query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
downloading file to the disk and then reading that file, this will allow us to read large S3 files without exhausting resources/crashing the system
|
def download_and_process_file?(file_name)
Rails.logger.info "processing file: #{file_name}"
@form_count = 0
@error_count = 0
file_details = parse_file_name(file_name)
return false if file_details.blank?
# downloads S3 file into local file, allows for processing large files this way
temp_file = Tempfile.new(file_name, encoding: 'ascii-8bit')
# downloads file into temp_file
bucket.object(file_name).get(response_target: temp_file)
process_file?(temp_file, file_details)
rescue => e
Rails.logger.error(e.message)
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def download_s3_file\n run_callbacks :download_s3_file do\n @s3_local_object = download(@directory, @key)\n end\n end",
"def download_file\n run_callbacks :download_file do\n if attachment.stored_at_s3?\n @s3_file_processor = S3::ProcessFiles.new(attachment)\n s3_file_processor.download_s3_file\n self.local_file = s3_file_processor.file_path\n else\n self.local_file = attachment.path\n end\n end\n end",
"def get_json_from_log_file_for_download(file)\n if @read_from_s3 == true\n if s3_log_reader.present?\n s3_log_reader.retrieve_file(file)\n end\n else\n File.new(file, 'r')\n end\n end",
"def get(file)\n local_copy = \"#{@working_dir}/#{File.basename(file)}\"\n begin\n download = @s3_resource.bucket(@s3_bucket).object(file)\n if download.download_file(local_copy) then\n puts \"info: fetched #{file} from s3 (#{@s3_bucket})\"\n return local_copy\n else\n puts \"error: download from s3 failed\"\n end\n rescue Aws::S3::Errors::ServiceError => e\n puts \"info: error downloading #{file} from s3 (#{@s3_bucket})\"\n puts e\n end\n end",
"def retrieve_from_s3(node, source_file, destination_file)\n begin\n require 'aws-sdk'\n config = data_bag_config_for(node.chef_environment, DATA_BAG_AWS)\n s3_endpoint, bucket_name, object_name = parse_s3_url(source_file)\n\n if config.empty?\n AWS.config(:s3 => { :endpoint => s3_endpoint })\n else\n AWS.config(:access_key_id => config['access_key_id'],\n :secret_access_key => config['secret_access_key'],\n :s3 => { :endpoint => s3_endpoint })\n end\n\n object = get_s3_object(bucket_name, object_name)\n\n Chef::Log.debug(\"Downloading #{object_name} from S3 bucket #{bucket_name}\")\n ::File.open(destination_file, 'wb') do |file|\n object.read do |chunk|\n file.write(chunk)\n end\n Chef::Log.debug(\"File #{destination_file} is #{file.size} bytes on disk\")\n end\n rescue URI::InvalidURIError\n Chef::Log.warn(\"Expected an S3 URL but found #{source_file}\")\n raise\n end\n end",
"def retrieve_file(name, specific_file)\n msg \"retrieving a #{name} backup from S3 using bucket: #{bucket_name(name)}\"\n if specific_file.nil?\n objects = AWS::S3::Bucket.objects(bucket_name(name), :max_keys => 100)\n return if objects.empty?\n specific_file = objects.last.key\n end\n \n open(\"#{ENV['RESTORE']}/#{specific_file}\", 'w') do |file|\n AWS::S3::S3Object.stream(specific_file, bucket_name(name)) do |chunk|\n file.write chunk\n end\n end\n msg \"retrieved file #{ENV['RESTORE']}/#{specific_file}\"\n end",
"def run_me\r\n bucket_name = 'doc-example-bucket'\r\n object_key = 'my-file.txt'\r\n local_path = \"./#{object_key}\"\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if object_downloaded?(s3_client, bucket_name, object_key, local_path)\r\n puts \"Object '#{object_key}' in bucket '#{bucket_name}' \" \\\r\n \"downloaded to '#{local_path}'.\"\r\n else\r\n puts \"Object '#{object_key}' in bucket '#{bucket_name}' not downloaded.\"\r\n end\r\nend",
"def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end",
"def download_remote_file(bucket, key, local_filename)\n completed = false\n\n @logger.debug(\"S3 input: Download remote file \", :bucket => bucket, :remote_key => key, :local_filename => local_filename)\n\n # When using blocks to downloading objects,\n # the Ruby SDK will NOT retry failed requests after the first chunk of data has been yielded.\n # Doing so could cause file corruption on the client end by starting over mid-stream.\n # For this reason we use target file and not loading the file into memory\n begin\n ::File.open(local_filename, 'wb') do |file|\n reap = @s3.get_object({ bucket: bucket, key: key }, target: file)\n return completed if stop?\n completed = true\n @logger.debug(\"download completed: \", :completed => completed)\n return completed\n end\n rescue Aws::S3::Errors::ServiceError => e\n @logger.error(\"Could not download the file from S3: \", :error => e)\n end\n end",
"def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end",
"def retrieve file, part\n key = \"#{file.content.content_hash}/#{part}\"\n raise RequestError.new(:no_bucket, \"Bucket not found\") if Storage['woda-files'].nil?\n if (Storage.use_aws ? Storage['woda-files'][key].exists? == false : Storage['woda-files'][key].nil? ) then\n raise RequestError.new(:no_key, \"Key path not found\")\n end\n data = Storage['woda-files'][key].read()\n if part == 0 then\n file.downloads += 1\n file.save\n end\n uncrypt(file, data, part)\n end",
"def download(aFilename,aBucketName,aObjectName=nil)\n\t\taObjectName ||= File.basename(aFilename)\n\t\t#AWS::S3::S3Object.store(aObjectName, MiscUtils.string_from_file(aFilename), aBucketName)\n\t\tMiscUtils.string_to_file(get_content(aObjectName,aBucketName),aFilename)\n\tend",
"def download(path, &block)\n resource = Aws::S3::Resource.new(client: @client).bucket(@bucket).object(path)\n local = Tempfile.new\n resource.download_file local.path\n local.rewind\n block.call local\n ensure\n local&.close\n local&.unlink # deletes the temp file\n end",
"def download_file(bucket_name:, key:, local_path:)\n s3_resource.bucket(bucket_name).object(key).download_file(local_path)\n end",
"def run_me\n bucket_name = \"doc-example-bucket\"\n object_key = \"my-file.txt\"\n region = \"us-west-2\"\n private_key_file = \"my-private-key.pem\"\n private_key = OpenSSL::PKey::RSA.new(File.read(private_key_file))\n\n # When initializing this Amazon S3 encryption client, note:\n # - For key_wrap_schema, use rsa_oaep_sha1 for asymmetric keys.\n # - For security_profile, for reading or decrypting objects encrypted\n # by the v1 encryption client, use :v2_and_legacy instead.\n s3_encryption_client = Aws::S3::EncryptionV2::Client.new(\n encryption_key: private_key,\n key_wrap_schema: :rsa_oaep_sha1,\n content_encryption_schema: :aes_gcm_no_padding,\n security_profile: :v2,\n region: region\n )\n puts \"The content of '#{object_key}' in bucket '#{bucket_name}' is:\"\n puts download_object_with_private_key_encryption(\n s3_encryption_client,\n bucket_name,\n object_key\n )\nend",
"def fetch_object(file)\n @pool.process do\n dest = Pathname.new(\"#{@options[:destination]}/#{file.key}\")\n if file.key.end_with?(\"/\")\n puts \"Creating s3 subdirectory #{file.key} - #{Time.now}\" if verbose?\n dest.mkpath\n else\n dest.dirname.mkpath\n\n puts \"Copying from s3 #{file.key} - #{Time.now}\" if verbose?\n s3_client.get_object(response_target: \"#{dest}\",\n bucket: @options[:bucket],\n key: file.key,\n version_id: file.version_id)\n end\n\n @fetch_block_mutex.synchronize { yield file } if block_given?\n end\n end",
"def fetch(filename, filesize)\n end",
"def aws_get_file(bucket, key, **opt)\n meth = opt.delete(:meth) || calling_method\n client = opt.delete(:client)\n client ||= (bucket.client if bucket.is_a?(Aws::S3::Bucket))\n client ||= s3_client(**opt)\n params = { bucket: bucket, key: key }\n # @type [Aws::S3::Types::GetObjectOutput] response\n response = client.get_object(params, opt)\n Log.debug { \"#{meth}: AWS S3 response: #{response.inspect}\" }\n response.body.read\n rescue => error\n set_error(error)\n # noinspection RubyScope\n Log.warn { \"#{meth}: AWS S3 failure: #{error.class}: #{error.message}\" }\n end",
"def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end",
"def fetch_file(file_path)\n client.get_file(file_path)\n end",
"def download(path, key)\n File.open(path + '/' + File.basename(key), 'wb') do |file|\n client.get_object({ bucket: ENV['AWS_BUCKET'], key: key }, target: file)\n end\n end",
"def read\n object = bucket.objects.find(@path)\n object.content\n end",
"def download_s3_file(image_info, *sightings_count)\n\n folder = image_info[0]\n filename = image_info[1]\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{filename}\"\n\n if sightings_count\n sightings_count = sightings_count[0]\n subdirectory = folder.split(\"/\")[1]\n sightings_dir = create_directory(subdirectory, sightings_count)\n swap_file = \"#{sightings_dir}/#{filename}\"\n else\n swap_file = \"./public/swap/#{filename}\" # use when running via app.rb\n # swap_file = \"../public/swap/#{file}\" # use when running locally from /lib/s3_bucket.rb\n end\n\n s3 = connect_to_s3()\n file = File.new(swap_file, 'wb')\n s3.get_object({ bucket:bucket, key:s3_file_path }, target: swap_file)\n file.close if file\n\nend",
"def stream(key)\n file = file_for(key, skip_lookup: false)\n\n chunk_size = 5.megabytes\n offset = 0\n\n raise ActiveStorage::FileNotFoundError unless file.present?\n\n while offset < file.size\n yield file.download(range: offset..(offset + chunk_size - 1)).string\n offset += chunk_size\n end\n end",
"def import_file_content_from_s3\n AWS::S3.new.buckets['csv_data_feed'].objects['csv.csv'].read\nend",
"def download_zip_from_s3(file_path, filename, connection)\n\ts3_key = \"zipped_packages/\" + filename\n\tsuccess = connection.download(s3_key, file_path + filename)\n\treturn success\nend",
"def download(bucket, key)\n connect_to_s3\n @temp_file_path = File.join(Dir.tmpdir, key.gsub('/', '-'))\n File.open(temp_file_path, 'w+') do |f|\n f.puts AWS::S3::S3Object.value(key,bucket)\n end\n end",
"def download_object_with_private_key_encryption(\n s3_encryption_client,\n bucket_name,\n object_key\n)\n response = s3_encryption_client.get_object(\n bucket: bucket_name,\n key: object_key\n )\n return response.body.read\nrescue Aws::Errors::ServiceError => e\n puts \"Error downloading object: #{e.message}\"\nend",
"def download_url\n s3 = AWS::S3.new\n bucket = s3.buckets[ENV[\"S3_BUCKET\"]]\n object = bucket.objects[self.aws_root_to_self_path]\n object.url_for(:get, { \n expires: 10.minutes,\n response_content_disposition: 'attachment;'\n }).to_s\n end",
"def download\n # Check if we already have a functional working_directory\n return if @working_directory && Dir.exist?(@working_directory)\n\n # No existing working directory, creating a new one now\n self.working_directory = Dir.mktmpdir\n\n s3_client.find_bucket!(s3_bucket).objects.each do |object|\n file_path = object.key # :team_id/path/to/file\n download_path = File.join(self.working_directory, file_path)\n\n FileUtils.mkdir_p(File.expand_path(\"..\", download_path))\n UI.verbose(\"Downloading file from S3 '#{file_path}' on bucket #{self.s3_bucket}\")\n\n object.download_file(download_path)\n end\n UI.verbose(\"Successfully downloaded files from S3 to #{self.working_directory}\")\n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def aws_S3_object_get_and_read(bucket, name)\n log \"AWS: getting S3Object 'name'\"\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n log \"AWS: reading S3Object '#{object.key}'\"\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end",
"def retrieve_file(name, specific_file)\n msg \"retrieving a #{name} backup from S3\"\n objects = AWS::S3::Bucket.find(bucket_name(name)).objects\n raise \"No #{name} backups to retrieve\" if objects.size < 1\n \n o = objects.find{|o| o.key == specific_file}\n raise \"Could not find the file '#{specific_key}' in the #{name} bucket\" if o.nil? && !specific_file.nil?\n key = specific_file.nil? ? objects.last.key : o.key\n msg \"retrieving archive: #{key}\"\n File.open(key, \"wb\") { |f| f.write(AWS::S3::S3Object.value(key, bucket_name(name))) } \n msg \"retrieved file './#{key}'\"\n end",
"def get(path)\n object = bucket.objects.find(path)\n tempfile = Tempfile.new\n tempfile.write(object.content)\n tempfile.rewind\n tempfile\n end",
"def download\n return file if file\n\n self.file = retrieve_file\n end",
"def download_link\n s3 = Aws::S3::Client.new\n signer = Aws::S3::Presigner.new(client: s3)\n signer.presigned_url(\n :get_object,\n bucket: ENV['SEATSHARE_S3_BUCKET'],\n key: path,\n expires_in: 86_400\n )\n end",
"def download_remote_file(remote_object, local_filename)\n completed = false\n @logger.debug(\"S3 input: Download remote file\", :remote_key => remote_object.key, :local_filename => local_filename)\n File.open(local_filename, 'wb') do |s3file|\n return completed if stop?\n begin\n remote_object.get(:response_target => s3file)\n rescue Aws::S3::Errors::ServiceError => e\n @logger.error(\"Unable to download file. We´ll requeue the message\", :file => remote_object.inspect)\n throw :skip_delete\n end\n end\n completed = true\n\n return completed\n end",
"def aws_download(location, name)\n return Rubyprot::Storage.aws_download(location, name)\n end",
"def storage_file_content storage_file_path, encryption_key: nil\n local_tempfile = Tempfile.new \"cloud-storage-tests\"\n storage_file = @bucket.file storage_file_path,\n encryption_key: encryption_key\n storage_file.download local_tempfile.path, encryption_key: encryption_key\n File.read local_tempfile.path\n ensure\n local_tempfile.close\n local_tempfile.unlink\n end",
"def retrieve_file\n if @upload.public? && @upload.file_type.public? && @upload.address.present? && @upload.success?\n BlockchainRetrieveJob.perform_later(@upload.id)\n end\n end",
"def retrieve_s3_object_content_to_tmp_file(bucket_name:, object_key:)\n bucket_region = bucket_region bucket_name\n\n tempfile = \"/tmp/s3util#{Time.now.to_i}#{Time.now.to_i}\"\n File.open(tempfile, 'wb') do |file|\n s3(region: bucket_region).get_object(bucket: bucket_name,\n key: object_key) do |chunk|\n file.write(chunk)\n end\n end\n\n tempfile\n end",
"def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end",
"def read_workspace_file(workspace_bucket_id, filename)\n file = self.get_workspace_file(workspace_bucket_id, filename)\n file_contents = file.download\n file_contents.rewind\n file_contents\n end",
"def get(bucket, local_file=nil) # s3://BUCKET/OBJECT LOCAL_FILE\n send_command \"get\", bucket, local_file\n end",
"def download(key, filepath)\n log \"downloading #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n outer_response = storage_client.get(object_path) do |response|\n File.open(filepath, 'wb') do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n outer_response[\"Content-Length\"].to_i\n end",
"def stream(key)\n begin\n file = client.download(\"/\"+key) do |chunk|\n yield chunk\n end\n rescue DropboxApi::Errors::NotFoundError\n raise ActiveStorage::FileNotFoundError\n end\n end",
"def get_file(url)\n get(url).body\n end",
"def open(path, encoding: self.encoding, tempdir: nil, **opts, &block)\n path = full_path(path)\n temp = Tempfile.new(File.basename(path), tempdir, encoding: encoding)\n temp.close\n\n opts = opts.merge(\n response_target: temp.path,\n bucket: name,\n key: path,\n )\n @client.get_object(**opts)\n\n File.open(temp.path, encoding: encoding, &block)\n rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket, Aws::S3::Errors::NotFound\n raise BFS::FileNotFound, trim_prefix(path)\n end",
"def get_file(url); end",
"def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\n # pull out latest file by timestamp\n\ttarget = obstxt.max_by { |a| a.last_modified }\n\n\t# get URL\n\ttarget.temporary_url\nend",
"def get_file(filename, &block)\n if block_given?\n http.get(200, luwak, escape(filename), &block)\n nil\n else\n tmpfile = LuwakFile.new(escape(filename))\n begin\n response = http.get(200, luwak, escape(filename)) do |chunk|\n tmpfile.write chunk\n end\n tmpfile.content_type = response[:headers]['content-type'].first\n tmpfile\n ensure\n tmpfile.close\n end\n end\n end",
"def download_thread\n Thread.new do\n file = nil\n until @download_list.empty?\n @download_mutex.synchronize do\n file = @download_list.pop\n end\n next if file.nil?\n # AWS stores directories as their own object\n next if file.content_length == 0 && file.key =~ /\\/$/\n\n tmp = Tempfile.new(file.object_id.to_s)\n @source_container.files.get(file.key) do |data, rem, cl|\n tmp.syswrite(data)\n end\n tmp.flush\n tmp.rewind\n @upload_mutex.synchronize do\n @upload_list.push(body: tmp, key: file.key)\n end\n end\n end\n end",
"def readline\n bucket,key = fs.split_path(path)\n @handle ||= fs.s3.interface.get_object(bucket, key).each\n begin\n @handle.next\n rescue StopIteration, NoMethodError\n @handle = nil\n raise EOFError.new(\"end of file reached\")\n end\n end",
"def read_file(path)\n response = with_remote do |http|\n http.get(path)\n end\n response.body\n end",
"def update_file(file_data)\n sha = file_data['sha256']\n file_dir = create_cache_dir(file_data['sha256'])\n file_path = File.join(file_dir, File.basename(file_data['filename']))\n if check_file(file_path, sha)\n @logger.debug(\"Using prexisting file: #{file_path}\")\n return file_path\n end\n\n @logger.debug(\"Queueing download for: #{file_path}\")\n serial_execute { download_file(file_path, sha, file_data['uri']) }\n end",
"def file_data\n @client.get_file @file_url\n end",
"def read(&block)\n Dir.mktmpdir(File.join(\"Amylase-#{UUID.new.generate}\"), Dir.tmpdir) do |tmpdir|\n tmp_filename = File.join(tmpdir, @data_source.name)\n\n File.open(tmp_filename, 'wb') do |file|\n @s3_obj.read do |chunk|\n file.write(chunk)\n end\n end\n\n File.open(tmp_filename) do |file|\n file.each_line do |line|\n yield line\n end\n end\n end\n end",
"def get_file(file_path)\n ensure_file_open!\n @file.read(file_path)\n end",
"def object_content_by_object_unsigned_request(bucket_name, object_key, region)\r\n object_path = \"https://s3.#{region}.amazonaws.com/#{bucket_name}/#{object_key}\"\r\n response = Net::HTTP.get(URI(object_path))\r\n puts \"Content of unsigned request to '#{object_path}':\\n\\n#{response}\\n\\n\"\r\nend",
"def download(url)\n base.get(url, @file_path)\n end",
"def generate_tmp_file\n FileUtils.mkdir_p(local_tmp_dir) unless File.exists?(local_tmp_dir)\n #TODO avoid name collision\n stored = File.new(local_file_pathname, 'wb')\n stored.write s3_obj.read\n stored.close\n # Download and write the file in blocks off the HTTP Response (see S3Object.read in aws-sdk docs)\n # File.open(local_file_pathname, 'w') do |file|\n # s3_obj.read do |chunk|\n # file.write(chunk)\n # end\n # file\n # end\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def get(local_path, s3_path, bucket)\n client.get_object(\n response_target: local_path,\n bucket: bucket,\n key: s3_path)\n end",
"def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def retrieve(path)\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n file = directory.files.get(path)\n\n body = file.body\n\n extname = File.extname(path)\n basename = File.basename(path, extname)\n\n file = Tempfile.new([basename, extname])\n file.binmode\n file.write(body)\n file.rewind\n\n file\n end",
"def retrieve_file(options)\n file_uri = options.fetch(:url)\n file_size = options.fetch(:file_size)\n\n retrieved = 0\n File.open(file_uri.path, 'rb') do |f|\n until f.eof?\n chunk = f.read(chunk_size)\n retrieved += chunk.length\n yield(chunk, retrieved, file_size)\n end\n end\n end",
"def fetch_file_from_url(url)\n logger.debug \"Starting GET of file from #{url}\"\n start_time = Time.now\n uri = URI.parse(url)\n if (uri.kind_of?(URI::HTTP))\n resp = Net::HTTP.get_response(uri)\n case resp\n when Net::HTTPSuccess then\n filename = File.basename(uri.path)\n tmpfile = Tempfile.new(filename,Dir.tmpdir)\n File.open(tmpfile.path,'wb+') do |f|\n f.write resp.body\n end\n tmpfile.flush\n file= ActionDispatch::Http::UploadedFile.new(tempfile: tmpfile)\n file.original_filename = filename\n file.content_type = resp.content_type\n logger.debug \"GET took #{Time.now - start_time} seconds\"\n return file\n else\n logger.error \"Could not get file from location #{url} response is #{resp.code}:#{resp.message}\"\n return nil\n end\n else\n return nil\n end\n rescue URI::InvalidURIError\n logger.error \"Invalid URI #{url}\"\n nil\n rescue => e\n logger.error \"error in fetch_file_from_url #{url}\"\n logger.error e.backtrace.join(\"\\n\")\n nil\n end",
"def s3pull(s3_bucket_name, library)\n s3 = AWS::S3.new\n bucket = s3.buckets[s3_bucket_name]\n\n stats = Photor.work(Downloader.pool(args: [library, options[:dry_run]])) do |pool, &tracker|\n bucket.objects.each do |s3_object|\n next if File.extname(s3_object.key).empty?\n tracker.call pool.fetch_if_new(s3_object)\n end\n end\n\n puts \"\\n\"\n puts \"downloaded: #{stats[:truthy]} skipped: #{stats[:falsey]}\"\n end",
"def s3_url\n establish_s3_connection\n bucket = s3keys[\"bucket\"]\n key = self.datastreams[\"s3\"].key_values.first\n s3 = AWS::S3.new\n s3.buckets[bucket].objects[key].url_for(:read, :expires => 60 * 60 * 1.5)\n end",
"def perform\n # before downloading we have to check if file exists. checkfiles service\n # also gives us information for the download: hostname, file size for\n # progressbar\n return self unless self.check\n\n file = open(File.join(@downloads_dir, @filename), 'wb')\n block_response = Proc.new do |response|\n downloaded = 0\n total = response.header['content-length'].to_i\n\n unless total == @filesize\n @error = 'Access denied'\n return self\n end\n\n response.read_body do |chunk|\n file << chunk\n downloaded += chunk.size\n progress = ((downloaded * 100).to_f / total).round(2)\n yield chunk.size, downloaded, total, progress if block_given?\n end\n end\n\n RestClient::Request.execute(:method => :get,\n :url => self.download_link,\n :block_response => block_response)\n file.close()\n @downloaded = true\n self\n end",
"def object_data(bucket_name, key, &block)\n send_s3_request('GET', :bucket => bucket_name, :key => key) do |response|\n if block_given?\n response.read_body &block\n return true\n else\n return response.body\n end\n end\n end",
"def object_content_by_bucket_unsigned_request(bucket_name, region)\r\n bucket_path = \"https://s3.#{region}.amazonaws.com/#{bucket_name}\"\r\n response = Net::HTTP.get(URI(bucket_path))\r\n puts \"Content of unsigned request to '#{bucket_path}':\\n\\n#{response}\\n\\n\"\r\nend",
"def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #{@filename} due to following error occurred #{e}\")\n end",
"def nexmo_get_cr(recording_url,file_name,tmp_dir,location=nil)\n\t\t# tmp_dir = 'public/wav/'\n\t\tclaims = {\n\t\t application_id: APP_ID,\n\t\t private_key: APP_KEY,\n\t\t nbf: 1483315200,\n\t\t ttl: 800\n\t\t}\n\n\t\ttoken = Vonage::JWT.generate(claims)\n\t\turl = URI(recording_url)\n\n\t\thttps = Net::HTTP.new(url.host, url.port);\n\t\thttps.use_ssl = true\t\n\t\t# https.set_debug_output(STDOUT)\n\n\t\trequest = Net::HTTP::Get.new(url)\n\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\trequest[\"Authorization\"] = \"Bearer #{token}\"\n\n\t\tfile_loc = open(\"#{tmp_dir}#{file_name}\", 'wb')\n\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD | Download to : #{file_loc}\"\n\t\t\n\t\tdownload_file_response_code = nil\n\t\tbegin\n\t\t\thttps.request(request) do |response|\n\t\t\t\tdownload_file_response_code = response.code\n\t\t\t\tresponse.read_body do |chunk|\n\t\t\t\t\tfile_loc.write(chunk)\n\t\t\t\tend\n\t\t\tend\n\t\trescue => e\n\t\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD ERROR | #{e}\"\n\t\tensure\n\t\t\tfile_loc.close\n\t\tend\n\n\t\ts3_object = nil\n\t\tif location == :s3\n\t\t\ts3_object = S3_CLIENT.put_object(\n\t\t\t\t{\n\t\t\t\t\tbody: file_loc,\n\t\t\t\t\tbucket: S3_BUCKET,\n\t\t\t\t\tkey: file_name\n\t\t\t\t}\n\t\t\t)\n\t\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD | AWS_S3 : #{s3_object}\"\n\t\t\t# File.delete(file_loc)\n\t\tend\n\t\t\n\t\treturn download_file_response_code,s3_object\n\tend",
"def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end",
"def aws_S3_object_get_and_read_no_log(bucket, name)\n object = aws_call('aws_S3_object_get', bucket: bucket, name: name)\n if aws_call('aws_obj_exists?', obj: object)\n return aws_call('aws_S3_object_read', object: object)\n end\n return \"\"\n rescue AWS::S3::Errors::NoSuchKey => e\n return \"\"\n end",
"def retrieve_log_files_from_s3\n s3_log_reader.retrieve_job_files(record_id)\n end",
"def download(file:)\n tenant = file&.resource&.tenant\n if file.blank? || tenant.blank?\n cc.render status: 404, plain: 'Not found'\n return\n end\n\n url = file.merritt_s3_presigned_url\n\n cc.redirect_to url\n rescue HTTP::Error => e\n raise MerrittError, \"HTTP Error while creating presigned URL with Merritt\\n\" \\\n \"#{file.merritt_presign_info_url}\\n\" \\\n \"Original HTTP library error: #{e}\\n\" \\\n \"#{e.full_message}\"\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download_from_blobstore\n Thread.new do\n blobstore_client = Product.get_blobstore_client\n blobstore_id = @location['object_id']\n\n FileUtils.mkdir_p version_dir\n\n if blobstore_client.exists?(blobstore_id)\n retry_count = 0\n done = false\n\n while !done && retry_count < 5\n File.open(bits_full_local_path_dl, \"wb\") do |file|\n begin\n blobstore_client.get(blobstore_id, file)\n location_size_value = @location['size']\n raise \"Download interrupted for #{blobstore_id} at #{file.size} bytes out of #{location_size_value} bytes.\" if file.size < location_size_value\n\n done = true\n rescue => ex\n retry_count += 1\n $logger.warn \"There was an error while downloading #{product.name} v#{version}. Retrying... ##{retry_count}. Error was #{ex.to_s}\"\n sleep 5\n end\n end\n end\n\n unless done\n $logger.error \"Could not download #{product.name} v#{version}.\"\n FileUtils.rm_f bits_full_local_path_dl\n end\n else\n $logger.warn \"Could not find bits for #{product.name} v#{version}.\"\n end\n\n if @location['sha'] != Digest::SHA1.file(bits_full_local_path_dl).hexdigest\n $logger.error \"Download of #{product.name} v#{version} failed signature check.\"\n FileUtils.rm_f bits_full_local_path_dl\n else\n begin\n if @product.type != Product::TYPE_STEMCELL\n FileUtils.mkdir_p bits_full_local_path_unpacked\n tgz = Zlib::GzipReader.new(File.open(bits_full_local_path_dl, 'rb'))\n Minitar.unpack(tgz, bits_full_local_path_unpacked)\n FileUtils.mv bits_full_local_path_unpacked, bits_full_local_path, :force => true\n FileUtils.rm_f bits_full_local_path_dl\n else\n FileUtils.mv bits_full_local_path_dl, bits_full_local_path, :force => true\n end\n rescue => ex\n $logger.error \"Could not unpack #{product.name} v#{version}: #{ex.message} - #{ex.backtrace}.\"\n FileUtils.rm_f bits_full_local_path_unpacked\n FileUtils.rm_f bits_full_local_path\n FileUtils.rm_f bits_full_local_path_dl\n end\n end\n end\n end",
"def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, list_all: nil, fromdate: nil, todate: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.get(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path,\n diff_with: diff_with,\n list_all: list_all,\n fromdate: fromdate,\n todate: todate\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::FileBucket::File)]\n end",
"def get_filebucket_file(path, environment:, bucket_path: nil, diff_with: nil, list_all: nil, fromdate: nil, todate: nil)\n headers = add_puppet_headers('Accept' => 'application/octet-stream')\n\n response = @client.get(\n with_base_url(\"/file_bucket_file/#{path}\"),\n headers: headers,\n params: {\n environment: environment,\n bucket_path: bucket_path,\n diff_with: diff_with,\n list_all: list_all,\n fromdate: fromdate,\n todate: todate\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::FileBucket::File)]\n end",
"def get_file_from_store(file)\n Cloudsync::File.from_s3_obj( get_obj_from_store(file), self.to_s )\n end",
"def stream(key)\n object = object_for(key)\n\n chunk_size = 5.megabytes\n offset = 0\n\n raise ActiveStorage::FileNotFoundError unless object.exists?\n\n while offset < object.content_length\n yield object.get(range: \"bytes=#{offset}-#{offset + chunk_size - 1}\").body.string.force_encoding(Encoding::BINARY)\n offset += chunk_size\n end\n end",
"def get_file_download(bucket_id:, file_id:)\n path = '/storage/buckets/{bucketId}/files/{fileId}/download'\n .gsub('{bucketId}', bucket_id)\n .gsub('{fileId}', file_id)\n\n if bucket_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"bucketId\"')\n end\n\n if file_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"fileId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"def download(cloud_file)\n uri = {file_path: cloud_file.path}\n response = Dropbox.successful_request?(:file, access_token, uri)\n\n response.body\n end",
"def readline\n @handle ||= fs.s3.interface.get_object(fs.bucket(path), fs.key_path(path)).each\n begin\n @handle.next\n rescue StopIteration, NoMethodError\n @handle = nil\n raise EOFError.new(\"end of file reached\")\n end\n end",
"def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end",
"def process\n verify_url!\n download_from_url do |downloaded_file|\n if valid_readers_format?\n downloaded_file\n else\n unzip(downloaded_file)\n end\n end\n end",
"def open_file\n\t\t\tif file_path[-4..-1] == \".bz2\"\n\t\t\t\treturn Bzip2::Reader.open(file_path)\n\t\t\telse\n\t\t\t\treturn File.open(file_path,'r')\n\t\t\tend\n\t\tend",
"def read_file(path)\n api.read_file container_name, path\n end",
"def download_apigateway_importer(s3_bucket, s3_key)\r\n s3 = Aws::S3::Client.new\r\n\r\n # current version\r\n current_s3_version = File.open(@versionpath, 'rb').read if File.exist?(@versionpath)\r\n\r\n # online s3 version\r\n desired_s3_version = s3.head_object(bucket: s3_bucket, key: s3_key).version_id\r\n\r\n # compare local with remote version\r\n if current_s3_version != desired_s3_version || !File.exist?(@jarpath)\r\n puts \"Downloading aws-apigateway-importer jar with S3 version #{desired_s3_version}\"\r\n s3.get_object(response_target: @jarpath, bucket: s3_bucket, key: s3_key)\r\n File.write(@versionpath, desired_s3_version)\r\n end\r\n end",
"def read\n @fileobj.seek @data_offset\n @data = @fileobj.read @data_size\n end",
"def download(path)\n RestClient::Request.execute(:method => :get, :url => (@host + '/api/v1/files' + escape(path)), :user => @user, :password => @password, :raw_response => true, :headers => {:accept_encoding => ''}).file\n end",
"def read(bytes = nil, outbuf = nil)\n @content_length ||= @s3object.content_length\n\n return '' if (@pos >= @content_length) || (bytes == 0)\n\n bytes ||= @content_length\n\n upper_bound = @pos + bytes - 1\n upper_bound = (@content_length - 1) if upper_bound >= @content_length\n\n data = @s3object.read :range => @pos..upper_bound, :if_unmodified_since => @last_modified\n\n @pos = upper_bound + 1\n\n outbuf.replace data if outbuf \n\n return data\n\n rescue ::Aws::S3::Errors::PreconditionFailed\n fail ReadModifiedError, \"S3 object #{@s3object.key} was updated during read (modified since #{@last_modified.to_s})\"\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def file(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n response = make_get_call('/files/%i' % [id])\n response.download = download(id)\n\n response\n end",
"def download(bucket, site, dir)\n puts \"> AWS Download: #{site} @ #{bucket}\".yellow\n s3 = s3_client\n\n # get list of objects\n response = s3.list_objects_v2(bucket: bucket, prefix: site)\n files = response.contents.map(&:key).reject do |path|\n [\n '*/branches/**', '*/tags/**', '*/pr/**', # exclude git subfolders\n '*/tmp/**', '*/trash/**', # exclude user subfolders\n ].any? { |glob| File.fnmatch(glob, path) } ||\n File.fnmatch('*/{en,de,ru,fr}/**', path, File::FNM_EXTGLOB)\n end\n\n if files.size.zero?\n raise AWSError.new(\"No files downloaded: #{bucket} @ #{site}\")\n end\n\n # get tmp dir to save data to\n Log.debug(\"S3 download to #{dir}\")\n puts '> S3 Download'.green\n\n progress = ProgressBar.create(title: ' AWS::Get'.green, total: files.size)\n Dir.chdir(dir) do\n files.each do |file|\n # progress.title = file\n FileUtils.mkdir_p(File.dirname(file))\n s3.get_object(\n response_target: file,\n bucket: bucket,\n key: file\n )\n progress.increment\n end\n end\n progress.finish unless progress.finished?\n end",
"def open_file(file_path)\n response = HTTParty.get(\"https://#{accountName}.azuredatalakestore.net\" +\n \"/webhdfs/v1/#{file_path}?op=OPEN\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\",\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => \"*/*\",\n \"Cache-Control\" => 'no-cache',\n \"Host\" => \"#{accountName}.azuredatalakestore.net\",\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n verify: true,\n })\n \n return response.read_body\n end"
] |
[
"0.76967794",
"0.71969587",
"0.71747994",
"0.7142552",
"0.6963291",
"0.6862504",
"0.68591654",
"0.6842448",
"0.67773116",
"0.674888",
"0.6712193",
"0.66880006",
"0.661093",
"0.65926147",
"0.6532359",
"0.65115345",
"0.6506801",
"0.6496558",
"0.64838916",
"0.6474256",
"0.6470667",
"0.6442628",
"0.6439087",
"0.6430249",
"0.64292127",
"0.6427913",
"0.6414954",
"0.6366483",
"0.6340723",
"0.6332249",
"0.6315804",
"0.6295643",
"0.62925136",
"0.6278624",
"0.6272045",
"0.6270336",
"0.62396115",
"0.6220804",
"0.6220716",
"0.6213074",
"0.6207721",
"0.61824304",
"0.617542",
"0.6169442",
"0.61683613",
"0.61651564",
"0.61453956",
"0.6143775",
"0.6138099",
"0.61293805",
"0.6079606",
"0.60635024",
"0.6046533",
"0.60354155",
"0.6032718",
"0.60229516",
"0.60185117",
"0.601759",
"0.6011836",
"0.60074145",
"0.60055894",
"0.60023135",
"0.5996941",
"0.5988987",
"0.5977293",
"0.5974165",
"0.59721553",
"0.5972119",
"0.5961181",
"0.5952989",
"0.59292555",
"0.5926957",
"0.5926142",
"0.5920213",
"0.59180397",
"0.5915662",
"0.5906745",
"0.5903776",
"0.59012026",
"0.5900061",
"0.5898391",
"0.5888807",
"0.5888807",
"0.58848107",
"0.5882911",
"0.5871665",
"0.58658516",
"0.5864768",
"0.58635765",
"0.5861232",
"0.5844348",
"0.58427227",
"0.5836396",
"0.5834738",
"0.58303654",
"0.58238333",
"0.5823592",
"0.58218896",
"0.58042276",
"0.5801287"
] |
0.5991616
|
63
|
Run registered jobs. ==== Args [current_expire] expire for processing (secs, 0=unexpired) ==== Return self
|
def run(current_expire = @expire)
if 0 == current_expire
run_once while not empty?
else
@end_time = Time.new.to_f + @expire
run_once while not(empty?) and @end_time >= Time.new.to_f
@end_time = nil
end
if @remain_hook
@remain_received = !empty?
@remain_hook.call if @remain_received
end
rescue Exception => e
@exception = e
raise e
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def schedule_recurring_jobs\n EmbargoAutoExpiryJob.perform_later(account)\n LeaseAutoExpiryJob.perform_later(account)\n end",
"def perform_now\n raise(::Mongoid::Errors::Validations, self) unless valid?\n\n worker = RocketJob::Worker.new(inline: true)\n start if may_start?\n # Re-Raise exceptions\n rocket_job_work(worker, true) if running?\n result\n end",
"def expire!\n @monitor.synchronize do\n check_expired(Time.now.to_f)\n self\n end\n end",
"def start\n with_mutex do\n if not running?\n @ticker.run\n end\n self\n end\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def fire\n return if @timers.empty?\n\n time = Time.now + Timer::QUANTUM\n while not empty? and time > @timers.first.time\n timer = @timers.first\n @timers.delete timer\n timer.call\n end\n end",
"def schedule_jobs(jobs)\n scheduler = Rufus::Scheduler.start_new\n \n jobs.each do |job|\n Mongolicious.logger.info(\"Scheduled new job for #{job['db'].split('/').last} with interval #{job['interval']}\")\n scheduler.every job['interval'] do\n backup(job)\n end\n end \n \n scheduler.join\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def perform(current_time)\n Rails.logger.info \"Running DisableExpiredDownloadUrlsCronJob at #{current_time}\"\n\n urls_to_expire = DownloadUrl.where(enabled: true).where('expires_at <= ?', current_time)\n if urls_to_expire.any?\n Rails.logger.info \"Disabling #{urls_to_expire.size} expired URLs\"\n urls_to_expire.update_all(enabled: false) # rubocop:disable Rails/SkipsModelValidations\n else\n Rails.logger.info('No URLs have expired.')\n end\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def trigger (params)\n\n return if paused?\n\n ldebug { \"trigger() cron : #{@fei.to_debug_s}\" }\n\n #@raw_child.application_context = @application_context\n # done in expool.tlaunch_child()\n\n begin\n\n @counter += 1\n store_itself\n #\n # note : one variant would be to give Time.now.to_f as a sub_id...\n # then no need to store...\n #\n # but it's good to have a counter to keep track of the number of\n # executions\n\n child_fei = get_expression_pool.tlaunch_child(\n self,\n first_expression_child,\n @counter,\n @applied_workitem.dup,\n :register_child => false)\n #\n # register_child is set to false, cron doesn't keep\n # track of its spawned children\n\n rescue\n\n lerror do\n \"trigger() cron caught exception\\n#{OpenWFE::exception_to_s($!)}\"\n end\n end\n end",
"def nice_queued_method(caching_key, clear_key = true, &block)\n unless Rails.cache.read(caching_key)\n Rails.cache.write caching_key, {:started => Time.now}\n yield \n Rails.cache.delete caching_key if clear_key\n end\n end",
"def start_recurring_payment\n return unless recurring_period.present?\n run_at = nil\n if recurring_period.to_s.is_i? # each custom days\n run_at = recurring_period.to_i.days.from_now\n # run_at = recurring_period.to_i.minutes.from_now\n else\n case recurring_period\n when 'daily'\n run_at = 1.day.from_now\n when 'weekly'\n run_at = 7.days.from_now\n when 'monthly'\n run_at = 1.month.from_now\n when 'quarterly'\n run_at = 3.months.from_now\n when 'biannually'\n run_at = 6.months.from_now\n when 'yearly'\n run_at = 1.year.from_now\n end\n end\n Delayed::Job.enqueue(LongTasks::RecurringPaymentNotification.new(id), run_at: run_at - 1.day) if run_at && ['tithe', 'partnership'].include?(goal)\n Delayed::Job.enqueue(LongTasks::RecurringPayment.new(id), run_at: run_at) if run_at\n end",
"def perform\n scan\n Delayed::Job.enqueue self, 0, Time.now.utc + 20.seconds # requeue for next time\n # todo: save the job id somewhere\n end",
"def Job(active_job)\n lambda do |object|\n active_job.perform_later(object.id)\n end\n end",
"def run!\n logger.info(\"Running task #{self.class.to_s}\")\n @block.call\n @next_run = cron_parser && cron_parser.next(Time.now)\n end",
"def step_trigger\n\n now = Time.now\n\n if @exit_when_no_more_jobs && @pending_jobs.size < 1\n\n @stopped = true\n return\n end\n\n # TODO : eventually consider running cron / pending\n # job triggering in two different threads\n #\n # but well... there's the synchronization issue...\n\n #\n # cron jobs\n\n if now.sec != @last_cron_second\n\n @last_cron_second = now.sec\n\n @cron_jobs.each do |cron_id, cron_job|\n #trigger(cron_job) if cron_job.matches?(now, @precision)\n cron_job.trigger if cron_job.matches?(now)\n end\n end\n\n #\n # pending jobs\n\n now = now.to_f\n #\n # that's what at jobs do understand\n\n loop do\n\n break if @pending_jobs.length < 1\n\n job = @pending_jobs[0]\n\n break if job.at > now\n\n #if job.at <= now\n #\n # obviously\n\n job.trigger\n\n @pending_jobs.delete_at 0\n end\n end",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def simulate_expire; end",
"def perform(*args)\n # start a \"timer\" and run it until whenever\n start_time = Time.now.to_i\n\n expiration_time = Config.find_by(description: 'Timer expiration').value.to_f\n \n # just run forever (i.e. until expired or cancelled)\n while !cancelled? && (Time.now.to_f - start_time) < expiration_time\n end\n\n # remove own JID from Timer table\n timer = Timer.find_by(jid: jid)\n # Don't try this update if a Timer with this JID does not exist\n if timer\n timer.update(jid: nil)\n end\n\n end_time = Time.now.to_f\n\n puts \"Timer JID:#{jid} ran for: #{end_time - start_time} seconds\"\n end",
"def process_available_jobs\n processed = false\n until shutdown?\n reset_filter_if_expired\n job = Job.rocket_job_next_job(name, current_filter)\n break unless job\n\n SemanticLogger.named_tagged(job: job.id.to_s) do\n processed = true unless job.rocket_job_work(self, false, current_filter)\n end\n end\n processed\n end",
"def calc_next_run\n RunAtPeriodicJob.new(:name => self.name, :job => self.job, :run_at_minutes => self.run_at_minutes)\n end",
"def reschedule\n\n return if @stopped\n\n t = OpenWFE::Timer.new\n\n linfo { 'reschedule() initiating...' }\n\n options = { :include_classes => Rufus::Schedulable }\n\n get_expression_storage.find_expressions(options).each do |fexp|\n\n linfo { \"reschedule() for #{fexp.fei.to_s}...\" }\n\n onotify(:reschedule, fexp.fei)\n\n fexp.reschedule(get_scheduler)\n end\n\n linfo { \"reschedule() done. (took #{t.duration} ms)\" }\n end",
"def perform(args = nil)\n Notification.notify(Notification::INFO, :subject_summary => \"Fax Fetcher\", :message => 'started')\n FaxSource.each do |source|\n add_periodic_timer(15.minutes) { source.retrieve! }\n Notification.notify(Notification::INFO, :subject_summary => \"Next retrieval of #{source.key.humanize.capitalize} faxes at #{60.minutes.from_now.in_time_zone(EST).strftime('%I:%M%p')}\", :message => '')\n end\n end",
"def current_cron_jobs\n client.get_cron_jobs(label_selector)\n end",
"def publish!(current_time = Time.current)\n PublishPageJob.perform_later(id, public_on: current_time)\n end",
"def expire(key, expires_in)\n namespace(key) { |key| super(key, expires_in) }\n end",
"def start_cache_renew_job\n\t\tThread.new do\n\t\t\tloop do\n\t\t\t\tupdate_cache\n\t\t\t\tsleep(CONFIG[\"cache_interval\"]*60) #the cache is valid for this period of time\n\t\t\tend\n\t\tend\n\tend",
"def run(now=Time.now)\n t = nil\n begin\n t = process(now, t)\n end while active\n t\n end",
"def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# if min == 0\r\n# ret = ActiveRecord::Base.connection.execute(\"delete from invites where invitee_id is null and created_at < subdate(now(), interval 3 day)\")\r\n# puts \"recycle invites: #{ret}\"\r\n# end\r\n end",
"def run\n case self[:job]\n when Proc\n self[:job].call\n else\n self[:job]\n end\n end",
"def next\n active_job_id = nil\n job_query.perform_with_advisory_lock(parsed_queues: parsed_queues, queue_select_limit: GoodJob.configuration.queue_select_limit) do |execution|\n active_job_id = execution.active_job_id\n performing_active_job_ids << active_job_id\n end\n ensure\n performing_active_job_ids.delete(active_job_id)\n end",
"def run\n super\n cron_poller.start\n end",
"def reserve_and_run_one_job; end",
"def new_job(what, overrides)\n @pipeline << Job.new(what, overrides)\n yield\n @pipeline.pop\n end",
"def getCurrentJobs\n getJobs('0/')\n end",
"def execute(*args)\n execute_job(new_job(*args))\n end",
"def run\n schedule_managers\n end",
"def jobs\r\n end",
"def jobs\n\t\t# ...\n\tend",
"def process_files\n Proc.new do\n completed_files = files_queue.select { |k,v| Time.now > v + file_wait_time }\n completed_files.each do |file_path, time|\n CreateOcrRequestJob.perform_later(file_path: file_path)\n files_queue.delete(file_path)\n end\n end\n end",
"def fire_expired\n # all time is expected as milliseconds\n now = Timers.now\n\n # detect when the clock has reversed\n reschedule if now < @last_fired\n @last_fired = now\n\n # defer firing the timer until after this loop so we can clean it up first\n # --\n # Work around JRuby bug by converting set to array before dup'ing\n @timers.to_a.dup.each do |timer|\n break unless timer.expired?(now)\n Logger.debug(klass: self.class, name: :fire_expired, message: \"firing expired timer! #{timer.inspect}\")\n timer.fire\n cancel(timer)\n end\n end",
"def expire=(_); end",
"def execute!\n @context.backend.schedule { run }\n end",
"def access_current_job\n if job = @job\n yield job\n end\n end",
"def run_replications\n # Add fresh schedule\n old_shedule = @schedule\n @schedule = {}\n @active = false\n\n old_shedule.each_value do |conn|\n conn.start\n end\n end",
"def perform tenant_id\n accepting_new_jobs = $redis.setnx \"generating_docset\", Time.now.to_i\n\n if !accepting_new_jobs \n $redis.setnx \"new_docset_request\", Time.now.to_i\n\n if stale?\n Rails.logger.debug \"assume prev job died, doing heavy lifting anyway\"\n run_job tenant_id\n else\n Rails.logger.debug \"already in progress, skipping\"\n end\n\n else\n Rails.logger.debug \"starting new job\"\n run_job tenant_id\n end\n\n end",
"def run!\n PeriodicJob.log_error \"Executing job id #{self.id}, #{self.to_s}...\"\n begin\n self.last_run_at = Time.now\n self.next_run_at = nil\n self.save\n command = self.job.gsub(/#JOBID#/, self.id.to_s).gsub(/#RAILS_ROOT#/, Rails.root.to_s)\n puts command\n eval(command)\n self.last_run_result = \"OK\"\n PeriodicJob.log_info \"Job completed successfully\"\n rescue Exception\n err_string = \"'#{self.job}' could not run: #{$!.message}\\n#{$!.backtrace}\"\n PeriodicJob.log_error err_string\n self.last_run_result = err_string.slice(1..500)\n begin\n GeneralMailer.failed_periodic_job(self).deliver\n rescue\n end\n end\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end",
"def try_start(key, concurrency)\n @job_id = @redis.incr(JOB_ID_KEY)\n now = Time.now.to_i\n result = @redis.multi do\n @redis.zadd(key, now, @job_id)\n @redis.zcount(key, (now - STALE_TTL).to_s, (now + MAX_CLOCK_SKEW).to_s)\n end\n\n if result[1].to_i <= concurrency\n start_heartbeat(key)\n true\n else\n @redis.zrem(key, @job_id)\n false\n end\n end",
"def method_missing(name, *args, &block)\n if [:in, :at, :every, :cron].include? name\n if defined? @@scheduler\n ret = @@scheduler.send(name, *args, &block)\n @jobs << ret\n ret\n else\n @queue << [name, args, block]\n end\n else\n @@scheduler.send(name, *args, &block)\n end\n end",
"def work_job\n \n # MAINTENANCE\n \n # Are we shutting down?\n if @shutdown\n Kernel.exit!(0) if @current_jobs.size == 0\n end\n \n # PROCESSING JOBS\n \n # Get a job\n job = get_new_job\n return unless job\n log.info \"Got a new job #{job.id}\"\n \n if job.job_class.fork?\n # Job that requires a fork, perfect for long-running stuff.\n log.debug \"Forking the process for job #{job.id}\"\n pid = fork do\n process_job job\n end\n @job_pids[job.id] = pid\n # TODO: We need to store which PID corresponds to this job\n elsif job.job_class.fiber?\n # A job that requires a separate fiber.\n log.debug \"Creating a new fiber for job #{job.id}\"\n Fiber.new do\n process_job job\n finish_job job\n end.resume\n else\n # Old-school, blocking job\n log.debug \"Running job #{job.id} in the blocking mode\"\n process_job job\n finish_job job\n end\n end",
"def work( payload, metadata )\n\t\tself.job_counter.mark\n\t\tself.job_timer.time do\n\t\t\tsuper\n\t\tend\n\tend",
"def next_tick(&block)\n @run_queue << block\n if reactor_thread?\n # Create a next tick timer\n if not @next_tick_scheduled\n @next_tick.start(0)\n @next_tick_scheduled = true\n @next_tick.ref\n end\n else\n @process_queue.call\n end\n\n self\n end",
"def schedule_execution\n @serialized_execution.post(@executor) do\n synchronize do\n begin\n Thread.current[:__current_actor__] = reference\n yield\n rescue => e\n log FATAL, e\n ensure\n Thread.current[:__current_actor__] = nil\n end\n end\n end\n\n nil\n end",
"def perform!\n run_callbacks(:before_perform, self)\n self.class.upcoming_mailings\n .in_batches(of: self.class.batch_size)\n .each do |batch|\n run_callbacks(:on_perform, self, batch)\n batch.each(&:process!)\n end\n run_callbacks(:after_perform, self)\n nil\n end",
"def fire_expired\n # all time is expected as milliseconds\n now = Timers.now\n\n # detect when the clock has reversed\n reschedule if now < @last_fired\n @last_fired = now\n runnables, periodicals, expired_count = [], [], 0\n\n # defer firing the timer until after this loop so we can clean it up first\n @timers.each do |timer|\n break unless timer.expired?(now)\n runnables << timer\n periodicals << timer if timer.periodical?\n expired_count += 1\n end\n\n remove expired_count\n\n while timer = runnables.shift\n begin\n timer.fire\n rescue => e\n if @exception_handler\n @exception_handler.call(e)\n else\n renew(periodicals)\n raise\n end\n end\n end\n\n renew periodicals\n end",
"def dispatch\n body = {\n 'command' => @command,\n 'nodes' => @nodes,\n 'run_timeout' => @timeout\n }\n\n ::Chef_Delivery::ClientHelper.enter_client_mode_as_delivery\n resp = @rest.post_rest('/pushy/jobs', body)\n ::Chef_Delivery::ClientHelper.leave_client_mode_as_delivery\n\n @job_uri = resp['uri']\n refresh\n end",
"def queue_future_jobs\n tasks.each do |task|\n # Schedule the new run times using the future job wrapper.\n new_run_times = task.future_run_times - task.existing_run_times\n new_run_times.each do |time|\n SimpleScheduler::FutureJob.set(queue: @queue_name, wait_until: time)\n .perform_later(task.params, time.to_i)\n end\n end\n end",
"def jobs\n @jobs ||= Beaneater::Jobs.new(self)\n end",
"def run\n while (get_job() ) do\n checkout_job()\n do_job()\n complete_job()\n end\n end",
"def initialize *jobs\n super()\n @stopped = true\n @suspended = false\n @queue = Queue.new\n jobs.each{|job|\n self.push(job)\n }\n @mutex = Mutex.new\n @timezone = nil\n end",
"def perform args={each_minute: RUN_EVERY}\n # call an other job\n CowsayJob.perform_later # topic: 'ru'\n \n self.class.perform_later wait: args[:each_minute].minute # re-queue\n end",
"def expire_files(expiration_date)\n old_objects = bucket.objects(prefix: @prefix).select do |object|\n object.last_modified <= expiration_date\n end\n\n delete(old_objects)\n\n bucket.multipart_uploads.each do |multipart_upload|\n next if @prefix && !multipart_upload.key.start_with?(@prefix)\n # no need to check multipart uploads initiated before expiration date\n next if multipart_upload.initiated > expiration_date\n\n most_recent_part = multipart_upload.parts.sort_by(&:last_modified).last\n if most_recent_part.nil? || most_recent_part.last_modified <= expiration_date\n abort_multipart_upload(multipart_upload)\n end\n end\n end",
"def save\n self.class.store(job_id, data, expire_at)\n self\n end",
"def expire_at\n if finished? && @expire_in > 0\n finished_at.to_i + @expire_in\n else\n super\n end\n end",
"def schedule_evaluation\n ActiveRecord::Base.transaction do\n job = EvaluateRecommendationJob.perform_later(self)\n self.ingredient.add_job(job.job_id)\n job\n end\n end",
"def start\n until @done\n job = retrieve_job\n job.execute if job\n end\n end",
"def execute\n EM.run do\n @workers = []\n @max_workers.times { @workers << Worker.new(@max_jobs_per_worker) }\n\n EM.add_periodic_timer(2) do\n @workers.each { |worker| EM.defer( worker ) if worker.has_jobs? }\n end\n end\n end",
"def run(count: Container.processor_count, **options, &block)\n\t\t\t\tcount.times do\n\t\t\t\t\tspawn(**options, &block)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn self\n\t\t\tend",
"def pexpire(key, milliseconds, **kwarg)\n node_for(key).pexpire(key, milliseconds, **kwarg)\n end",
"def enqueue_job\n BackgroundJob.enqueue(\n InviteJob,\n {\n manager_id: @invitee_manager[:id],\n invite_token: @invite_token\n }\n )\n\n success\n end",
"def run!\n TaskServerLogger.instance.error \"Executing job id #{self.id}, #{self.to_s}...\"\n begin\n self.last_run_at = Time.zone.now\n self.next_run_at = nil\n self.save\n eval(self.job.gsub(/#JOBID#/, self.id.to_s).gsub(/#RAILS_ROOT#/, RAILS_ROOT))\n self.last_run_result = \"OK\"\n TaskServerLogger.instance.info \"Job completed successfully\"\n rescue Exception\n err_string = \"'#{self.job}' could not run: #{$!.message}\\n#{$!.backtrace}\"\n TaskServerLogger.instance.error err_string\n puts err_string unless ENV['RAILS_ENV'] == \"test\"\n self.last_run_result = err_string.slice(1..500)\n begin\n Notifier.deliver_job_failure(self)\n rescue\n end\n end\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end",
"def run_job\n end",
"def fire\n schedule_firing_time if @periodical\n @timer_proc.call\n end",
"def expire\n self.expires_on = DateTime.current\n self\n end",
"def execute\n self.started\n self.execute_internal\n self.finished\n end",
"def new\n @bulletin = @current_user.jobs.build\n super\n end",
"def expire!\n update_config 'expired' => true\n end",
"def execute_tasks(starttime)\n now=Time.now\n starttime=Time.at(now.to_i-24*60*60) if starttime.nil? \n $stdin.each_line do |line|\n md= /^([^\\t|^\\#].*\\t){5}/.match(line)\n if (md)\n cron = Rufus::Scheduler::CronLine.new(md[0]) \n next_time = cron.next_time(starttime)\n if (next_time.day()==now.day())\n command=line[md[0].length .. line.length-1]\n system(command)\n end\n end\n end\nend",
"def scrape_jobs\n @scraper = FreelancerFinder::Scraper.new\n @scraper.scrape_recent_jobs.each do |job_hash|\n FreelancerFinder::Job.new(job_hash) unless FreelancerFinder::Job.all.detect {|job| job.path == job_hash[:path]} # next create a job instance from the data we just scraped unless it exists already\n end\n end",
"def expire!\n successor = BillingPeriod.create! booking: booking,\n start_date: start_of_next_period\n successor.delay.charge!\n end",
"def queue_job; end",
"def generate\n GenerateInvoiceJob.perform_later\n end",
"def register_reaper_process\n redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, nx: true, ex: drift_reaper_interval) }\n end",
"def do_trigger\n\n hit_exception = false\n\n begin\n\n @block.call @job_id, @at, @params\n\n rescue Exception => e\n\n @scheduler.send(:log_exception, e)\n\n hit_exception = true\n end\n\n if \\\n @scheduler.instance_variable_get(:@exit_when_no_more_jobs) or\n (@params[:dont_reschedule] == true) or\n (hit_exception and @params[:try_again] == false)\n\n @scheduler.instance_variable_get(:@non_cron_jobs).delete(job_id)\n # maybe it'd be better to wipe that reference from here anyway...\n\n return\n end\n\n #\n # ok, reschedule ...\n\n\n params[:job] = self\n\n @at = @at + Rufus.duration_to_f(params[:every])\n\n @scheduler.send(:do_schedule_at, @at, params)\n end",
"def perform(*args)\n if Service.get_service.jobs_enabled?\n # Job processing is enabled.\n Delayed::Worker.logger.info \"---> running #{self.class}(#{args.join(',')}) on #{self.queue_name} at priority #{Process::getpriority(Process::PRIO_PROCESS, 0)}\"\n start_time = Time.current\n perform_if_enabled(*args)\n Delayed::Worker.logger.info \"<--- finished #{self.class} after #{time_ago_in_words(start_time)}\"\n else\n # Resubmit the job with the required parameters after the specified delay. If the inline adapter is being used, we just ignore this.\n Delayed::Worker.logger.warn \"**** job processing disabled for #{self.class}\"\n begin\n self.class.set(wait: DISABLED_RETRY_INTERVAL).perform_later(*args)\n rescue NotImplementedError => _e\n Delayed::Worker.logger.error \"**** no job queue available for future job #{self.class}\"\n end\n end\n end",
"def next_vix_futures_symbol(current_date=Date.today)\n File.open(vix_futures_expirations_file) do |f|\n f.any? do |line|\n last_expiration_date, symbol = process_line(line)\n return symbol if current_date <= last_expiration_date # last_expiration_date = last day that future can be traded\n end\n end\n return nil # only if we went through the whole file and no future date was populated\n end",
"def start\n unless @enabled\n @enabled = true\n\n begin\n next_item = self.get_next\n\n unless next_item.nil?\n @clock = next_item.due_time if next_item.due_time > @clock\n next_item.invoke\n else\n @enabled = false\n end\n\n end while @enabled\n end\n end",
"def start_periodic_timers; end",
"def start_periodic_timers; end",
"def perform\n gather_items.each do |item|\n begin\n Timeout.timeout(timelimit) do\n perform_job(item)\n end\n rescue Exception => exception\n raise exception if Rails.env.test?\n unless item.destroyed?\n report_exception(exception, item)\n retry_item(item)\n end\n end\n end\n if follow_on_job?\n queue_job(follow_on_priority, follow_on_delay.from_now, true)\n end\n end",
"def run_next_job\n @processing_node = ProcessingNode.find_by_ip_address_and_status(request.remote_ip, 'activated')\n respond_to do |format|\n if @processing_node and @job = @processing_node.jobs_queue.run_next_job(@processing_node)\n flash[:notice] = 'Job was successfully started.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => { :job => @job, :r_script => @job.r_script, 'params' => @job.job_parameters } }\n else\n format.html { redirect_to :action => 'index', :status => 404 }\n format.xml { render :xml => 'No job waiting', :status => 404 }\n end\n end\n end",
"def refresh!(expiry = DEFAULT_EXPIRY)\n # If we are not already updating and the cache is empty\n if !@updating && !ready?\n #puts \"Updating...\"\n @updating = true\n\n # Fetch each API\n BULK_APIS.each do |name, api_url|\n raw_response = request(api_url)\n redis.set(redis_key(name), raw_response) \n redis.expire(redis_key(name), expiry)\n end\n @updating = false \n true\n else\n return raise PoeWatch::Api::Error.new(\"An update is already in progress\") if @updating\n # puts \"Already up to date\"\n end\n end",
"def check_for_enqueued_tasks\n while (task = get_next_task)\n if self.respond_to? task.worker_method\n Thread.current[:persistent_job_id] = task[:id]\n Thread.current[:job_key] = task[:job_key]\n args = Marshal.load(task.args)\n invoke_user_method(task.worker_method,args)\n else\n task.release_job\n end\n # Unless configured to loop on persistent tasks, run only\n # once, and then break\n break unless BDRB_CONFIG[:backgroundrb][:persistent_multi]\n end\n end",
"def process\n puts 'Bacground processor - %s' % self\n\n read do |func, data|\n Lux::DelayedJob.call func, data\n end\n end",
"def invoke_job\n payload_object.perform\n end",
"def work(interval = 5.0, &block)\n interval = Float(interval)\n $0 = \"resque: Starting\"\n startup\n\n loop do\n break if shutdown?\n\n if not paused? and job = reserve\n log \"got: #{job.inspect}\"\n job.worker = self\n run_hook :before_fork, job\n working_on job\n\n perform(job, &block)\n\n done_working\n @child = nil\n else\n break if interval.zero?\n log! \"Sleeping for #{interval} seconds\"\n procline paused? ? \"Paused\" : \"Waiting for #{@queues.join(',')}\"\n sleep interval\n end\n end\n\n ensure\n unregister_worker\n end",
"def next_at(after: nil, limit: nil, now_limit: nil)\n job_query.next_scheduled_at(after: after, limit: limit, now_limit: now_limit)\n end",
"def perform\n ### Destroy all ads where expiry is less than the current time\n Rails.logger.info(\"AdsExpiryWorker_STARTED\")\n expired_ads = PropertyAd.where(\"expiry_at < ?\", Time.now)\n expired_ads.each {|t| Rails.logger.info(\"AdsExpiryWorker_PROCESSING_#{ad.id}\") }\n expired_ads.destroy_all\n\n ### Send email to ads which are going to expire the next day\n ads_about_to_expire = PropertyAd.where(\"expiry_at < ?\", Time.now - 1.day)\n\n ads_about_to_expire.each do |ad|\n Rails.logger.info(\"AdsExpiryWorker_ABOUT_TO_EXPIRE_PROCESSING_STARTED_#{ad.id}\")\n udprn = ad.udprn\n details = PropertyDetails.details(ad.udprn)[:_source]\n vendor_email = details[:vendor_email]\n vendor_property_address = details[:address]\n if vendor_email\n template_data = { vendor_property_address: vendor_property_address }\n self.class.send_email(vendor_email, 'vendor_quote_lost_notify_agent', self.class.to_s, template_data)\n end\n Rails.logger.info(\"AdsExpiryWorker_ABOUT_TO_EXPIRE_PROCESSING_FINISHED_#{ad.id}\")\n end\n\n Rails.logger.info(\"AdsExpiryWorker_FINISHED\")\n\n end"
] |
[
"0.52272254",
"0.4739352",
"0.4690504",
"0.46370155",
"0.45082107",
"0.4501472",
"0.4485635",
"0.4468313",
"0.4468313",
"0.4468308",
"0.44597876",
"0.44346276",
"0.44338608",
"0.4421992",
"0.4410304",
"0.43888772",
"0.43817842",
"0.43430975",
"0.43101612",
"0.4306353",
"0.42864332",
"0.42851326",
"0.4271213",
"0.42706454",
"0.42639703",
"0.42549944",
"0.42498064",
"0.4239669",
"0.42288214",
"0.4225073",
"0.42165107",
"0.4209311",
"0.42013234",
"0.4193807",
"0.41821414",
"0.4173228",
"0.41726905",
"0.41570592",
"0.41541907",
"0.4149393",
"0.41445157",
"0.41436368",
"0.41363356",
"0.4128717",
"0.41248146",
"0.41237572",
"0.41233462",
"0.4121615",
"0.4116939",
"0.41122258",
"0.4109672",
"0.41080076",
"0.41030985",
"0.40899253",
"0.4077732",
"0.40750524",
"0.40666726",
"0.40592578",
"0.40536132",
"0.40357834",
"0.40247136",
"0.40188843",
"0.40178692",
"0.40166163",
"0.40129888",
"0.40086678",
"0.40012196",
"0.39992014",
"0.39973477",
"0.39965007",
"0.39958924",
"0.39924538",
"0.39921898",
"0.39827526",
"0.39764696",
"0.39690602",
"0.39605337",
"0.39586824",
"0.3956254",
"0.39552462",
"0.39483175",
"0.39474845",
"0.39459318",
"0.39429638",
"0.39413077",
"0.39399976",
"0.39284694",
"0.39284396",
"0.39250186",
"0.3922653",
"0.3922653",
"0.3917411",
"0.39162835",
"0.3913126",
"0.39129874",
"0.39115503",
"0.39097297",
"0.38994727",
"0.38890526",
"0.3887775"
] |
0.65313315
|
0
|
Run a job and forward pointer. ==== Return self
|
def run_once
if @first_pointer
@busy = true
procedure = forward
procedure = forward while @first_pointer and procedure.canceled?
procedure.run unless procedure.canceled?
end
ensure
@busy = false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run\n case self[:job]\n when Proc\n self[:job].call\n else\n self[:job]\n end\n end",
"def run_job\n end",
"def run!\n TaskServerLogger.instance.error \"Executing job id #{self.id}, #{self.to_s}...\"\n begin\n self.last_run_at = Time.zone.now\n self.next_run_at = nil\n self.save\n eval(self.job.gsub(/#JOBID#/, self.id.to_s).gsub(/#RAILS_ROOT#/, RAILS_ROOT))\n self.last_run_result = \"OK\"\n TaskServerLogger.instance.info \"Job completed successfully\"\n rescue Exception\n err_string = \"'#{self.job}' could not run: #{$!.message}\\n#{$!.backtrace}\"\n TaskServerLogger.instance.error err_string\n puts err_string unless ENV['RAILS_ENV'] == \"test\"\n self.last_run_result = err_string.slice(1..500)\n begin\n Notifier.deliver_job_failure(self)\n rescue\n end\n end\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end",
"def run!\n @running = true\n @thread = Thread.current\n while @running\n send! @q.pop\n end\n self\n end",
"def run\n while (get_job() ) do\n checkout_job()\n do_job()\n complete_job()\n end\n end",
"def job \n @job\n end",
"def start\n until @done\n job = retrieve_job\n job.execute if job\n end\n end",
"def run(job)\n if @inqueue.size >= @queue_length\n @result_handler.call(*result)\n end\n @inqueue.push(job)\n @jobcount += 1\n nil\n end",
"def queue_job; end",
"def invoke_job\n payload_object.perform\n end",
"def call(job)\n @last_job_id = job.job_id\n block.call(job)\n end",
"def invoke_job\n payload_object.perform\n end",
"def working!\n disque.with {|cn| cn.call :working, job_id } if disque && job_id\n end",
"def run!\n PeriodicJob.log_error \"Executing job id #{self.id}, #{self.to_s}...\"\n begin\n self.last_run_at = Time.now\n self.next_run_at = nil\n self.save\n command = self.job.gsub(/#JOBID#/, self.id.to_s).gsub(/#RAILS_ROOT#/, Rails.root.to_s)\n puts command\n eval(command)\n self.last_run_result = \"OK\"\n PeriodicJob.log_info \"Job completed successfully\"\n rescue Exception\n err_string = \"'#{self.job}' could not run: #{$!.message}\\n#{$!.backtrace}\"\n PeriodicJob.log_error err_string\n self.last_run_result = err_string.slice(1..500)\n begin\n GeneralMailer.failed_periodic_job(self).deliver\n rescue\n end\n end\n self.save\n\n # ...and persist the next run of this job if one exists\n set_next_job\n end",
"def work\n possible_job = pluck_queue_message(:job_requests) # FIX: pluck doesn't delete\n job = Job.build(@instance_id, possible_job)\n job.valid? ? process(job) : process_invalid(job)\n end",
"def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend",
"def execute(*args)\n execute_job(new_job(*args))\n end",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def access_current_job\n if job = @job\n yield job\n end\n end",
"def fork_and_run(job, &block)\n # run a job in forked child and retrieve the results into the job object.\n r, w = IO.pipe\n\n pid = fork do\n r.close\n result = block.call\n Marshal.dump(result, w)\n exit!(0) # skips exit handlers.\n end\n\n w.close\n job[:result] = r\nend",
"def process\n puts 'Bacground processor - %s' % self\n\n read do |func, data|\n Lux::DelayedJob.call func, data\n end\n end",
"def work_job\n \n # MAINTENANCE\n \n # Are we shutting down?\n if @shutdown\n Kernel.exit!(0) if @current_jobs.size == 0\n end\n \n # PROCESSING JOBS\n \n # Get a job\n job = get_new_job\n return unless job\n log.info \"Got a new job #{job.id}\"\n \n if job.job_class.fork?\n # Job that requires a fork, perfect for long-running stuff.\n log.debug \"Forking the process for job #{job.id}\"\n pid = fork do\n process_job job\n end\n @job_pids[job.id] = pid\n # TODO: We need to store which PID corresponds to this job\n elsif job.job_class.fiber?\n # A job that requires a separate fiber.\n log.debug \"Creating a new fiber for job #{job.id}\"\n Fiber.new do\n process_job job\n finish_job job\n end.resume\n else\n # Old-school, blocking job\n log.debug \"Running job #{job.id} in the blocking mode\"\n process_job job\n finish_job job\n end\n end",
"def execute!\n @context.backend.schedule { run }\n end",
"def run_job\n begin\n set_initial_status\n initialize_job\n run_job_template\n rescue => err\n job_error_handler(err)\n ensure\n close_job\n end\n end",
"def job\n @job\n end",
"def job\n @job\n end",
"def perform!\n Quebert.config.before_job(self)\n Quebert.config.around_job(self)\n\n # Honor the timeout and kill the job in ruby-space. Beanstalk\n # should be cleaning up this job and returning it to the queue\n # as well.\n val = ::Timeout.timeout(ttr, Job::Timeout){ perform(*args) }\n\n Quebert.config.around_job(self)\n Quebert.config.after_job(self)\n\n val\n end",
"def send_job\n new_job.tap do |job|\n yield job\n log_message :C, :job, job\n sendmsg(job.chunked_packed_stream)\n end\n end",
"def forward()\n @forward\n end",
"def run\r\n\t\t\t@b.call\r\n\t\tend",
"def do_job(job)\n job['run_at'] = Time.now\n job['status'] = 'in progress'\n job['attempt'] += 1\n storage.save(job) do |job|\n begin\n args = job['args'].merge(JR.config[:merge_job_itself_to_args] ? {:job_itself => job.dup} : {})\n job.succeed(args)\n job['args'] = args\n job_completed(job)\n rescue CancelJob\n cancel_job(job)\n rescue Exception => e\n rescue_job(e, job)\n end\n end\n end",
"def run_next_job\n @processing_node = ProcessingNode.find_by_ip_address_and_status(request.remote_ip, 'activated')\n respond_to do |format|\n if @processing_node and @job = @processing_node.jobs_queue.run_next_job(@processing_node)\n flash[:notice] = 'Job was successfully started.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => { :job => @job, :r_script => @job.r_script, 'params' => @job.job_parameters } }\n else\n format.html { redirect_to :action => 'index', :status => 404 }\n format.xml { render :xml => 'No job waiting', :status => 404 }\n end\n end\n end",
"def call(*args, **kwargs, &block)\n forward(*args, **kwargs, &block)\n end",
"def work\n if job = lock_job\n QC.log_yield(:at => \"work\", :job => job[:id]) do\n process(job)\n end\n end\n end",
"def perform\n @worker.call\n @last_result\n end",
"def run\n self.proc.call\n end",
"def perform!\n transfer!\n cycle!\n end",
"def perform!\n transfer!\n cycle!\n end",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def start\n prepare\n loop { fork_one_job }\n end",
"def run!\n if (self.finished?)\n self.finish!\n else\n @fibers.each(&:resume)\n end\n end",
"def execute\n self.started\n self.execute_internal\n self.finished\n end",
"def run(job, queue=:default)\n Metriks.timer(\"handler.job.run\").time do\n job.run(queue, payload, params)\n end\n end",
"def perform\n scan\n Delayed::Job.enqueue self, 0, Time.now.utc + 20.seconds # requeue for next time\n # todo: save the job id somewhere\n end",
"def invoke_job\n self.attempts += 1\n payload_object.perform\n end",
"def work\n\t\tsuper\n\t\t@link = @work\n\tend",
"def perform(*args)\n puts \"--------------------------\"\n puts \"---- Running Job ----\"\n puts \"--------------------------\"\n end",
"def job= (work)\n @job = work\n end",
"def run(t)\n retry_until { DRMAA.run_job(t.ptr) }\n end",
"def run\n @job = Job.find(params[:id])\n @processing_node = ProcessingNode.find_by_ip_address(request.remote_ip) || ProcessingNode.find(params[:node])\n\n respond_to do |format|\n if @job.run(@processing_node)\n flash[:notice] = 'Job was successfully started.'\n format.html { redirect_to(@job.r_script) }\n format.xml { render :xml => @job.r_script }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def run\n pgp = Lodqa::Graphicator.produce_pseudo_graph_pattern @query\n pseudo_graph_pattern = PseudoGraphPattern.create pgp:, query: @query\n search = create_search pseudo_graph_pattern\n SearchJob.perform_later search.search_id\n search.search_id\n end",
"def Job(active_job)\n lambda do |object|\n active_job.perform_later(object.id)\n end\n end",
"def run\n while @running\n step\n end\n end",
"def job\n @job\n end",
"def work\n while true\n job = @queue.pop\n task = job[:task]\n\n if task == :quit\n break\n elsif task == :joust\n begin\n work_joust(job[:prog], job[:code], job[:try_only], job[:callback])\n rescue => err\n log(err.inspect, err)\n job[:callback].call(:fatal, err.inspect)\n break\n end\n else\n log(\"Broken job: #{job}\")\n job[:callback].call(:fatal, \"Broken job: #{job}.\")\n break\n end\n end\n end",
"def job\n OSC::Machete::Job.new(\n script: script,\n pbsid: pbsid,\n host: host || workflow.batch_host,\n torque_helper: ResourceMgrAdapter.new(workflow)\n )\n end",
"def run\n if @start.kind_of? String\n client = Restfulie.at(@start)\n client = client.follow if @follow\n client = client.accepts(@accepts) if @accepts\n @start = current = client.get\n else\n # probably configured thru the Rest Process Model class\n @start = current = @goal.class.get_restfulie.get\n end\n \n # load the steps and scenario\n @goal.steps \n @goal.scenario \n \n while(!@goal.completed?(current))\n current = @walker.move(@goal, current, self)\n end\n current\n end",
"def run(t)\n retry_until { DRMAA.run_job(t.ptr) }\n end",
"def work_thread(opts)\n\n args = opts[:args]\n case \n when args.is_a?(Symbol)\n case opts[:args].id2name\n when /\\A@/\n send_args = self.instance_variable_get(opts[:args].id2name)\n else\n # TODO: not sure what this would be used for\n send_args = args\n end\n send = lambda do\n self.send(opts[:method], send_args)\n end\n when args.nil?\n send = lambda do\n self.send(opts[:method])\n end\n else\n send = lambda do\n self.send(opts[:method], args)\n end\n end\n\n Thread.new do\n begin\n send.call\n rescue StandardError => e\n logger.error(@jobkey) { \"#{ e.message } - (#{ e.class })\" } \n (e.backtrace or []).each do |line|\n logger.error(@jobkey) { \"#{line}\" }\n end\n self.delete\n end\n end\n\n end",
"def perform\n @analysis = Analysis.find(@analysis_id)\n\n # get the analysis and report that it is running\n @analysis_job = AnalysisLibrary::Core.initialize_analysis_job(@analysis, @analysis_job_id, @options)\n\n # reload the object (which is required) because the subdocuments (jobs) may have changed\n @analysis.reload\n\n ids = []\n if @options[:data_points].empty?\n logger.info 'No datapoints were passed into the options, therefore checking which datapoints to run'\n\n # queue up the simulations\n @analysis.data_points.where(status: 'na').each do |dp|\n logger.info \"Adding #{dp.uuid} to simulations queue\"\n\n # TODO: move this method to the datapoint model\n ids << dp.submit_simulation\n end\n end\n\n logger.info \"Delayed Job ids are: #{ids}\"\n\n # Watch the delayed jobs to see when all the datapoints are completed.\n # I would really prefer making a chord or callback for this.\n until ids.empty?\n ids.each do |id|\n ids.delete(id) if Delayed::Job.find(id).nil?\n end\n\n # logger.info ids\n\n sleep 5\n end\n\n # TODO: Finalize the worker nodes\n\n rescue => e\n log_message = \"#{__FILE__} failed with #{e.message}, #{e.backtrace.join(\"\\n\")}\"\n logger.error log_message\n @analysis.status_message = log_message\n @analysis.save!\n ensure\n logger.info 'Finished running batchrun method'\n @analysis_job.end_time = Time.now\n @analysis_job.status = 'completed'\n @analysis_job.save!\n @analysis.reload\n @analysis.save!\n end",
"def work\n if job = lock_job\n QC.log_yield(:action => \"work_job\", :job => job[:id]) do\n begin\n call(job)\n log(:action => \"finished_work\", :job => job[:id])\n rescue Object => e\n log(:action => \"failed_work\", :job => job[:id], :error => e.inspect)\n handle_failure(job, e)\n ensure\n @queue.delete(job[:id])\n log(:action => \"delete_job\", :job => job[:id])\n end\n end\n end\n end",
"def run &block\n worker = launch &block\n exit worker.wait\n end",
"def run\n # stop if we don't what to do for jobs or results\n raise ArgumentError, \"The for_job block must be set\" unless @for_job\n raise ArgumentError, \"The for_result block must be set\" unless @for_result\n\n # create the workers\n @workers = Array.new(@num_workers).map do |worker|\n Thread.new(@jobs, @results){|jobs, results|\n loop do\n results << @for_job.call(jobs, jobs.pop)\n end\n }\n end\n\n # loop main thread until complete\n loop do\n # wait and pass result into for_result block\n @for_result.call(@results.pop)\n\n if @results.empty? && @jobs.empty?\n until @jobs.num_waiting == @workers.size\n Thread.pass\n end\n @workers.each(&:kill)\n break\n end\n end\n\n\n end",
"def perform(job)\n load_actions\n Cyclop::Action.find_by_queue(job.queue).perform(*job.job_params)\n 0\n rescue Exception => e\n log e.to_s\n job.release! e\n 1\n end",
"def do_work\n end",
"def job(url)\n server(url).job(URI(url).path)\n end",
"def process(context)\n @action = context.action if context && context.respond_to?(:action) && context.action\n logger.info(\"Starting job #{self.class.name.underscore} with action #{@action}\")\n begin\n self.__send__(@action, context)\n logger.info(\"Finished job #{self.class.name.underscore} with action #{@action}\")\n rescue\n logger.info(\"Failed job #{self.class.name.underscore} with action #{@action}\")\n raise\n end\n end",
"def start_job\n associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => \"/credentials/#{id}/jobs.xml\")) / :job))\n end",
"def post; FacebookPostJob.new.async.perform(self.id); end",
"def run\r\n return unless if?\r\n job_name.constantize.send method_name, formatted_arguments\r\n end",
"def call(&block)\n execute(&block) if valid?\n execution_attempted!\n self\n end",
"def call(job)\n args = job[:args]\n klass = eval(job[:method].split(\".\").first)\n message = job[:method].split(\".\").last\n klass.send(message, *args)\n end",
"def call\n run_callbacks :call do\n enqueue\n end\n end",
"def call(rjob, time)\n # Since Rufus scheduler starts a new thread for each job, we must manage the connection\n # pool ourselves.\n # http://stackoverflow.com/questions/11248808/connection-pool-issue-with-activerecord-objects-in-rufus-scheduler\n ActiveRecord::Base.connection_pool.with_connection do\n new_launched_job.run_job\n end\n end",
"def perform(record)\n run(record, false)\n end",
"def run(&block); end",
"def enqueue(active_job)\n enqueue_at(active_job, nil)\n end",
"def perform(*args, **opt)\n no_raise = record = nil\n super\n args = arguments.dup\n opt = args.extract_options!.dup\n no_raise = opt.delete(:no_raise)\n meth = opt[:meth] ||= \"#{self.class}.#{__method__}\"\n start = opt[:start] ||= timestamp\n timeout = opt[:timeout]\n\n service = args.shift.presence or raise ExecError, \"#{meth}: no service\"\n request = args.shift.presence or raise ExecError, \"#{meth}: no request\"\n record = JobResult.create(active_job_id: job_id)\n\n opt[:deadline] ||= (start + timeout) if timeout\n opt[:job_type] ||= service.is_a?(Array) ? :waiter : :worker\n\n # noinspection RubyMismatchedArgumentType\n if opt[:job_type] == :worker\n worker_task(record, service, request, **opt)\n else\n waiter_task(record, service, request, **opt)\n end\n\n rescue => error\n record&.update(error: error)\n raise error unless no_raise\n __output \"JOB ERROR: #{error.full_message}\"\n {}\n end",
"def schedule(job)\n \n # If we can't get a lock on the @workforce then the Coordinator is most likely shutting down.\n # We want to skip creating new workers in this case.\n if @job_queue.num_waiting == 0 && @workforce.size < QueueToTheFuture.maximum_workers && @workforce.mu_try_lock\n @workforce.push Thread.new() { while job = @job_queue.shift; job.__execute__; end }\n @workforce.mu_unlock\n end\n \n @job_queue.push(job)\n \n nil\n end",
"def perform(&block); end",
"def forward\n end",
"def run_job(func, *args)\n if self.method(func).arity > 1\n self.send(func, *args)\n else\n self.send(func, args)\n end\n end",
"def request(name,job)\n rz_send(service_socket(name),[JSON.dump(job)])\n self\n end",
"def run\n LibZMQ.zmq_proxy @frontend, @backend, @capture\n end",
"def submit_job\n input_deck = generate_input_deck\n # results_script = generate_results_script\n\n if !input_deck.nil? #&& !results_script.nil?\n submit_script = generate_submit_script(input_deck: input_deck)\n # submit_script = generate_submit_script(input_deck: input_deck,\n # results_script: results_script)\n\n if !submit_script.nil?\n Dir.chdir(jobdir) {\n cmd = \"qsub #{prefix}.sh\"\n self.pid = `#{cmd}`\n }\n end\n end\n\n # If successful, set the status to \"Submitted\" and save to database.\n unless pid.nil? || pid.empty?\n self.pid = pid.strip\n # self.submitted_at = Time.new.ctime\n set_status! :b\n else\n self.pid = nil\n # self.submitted_at = '---'\n set_status! :f\n end\n end",
"def run() end",
"def perform(message)\n # If this job has been chained from another, the log will already exist and\n # should not be created\n if @logger.nil?\n @logger = create_logger(@status.id)\n end\n\n # Flag job started running\n if @params_logged\n @logger.info \"Start #{self.class.name}\"\n else\n @logger.info \"Start #{self.class.name} with params: #{message.to_json}\"\n end\n @status.started\n\n begin\n # all subclasses extend this method to define their job\n do_workflow(message)\n rescue Exception => e\n handle_wokflow_exception(e)\n end\n end",
"def run; new.run; end",
"def start_work(child=self)\n fork do\n begin\n @job = child.beanstalk.reserve\n BEANPICKER_FORK[:job] = @job if BEANPICKER_FORK[:child_every]\n data = @job.ybody\n\n if not data.is_a?(Hash) or [:args, :next_jobs] - data.keys != []\n data = { :args => data, :next_jobs => [] }\n end\n\n t=Time.now\n debug \"Running #{@job_name}##{@number} with args #{data[:args]}; next jobs #{data[:next_jobs]}\"\n r = @blk.call(data[:args].clone)\n debug \"Job #{@job_name}##{@number} finished in #{Time.now-t} seconds with return #{r}\"\n data[:args].merge!(r) if r.is_a?(Hash) and data[:args].is_a?(Hash)\n\n @job.delete\n\n Beanpicker.enqueue(data[:next_jobs], data[:args]) if r and not data[:next_jobs].empty?\n rescue => e\n fatal Beanpicker::exception_message(e, \"in loop of #{@job_name}##{@number} with pid #{Process.pid}\")\n if BEANPICKER_FORK[:child_every]\n exit\n else\n Thread.new(@job) { |j| j.bury rescue nil }\n end\n ensure\n @job = nil\n end\n end\n end",
"def execute\n begin\n JobDispatch.logger.info \"Worker executing job #{job_id}: #{target}.#{method}\"\n Thread.current[\"JobDispatch::Worker.job_id\"] = job_id\n @klass = target.constantize\n @result = @klass.__send__(method.to_sym, *params)\n @status = :success\n rescue StandardError => ex\n\n notify_error(ex) rescue nil\n\n @result = {\n class: ex.class.to_s,\n message: ex.to_s,\n backtrace: ex.backtrace,\n }\n @status = :error\n JobDispatch.logger.debug ex\n ensure\n Thread.current[\"JobDispatch::Worker.job_id\"] = nil\n JobDispatch.logger.info \"Worker completed job #{job_id}: #{target}.#{method}, status: #{@status}\"\n end\n end",
"def call(job)\n @processed_job_ids << job.job_id\n block.call(job)\n end",
"def run\n @state.run(self)\n end",
"def job # this is a getter\n @job\n end",
"def run_batch\n make_run_batch_call\n end",
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def jobs\r\n end",
"def perform_now\n raise(::Mongoid::Errors::Validations, self) unless valid?\n\n worker = RocketJob::Worker.new(inline: true)\n start if may_start?\n # Re-Raise exceptions\n rocket_job_work(worker, true) if running?\n result\n end",
"def perform!\n super\n transfer!\n cycle!\n end",
"def run_queue(url='druby://127.0.0.1:61676')\n queue = Queue.new # Containing the jobs to be processed\n \n #Start up DRb with URI and object to share:\n DRb.start_service(url, queue)\n puts \"Listening for connection...\"\n while job = queue.deq\n yield job\n end\nend",
"def run(&_block)\n return_value = nil\n\n command = catch(:breakout_nav) do # Throws from PryByebug::Commands\n return_value = allowing_other_threads { yield }\n {} # Nothing thrown == no navigational command\n end\n\n # Pry instance to resume after stepping\n @pry = command[:pry]\n\n perform(command[:action], command[:options])\n\n return_value\n end",
"def reserve_and_run_one_job; end"
] |
[
"0.70431983",
"0.6526396",
"0.62789714",
"0.62318945",
"0.61395353",
"0.6130733",
"0.61299556",
"0.6091892",
"0.60844254",
"0.6040589",
"0.59648025",
"0.59125257",
"0.5862717",
"0.5832787",
"0.5824651",
"0.5821299",
"0.5800369",
"0.57902586",
"0.57861924",
"0.578216",
"0.57783556",
"0.57523346",
"0.57408696",
"0.5736861",
"0.5734894",
"0.5734894",
"0.572628",
"0.57173955",
"0.57148534",
"0.5712312",
"0.56941295",
"0.5685241",
"0.56791407",
"0.5674229",
"0.56550276",
"0.5618113",
"0.5617476",
"0.5617476",
"0.5607761",
"0.56034756",
"0.55894035",
"0.55831033",
"0.5577714",
"0.5566966",
"0.5564853",
"0.5563719",
"0.5555792",
"0.5552963",
"0.55304384",
"0.5527673",
"0.5527206",
"0.55265075",
"0.5522221",
"0.55122685",
"0.55092615",
"0.54793286",
"0.5478493",
"0.5460858",
"0.5460308",
"0.5458794",
"0.5455002",
"0.54472023",
"0.54452705",
"0.5445226",
"0.5434352",
"0.5424295",
"0.5416617",
"0.5415137",
"0.5412895",
"0.5412328",
"0.5403931",
"0.5397073",
"0.53854394",
"0.53809124",
"0.5377658",
"0.53564113",
"0.53505135",
"0.5329702",
"0.53238076",
"0.5319482",
"0.5316202",
"0.53151196",
"0.5311301",
"0.531128",
"0.53046983",
"0.5304035",
"0.53031206",
"0.53025824",
"0.5301316",
"0.5299795",
"0.52993345",
"0.5298051",
"0.52977777",
"0.5297335",
"0.5295713",
"0.52933794",
"0.52905655",
"0.5285514",
"0.52833617",
"0.5279114",
"0.52790487"
] |
0.0
|
-1
|
Return if some jobs processing now. ==== Args [args] ==== Return true if Delayer processing job
|
def busy?
@busy
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_jobs_hve_been_processed?(queue)\n (job_count(queue) == 0) && (working_job_count(queue) <= 1)\n end",
"def eop?\n @jobs.empty?\n end",
"def completed?\n !self.shift_jobs.empty?\n end",
"def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end",
"def processing?\n return false if self.batch.blank?\n return false if !self.batch.methods.include? :status\n return (!self.batch.status.empty?) && (self.batch.status.count == 1) && (self.batch.status[0] == \"processing\")\n end",
"def delayed_jobs_running?\n (defined?(Delayed::Job) and Delayed::Job.count > 0)\n end",
"def job_ended?\n FINAL_JOB_TASK_STATUSES.include?(@task_status)\n end",
"def job?\n layer_finder.job != nil\n end",
"def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end",
"def executing_job?\n @executing_job == true\n end",
"def has_job_progress?\n !job_progress_queue.empty?\n end",
"def job_status_processed?\n if self.has_interpreter_assigned? && self.invoice_submitted? && self.completed?\n return true\n else\n return false\n end\n end",
"def finished?\n lock.value != 1 && queued_jobs.size.zero? && indegree.size.zero?\n end",
"def execute\n if job.execute\n return true\n else\n return false\n end\n end",
"def check_job_status(report)\n job = load_job(report[:job_id])\n if (job && ((job.processed?) && !(job.complete?)))\n job.send_pack_request # Send a job complete message to the workers, and have one of them download and zip up the results files\n end\n end",
"def processing?\n hash = status\n return false unless hash\n ['incomplete', 'ready', 'shutting_down'].include? hash[:ensure]\n end",
"def run?\n return false unless @process\n return true\n end",
"def processing?\n if hash = status\n case hash[:ensure]\n when \"incomplete\", \"ready\", \"shutting_down\"\n true\n else\n false\n end\n else\n false\n end\n end",
"def more_work?\n get_queue_message_count(:job_requests) > 0\n end",
"def run?\n return false unless @process\n return true\n end",
"def processing?\n self.result_payload(true).has_key?('started_at') && !self.result_payload(true).has_key?('finished_at')\n end",
"def follow_on_job?\n false\n end",
"def has_pending?(job, batch)\n sql = \"Select count(*) from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and ( status = 'queued' or status = 'running' );\"\n r = exec_sql(sql)\n count = r.first[\"count\"].to_i\n count > 0\n end",
"def destroy_failed_jobs?\n return true\n end",
"def process_available_jobs\n processed = false\n until shutdown?\n reset_filter_if_expired\n job = Job.rocket_job_next_job(name, current_filter)\n break unless job\n\n SemanticLogger.named_tagged(job: job.id.to_s) do\n processed = true unless job.rocket_job_work(self, false, current_filter)\n end\n end\n processed\n end",
"def run?\n seconds_left == 0\n end",
"def stalled?\n # only makes sense for jobs that are in an actively processing state\n return false unless pending? || in_progress?\n\n (Time.zone.now - updated_at) > IDLE_THRESHOLD\n end",
"def processing?\n if @progress == 100\n false\n else\n true\n end\n end",
"def working?\n job_working?\n end",
"def running?; started? && !finished? end",
"def has_run?\n @passed != nil\n end",
"def processing?\n running? && (sub_state == :processing)\n end",
"def been_active?\n # Shell out to grep with -m 1 for lazy match, as the log files can grow quite large\n # and we only need to know if one job has ever started.\n any_job = `egrep -m 1 ';pbs_mom;Job;.+;Started' /var/spool/pbs/mom_logs/*`.strip\n any_job.length > 0\nend",
"def work_pending?\n !buffer.empty?\n end",
"def finished?\n\tfinished_on.present? \n\tend",
"def finished?\n finished_at.present? && retried_good_job_id.nil?\n end",
"def check_if_finished\n return parent_check if parent\n\n st = status\n raise error_message(st) if st.failed?\n\n queued = st.queued?\n return [true, queued, st] if st.completed?\n\n [false, queued, nil]\n end",
"def processing?\n status == :processing\n end",
"def running?\n\t\t!cancelled?\n\tend",
"def running?\n started? && !finished?\n end",
"def populating?\n self.sidekiq_workers.each do |job_id|\n status = Sidekiq::Status::status(job_id)\n \n if status == :queued || status == :working\n return true\n else # status either :complete, :failed, or nil\n self.sidekiq_workers.delete(job_id)\n self.save\n end\n end\n\n return false\n end",
"def can_process_cmd?\n settings.queue.empty?\n end",
"def trigger_condition_met?(_job)\n true\n end",
"def can_do_job_async?(job)\n !! job.queue['async']\n end",
"def complete?\n if threaded?\n !running?\n else\n true\n end\n end",
"def running?\n return ![:deleted, :archived, :cancelled, :complete].include?(self.state)\n end",
"def incomplete?\r\n job_status != JobStatus::COMPLETED\r\n end",
"def done?\n get_ingest_run.done?\n end",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def running?\n !running.empty?\n end",
"def extract_in_progress?\n return false unless File.exist?(processing_archive_flag_path)\n\n if (Time.now - File.mtime(processing_archive_flag_path)) >= ProcessingRetryTime\n extract_completed!\n false\n else\n true\n end\n end",
"def delayed_job?\n option?(\"delayed_job\")\n end",
"def complete?\n finished? || cancelled? || failed? || job_failed? || timeout?\n end",
"def ok_to_run?\n # check the limit of max processes, if given\n @max_processes == 0 || ThreadGroup::Default.list.size <= @max_processes\n# !@args['max'] || @pids.size < @args['max']\nend",
"def finished?\n !new? && !processing?\n end",
"def ran?\n completed? || failed?\n end",
"def job?(cmd)\n @job = api.query_job(cmd)\n job.wait_until_done!\n fld = job.failed?\n puts(job.error['message']) if fld\n fld\n end",
"def success?\n killers.any?(&:success?)\n end",
"def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end",
"def is_job_running_on_host(finished_job_task_status_counters)\n finished_job_task_status_counters.active_count > 0\n end",
"def finished?\n !@operations or @operations.empty?\n end",
"def processing?\n status == STATUS_PROCESSING\n end",
"def all_done?\n return false if $producers.any?{|_thr| _thr.alive?}\n return false if $consumers.any?{|_proc| _proc.busy?}\n return true\nend",
"def done?\n beam.empty?\n end",
"def cleanup_discarded_jobs?\n return rails_config[:cleanup_discarded_jobs] unless rails_config[:cleanup_discarded_jobs].nil?\n return ActiveModel::Type::Boolean.new.cast(env['GOOD_JOB_CLEANUP_DISCARDED_JOBS']) unless env['GOOD_JOB_CLEANUP_DISCARDED_JOBS'].nil?\n\n true\n end",
"def success?\n return @process.success? if @process\n return false\n end",
"def running?\n !@manager_thread.nil? &&\n ['sleep', 'run'].include?(@manager_thread.status)\n end",
"def running?\r\n return !@list.nil?\r\n end",
"def task_running?(response)\n return true if response.nil?\n return !(response.data['status'].eql?(\"succeeded\") || response.data['status'].eql?(\"failed\"))\n end",
"def recent_job?(wi)\n # In case of large # of queued jobs for the same source, we check for the latest \n # and skip processing if too close in time to the last one \n return false unless last_job_time = BackupWorker.cache.get(job_start_key(wi))\n DaemonKit.logger.debug \"Got job time from Redis: #{last_job_time}\"\n \n (Time.now - Time.parse(last_job_time)) < @@consecutiveJobExecutionTime\n \n # return false unless last_job_time = BackupSourceJob.cleanup_connection do\n # # there should always be a dataType option now..\n # if last_job = BackupSourceJob.backup_source_id_eq(wi.source_id).backup_data_set_id_eq(get_dataset(wi)).newest\n # last_job.created_at\n # end\n # end\n end",
"def processing?\n @status == STATUS_PROCESSING\n end",
"def queued?\n job_queued?\n end",
"def finished?\n started? and threads.none?(&:status)\n end",
"def executed\n @process_status.nil? ? false : true\n end",
"def has_job?(job_name)\n jobs.exists?(job_name)\n end",
"def executable?\n \n # Return false if picked up by another WQ instance\n if id\n old_lock_version = lock_version\n self.reload\n return false if old_lock_version != lock_version\n end\n \n # Return true we can sill be executed\n return WorkerQueue.available_tasks.include?(self) && !completed? && !running? \n end",
"def queued?\n dj.present?\n end",
"def hault_processing\n if self.processing?\n true\n else\n false\n end\n end",
"def not_finished?\n more_results == :NOT_FINISHED\n end",
"def running? ; @running end",
"def unfinished?\n !finished?\n end",
"def running?\n @lock.synchronize { defined?(@start_time) } && !done?\n end",
"def check_for_job_completion\n self.job.check_for_completion if complete?\n end",
"def running?\n started? && !dead?\n end",
"def remaining?\n cleanup\n return false if count >= max_operations\n true\n end",
"def needs_a_worker?\n\t\treturn true if self.workers.empty?\n\t\tqueue = self.get_message_counting_queue or return false\n\n\t\t# Calculate the number of workers across the whole broker\n\t\tif ( cc = queue.consumer_count ) >= self.max_workers\n\t\t\tself.log.debug \"%p: Already at max workers (%d)\" % [ self.task_class, self.max_workers ]\n\t\t\treturn false\n\t\telse\n\t\t\tself.log.debug \"%p: Not yet at max workers (have %d)\" % [ self.task_class, cc ]\n\t\tend\n\n\t\tself.log.debug \"Mean jobcount is %0.2f\" % [ self.mean_jobcount ]\n\t\treturn self.mean_jobcount > 1 && !self.sample_values_decreasing?\n\tend",
"def has_left?\n self.activity.each {|activity|\n if [\"10\", #Processed\n \"80\", # Picked Up by Shipping Partner\n \"81\", # Arrived Shipping Partner Facility\n \"82\"] # Departed Shipping Partner Facility\n\n return true\n end\n }\n return false\n end",
"def job_status_expired?\n if self.expired?\n return true\n else\n return false\n end\n end",
"def complete?\n @gapi.job_complete\n end",
"def did_complete_transcoding?\n if variant_jobs.all? { |j| j.finished? }\n variant_jobs.any? { |j| j.failed? } ? false : true\n else\n false\n end\n end",
"def completed?\n job_completed?\n end",
"def should_stop?\n time_is_up? ? more_work? : false\n end",
"def done?\n exit_status.present?\n end",
"def has_work?\n how_much_more_work > 0\n end",
"def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end",
"def might_have_data?\n @state.to_s =~ /finished|aborted|running/\n end",
"def job_running_past_expected_end_time?\n Time.zone.now > job_expected_end_time\n end",
"def finished?\n true unless self.finished_on.nil?\n end",
"def finished?\n @game.finished || @pass_order.size == @game.players.size\n end",
"def deal?\n if self.finished?\n return self.local_goals == self.guest_goals\n end\n return false\n end"
] |
[
"0.6854574",
"0.67004204",
"0.6669079",
"0.6595723",
"0.6595723",
"0.65343857",
"0.6525657",
"0.6487264",
"0.64833665",
"0.6463926",
"0.64392865",
"0.6434155",
"0.6428885",
"0.6404588",
"0.64035004",
"0.6400523",
"0.63845074",
"0.6366995",
"0.63599885",
"0.6354189",
"0.63470876",
"0.6346015",
"0.6336722",
"0.6325295",
"0.6312025",
"0.62977064",
"0.62962747",
"0.6266415",
"0.62520784",
"0.62277496",
"0.62061536",
"0.6199286",
"0.61896676",
"0.61840725",
"0.6170851",
"0.613093",
"0.6129849",
"0.6127679",
"0.61258197",
"0.6115842",
"0.61130464",
"0.61032224",
"0.610258",
"0.6102036",
"0.6092982",
"0.608675",
"0.6084699",
"0.60806316",
"0.60719365",
"0.60719365",
"0.6067181",
"0.6061923",
"0.6056431",
"0.6042281",
"0.60415095",
"0.60288405",
"0.60249585",
"0.60172117",
"0.6015338",
"0.60109526",
"0.60055256",
"0.5998888",
"0.59855986",
"0.5983972",
"0.5981174",
"0.5977702",
"0.5967406",
"0.5960602",
"0.5950585",
"0.59474677",
"0.5945843",
"0.59364766",
"0.5930858",
"0.5925699",
"0.5922547",
"0.592233",
"0.59177125",
"0.5917269",
"0.5914326",
"0.59052044",
"0.59048223",
"0.5901231",
"0.58984727",
"0.58974",
"0.5896719",
"0.5895907",
"0.58933616",
"0.5882098",
"0.58795524",
"0.587678",
"0.5870185",
"0.5870141",
"0.58675945",
"0.5866426",
"0.5865898",
"0.5865341",
"0.5863204",
"0.58485526",
"0.5846256",
"0.5845797",
"0.58439356"
] |
0.0
|
-1
|
Return true if no jobs has. ==== Return true if no jobs has.
|
def empty?
!@first_pointer
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def eop?\n @jobs.empty?\n end",
"def completed?\n !self.shift_jobs.empty?\n end",
"def has_job?(job_name)\n jobs.exists?(job_name)\n end",
"def all_jobs_hve_been_processed?(queue)\n (job_count(queue) == 0) && (working_job_count(queue) <= 1)\n end",
"def has_job_progress?\n !job_progress_queue.empty?\n end",
"def exist?\n jobinfo.exist?\n end",
"def delayed_jobs_running?\n (defined?(Delayed::Job) and Delayed::Job.count > 0)\n end",
"def exists?\n SideJob.redis.sismember 'jobs', id\n end",
"def has_job_draft?\n self.jobs.draft_only.count > 0\n end",
"def job_exists? name\n\t\t\tjob = get_job name\n\t\t\treturn job[:success]\n\t\tend",
"def limit_jobs?\n !self[:scheduling].nil? && self[:scheduling] == false\n end",
"def incomplete?\r\n job_status != JobStatus::COMPLETED\r\n end",
"def job?\n layer_finder.job != nil\n end",
"def empty?\n @queued.empty?\n end",
"def working?\n job_working?\n end",
"def more_work?\n get_queue_message_count(:job_requests) > 0\n end",
"def populating?\n self.sidekiq_workers.each do |job_id|\n status = Sidekiq::Status::status(job_id)\n \n if status == :queued || status == :working\n return true\n else # status either :complete, :failed, or nil\n self.sidekiq_workers.delete(job_id)\n self.save\n end\n end\n\n return false\n end",
"def jobs\n @jobs || {}\n end",
"def finished?\n lock.value != 1 && queued_jobs.size.zero? && indegree.size.zero?\n end",
"def include?(job)\n jobs.keys.include?(job.key)\n end",
"def has_pending?\n self.class.job_run_class.has_pending?(@job, @batch)\n end",
"def active?\n activejobs = Dir.glob('/var/spool/pbs/mom_priv/jobs/*').count\n activejobs > 0\nend",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n\t\t@queue.empty?\n\tend",
"def empty?\n @queue.empty?\n end",
"def is_empty()\n @queue.size == 0\n end",
"def empty?\n self.results.empty?\n end",
"def executing_job?\n @executing_job == true\n end",
"def check_for_empty_batch?\n batch.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @que.empty?\n end",
"def is_empty()\n @queue.count { _1 } == 0\n end",
"def destroy_failed_jobs?\n return true\n end",
"def job?(cmd)\n @job = api.query_job(cmd)\n job.wait_until_done!\n fld = job.failed?\n puts(job.error['message']) if fld\n fld\n end",
"def jobs_without_template\n []\n end",
"def available?\n @available ||= begin\n response = RestClient::Request.execute(\n method: :get,\n url: build_jobs_url,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n response.code == 200 ? true : false\n rescue Timeout::Error => e\n false\n rescue => e\n false\n end\n end",
"def been_active?\n # Shell out to grep with -m 1 for lazy match, as the log files can grow quite large\n # and we only need to know if one job has ever started.\n any_job = `egrep -m 1 ';pbs_mom;Job;.+;Started' /var/spool/pbs/mom_logs/*`.strip\n any_job.length > 0\nend",
"def empty?\n self.queue_size == 0\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n self.count == 0\n end",
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def has_pending?(job, batch)\n sql = \"Select count(*) from #{@schema_name}.job_runs where job_id = '#{job.id}' and batch = '#{batch.to_json}' and ( status = 'queued' or status = 'running' );\"\n r = exec_sql(sql)\n count = r.first[\"count\"].to_i\n count > 0\n end",
"def empty?\n @que.empty?\n end",
"def empty?\n @que.empty?\n end",
"def empty?\n @que.empty?\n end",
"def queued?\n job_queued?\n end",
"def any?\n !@queue.empty?\n end",
"def any?\n !@queue.empty?\n end",
"def job_status_processed?\n if self.has_interpreter_assigned? && self.invoice_submitted? && self.completed?\n return true\n else\n return false\n end\n end",
"def available_jobs\n active_jobs + eligible_jobs\n end",
"def empty?\n return false\n end",
"def any?\n !@queue.empty?\n end",
"def empty?\n @q.empty?\n end",
"def completed?\n job_completed?\n end",
"def run_persistent_jobs?\n !get_config_value(:persistent_disabled, false)\n end",
"def workers_available?\n @worker.nil?\n end",
"def empty?\n load # make sure we have determined the number of fetched records\n\n @number_of_records.zero?\n end",
"def not_qualified?\r\n job_status != JobStatus::COMPLETED and job_status != JobStatus::INCOMPLETED and job_status != JobStatus::EXCLUDED\r\n end",
"def ready?\n inslots.values.all?{|inslot| queues[inslot.name].length > 0 }\n end",
"def empty?(name = '.+')\n queues_matching(name).all?(&:empty?)\n end",
"def has_work?\n how_much_more_work > 0\n end",
"def check_for_job_completion\n self.job.check_for_completion if complete?\n end",
"def empty?\n count == 0\n end",
"def empty?\n count == 0\n end",
"def empty()\n @queue.size == 0\n end",
"def seen_job_with_id?(job_id)\n @processed_job_ids.include?(job_id)\n end",
"def empty?; tasks.empty? end",
"def complete?\n @gapi.job_complete\n end",
"def empty?\n @q.empty?\n end",
"def is_empty()\n @requests.empty?\n end",
"def pending_data?\n !pending_queues.empty?\n end",
"def empty?\n count == 0\n end",
"def processings?\n @processings.any?\n end",
"def process_available_jobs\n processed = false\n until shutdown?\n reset_filter_if_expired\n job = Job.rocket_job_next_job(name, current_filter)\n break unless job\n\n SemanticLogger.named_tagged(job: job.id.to_s) do\n processed = true unless job.rocket_job_work(self, false, current_filter)\n end\n end\n processed\n end",
"def available_jobs\n @jobs = Job.all.select { |j| !j.agents.include?(current_user) && j.start_date >= Date.today }\n end",
"def empty?\n return true unless @all\n @all.empty?\n end",
"def empty?\n count <= 0\n end",
"def empty()\n @queue.empty?\n end",
"def can_work?\n @available_workers.length > 0\n end",
"def done?\n beam.empty?\n end",
"def running?\n !running.empty?\n end",
"def lost_jobs\n @lost_jobs ||= []\n end",
"def empty?\n @timers.empty?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n count.zero?\n end",
"def empty?\n record_count == 0\n end",
"def as_jobs\n @jobs ||= find_latest_completed_jobs\n end",
"def finished?\n !@operations or @operations.empty?\n end",
"def busy?\n !@work_queue.empty? || super\n end",
"def empty?\n @j_map.isEmpty()\n end",
"def work_pending?\n !buffer.empty?\n end",
"def working?\n @available_workers.length < @workers.length\n end",
"def in_use?\n !batch.nil?\n end",
"def empty()\n @q.empty?\n end",
"def rocket_job_singleton_active?\n self.class.where(:state.in => [:running, :queued], :id.ne => id).exists?\n end",
"def running?\r\n return !@list.nil?\r\n end",
"def all_jobs\n\n find_jobs()\n end"
] |
[
"0.8507919",
"0.778034",
"0.7635272",
"0.7491267",
"0.7461306",
"0.730035",
"0.7146288",
"0.7036515",
"0.69870913",
"0.694431",
"0.6943504",
"0.68761075",
"0.6840493",
"0.68226695",
"0.6787725",
"0.67861354",
"0.6744073",
"0.67409444",
"0.6735555",
"0.6730775",
"0.67303926",
"0.67227143",
"0.66996425",
"0.66996425",
"0.66996425",
"0.668576",
"0.66619134",
"0.665598",
"0.6649198",
"0.6645866",
"0.6645711",
"0.66202676",
"0.6600095",
"0.6583784",
"0.65499973",
"0.652153",
"0.6501034",
"0.6491912",
"0.6489742",
"0.6484143",
"0.647965",
"0.6478654",
"0.6478654",
"0.64744747",
"0.6468468",
"0.64649993",
"0.64649993",
"0.64649993",
"0.64353347",
"0.64257497",
"0.64255136",
"0.64232767",
"0.64221466",
"0.64198583",
"0.6414714",
"0.6408019",
"0.6401361",
"0.6397163",
"0.6389792",
"0.63892114",
"0.63879234",
"0.63847685",
"0.6367977",
"0.6366183",
"0.63643956",
"0.63591796",
"0.63591796",
"0.6357484",
"0.63566464",
"0.6355313",
"0.63526016",
"0.6342705",
"0.6332117",
"0.6330507",
"0.63241535",
"0.6322827",
"0.63215387",
"0.6318949",
"0.629792",
"0.62931126",
"0.62830395",
"0.627661",
"0.6275884",
"0.6272534",
"0.62714833",
"0.6271159",
"0.6267857",
"0.6267857",
"0.6267857",
"0.6244196",
"0.62438446",
"0.6237753",
"0.6233003",
"0.62319297",
"0.62095606",
"0.62083787",
"0.620407",
"0.6198291",
"0.61961037",
"0.61855876",
"0.61675566"
] |
0.0
|
-1
|
Return remain jobs quantity. ==== Return Count of remain jobs
|
def size(node = @first_pointer)
if node
1 + size(node.next)
else
0
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pending_job_count\n\n @pending_jobs.size\n end",
"def jobs_performed\n Resque.redis.get(jobs_performed_key).to_i\n end",
"def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def total_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.parent_job_id.blank?\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def time_remaining\n return 0 if finished_at\n backup_source_jobs.map(&:time_remaining).sum\n end",
"def njobs\n @njobs.to_i\n end",
"def applied_count(job)\n job.applied_jobs.where(status: 0).count +\n job.applied_jobs.where(status: 3).count\n end",
"def quantity\n @task_worker_lock.synchronize {@task_workers.size}\n end",
"def last_job_number\n @jobs.length\n end",
"def complete\n job.quantity - job.completed\n end",
"def at_job_count\n\n @non_cron_jobs.values.select { |j| j.class == AtJob }.size\n end",
"def num_waiting\n @waiting.size\n end",
"def num_waiting\n @waiting.size\n end",
"def num_waiting\n @queue.num_waiting\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def prayer_requests_qty\n Rails.cache.fetch(\"prayer_requests-qty-#{id}\") do\n content_prayers.pending.count\n end\n end",
"def queue_length\n @job_queue.length\n end",
"def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end",
"def get_job_count(type='scanner')\n job_count = 0\n framework.jobs.each do |k, j|\n if j.name =~ /#{type}/\n job_count = job_count + 1\n end\n end\n return job_count\n end",
"def quantity\n quantity_initial - quantity_consumed\n end",
"def remaining_count\n raw_history['results_remaining']\n end",
"def num_child_jobs\n @gapi.statistics.num_child_jobs || 0\n end",
"def every_job_count\n\n @non_cron_jobs.values.select { |j| j.class == EveryJob }.size\n end",
"def njobs\n @pool.njobs\n end",
"def queued_build_count\n response = get('buildQueue')\n response.count\n end",
"def queue_count()\n @work_queue.size + super()\n end",
"def length\n (@client.redis.multi do\n %w[ locks work scheduled depends ].each do |suffix|\n @client.redis.zcard(\"ql:q:#{@name}-#{suffix}\")\n end\n end).inject(0, :+)\n end",
"def waiting_size\n @waiting.size\n end",
"def count_jobs\n \tself.bugs.bug_has_closed.count\n end",
"def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end",
"def num_waiting\n @num_waiting\n end",
"def pending_count\n @pendings.size\n end",
"def queue_count()\n @queue.length\n end",
"def num_waiting\n @waiting\n end",
"def queued_messages\n @queue.length\n end",
"def queued_jobs_requesting_gpus_counter(job)\n if is_job_requesting_gpus_and_queued(job)\n #@queued_jobs_requesting_gpus += 1\n return 0\n end\n end",
"def queued_messages\n @queue.length\n end",
"def count\n\t\t@queue.length\n\tend",
"def total_unprocessed_tasks_count\n return @total_unprocessed_tasks_count\n end",
"def queue_count()\n cnt = 0\n @flows.each_value { |f| cnt += f.queue_count() }\n cnt\n end",
"def queue_count\n @queues.length\n end",
"def available_jobs\n active_jobs + eligible_jobs\n end",
"def num_waiting\n @resources.num_waiting\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n counter += item.quantity\n end\n counter\n end",
"def quantity_available\n available = item_hash.deep_find(:quantity_available)\n if available.nil?\n return quantity_listed - quantity_sold\n else\n return available.to_i\n end\n end",
"def pending_tasks_count\n @@pending_tasks.length\n end",
"def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end",
"def cron_job_count\n\n @cron_jobs.size\n end",
"def tasks_total_count\n tasks.length\n end",
"def slow_total_check_amount\r\n total_chk_amount = 0\r\n self.jobs.each do |job|\r\n check_amount = 0\r\n if job.parent_job_id.blank?\r\n check_amount = CheckInformation.find_by_job_id(job.id).check_amount if CheckInformation.find_by_job_id(job.id)\r\n end\r\n total_chk_amount += check_amount.to_f\r\n end\r\n return total_chk_amount\r\n end",
"def num_waiting\n @num_waiting.value\n end",
"def get_completed_eobs\r\n completed_eobs = 0\r\n self.jobs.each do |job|\r\n # job.eob_count will fetch total EOB count for the job based on count of database table records for EOBs\r\n completed_eobs = job.eob_count + completed_eobs\r\n end\r\n return completed_eobs\r\n end",
"def amount_kills\n mutations.select(&:success?).length\n end",
"def num_waiting\n @pop_mutex.waiting_threads_count + @waiter.waiting_threads_count\n end",
"def remaining\n max - used\n end",
"def quantity\n consumables.size\n end",
"def waiting_count\n @map[Constants::TaskStatus::REQUESTED]\n end",
"def pending_count\n return @pending_count\n end",
"def work_queue_size()\n @work_queue.size\n end",
"def pending\n total - done\n end",
"def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end",
"def waitlist_size\n @queue.size\n end",
"def num_waiting\n end",
"def num_waiting\n end",
"def item_count\n\t\tquery(\"* marked:'quantityText'\", :text)[0]\n\tend",
"def remaining_production_total\n return productions_total - allotment_total_of_production_queue - allotment_total_of_research\n end",
"def subjects_count\n subject_count = 0\n self.slots.each do |slot|\n subject_count += slot.subjects.count unless slot.cancelled?\n end\n return subject_count\n end",
"def executions_count\n aj_count = serialized_params.fetch('executions', 0)\n # The execution count within serialized_params is not updated\n # once the underlying execution has been executed.\n if status.in? [:discarded, :succeeded, :running]\n aj_count + 1\n else\n aj_count\n end\n end",
"def queue_length\n @executor.getQueue.size\n end",
"def incomplete_count\n incomplete.count\n end",
"def job_durations(success=true)\n Resque.redis.lrange(jobs_duration_key(success),0,durations_recorded - 1).map(&:to_f)\n end",
"def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end",
"def time_remaining\n member.last_backup_job.time_remaining rescue 0\n end",
"def count_failing\n return self.failing_products.size\n end",
"def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end",
"def tasks_finished_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_finished_count\n end\n end",
"def total_count(queue)\n collection.find(conditions(queue)).count\n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def count_items\n @items.size\n end",
"def inventory_count\n @inventory.count\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def clean_previous_jobs(keep_last_one=true)\n back_size = @previous_jobs.size\n jobs_tabs = @previous_jobs.values\n i = jobs_tabs.size - 2\n # on remonte jusqu'au previous clean_jobs==true\n i -= 1 while i >= 0 && ! jobs_tabs[i].clean\n return 0 if i < 0\n i -= 1 if keep_last_one && i != 0\n last_clean_job_id = jobs_tabs[i].id\n # et supprime ce qu'il y a avant.\n @previous_jobs.shift while ! @previous_jobs.empty? && @previous_jobs.first.first != last_clean_job_id\n back_size - @previous_jobs.size\n rescue => err\n log.error \"%s (%d, %d, %s)\" % [err.to_s, @previous_jobs.size, back_size, i, last_clean_job_id]\n @previous_jobs.size - back_size\n end",
"def total_complete\n tasks.select { |task| task.complete? }.count\n end",
"def total_tasks\n tasks.count\n end",
"def allotment_total_of_production_queue\n allotment_total = 0\n production_queues.each do |production_queue|\n allotment_total += production_queue.allotment unless production_queue.allotment.blank?\n end\n return allotment_total\n end",
"def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end",
"def count_prizes_left\n @count_prizes_left ||= quantity - short_listed_winners.count(:conditions => \"accepted = true or (accepted is null and created_on >= now()::date - interval '#{AppConfig.prize_expires_after_in_days} days')\")\n end",
"def task_count()\n @tasks.size\n end",
"def failed_tasks_count\n return @failed_tasks_count\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end",
"def item_count\n return @item_count\n end",
"def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end",
"def scheduled_messages_count\n with_queue_control do |control|\n control.scheduled_count\n end\n end",
"def count\r\n items.size\r\n end",
"def item_count\n self.line_items.inject(0) { |total, line_item| total + line_item.quantity }\n end",
"def quantity_max_available_for_amend\n quantity + quantity_rejected\n end",
"def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end",
"def method()\n @workers.size\n end",
"def tasks_pending_count\n count do |task|\n task.pending?\n end\n end"
] |
[
"0.7782873",
"0.7174962",
"0.70194036",
"0.70018005",
"0.6936034",
"0.6923153",
"0.6765832",
"0.67033696",
"0.67028147",
"0.6607347",
"0.6583595",
"0.6573486",
"0.6573486",
"0.64835614",
"0.6480092",
"0.6480092",
"0.6439144",
"0.6410101",
"0.63951886",
"0.63694125",
"0.6343797",
"0.6325183",
"0.6308006",
"0.62983817",
"0.6284291",
"0.6191073",
"0.61791533",
"0.61736906",
"0.617284",
"0.6167267",
"0.61609244",
"0.6154899",
"0.6143632",
"0.6132908",
"0.61252093",
"0.6117465",
"0.6064375",
"0.6051877",
"0.60338426",
"0.6028876",
"0.60249335",
"0.6019622",
"0.60175395",
"0.60007876",
"0.5992383",
"0.5983564",
"0.5982363",
"0.59814507",
"0.5979352",
"0.59727985",
"0.5967905",
"0.596382",
"0.59558225",
"0.59545517",
"0.5950953",
"0.5940269",
"0.5933352",
"0.5914917",
"0.5911664",
"0.5888974",
"0.5881335",
"0.5874876",
"0.5872418",
"0.5864056",
"0.5864056",
"0.58589834",
"0.5854658",
"0.58405703",
"0.5836272",
"0.5831535",
"0.58226573",
"0.58067524",
"0.5794421",
"0.5793221",
"0.57679725",
"0.5767549",
"0.5767549",
"0.5761796",
"0.57395035",
"0.57297206",
"0.5718858",
"0.57167727",
"0.57167727",
"0.57145184",
"0.57084465",
"0.5702639",
"0.5702223",
"0.56998503",
"0.5692816",
"0.5684111",
"0.56752485",
"0.5674014",
"0.5667341",
"0.56635576",
"0.5651359",
"0.56481946",
"0.5640894",
"0.56400985",
"0.5639039",
"0.5637614",
"0.56319743"
] |
0.0
|
-1
|
register new job. ==== Args [procedure] job(Delayer::Procedure) ==== Return self
|
def register(procedure)
lock.synchronize do
if @last_pointer
@last_pointer = @last_pointer.break procedure
else
@last_pointer = @first_pointer = procedure
end
if @remain_hook and not @remain_received
@remain_received = true
@remain_hook.call
end
end
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_job(job)\n @stream.add_message(job.to_message)\n job\n end",
"def job=(job)\n @job = job\n end",
"def job=(job)\n @job = job\n end",
"def enqueue(job)\n @jobs ||= {}\n @jobs[job.key] = {}\n\n self.save\n end",
"def add_job(job_def)\n\t\t\tjob = JobBuilder.new(self).build(job_def)\n\t\t\traise \"Error : job with name #{job.name} already exists\" if @jobs.has_key?(job.name)\n\t\t\t@jobs[job.name] = job\n\t\tend",
"def add!(proc = nil, &block)\n job = proc || block\n job.respond_to?(:call) or raise \"Must respond_to?(:call)! #{job.inspect}\"\n if @job_procs.any? && job.respond_to?(:merge) && (merged_queue = job.merge(@job_procs))\n @job_procs = merged_queue\n else\n @job_procs << job\n end\n work! unless paused?\n end",
"def addJob( job )\n\t\t\t\tThread.exclusive {\n\t\t\t\t\t@jobs << job\n\t\t\t\t\twake()\n\t\t\t\t}\n\t\t\tend",
"def enqueue_job!(job, wait_until)\n job.run_callbacks :enqueue do\n job.enqueue!\n job.save! do\n Burstflow::Worker.set(wait_until: wait_until).perform_later(workflow.id, job.id)\n end\n end\n end",
"def enqueue(job)\n enqueue_at(job, nil)\n end",
"def add(job)\n if @workers.empty?\n @work_queue.insert(0, job)\n else\n worker = @workers.pop()\n ask_worker(worker, job)\n end\n end",
"def register_worker_for_job(job, worker)\n job = job.stringify_keys\n if job['id'].blank?\n debug(\"job id not found. delegating again the job #{job.inspect}\") if self.class.debug_enabled?\n delegate(job)\n else\n start_worker(job, worker)\n end\n end",
"def enqueue(job)\n build_worker(job).schedule\n end",
"def add_job(job, output_file)\n @_jobs << Job.new(job, @_places[:input], \n @_places[:output].merge({:object => output_file})\n )\n end",
"def register(procedure)\n priority = procedure.delayer.priority\n lock.synchronize do\n last_pointer = get_prev_point(priority)\n if last_pointer\n @priority_pointer[priority] = last_pointer.break procedure\n else\n procedure.next = @first_pointer\n @priority_pointer[priority] = @first_pointer = procedure\n end\n if @last_pointer\n @last_pointer = @priority_pointer[priority]\n end\n if @remain_hook and not @remain_received\n @remain_received = true\n @remain_hook.call\n end\n end\n self\n end",
"def job(job,params={})\n if (@job[extract_job(job)] && !params[:force])\n return @job[extract_job(job)]\n end\n @job[extract_job(job)] = get_job(job)\n end",
"def push(job)\n super Marshal.load(Marshal.dump(job))\n end",
"def new_job\n j = self.class.new\n j.save\n end",
"def new_job(what, overrides)\n @pipeline << Job.new(what, overrides)\n yield\n @pipeline.pop\n end",
"def add_job(item)\n @jobs[last_job_number] = item\n end",
"def startWorkingJob(job)\n\t\t@db.hset('sgt-unit:'+@id, 'job', job.id)\n\tend",
"def enqueue_job\n BgJob.enqueue(\n NewUserRegisterJob,\n {\n client_id: @client_id,\n user_id: @user.id,\n geoip_country: nil,\n event: {\n client_id: @user.client_id,\n event_source: GlobalConstant::Event.api_source,\n event_name: GlobalConstant::Event.user_register_name,\n event_data: {\n user: @user.get_hash\n },\n event_timestamp: Time.now.to_i\n }\n }\n )\n end",
"def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend",
"def delegate(job)\n job = job.stringify_keys\n job['id'] = generate_job_id(job) unless job_failed?(job)\n @jobs[job['id']] = job\n job['env_options'][CapistranoMulticonfigParallel::ENV_KEY_JOB_ID] = job['id']\n # debug(@jobs)\n # start work and send it to the background\n @workers.async.work(job, Actor.current)\n end",
"def <<(scrape_job) save scrape_job end",
"def create(id, job)\n connection.post do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"def create_for_job(job, batch)\n jr = JobRun.new(self)\n jr.created_at = Time.now\n jr.job_id = job.id\n jr.status = :new\n jr.batch = batch.to_json\n insert_sql = \"INSERT INTO #{@schema_name}.job_runs(created_at, updated_at, job_id, batch, status) VALUES ('#{Time.now}','#{Time.at(0)}', '#{job.id}', '#{batch.to_json}', 'new') RETURNING id\";\n r = exec_sql(insert_sql).values\n if r.length == 0\n return nil\n end\n jr.id = r.first[0].to_i\n jr\n end",
"def job=(job_name)\n @job = job_name\n end",
"def call(job)\n @last_job_id = job.job_id\n block.call(job)\n end",
"def job=(person_job)\n @job = person_job\n end",
"def record_job(job_json)\n job = JSON.parse(job_json)\n processing_jobs.create!(\n :account_id => account_id,\n :cloud_crowd_id => job['id'],\n :title => title,\n :remote_job => job\n )\n end",
"def << job_data\n add_job(job_data)\n end",
"def do_job(job)\n job['run_at'] = Time.now\n job['status'] = 'in progress'\n job['attempt'] += 1\n storage.save(job) do |job|\n begin\n args = job['args'].merge(JR.config[:merge_job_itself_to_args] ? {:job_itself => job.dup} : {})\n job.succeed(args)\n job['args'] = args\n job_completed(job)\n rescue CancelJob\n cancel_job(job)\n rescue Exception => e\n rescue_job(e, job)\n end\n end\n end",
"def create\n job = Job.new\n job.job_name = params[:job_name]\n job.description = params[:description]\n job.quote = params[:quote].to_f\n job.running_total = 0\n \n if job.save\n jobConnect = JobToUser.new\n jobConnect.job_id = job.id\n jobConnect.user_id = current_user.id\n jobConnect.save\n redirect_to(\"/services/show\", :notice => 'Job was successfully created.')\n else\n redirect_to(\"/services/show\", :notice => 'Job Failed to Save. Try Again Later.')\n end\n end",
"def set_background_job_ref(job)\n return unless respond_to?(:background_job_ref=)\n\n job = \"#{job.provider_job.class.name.ns_underscore}%#{job.provider_job.id}\" if job.respond_to?(:provider_job)\n self.background_job_ref = job\n end",
"def add_cpu_job(job, &callback)\n @cpu_worker_queue << { job: job, callback: callback }\n end",
"def job= (work)\n @job = work\n end",
"def enqueue_job(job, event)\n delayed_job = job.queue\n\n logger.info \"Queued #{event.event_description} as job #{delayed_job.id}\"\n\n {\n 'status' => 'ok',\n 'job_id' => delayed_job.id,\n 'queue' => delayed_job.queue,\n 'priority' => delayed_job.priority,\n 'created_at' => delayed_job.created_at,\n }\n end",
"def enqueue(job)\n sqs.send_message(\n queue_url: get_queue_url(job),\n message_body: MultiJson.dump(job.serialize)\n )\n end",
"def enqueue_job\n BgJob.enqueue(\n SendDoubleOptIn,\n {\n client_id: @client_id,\n user_id: @user.id\n }\n ) if @client.is_verify_page_active_for_client?\n\n BgJob.enqueue(\n NewUserRegisterJob,\n {\n client_id: @client_id,\n user_id: @user.id,\n browser_user_agent: @browser_user_agent,\n geoip_country: @geoip_country,\n event: {\n client_id: @user.client_id,\n event_source: GlobalConstant::Event.web_source,\n event_name: GlobalConstant::Event.user_register_name,\n event_data: {\n user: @user.get_hash\n },\n event_timestamp: Time.now.to_i\n }\n }\n )\n end",
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def dequeue(job)\n @jobs = @jobs.delete(job.key)\n\n self.save\n end",
"def add_cron_job(job)\n client.create_cron_job(Kubeclient::Resource.new(job.cron_job_manifest))\n end",
"def create\n @job = Job.new(params[:job].reject{|key, value| key == 'jobs_queue_id'})\n @job.user = current_user\n\n respond_to do |format|\n if @job.save\n if @job.r_script.tags.collect{|tag| tag.name}.include?('install script')\n @job.pending \n elsif queue = JobsQueue.find_by_id(params[:job][:jobs_queue_id].to_i) \n @job.submit(queue) \n end\n create_log_entry(@job.r_script, @job, 'use')\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job.to_xml(:include => { :job_parameters => { :include => :data_set } }), :status => :created, :location => @job }\n else\n @job.jobs_queue_id = params[:job][:jobs_queue_id]\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n params[:job]['body_src'] = sanitize(params[:job]['body_src'])\n if params[:job]['callback_url'].empty? || \n !params[:job]['callback_url'].match(URL_REGEXP)\n params[:job].delete('callback_url') \n end\n flag = Mugen::Job.create(params[:job]) \n\n redirect_to mygengo_jobs_path\n end",
"def enqueue\n # We need to save before passing to perform_later b/c perform_later will need our ID.\n # For this reason, the job_id col can't have a null constraint.\n save! unless persisted?\n job = job_class.constantize.perform_later(self, **job_params)\n update!(job_id: job.job_id, provider_job_id: job.provider_job_id)\n end",
"def save\n # if job is invalid return false\n return false unless valid?\n\n # update next_enqueue_timestamp\n @next_enqueue_timestamp = calculate_next_enqueue_time(Time.now.utc).to_i\n\n Sidekiq.redis do |conn|\n # add to set of all jobs\n conn.sadd(self.class.jobs_key, redis_key)\n\n # add informations for this job!\n conn.hmset(redis_key, *hash_to_redis(to_hash))\n end\n\n logger.info { \"CRON JOB: add job with name: #{@name}\" }\n end",
"def load_job_submit\n location = Location.find_by_location_barcode(self.pdt_screen_def.get_input_control_value(\"location\"))\n self.set_temp_record(:location, location)\n if !location\n result_screen = PDTTransaction.build_msg_screen_definition(\"location does not exist\",nil,nil,nil)\n return result_screen\n end\n\n if !location.current_job_reference_id\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n job = Job.find_by_id(location.current_job_reference_id)\n \n if !job\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n\n if job.job_type_code.upcase != \"RECOOLING\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"this is not a recooling job\",nil,nil,nil)\n return result_screen\n end\n\n if job.current_job_status.upcase != \"JOB_CREATED\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"job[\" + job.job_number + \"] status must be 'created'\",nil,nil,nil)\n return result_screen\n end\n\n pallet_probes = PalletProbe.find_all_by_job_id(job.id)\n if (pallet_probes.length() == 0)\n error = [\"NO PROBES ALLOCATED\"]\n result_screen = PDTTransaction.build_msg_screen_definition(nil, nil, nil, error)\n return result_screen\n end\n\n ActiveRecord::Base.transaction do\n job.update_attribute(:current_job_status, \"JOB_LOADED\")\n\n self.set_transaction_complete_flag\n end\n\n self.set_transaction_complete_flag\n result_screen = PDTTransaction.build_msg_screen_definition(\"job loaded succesfully\",nil,nil,nil)\n return result_screen\n end",
"def create_job_record(job_id)\n if @dbh[:progress_bars].filter(:id => job_id).first\n @dbh[:progress_bars].filter(:id => job_id).\n update(:progress_text => 'queued...', \n :progress_percent => 0,\n :job_start => Time.now,\n :last_updated => Time.now,\n :job_finish => nil)\n else\n @dbh[:progress_bars].\n insert(:id => job_id, \n :progress_text => 'queued...', \n :job_start => Time.now, \n :last_updated => Time.now)\n end\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def call(job)\n @processed_job_ids << job.job_id\n block.call(job)\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to verify_job_url(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_job\n @job = Job.find(params[:job_id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def add_dependency(job)\n Jobs::DependentJob.transaction { \n # d =Jobs::DependentJobDependency.create(:job=>self, :prereq=>job)\n self.dependencies << job\n self.save!\n }\n end",
"def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @job = Job.new\n end",
"def set_job\n @job = Job.find_by_id(params[:id])\n end",
"def set_job\n @job = Job.find(params[:id])\n end",
"def send_job(job)\n begin\n response = RestClient::Request.execute(\n method: :post,\n url: build_jobs_url,\n payload: job.to_codem_json,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n if response.code == 202\n if (obj = JSON.parse(response.to_str))\n obj[\"job_id\"]\n else\n raise \"Job #{job.id} was created on transcoder #{self.id}, but no job ID was returned.\"\n end\n else\n nil\n end\n rescue Timeout::Error => e\n nil\n rescue => e\n nil\n end\n end"
] |
[
"0.6294539",
"0.6210864",
"0.6163173",
"0.61373377",
"0.60448307",
"0.59881175",
"0.5910839",
"0.5843558",
"0.58221287",
"0.5782402",
"0.5760604",
"0.57446545",
"0.573852",
"0.5684736",
"0.56588286",
"0.5637527",
"0.5607542",
"0.5581098",
"0.556459",
"0.5517109",
"0.54985875",
"0.5496423",
"0.5490064",
"0.5474088",
"0.54654574",
"0.542189",
"0.5413932",
"0.5392669",
"0.53920996",
"0.5377763",
"0.53717315",
"0.5367668",
"0.5367316",
"0.5362509",
"0.53416425",
"0.5336985",
"0.53344494",
"0.53339994",
"0.5319768",
"0.5316147",
"0.52593434",
"0.5252976",
"0.52189845",
"0.5212588",
"0.5212122",
"0.5194676",
"0.5180317",
"0.51797175",
"0.51570904",
"0.51564056",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.5151998",
"0.51414543",
"0.51412916",
"0.51303136",
"0.51303136",
"0.51303136",
"0.51294756",
"0.5118269",
"0.51032805",
"0.5098275",
"0.5092575",
"0.5081151"
] |
0.6002835
|
5
|
NO CAPITAL LETTER FOR VARIABLES
|
def initialize(name, x_o)
@name= name
@x_o= x_o
@chosen= Array.new
@reach= Array.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def underscore_vars\r\n self.gsub(/\\b[a-z][a-z]*(?:[A-Z][a-z]*)(?:[A-Z][a-z]*)*\\b/) {|word|\r\n word.underscore\r\n }\r\n end",
"def unusualCapitalization(*x); field('unusualCapitalization', *x) end",
"def new_var\n ('A'..'Z').to_a.each do |letter|\n if !vars.include?(letter)\n vars << letter\n return letter\n end\n end\n end",
"def variable_checker(variable)\n $user_variables[variable.upcase.ord - 65]\n end",
"def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal 'the number is ', \"the number is 42\"[/\\D+/]\n assert_equal 'space:', \"space: \\t\\n\"[/\\S+/]\n # ... a programmer would most likely do\n assert_equal ' = ', \"variable_1 = 42\"[/[^a-zA-Z0-9_]+/]\n assert_equal ' = ', \"variable_1 = 42\"[/\\W+/]\n end",
"def scope2(var)\r\n\tvar.upcase\r\nend",
"def contains_only_capital_letters\n if ! Configs.get_config('allow_capitalssubj').to_bool && ! (self.title =~ /^([0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*[\\75-\\77]*[A-Z]+[0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*)+$/).nil?\n self.errors.add('title', I18n.t(:cap_letters))\n end\n end",
"def capitalize!() end",
"def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal \"the number is \", \"the number is 42\"[/\\D+/]\n assert_equal \"space:\", \"space: \\t\\n\"[/\\S+/]\n assert_equal \" = \", \"variable_1 = 42\"[/\\W+/]\n end",
"def three_word_name; end",
"def two_word_name; 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 alphabet\n\t\treturn @variables | @constants\n\tend",
"def var_name()\n if self.id.start_with?(/\\Ah?l_/i)\n return self.id.downcase\n else\n return \"l_#{self.id.downcase}\"\n end\n end",
"def letter_cases(allow_prefixed_underscores: true)\n LuckyCase.cases self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def pe_variable(pe)\n pe.name.squish.downcase.tr(\" \",\"_\").to_sym\n end",
"def mozart_italian; end",
"def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end",
"def not_capital?(skip_prefixed_underscores: false)\n self.decapitalized? skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def downcase!() end",
"def variablize(original)\n return original.downcase if original =~ /[A-Z]+/ && original !~ /_/\n return original[0].downcase + original[1..-1] if original !~ /_/\n camelized = original.split('_').map { |e| e.capitalize }.join\n camelized[0].downcase + camelized[1..-1]\n end",
"def snake_case(name); 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 name\n\t\t\t\t@name ||= title.downcase.gsub(/\\s+/, UNDERSCORE).gsub(/[^a-z0-9_]/i, BLANK_STRING).to_sym\n\t\t\tend",
"def gluck_italian; end",
"def abbreviation; end",
"def abbreviation; end",
"def abbreviation; end",
"def abbreviation; end",
"def variable_name=(variable_name)\n self[:variable_name] = variable_name.downcase.gsub(/[^0-9a-z_ ]/i, \"\").strip.tr(\" \", \"_\")\n end",
"def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end",
"def under_attack\n puts \"THE world is in danger due to the evil taking over!!!\".upcase\nend",
"def variable_name; end",
"def variable_name; end",
"def name ; self[:name].downcase end",
"def capitalize() end",
"def upcase!() end",
"def decapitalized?(skip_prefixed_underscores: false)\n LuckyCase.decapitalized? self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def detect_capital_use(word)\n var1 = word.upcase\n var2 = word.downcase\n var3 = word.capitalize\n return true if word == var1\n return true if word == var2\n return true if word == var3\n false\nend",
"def lucky_case(allow_prefixed_underscores: true)\n LuckyCase.case self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def half_wind_abbreviation; end",
"def cardinal_abbreviation; end",
"def downcase_keys\n end",
"def makeCensoredVarname( varname )\n varname = basicCensor( varname )\n if( KEYWORD_TRANSLATIONS.has_key?( varname ))then\n varname = KEYWORD_TRANSLATIONS[ varname ];\n end\n return varname\nend",
"def alternative_full_names_without_diacritics\n @alternative_full_names_without_diacritics ||= []\n end",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def var\n\t\t@var ||= \"aljfhnkjlngdkjfj\" #ekvivalen na konstruktor po podrazbirane\n\tend",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def downcase() end",
"def strict_variables; end",
"def var_name_ok?(varname)\n svar=varname.to_s\n if @@reserved_words.include?(svar)\n raise ArgumentError, \"Name \\\"#{svar}\\\" is a reserved word in Ruby.\"\n elsif @@reserved_vars.include?(svar)\n raise ArgumentError, \"Cannot override the #{svar} variable.\"\n elsif /\\A[a-zA-Z][a-zA-Z0-9_]*\\z/.match(svar)\n return svar\n else\n raise ArgumentError, \"Invalid variable name \\\"#{var}\\\": it must be a letter followed by any number of letters, numbers and underscores.\"\n end\n end",
"def first_capitalize\n mb_chars.capitalize.to_s\nend",
"def swapcase!() end",
"def full_name_without_diacritics\n @full_name_without_diacritics\n end",
"def missing_alphas(sentence)\n puts sentence\nend",
"def capital?(skip_prefixed_underscores: false)\n LuckyCase.capital? self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def name_underscored\n self.name.gsub(' ', '_')\n end",
"def unicode_names; end",
"def charset=(_); end",
"def capital_word_case?(allow_prefixed_underscores: true)\n LuckyCase.capital_word_case? self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def clarify_characters\n unclear_characters = {\n ',' => 'Comma (,)',\n '.' => 'Period (.)',\n ';' => 'Semicolon (;)',\n ':' => 'Colon (:)',\n '`' => 'Backtick (`)',\n '-' => 'Minus Sign (-)',\n '+' => 'Plus Sign (+)',\n '=' => 'Equals Sign (=)',\n '_' => 'Underscore (_)',\n '~' => 'Tilde (~)'\n }\n unclear_characters.key?(self) ? unclear_characters[self] : self\n end",
"def normal_to_C(name)\n name = name.to_s.dup\n\n name.sub!(/==$/, '_equals2')\n name.sub!(/=$/, '_equals')\n name.sub!(/\\?$/, '_p')\n name.sub!(/\\!$/, '_bang')\n\n return name\n end",
"def capitalize\n (self.to_s.capitalize! || self).to_sym\n end",
"def alpha=(_); end",
"def refurbish variable_name\n Value.typed @vars[variable_name], variable_name.to_s.sub(/^\\@/, '') #.sub(/^\\$/, '')\n end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def downcase_fields\n self.guess.downcase!\n end",
"def include_char_variants(world)\n keys = CHAR_VARIANTS.keys.join\n world.downcase.gsub(/[#{keys}]/, CHAR_VARIANTS)\n end",
"def alphanunder\n _str = self\n _alphanum_str = _str.gsub(/[^A-Za-z0-9_\\-\\.@ \\/]/,\"\")\n _under_str = _alphanum_str.gsub(/[ \\/\\.\\-@]/,\"_\")\n _under_str.downcase\n end",
"def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def letters_only\n\t\tregex = /\\A[^0-9`!@#\\$%\\^&*+_=]+\\z|\\A\\z/\n\t\tvalidates_format_of :name, :with => regex\n\t\tvalidates_format_of :university, :with => regex\n\t\tvalidates_format_of :department, :with => regex\n\tend",
"def varietal_name\n if varietal.nil? || varietal.name.nil?\n return nil\n else\n varietal.name\n end\n end",
"def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end",
"def swapcase() end",
"def _normalize(name)\n # maybe do something more, maybe not.. ruby does allow for\n # some weird stuff to be used as a variable name. the user\n # should use some common sense. and, other things might\n # also be an syntax error, like starting with a number.\n # this normalization is more of a comvenience than anything\n # else\n name.tr('-', '_')\n end",
"def downcase; end",
"def initialize_name_and_code\n self.code ||= self.name.gsub(\" \", \"_\").downcase\n self.name ||= self.code.gsub(\"_\", \" \").capitalize\n end",
"def titlecase!\n replace(titlecase)\n end",
"def unicode_names=(_arg0); end",
"def lucky_cases(allow_prefixed_underscores: true)\n LuckyCase.cases self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def is_lower?(c)\n return c != c.capitalize\n end",
"def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end",
"def name_with_initial; end",
"def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end",
"def shout (maj)\n maj.upcase\nend",
"def nameToJavaVar( name )\n return '' if( name.nil? )\n RAILS_DEFAULT_LOGGER.debug \"nameToJavaVar; name=#{name}\"\n name.strip!;\n s = name[0,1].downcase! \n RAILS_DEFAULT_LOGGER.debug \"new 1st char |#{s}|\";\n name[0]= s if( ! s.nil? ); \n RAILS_DEFAULT_LOGGER.debug \"output name |#{name}|\";\n name;\nend",
"def pre\n 'alpha'\n end",
"def uppercase_fields\n\t self.fname.capitalize!\n\t self.lname.capitalize!\n\t self.address.capitalize!\n\t self.city.capitalize!\n\t self.state.upcase!\n\t self.email.downcase!\n\t # self.area.capitalize!\n\t self.discipline.capitalize!\n\tend",
"def titlecase_char?(char)\n TITLECASE_LETTER_SET.include?(char.ord)\n end",
"def upcase() end",
"def name_sym\n @name_sym ||= name.downcase.to_sym\n end",
"def yell_name\r\n @name.upcase + \"!\"\r\n end",
"def symbolize\n return :empty if self.empty?\n return self.downcase.gsub(\" \", \"_\").to_sym\n end",
"def underscore!\n gsub!('::', '_')\n gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n downcase!\n end"
] |
[
"0.6738861",
"0.6530359",
"0.64228284",
"0.63078254",
"0.6243661",
"0.6239441",
"0.61731315",
"0.6168101",
"0.61481297",
"0.6122314",
"0.6108365",
"0.6105782",
"0.6059997",
"0.6058601",
"0.60455394",
"0.5989471",
"0.594478",
"0.5941",
"0.5920999",
"0.5902168",
"0.58866817",
"0.5874701",
"0.58502585",
"0.58155316",
"0.58033305",
"0.58012587",
"0.58012587",
"0.58012587",
"0.58012587",
"0.5801024",
"0.57946205",
"0.5784868",
"0.57724494",
"0.57724494",
"0.5760296",
"0.5751549",
"0.57406694",
"0.57365215",
"0.5735648",
"0.57269514",
"0.5722742",
"0.5715582",
"0.5711932",
"0.5711712",
"0.56922853",
"0.5677225",
"0.56567925",
"0.5647524",
"0.5645301",
"0.56296664",
"0.5625675",
"0.5623404",
"0.56119406",
"0.5608743",
"0.55972505",
"0.55755883",
"0.5571668",
"0.55708253",
"0.556997",
"0.5559121",
"0.55527496",
"0.5542406",
"0.5540331",
"0.5536154",
"0.55349517",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532095",
"0.5532013",
"0.5528888",
"0.55259305",
"0.5525398",
"0.5517016",
"0.55114675",
"0.55100846",
"0.5495637",
"0.549292",
"0.5492468",
"0.5492309",
"0.5491185",
"0.54898864",
"0.54881305",
"0.54769415",
"0.54761106",
"0.547063",
"0.5466283",
"0.546576",
"0.54630107",
"0.54536587",
"0.5444514",
"0.5444195",
"0.54374593",
"0.5431059",
"0.5430651",
"0.5429514",
"0.5428142"
] |
0.0
|
-1
|
check if the selected coordinates are inside of reach
|
def check_bingo
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\nend",
"def include?(pnt)\n pnt.lat >= south && pnt.lng >= west && pnt.lat < north && pnt.lng < east\n end",
"def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\n end",
"def within_clickable?(x, y)\n if x >= @px && x <= @qx then\n if y >= @py && y <= @qy then\n return true\n end\n end\n \n false\n end",
"def area_clicked(leftX, topY, rightX, bottomY)\n # complete this code\n if ((mouse_x > leftX and mouse_x < rightX) and (mouse_y > topY and mouse_y < bottomY))\n true\n else\n false\n end\nend",
"def check_diaganol(x_target, y_target)\n\n x = coordinate_x\n y = coordinate_y\n \n\n #top to bottom and left to right\n if x < x_target and y > y_target\n while x < x_target do \n x = x + 1 \n y = y - 1\n\n return true if is_occupied?(x, y) == true\n end\n end\n\n #top to bottom and right to left\n if x > x_target and y > y_target\n while x > x_target do \n \n x = x - 1 \n y = y - 1\n return true if is_occupied?(x, y)\n \n end\n end\n\n #bottom to top and right to left\n if x > x_target and y < y_target\n while x > x_target do \n x = x - 1 \n y = y + 1\n \n return true if is_occupied?(x, y)\n end\n end\n\n #bottom to top and left to right\n if x < x_target and y < y_target\n while x < x_target do \n x = x + 1 \n y = y + 1\n return true if is_occupied?(x, y)\n end\n end\n\n return false\n end",
"def within_drawn? x1, y1, x2, y2\n ((x2 - @origin.x) < x1 && x1 < (x2 - origin.x + size.x) && (y2 - @origin.y) < y1 && y1 < (y2 - origin.y + size.y))\nend",
"def located_here?(x,y)\n self.location == [x,y]\n end",
"def boundaries(x, y)\n return false if x > 7 || x < 0 || y > 7 || y < 0\n return true\n\n end",
"def within?(x, y)\n (x >= 0) && (x < height) && (y >= 0) && (y < height)\n end",
"def legal(coords)\n offsets = [ [1, 2], [-1, 2], [1, -2], [-1, -2], [2, 1], [-2, 1], [2, -1], [-2, -1] ]\n moves = []\n offsets.each do |offset|\n move = [@row+offset[0], @column+offset[1]]\n moves << move\n end\n #loop through possible moves\n moves.each do |move|\n #if chosen coords = moves array coords check if occupied\n if coords === move\n return occupied?(coords)\n end\n end\n return false \n end",
"def is_outside_view\n @x2<0 && @y2<0\n end",
"def check_coords(coord)\n target = $new_game.grid[coord[0]][coord[1]]\n if target[:ship] == true\n $new_game.hits += 1\n $new_game.targets -= 1\n target[:display] = \"XX\"\n self.hit\n else\n # Miss\n target[:display] = \"OO\"\n $new_game.lives -= 1\n self.miss\n end\n $prompt.collect_coords\n end",
"def isBoundedBy(coord)\n inBox(getBox([nw_lon,nw_lat],[se_lon,se_lat]),coord)\n end",
"def contains(mover)\n l = mover.location\n ((@x..@x + @w).cover? l.x) && ((@y..@y + @h).cover? l.y)\n end",
"def inside?(x, y)\n x >= 0 && x < @width && y >= 0 && y < @height\n end",
"def inside?(mouse_x, mouse_y)\n pos_x = @x * @width\n pos_y = @y * @height\n mouse_x >= pos_x && mouse_x <= pos_x + @width && \\\n mouse_y >= pos_y && mouse_y <= pos_y + @height\n end",
"def in_bounds(pos)\n pos.all? { |coord| coord.between?(0, 7) }\n end",
"def has_point(x, y)\n is_negative = (x < 0 or y < 0)\n is_greater_than_dimensions = (x > @width or y > @height)\n\n if is_negative or is_greater_than_dimensions\n result = false\n puts \"[#{x},#{y}] is Outside of Grid, Robot will ignore command\"\n else\n result = true\n end\n\n return result;\n end",
"def exists_at?(coords)\n coords.all? { |c| c.between?(0, 7) }\n end",
"def within_range(coordinates)\r\n return true if coordinates[0].between?(0, 7) && coordinates[1].between?(0, 7)\r\n return false\r\n end",
"def inside_rect?(point1, point2)\n lats = [point1.lat, point2.lat].sort\n lons = [point1.lon, point2.lon].sort\n la = self.lat\n lo = self.lon\n\n (la >= lats[0] && la <= lats[1] && lo >= lons[0] && lo <= lons[1])\n end",
"def legal(coords)\n row_dist = (@row - coords[0]).abs\n col_dist = (@column - coords[1]).abs\n if row_dist > 1 || col_dist > 1\n return false\n elsif check\n puts \"cant move into check\"\n return false\n else\n return occupied?(coords)\n end\n end",
"def inArea lat, lon\n if(!inBounds(lat,lon))\n false\n else\n lastpoint = border_points.last\n y2 = 100\n x2 = 200\n a = (y2 - lat)/(x2 - lon)\n b = lat - a*lon\n icount = 0\n border_points_minus_removed.each_with_index do |point|\n\tif(intersect(lastpoint, point, a, b, lon, x2))\n\t icount += 1\n\tend\n\tlastpoint = point\n end\n (icount % 2) == 1\n end\n end",
"def visible?(fromx, fromy, x, y)\n return false unless map[y][x]\n dx = x - fromx\n dy = y - fromy\n g = dx.gcd(dy)\n return false if g.zero? # seeing ourselves does not count\n return true if g == 1\n mx = dx / g\n my = dy / g\n (1..g - 1).none? { |k| map[fromy + k * my][fromx + k * mx] }\n end",
"def include?(point)\r\n (point - @pos).abs <= @radius\r\n end",
"def is_occupied?(x, y, game)\n game.pieces.where(location_x: x, location_y: y).present?\n end",
"def contains?(x, y)\n x > bounds.x && x < bounds.x+bounds.width && y > bounds.y && y < bounds.y+bounds.height\n end",
"def obstacle?(check_x, check_y)\n game.pieces.exists?(:x_position => check_x,\n :y_position => check_y,\n :active => 1)\n end",
"def move_valid?(x, y)\n (0...@width).cover?(x) && (0...@height).cover?(y) && !@visited[x][y]\n end",
"def found_goal?(neighbors) \n neighbors.each do |neighb| \n if grid.is_goal? neighb\n set_position(neighb) \n return true\n end\n end\n return false\n end",
"def scan\n x = position[0]\n y = position[1]\n !Robot.in_position(x, y).empty? || !Robot.in_position(x+1, y).empty? || !Robot.in_position(x-1,y).empty? || !Robot.in_position(x,y+1).empty? || !Robot.in_position(x,y-1).empty?\n end",
"def check_grid_coordinates(x, y)\n (x >= 0) && (x < @height) && (y >= 0) && (y < @width)\n end",
"def isInside(_pos)\n raise \"not defined\" ;\n end",
"def coordinates_inside_box?(x_idx, y_idx)\n (x_idx >= 0 && x_idx < width) && (y_idx >= 0 && y_idx < height)\n end",
"def under_point?(mouse_x, mouse_y)\n mouse_x > x - PAD && mouse_x < x + width + PAD && mouse_y > y - PAD && mouse_y < y + height + PAD\n end",
"def checkWithinBoundaries?(player)\n # Is this necessary (abs'ing for range)\n lat = self.latitude\n long = self.longitude\n lat2 = self.latitude2\n long2 = self.longitude2\n\n if !player.positioned?\n return false\n end\n\n if (lat > lat2)\n temp = lat2\n lat2 = lat\n lat = temp\n end\n\n if (long > long2)\n temp = long2\n long2 = long\n long = temp\n end\n \n if (player.lat >= lat && player.lat <= lat2) && (player.long >= long && player.long <= long2)\n return true\n else\n return false\n end\n end",
"def contains? position\n # If POI is given instead of location, get location first\n position = position.location if PointOfInterest === position\n\n x = position[0]\n y = position[1]\n\n # Use the raycasting technique to determine if point is inside polygon\n # We are in 2D, which makes it easier.\n # We can also choose the direction of the ray, which makes it almost trivial\n # (Choose ray paralell to x-achis\n intersections = 0\n\n [vertices, vertices.first].flatten.each_cons(2) do |v1, v2|\n # Check if we are inside bounding recangle of 2 vertices\n v1x = v1[0]\n v1y = v1[1]\n v2x = v2[0]\n v2y = v2[1]\n if (v1y < y and y <= v2y) or (v1y >= y and y > v2y)\n # check if we are LEFT of or onthe line from v1 to v2 is at this x coordinate\n cp.polygon(*p.map_vertices.map{|v| v.to_a}.flatten)\n vx = v2x - v1x\n vy = v2y - v1y\n if (x <= v1x and x < v2x)\n intersections +=1\n elsif x >= v1x and x > v2x\n next\n else\n x_line = v1x + vx * (y - v1y) / vy\n if vy == 0 or vx == 0 or x < x_line\n intersections += 1\n end\n end\n end\n end\n return intersections.odd?\n end",
"def in_range?\n return self.range.include?([@x, @y])\n end",
"def intersects?(other)\n# (@x <= other.x_outer && other.x <= @x_outer) || (@y <= other.y_outer && other.y <= @y_outer) ||\n# (@z <= other.z_outer && other.z <= @z_outer)\n\n\n (other.x < (@x + @l)) && ((other.x + other.l) > @x) &&\n (other.y < (@y + @w)) && ((other.y + other.w) > @y) &&\n (other.z < (@z + @h)) && ((other.z + other.h) > @z)\n\n end",
"def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end",
"def on_board?(pos)\n pos.all? {|coord| coord.between?(0, SIZE - 1)}\n end",
"def inbounds?(point)\n return false if point.x < 0\n return false if point.x >= @grid_width\n return false if point.y < 0\n return false if point.y >= @grid_height\n return true\n end",
"def check_hit(box) # Checa se a hitbox tem overlap com outra hitbox\n heightimp = false\n @zlist.each do |heightLevel| # Checa impacto de altura, se não tem impacto de altura, um objeto no maximo passa por cima do outro sem colidir\n box.zlist.each do |hitheight|\n if (heightLevel == hitheight) # Qualquer nivel de altura ser igual a qualquer nivel de altura da outra hitbox é o bastante pra ter impacto de altura\n heightimp = true\n end\n end\n end\n if (((@x > box.x + box.width or box.x > @x + @width) or (@y > box.y + box.length or box.y > @y + @length)) or (heightimp == false)) # Se não tem overlap bidimensional ou não há impacto de altura, não tem colisão\n return false\n else\n return true\n end\n end",
"def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end",
"def reachable? begTile, endTile\n x = begTile.x\n y = begTile.y\n self.move_one begTile if @tiles.empty?\n return @tiles.include? endTile\n end",
"def interior?(coords)\n x, y, z = coords\n x >= @origin_x && x <= @max_x &&\n y >= @origin_y && y <= @max_y &&\n z >= @origin_z && z <= @max_z\n end",
"def inbounds(destination)\n row = destination[0]\n column = destination[1]\n row >= 0 && row <= 7 && column >= 0 && column <= 7\n end",
"def inBounds lat, lon\n lat <= max_latitude && lat >= min_latitude && lon <= max_longitude && lon >= min_longitude\n end",
"def is_obstructed?(piece1_loc, destination)\r\n# converts the location arrays into easier-to-read x and y terms\r\n x1 = piece1_loc[0]\r\n y1 = piece1_loc[1]\r\n x2 = destination[0]\r\n y2 = destination[1]\r\n if piece2_loc != nil\r\n x3 = piece2_loc[0]\r\n y3 = piece2_loc[1]\r\n end\r\n # Determines whether the line between piece 1 and the destination is horizontal or vertical. \r\n # If neither, then it calculates the slope of line between piece 1 and destination. \r\n # If a second piece is given, then it also calculates the slope between piece 1 and piece 2.\r\n if y1 == y2\r\n horizontal = true\r\n elsif x1 == x2\r\n vertical = true\r\n else\r\n slope_dest = (y2-y1).to_f/(x2-x1).to_f\r\n end\r\n\r\n\tif horizontal && x1 < x2\r\n\t\t(x1+1..x2-1).each do |x|\r\n\t\t\treturn true if is_occupied?(x, y1)\r\n\t\tend\r\n\telsif horizontal && x1 > x2\r\n\t\t(x2+1..x1-1).each do |x|\r\n\t\t\treturn true if is_occupied?(x, y1)\r\n\t\tend\r\n\telsif vertical && y1 < y2\r\n\t\t(y1+1..y2-1).each do |y|\r\n\t\t\treturn true if is_occupied?(x1, y)\r\n\t\tend\r\n\telsif vertical && y1 > y2\r\n\t\t(y2+1..y1-1).each do |y|\r\n\t\t\treturn true if is_occupied?(x1, y)\r\n\t\tend\r\n\telsif horizontal || vertical\r\n\t\treturn false\r\n\telsif slope_dest.abs == 1.0 && x1 < x2\r\n\t\t(x1+1..x2-1).each do |x|\r\n\t\t\tdelta_y = x-x1\r\n\t\t\ty = y2 > y1 ? y1 + delta_y : y1 - delta_y\r\n\t\t\treturn true if is_occupied?(x, y)\r\n\t\tend\r\n\telsif slope_dest.abs == 1.0 && x1 > x2\r\n\t\t(x2+1, x1-1).each do |x|\r\n\t\t\tdelta_y = x1-x\r\n\t\t\ty = y2 > y1 ? y1 + delta_y : y1 - delta_y\r\n\t\t\treturn true if is_occupied?(x, y)\r\n\t\tend\r\n\telsif (slope_dest.abs != 1.0)\r\n\t\tfail 'path is not a straight line'\r\n\telse return false\r\n\tend\r\n\t\r\nend",
"def valid_location(x, y)\n return (x >= 0) && (x < Settings.get_horizontal_size) && (y >= 0) && (y < Settings.get_vertical_size)\n end",
"def occupied?(x, y)\n game.pieces.where(x_coordinates: x, y_coordinates: y).present?\n end",
"def cell_occupied_by?(player, x, y)\n player.x == x && player.y == y\n end",
"def in_bounds?(x, y)\n x >= 0 && x < @grid_width && y >= 0 && y < @grid_height\n end",
"def in?(x, y)\n ((x-@x)**2) + ((y-@y)**2) <= (@r**2)\n end",
"def on_board?(*args)\n x, y, length, direction = args.flatten\n\n x_max = x\n y_max = y\n case direction\n when :across\n x_max = x + length\n when :down\n y_max = y + length\n end\n\n @x_range.cover?(x) && @y_range.cover?(y) && @x_range.cover?(x_max) && @y_range.cover?(y_max)\n end",
"def pos?(x, y)\n (width.include?(x) && height.include?(y)) ||\n occupied_spaces.include?([x, y])\n end",
"def take_hit_at(x_coord, y_coord)\n #if @position.is_equal_to(x_coord, y_coord)\n if @position == Point.new(x_coord, y_coord)\n @is_hit = true\n end\n end",
"def in?(px, py)\n ix, iy = @max+100, @max+100\n nbintersections = 0\n @points.each_index do |index|\n ax, ay = *@points[index]\n bx, by = *@points[(index + 1) % @points.length]\n nbintersections += intersectsegment(ax, ay, bx, by, ix, iy, px, py)\n end\n return (nbintersections%2 == 1)\n end",
"def safe_position?(x, y)\n x >= 0 &&\n x <= 4 &&\n y >= 0 &&\n y <= 4\n end",
"def valid_piece_movement?(coordinates)\n row = coordinates[:row]\n column = coordinates[:column]\n @active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])\n end",
"def within_reach?(obj)\n # Don't do anything if object doesn't exist.\n return false if not obj\n\n # Calculate the distance to the goal.\n distance_to_obj = Params::distance_to(*@position.values, obj.x, obj.y)\n\n # Determine if it is within reach, based on graphics things.\n return distance_to_obj <= Params::AGENT_REACH\n end",
"def mouse_inside_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end",
"def valid_pos?(pos)\n pos.all? { |coordinate| coordinate.between?(0, 7)}\n end",
"def alive?(x, y)\n @cells.include?([x, y])\n end",
"def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end",
"def within_bounds?(query_point)\n query_point.x >= point.x && query_point.x <= point.x + image.width &&\n query_point.y >= point.y && query_point.y <= point.y + image.height\n end",
"def new_point?(end_point)\n\t\tend_x, end_y = end_point\n\t\t!(pos_x == end_x && pos_y == end_y) \n\tend",
"def is_inbounds?(x, y)\n true unless y > @maze.max.size-1 or y < 0 or x > @maze.size-1 or x < 0\n end",
"def players_within_distance?; captured_points.include? @prey.coords end",
"def point_in_canvas(x, y)\n [*1..canvas.size - 2].include?(y) && [*1..canvas.first.size - 2].include?(x)\n end",
"def hit?(x, y)\n @rect.collide_point?(x, y)\n end",
"def up?(new_x_position, new_y_position)\n (self.y_position - new_y_position.to_i) > 0 && (new_x_position == self.x_position)\n end",
"def under_point?(mouse_x, mouse_y)\n mouse_x > x - PADDING_X and mouse_x < x + @width + PADDING_X and\n mouse_y > y - PADDING_Y and mouse_y < y + @height + PADDING_Y\n end",
"def pos_nt?(x, y)\r\n pos?(x, y) && !@through\r\n end",
"def contains?(x,y)\n\t\tdx = Haversine.distance([@yc,@xc],[@yc,x]).to_km\n\t\tdy = Haversine.distance([@yc,@xc],[y,@xc]).to_km\n\t\t#puts dx\n\t\t#puts dy\n\t\treturn (dx < @w and dy < @h)\n\tend",
"def check_ahead\n block_movement unless valid_coordinates?(*coords_ahead)\n end",
"def starpoint?(move)\n if !move.is_a? Hash\n raise \"move param must be a Hash\"\n end\n\n if move[:x] == 3 and move[:y] == 3\n return true\n elsif move[:x] == 15 and move[:y] == 3\n return true\n elsif move[:x] == 3 and move[:y] == 15\n return true\n elsif move[:x] == 15 and move[:y] == 15\n return true\n else\n return false\n end\n end",
"def can_path_through x,y\n @map[x][y] != :wall\n rescue\n false\n end",
"def check_ship (horv,x1,y1)\n if horv==1 #build in vertical position row increases\n (x1..x1+4).each { |r| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == r && s.colid==y1}\n if !sq.empty\n return true\n end #if\n }\n else\n (y1..y1+4).each { |c| # row changes y stayes same\n sq=self.squares.find{|s| s.rowid == x1 && s.colid==c}\n if !sq.empty\n return true\n end\n }\n end #horv\n return false # nothing to hit\n end",
"def ship_check(coords)\n coords.all? do |sel_coord|\n @board_hash[sel_coord].empty?\n end\n end",
"def a_point_belongs_to_ship(a_point)\n\toccupied_points.any? { |point| point.is_equal(a_point) } \n end",
"def is_in_map(v)\n v.x >= 0 && v.y >= 0 && v.x < @size.x && v.y < @size.y\n end",
"def at_boundary?\n\t\tif @location.x == 0 || @location.x == @dimension-1 || @location.y == 0 || @location.y == @dimension-1\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def over_bound?(x, y)\n if (x != @x || y != @y) && $game_map.valid?(x, y)\n max_w = $game_map.max_width ; max_h = $game_map.max_height\n screen_x = $game_map.adjust_x(x) * 32 + 16\n screen_y = $game_map.adjust_y(y) * 32 + 32\n sx = (screen_x / 32).to_i; sy = (screen_y / 32).to_i\n if sx.between?(0 - out_offset, max_w + out_offset) && \n sy.between?(0 - out_offset, max_h + out_offset)\n \n return false\n end # sx, sy\n end # xy != @xy && map_valid\n return true\n end",
"def include?(other_square)\n # top left\n @square.contains?(other_square.x1, other_square.y1) || \n # top right\n @square.contains?(other_square.x1, other_square.y2) || \n # bottom right\n @square.contains?(other_square.x1, other_square.y3) || \n # bottom left\n @square.contains?(other_square.x1, other_square.y4) \nend",
"def mouse_over_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end",
"def check_vertical(x_target, y_target)\n #bottom to top\n if coordinate_y < y_target\n (coordinate_y+1..y_target-1).each do |y|\n return true if is_occupied?(x_target, y)\n end\n return false\n end\n #top to bottom\n if y_target < coordinate_y\n (y_target+1..coordinate_y-1).each do |y|\n return true if is_occupied?(x_target, y)\n end\n return false\n end\n\n end",
"def can_move(i,j)\n\t\t#posición es 0\n\t\tif @laberinto[i,j] == 0\n\t\t\t#no se a pasado antes por ahi\n\t\t\tif @travel_path.count([i,j]) == 0\n\t\t\t\treturn true\n\t\t\telse \n\t\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def move_valid?(x, y)\n (0...@columns).cover?(x) && (0...@rows).cover?(y) && !@visited[x][y]\n end",
"def contains?(*args)\n x, y = *Vector2.extract(args.singularize)\n x.between?(self.x, self.x2 - 1) && y.between?(self.y, self.y2 - 1)\n end",
"def rover_in_bounds?(coordinate_x, coordinate_y)\n coordinate_x <= boundary_x && coordinate_y <= boundary_y && coordinate_x >= 0 && coordinate_y >= 0\n end",
"def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end",
"def falls_within?(x, y)\n x >= 0 && x < x_dimension && y >= 0 && y < y_dimension\n end",
"def contains_point(point, include_border=false)\n point.x.between?(@x, self.right) && point.y.between?(y, self.bottom) unless include_border\n (point.x >= @x) && (point.x <= self.right) && (point.y >= @y) && (point.y <= self.bottom)\n end",
"def in_range?(radius:, location:)\n (((location.latitude - @latitude) ** 2) + ((location.longitude - @longitude) ** 2)) < (radius ** 2)\n end",
"def findIntersectedPositions(moves)\n moves.inject([[0,0,'N'], [[0,0]].to_set, []]) do |acc, m|\n p = moveToNextPosition acc[0], m\n puts \"p = \" + p.to_s\n newPosition = [p[0], p[1]]\n visitedPositions = acc[1]\n puts \"vp = \" + visitedPositions.size.to_s\n crossedPositions = acc[2]\n if (visitedPositions & newPosition).size > 0\n puts \"contains: \" + newPosition.to_s\n c = crossedPositions + [newPosition]\n else\n c = crossedPositions\n end\n\n pathPositions = allPointsBetween acc[0], newPosition\n [p, visitedPositions + pathPositions, c]\n end\nend",
"def check_area\n if @selected == nil \n #if an area is visible\n if @drawn\n clear_tr_sprites\n @drawn = false\n else\n @windows[Win_Option].active = true\n @windows[Win_Option].visible = true\n @windows[Win_Option].index = 0\n @cursor.active = false\n end\n elsif @drawn == @selected\n #clear_tr_sprites\n #@drawn = false\n open_status_window(@selected)\n elsif not @selected.hide_move?\n clear_tr_sprites\n @drawn = @selected\n #choose type of drawing\n if @selected.is_a?(Game_Enemy)\n type = 1\n elsif not (@selected.perfaction? ^ @selected.moved?)# (moved and perfaction) or none\n type = 2\n elsif @selected.perfaction?# and !@selected.moved?\n type = 3\n else# if !@selected.perfaction? and @selected.moved?\n type = 4\n end \n draw_ranges(@selected, type)\n end\n end",
"def on_board?(coords)\n\t\tcoords.any? {|coord| coord < 1 || coord > @size } ? false : true\n\tend",
"def out_of_bounds?(x,y)\n x < 0 || y < 0 || x > @size - 1 || y > @size - 1\n end",
"def inComuna(lng,lat,comuna)\n ubicacion(lng,lat)\n sql = \"SELECT st_within((SELECT ST_SetSRID(ST_MakePoint(#{lng},#{lat}),4326)),(SELECT ST_GeomFromText(st_astext(area),4326) FROM comunas where id = #{comuna.id}));\"\n inside = ActiveRecord::Base.connection.execute(sql).first()['st_within']\n\n if inside\n return true\n else\n return false\n end\n end"
] |
[
"0.70325416",
"0.6989404",
"0.6918739",
"0.6804073",
"0.6769021",
"0.6758789",
"0.67091227",
"0.6674856",
"0.6654147",
"0.66429985",
"0.6603973",
"0.6578133",
"0.6547872",
"0.6542676",
"0.6525282",
"0.651598",
"0.6500879",
"0.6447569",
"0.64433056",
"0.64049065",
"0.6391718",
"0.638723",
"0.6375981",
"0.63643503",
"0.63385004",
"0.6302989",
"0.62999314",
"0.62949383",
"0.62918776",
"0.62727463",
"0.6268118",
"0.62335926",
"0.62205476",
"0.6220466",
"0.6213286",
"0.62106",
"0.6210262",
"0.6202278",
"0.61982065",
"0.6197933",
"0.61959887",
"0.61935663",
"0.61889505",
"0.61866826",
"0.6185153",
"0.6182885",
"0.6174651",
"0.6173397",
"0.6171779",
"0.6168005",
"0.61639714",
"0.6154855",
"0.6148906",
"0.6120855",
"0.61176324",
"0.61159724",
"0.6114052",
"0.610512",
"0.6099031",
"0.60977095",
"0.60968703",
"0.60966533",
"0.60962516",
"0.60896415",
"0.60876065",
"0.60848016",
"0.6075333",
"0.6070388",
"0.60672355",
"0.6062278",
"0.6060375",
"0.60455585",
"0.6044145",
"0.60379434",
"0.60322535",
"0.60312766",
"0.602752",
"0.6020782",
"0.6019659",
"0.6017046",
"0.60170025",
"0.60139805",
"0.6006855",
"0.6006818",
"0.6003482",
"0.60030717",
"0.59977627",
"0.5994735",
"0.5994147",
"0.59893507",
"0.59882516",
"0.598688",
"0.5982809",
"0.5982279",
"0.5982055",
"0.59764755",
"0.59743357",
"0.596701",
"0.59659225",
"0.5962091",
"0.5948022"
] |
0.0
|
-1
|
create the array of coordinates (x, y)
|
def store_in_array(coordinate)
chosen.push(coordinate)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end",
"def to_xy\n [x, y]\n end",
"def coordinate_array\n\t\t[latitude,longitude]\n\tend",
"def to_a\n [x_point,y_point]\n end",
"def coords\n coord_list = []\n (@x..(@x + @size_x - 1)).each do |i|\n (@y..(@y + @size_y - 1)).each do |j|\n coord = [i, j]\n coord_list << coord\n end\n end\n\n return coord_list\n end",
"def coords\n [x, y]\n end",
"def coordinates\n [@y_location, @x_location]\n end",
"def coord_array\n _coords.dup\n end",
"def to_xy\n a = self\n a = [a[0].x, a[0].y] if length == 1\n return *a\n end",
"def coordinates\n coordinates = Array.new\n \n coordinates.push self.lat\n coordinates.push self.lng\n \n return coordinates\n end",
"def generate_coordinates\n coordinates = []\n (0..@column_count - 1).to_a.each do |i|\n (0..@row_count - 1).to_a.each do |j|\n coordinates << {x: i, y: j, z: 0}\n end\n end\n coordinates\n end",
"def to_array\n @points.collect { |p| [p.x, p.y] }\n end",
"def coord_to_array(coordinates)\n x = coordinates[1]\n y = coordinates[0]\n conversion = ((x-1) * @size) + (y -1)\n end",
"def to_a\n [x, y]\n end",
"def to_a; [x, y] end",
"def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"def to_a\n [x, y]\n end",
"def pos_to_a\r\n [ pos.x, pos.y ]\r\n end",
"def to_a\n [x, y]\n end",
"def coords_arr(arr)\n\tarr.map.with_index do |line, x|\n\t\tline.map.with_index do |point, y|\n\t\t\tCOORDS_HASH[[x,y]] = point\n\t\t\t[x,y]\n\t\tend\n\tend\nend",
"def building_coordinates(x, y, height, width)\n puts\"building #{height}x#{width} at location (#{x},#{y})\"\n coords = Array.new\n (0..width-1).each do |j|\n\n (0..height-1).each do |i|\n\n co = Coordinate.new(x+i,y+j)\n coords.push(co)\n end\n\n end\n puts\"*getBuildingCoordinates* returning array of building coordinates\"\n coords\n end",
"def coords; {:x => @x, :y => @y} end",
"def to_coordinates\n [latitude, longitude]\n end",
"def coordinates\n [rand(50), rand(90)]\n end",
"def coordinates\n [latitude, longitude]\n end",
"def to_coordinates\n coord = [x, y]\n coord << z if with_z\n coord << m if with_m\n coord\n end",
"def generate_coords\n coords = [0,0]\n coords[0] = rand(9)\n coords[1] = rand(9)\n coords\n end",
"def new_coords(x, y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end",
"def coordinates\n [@data['latitude'].to_f, @data['longitude'].to_f]\n end",
"def coordinates\n [@data['latitude'].to_f, @data['longitude'].to_f]\n end",
"def create_position_array()\n array_2D = []\n array_1D = []\n\n (0...@row).each_with_index do |value, row_index|\n (0...@col).each_with_index { |value, col_index| array_1D.append(value+(row_index*@col)) }\n array_2D.append(array_1D)\n array_1D = []\n end\n\n return array_2D\n end",
"def coordinates\n\t coordinate_array.map(&:to_s).join(\",\")\n\tend",
"def to_a\n [x, y, w, h]\n end",
"def to_a\n [x, y, w, h]\n end",
"def new_coords(x,y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end",
"def to_a\n [@x, @y]\n end",
"def to_a\n [@x, @y]\n end",
"def coords(x, y)\n return [x % WIDTH, y % HEIGHT]\n end",
"def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates.last\n else\n append_list coordinates, x, y\n end\n lon = x.reduce(&:+) / x.size\n lat = y.reduce(&:+) / y.size\n [lon.round(7), lat.round(7)]\n end",
"def construct_coordinates\n construct_latitude\n construct_longitude\n end",
"def gen_coordinates\n [@gen_x, @gen_y] if generator?\n end",
"def coordinates\n row_values.product(col_values)\n end",
"def to_coordinates(x, y, size, orientation)\n coords = []\n\n if orientation == :across\n size.times do |n|\n coords << [x+n, y] \n end\n elsif orientation == :down\n size.times do |n|\n coords << [x, y+n]\n end\n end\n\n return coords\n end",
"def get_arr_x(x, y) \n x # this coordinate doesn't change\nend",
"def position\n [x, y]\n end",
"def point(x,y)\n [x,y]\nend",
"def coordinates\n [@data[:szer_geogr].to_f, @data[:dl_geogr].to_f]\n end",
"def position\n [@x, @y]\n end",
"def coordinates_to_indices(x, y)\n [x - 1, y - 1]\n end",
"def coordinates\n return 166, 72\n end",
"def to_ary\n [x, y]\n end",
"def get_coords_from_node(node)\n\t\t[node.x,node.y]\n\tend",
"def x_points\n points = [[], []]\n (0...height).each do |y|\n (0...width).each do |x|\n if (array[y][x]).nonzero? && (x - 1 < 0 || (array[y][x - 1]).zero?)\n points[0] << Point.new(x - 1, y) + @position\n end\n\n if (array[y][x]).nonzero? && (x + 1 >= length || (array[y][x + 1]).zero?)\n points[1] << Point.new(x + 1, y) + @position\n end\n end\n end\n\n points\n end",
"def to_xyz\n [x, y, z]\n end",
"def ship_coordinates\n @ship_squares.map do |squares|\n squares.map { |square| [square.x, square.y] }\n end\n end",
"def convert_position_to_array(position)\n\t\t@coordinate = position.chars\n\t\ttemp = @coordinate[0]\n\t\tx = @coordinate[1]\n\t\tx = (8 - position[1].to_i )\n\t\tconvert_y = { a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6 , h: 7 }\n\t\ty= convert_y.values_at(temp.to_sym)\n\t\t@coordinate[0]=x\n\t\t@coordinate[1]= y[0]\n\t\tposition_array = @coordinate\n\tend",
"def to_a\n [self.x, self.y, self.z]\n end",
"def coord(a, b)\n final_array = []\n first_array = (1..a).to_a\n second_array = (1..b).to_a\n first_array.each do |first_num|\n second_array.each do |second_num|\n coordinates = \"(#{first_num}, #{second_num})\"\n final_array.push(coordinates)\n end\n end\n final_array \nend",
"def coordinate_list\n @board.each_index.inject([]) do |result,row_index|\n result.concat( \n @board[row_index].each_index.collect do |column_index|\n [row_index + 1, column_index + 1]\n end\n )\n end\n end",
"def to_a\n if defined?(@to_a)\n @to_a\n else\n cs = self.coord_seq\n @to_a = if self.has_z?\n [ cs.get_x(0), cs.get_y(0), cs.get_z(0) ]\n else\n [ cs.get_x(0), cs.get_y(0) ]\n end\n end\n end",
"def position\n\t\t[ @x, @y ]\n\tend",
"def getVertices( x0, y0, x1, y1) # arguments define bounding box\n\t\tw, h = x1 - x0, y1 - y0\n\t\td = 5 # size of corner chip\n\n\t\t[\n\t\t\t[ d, 0], [ w - d, 0],\n [ w, d], [w, h - d],\n [ w - d, h], [ d, h],\n [ 0, h - d], [ 0, d]\n\t\t].map do |v| [ v[0] + x0, v[1] + y0 ] end.flatten\n\tend",
"def to_a\n [lat,lng]\n end",
"def create_cross_array(start)\n cross_array =[\n Point.new(start.x-1, start.y),\n Point.new(start.x+1, start.y),\n Point.new(start.x, start.y-1),\n Point.new(start.x, start.y+1),\n ]\n return cross_array\n end",
"def to_a\n [lat, lng]\n end",
"def to_a\n [lat, lng]\n end",
"def coords\n Vector[@ob.x, @ob.y, @ob.z]\n end",
"def new_coord\n [@position, @@move[@direction]].transpose.map { |coord| coord.reduce(:+) }\n end",
"def points\n [top_left, top_right, bottom_left, bottom_right]\n end",
"def xyz\n return [self.x,self.y,self.z]\n end",
"def to_xy( hex )\n tmp_q = hex.q\n x = @hex_ray * Math.sqrt(3) * ( tmp_q + hex.r/2.0 )\n y = @hex_ray * 3.0/2.0 * hex.r\n [ x, y ]\n end",
"def separate_coordinates\n piece = @input[0..1]\n @row = input_to_row(piece[1])\n @col = input_to_col(piece[0])\n\n location = @input[2..3]\n @row_new = input_to_row(location[1])\n @col_new = input_to_col(location[0])\n end",
"def get_cell_at_xy(input_array)\n input_array.map do |coord|\n x = coord[0]\n y = coord[1]\n at_coord(x, y)\n end\n end",
"def to_a\n [@x, @y, @z]\n end",
"def to_a\n [x, y, z]\n end",
"def coordinates\n @coordinates\n end",
"def getVertices( x0, y0, x1, y1) # arguments define bounding box\n\t\tw, h = x1 - x0, y1 - y0\n\t\thh = (h/2).to_i\n\n\t\t[\n\t\t\t[ hh, 0], [ w - hh, 0], [ w, hh], [ w - hh, h], [ hh, h], [ 0, hh]\n\t\t].map do |v| [ v[0] + x0, v[1] + y0 ] end.flatten\n\tend",
"def indices2coords(i,j)\n row = i2row(i)\n col = j2col(j)\n \"#{row}#{col}\"\n end",
"def to_ary\n [@x, @y]\n end",
"def get_coordinates(pos)\n row = (pos / @width) + 1\n col = (pos % @width) + 1\n [row, col]\n end",
"def node\n [@x, @y]\n end",
"def calculate_coordinates\n (\n egde(@x1, @y1, @x2, @y1) +\n egde(@x2, @y1, @x2, @y2) +\n egde(@x2, @y2, @x1, @y2) +\n egde(@x1, @y2, @x1, @y1)\n ).uniq\n end",
"def set_coordinates\n [rand(-100..100), rand(-100..100)]\n end",
"def to_a; [x, y, z] end",
"def latlng\n [lat, lon]\n end",
"def initialize\n @array = []\n x,y = 0,0\n while x < 8\n while y < 8\n @array << [x,y]\n y += 1\n end\n x += 1\n y = 0\n end\n @array\n end",
"def neighbor_coords\r\n coordinates = [\r\n up,\r\n down,\r\n right, \r\n left,\r\n # Diagonals\r\n # Move.new(up).right,\r\n # Move.new(up).left,\r\n # Move.new(down).right,\r\n # Move.new(down).left\r\n up_right,\r\n up_left,\r\n down_right,\r\n down_left\r\n ]\r\n\r\n coordinates.compact\r\n end",
"def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end",
"def coordinates\n raw_coords = multivalue_field('coordinates_ssim')\n coords = []\n raw_coords.each do |raw_coord|\n split_coord = raw_coord.split('|')\n coords << { :name => split_coord[0], :lat => split_coord[1], :lon => split_coord[2] }\n end\n coords\n end",
"def to_a\n [@x, @y, @z]\n end",
"def xyz\n [x, y, z]\n end",
"def pos\n [posx, posy]\n end",
"def coordinates(image)\n image.each_with_index.flat_map do |row,x|\n (0...row.length).find_all{|i| row[i] == @char }.map{|y| [x,y] }\n end\n end",
"def make_coord(hash)\n nary = hash.delete(:val)\n name = hash.delete(\"ITEM\")\n coord_att_conv!(hash)\n VArray.new(nary, hash, name)\n end",
"def coordinates(alt_format = false)\n coordinates_array = []\n if alt_format\n return ['-80.394617, 31.066399'] unless has_coordinates?\n dcterms_spatial.each do |el|\n coordinates_array << \"#{longitude(el)}, #{latitude(el)}\" if element_has_coordinates el\n end\n else\n return ['31.066399, -80.394617'] unless has_coordinates?\n dcterms_spatial.each do |el|\n coordinates_array << \"#{latitude(el)}, #{longitude(el)}\" if element_has_coordinates el\n end\n end\n coordinates_array\n end",
"def initialize\n @coordinates = Array.new(2)\n @piece = nil\n end",
"def corner_points_of_entity(x, y)\n [\n [x, y],\n [x + Entity::WIDTH - 1, y],\n [x, y + Entity::HEIGHT - 1],\n [x + Entity::WIDTH - 1, y + Entity::HEIGHT - 1],\n ]\n end",
"def proxy_coord\n execute(:proxy, :coord).to_a\n end",
"def coords_of_neighbors(x, y)\n coords_of_neighbors = []\n (x - 1).upto(x + 1).each do |neighbors_x|\n (y - 1).upto(y + 1).each do |neighbors_y|\n next if (x == neighbors_x) && (y == neighbors_y)\n coords_of_neighbors << [neighbors_x, neighbors_y]\n end\n end\n coords_of_neighbors\n end",
"def coordinates\n \"Xmin:%s Ymin:%s Xmax:%s Ymax:%s\" % [x_min, y_min, x_max, y_max]\n end",
"def latlon\r\n [latitude,longitude]\r\n end"
] |
[
"0.8378823",
"0.82199997",
"0.802542",
"0.7833199",
"0.78003895",
"0.7717408",
"0.7712346",
"0.76843995",
"0.76486474",
"0.7491063",
"0.7427675",
"0.7427582",
"0.7363452",
"0.73567325",
"0.729675",
"0.72708887",
"0.7259008",
"0.72423905",
"0.72154963",
"0.71543556",
"0.7111367",
"0.7110656",
"0.70672834",
"0.7058976",
"0.70416206",
"0.69731706",
"0.6972108",
"0.6965238",
"0.6941315",
"0.6941315",
"0.6938419",
"0.6929868",
"0.6928419",
"0.6928419",
"0.6918342",
"0.69112635",
"0.69112635",
"0.6877808",
"0.6842121",
"0.6831002",
"0.6813811",
"0.6773647",
"0.6773122",
"0.67576957",
"0.6756059",
"0.67360324",
"0.67161584",
"0.6689145",
"0.668898",
"0.6665593",
"0.6657629",
"0.663643",
"0.66184235",
"0.66034275",
"0.6561611",
"0.6557392",
"0.6529146",
"0.65086097",
"0.65033996",
"0.6491317",
"0.6487962",
"0.64868397",
"0.64677644",
"0.6443379",
"0.6413514",
"0.6413514",
"0.6407152",
"0.6402572",
"0.6400281",
"0.63770115",
"0.63668466",
"0.6365147",
"0.63643575",
"0.6350604",
"0.6323795",
"0.6317941",
"0.63028383",
"0.6287222",
"0.62785167",
"0.6274701",
"0.6271161",
"0.6259372",
"0.6252116",
"0.62451917",
"0.6242755",
"0.6221889",
"0.6203523",
"0.619417",
"0.61736685",
"0.61730516",
"0.6169456",
"0.61609685",
"0.6124767",
"0.61176854",
"0.611735",
"0.6115503",
"0.6111696",
"0.6090409",
"0.6085502",
"0.6072838",
"0.6066709"
] |
0.0
|
-1
|
Add url from object and calls get request on specified url.
|
def get_custom_url(custom_url, params = {})
params = Params.define_params(params, @config)
Request.get_response("#{@url}/#{custom_url}", @project_id, params)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get(url); end",
"def get(url)\n call(url: url)\n end",
"def call(url, **options)\n self.class.get url, options\n end",
"def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end",
"def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end",
"def get(url)\n self.class.get(url)\n end",
"def get_request\n # Use our @http_object object's request method to call the\n # Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end",
"def setup_http_request(obj, cookie=nil, args={})\n if args.has_key?(:url) and args[:url] != nil\n if args[:url].scan(/%[s|d]/).length > 0\n if args[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % args[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(args[:url] % args[:url_arg])\n else\n req = obj[:method].new(args[:url])\n end\n else\n if args.has_key?(:url_arg)\n if obj[:url].scan(/%[s|d]/).length > 0\n if obj[:url].scan(/%[s|d]/).length != args[:url_arg].length\n ALERT.call(caller_locations, __callee__, \"URL contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:url].scan(/%[s|d]/).length)\n exit 2\n end\n req = obj[:method].new(obj[:url] % args[:url_arg])\n else\n req = obj[:method].new(obj[:url])\n end\n else\n req = obj[:method].new(obj[:url])\n end\n end\n req[\"Host\"] = \"www.blablacar.fr\"\n req[\"origin\"] = \"https://www.blablacar.fr\"\n req[\"User-Agent\"] = \"Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0\"\n req[\"Accept\"] = \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\"\n if obj.has_key?(:referer)\n req['Referer'] = obj[:referer]\n else\n req[\"Referer\"] = \"https://www.blablacar.fr/dashboard\"\n end\n req.add_field(\"Connection\", \"keep-alive\")\n if cookie\n req.add_field(\"Cookie\", cookie)\n end\n if obj.has_key?(:header)\n obj[:header].each_slice(2).map{|h|\n req.add_field(h[0], h[1])\n }\n end\n if obj.has_key?(:data)\n if obj[:data].scan(/%[s|d]/).length > 0\n if obj[:data].scan(/%[s|d]/).length != args[:arg].length\n ALERT.call(caller_locations, __callee__, \"Body request contains %d '%%s' or '%%d' argument... Fix your code\" % obj[:data].scan(/%[s|d]/).length)\n exit 2\n else\n req.body = obj[:data] % args[:arg]\n end\n else\n req.body = obj[:data]\n end\n req['Content-Length'] = req.body.length\n end\n req\nend",
"def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end",
"def getObjectFromUrl(url,type=nil)\n method = 'getObjectFromUrl'\n type = BaseObj if not type\n args = {:url=>url}\n return_object type,method,args,true\n end",
"def perform_get(url)\n if url.is_a?(Hash)\n # url is actually a hash of url options, call another method\n # to turn it into a string representation.\n url = make_url(url)\n end\n\n # ...\nend",
"def perform_get_with_object(path, options, klass)\n perform_request_with_object(:get, path, options, klass)\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def get(path)\n # build full URL\n url = API_URL % [path]\n\n # log full URL\n @ctx.log.debug('BaseObject#get') { '%s' % [url] }\n\n # get URL from cache\n @ctx.cache.get(url)\n end",
"def http_get(curl, data, url)\n\n # Define the url we want to hit\n curl.url=url\n\n # Specify the headers we want to hit\n curl.headers = data['header']\n\n # perform the call\n curl.http_get\n\n # Set headers to nil so none get reused elsewhere\n curl.headers = nil\n\n # return the curl object\n return curl\nend",
"def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def get_url\n @url\n end",
"def request url, klass, object\n url = URI url\n\n request = klass.new url.path\n\n if object\n request.body = object.to_xml\n end\n\n dispatch request, to: url\n end",
"def get(url)\n raise \"Needs to be implemented\"\n end",
"def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def url(*args)\n args << (@request_params || {})\n Merb::Router.url(*args)\n end",
"def call\n fail(WordpRSS::InvalidURLError.new(\"#{url} is not a valid URL\")) unless url =~ URI::regexp\n\n RestClient.get(url)\n end",
"def get(url, args = {})\r\n make_request(:get, url, args)\r\n end",
"def url(url)\n @url = url\n end",
"def request\n self.http_response = http_client.get(url, request_options)\n self\n end",
"def consume_url; end",
"def to(url); end",
"def get(url='/', vars={})\n send_request url, vars, 'GET'\n end",
"def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend",
"def consume(url, options = {}, with_status = false)\n base_uri, path = extract_base_uri_and_path(url)\n\n method = (options[:method] || 'GET').to_s.downcase\n\n _options = build_httpparty_options(options, method)\n _options[:base_uri] = base_uri\n\n if with_status\n verbose_perform_request_to(method, path, _options)\n else\n perform_request_to(method, path, _options)\n end\n end",
"def get(url, key)\n _request(url, :GET, key)\n end",
"def get(url)\n private_get(url)\n Fiber.yield\n end",
"def get(request)\n do_request(request) { |client| client.http_get }\n end",
"def get(url, options = {})\n self.class.default_params.merge!(options)\n response = self.class.get(url)\n handle_response(response)\n end",
"def get_url(url, options = {})\n options = make_options(:url, url, options)\n get(options)\n end",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def url(*args)\n content.url(*args)\n end",
"def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end",
"def put url, object = nil\n request url, HTTP::Put, object\n end",
"def get(url, resource_name, options = {})\n build_response(resource_name) do\n connection.get do |req|\n req.url url\n req.params = options\n end\n end\n end",
"def method_missing(m,params={})\n get url(m.to_s.camelize,params)\n end",
"def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def url\n @url\n end",
"def url\n @url\n end",
"def fetch_with_url(url, options = {}, &block)\n use_callback = block_given?\n api_client.get(url) do |data, status_code|\n if data.present?\n fetch_with_attributes(data, save_associations: options[:save], &block)\n end\n block.call(data, status_code, data) if use_callback\n end\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end",
"def set_url\n @url = Url.find_by(key: params[:key])\n end",
"def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end",
"def url\n end",
"def set_url\n # @url = Url.find(params[:id])\n end",
"def set_url\n @url = Url.get_from_short(params[:id])\n end",
"def set_url\n @url = Url.find(params[:id])\n end",
"def url\n end",
"def get_api_resource ( url )\n\n if @cache.exists( url )\n return @cache.get( url )\n end\n\n uri = URI( url )\n request = Net::HTTP::Get.new( uri )\n request['X-TBA-App-Id'] = \"#{@organization}:#{@app_identifier}:#{@version}\"\n\n resource = Net::HTTP.start( uri.hostname, uri.port,\n :use_ssl => uri.scheme == 'https' ) { |http|\n http.request( request )\n }\n\n case resource\n when Net::HTTPSuccess, Net::HTTPRedirection\n data = JSON.parse( resource.body )\n @cache.set( url, data )\n return data\n else\n resource.value\n end\n end",
"def get\n execute_request { faraday_connection.get(href || '') }\n end",
"def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend",
"def url(value)\n @url = value\n end",
"def get_link(link,args={})\n link = BASE_URL + link\n get_request(link,args)\n end",
"def get(http: HTTParty)\n http.get(url)\n end",
"def url_obj (url)\n url_1 = HTTParty.get(url)\n return Nokogiri::HTML(url_1)\nend",
"def url\n @url\n end",
"def get endpoint\n do_request :get, endpoint\n end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def get_object_url(obj)\n routes = Rails.application.routes.url_helpers\n if Setting.host_name.to_s =~ /\\A(https?\\:\\/\\/)?(.+?)(\\:(\\d+))?(\\/.+)?\\z/i\n host, port, prefix = $2, $4, $5\n routes.url_for(obj.event_url({\n :host => host,\n :protocol => Setting.protocol,\n :port => port,\n :script_name => prefix\n }))\n else\n routes.url_for(obj.event_url({\n :host => Setting.host_name,\n :protocol => Setting.protocol\n }))\n end\n end",
"def url *args\n if args.first\n Url.current.qs(*args)\n else\n Url.current\n end\n end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def url=(_arg0); end",
"def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end",
"def url(name, *params)\n self.class.url(name, *params)\n end",
"def request\n EventMachine::HttpRequest.new(url)\n end",
"def get(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpGetWithEntity, url, options, &block\n end",
"def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def call_poke_url(url)\n JSON.parse(\n HTTP\n .get(URI(url))\n )\nend",
"def setup_options_for_url(options, request_url)\n options['head'] ||= {}\n options['url_fetched'] = request_url\n end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def link() url; end",
"def link() url; end",
"def getObject(object)\n\t\t\turi = parseURI(object)\n\t\t\tresponse = do_get(uri)\n\t\t\treturn nil if response == nil\n\t\t\treturn response\n\t\tend",
"def get(url)\n p = URI.parse url\n case p.scheme\n when /https?/\n http_get p, @resource[:path]\n when \"file\"\n FileUtils.copy p.path, @resource[:path]\n end\n end",
"def get(url)\n uri = URI.parse(url)\n response = nil\n opt = {:use_ssl => true}\n #start(address, port=nil, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt, &block)\n Net::HTTP.start(uri.host, uri.port, p_addr=nil, p_port=nil, p_user=nil, p_pass=nil, opt) { |http|\n request = Net::HTTP::Get.new uri\n request['Referer'] = REFERER\n response = http.request request # Net::HTTPResponse object\n }\n return response\nend",
"def get(url, options={}, &block)\n http_options = options.merge(@basic_options)\n if block_given?\n RestClient.get(url, http_options, &block)\n else\n RestClient.get(url, http_options)\n end\n end"
] |
[
"0.7186726",
"0.6792118",
"0.677997",
"0.6685166",
"0.66779363",
"0.6450926",
"0.62994295",
"0.6298646",
"0.6282261",
"0.6277992",
"0.62672895",
"0.61857253",
"0.6154108",
"0.61526364",
"0.6137064",
"0.6132324",
"0.61244875",
"0.61123127",
"0.61064374",
"0.6105405",
"0.6077206",
"0.6077",
"0.60395676",
"0.5991029",
"0.59843844",
"0.5982703",
"0.5972553",
"0.595586",
"0.5951244",
"0.59437066",
"0.59340143",
"0.5923052",
"0.5914353",
"0.5913927",
"0.59134954",
"0.5902978",
"0.5894471",
"0.58770466",
"0.587352",
"0.5868118",
"0.58673215",
"0.58616525",
"0.5845658",
"0.5839765",
"0.58272505",
"0.5825495",
"0.5825495",
"0.58191764",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.581565",
"0.5805204",
"0.5794307",
"0.57936794",
"0.5792706",
"0.5785605",
"0.57855934",
"0.5784947",
"0.57849073",
"0.57818305",
"0.5769601",
"0.5757819",
"0.57556325",
"0.57546103",
"0.57534784",
"0.57506615",
"0.57502997",
"0.57489973",
"0.5739717",
"0.5738959",
"0.5722459",
"0.57195455",
"0.57195455",
"0.57195455",
"0.57195455",
"0.57195455",
"0.57195455",
"0.57195455",
"0.5693143",
"0.5690433",
"0.5683856",
"0.5682186",
"0.5679156",
"0.5676834",
"0.5672",
"0.56665933",
"0.56649923",
"0.56649923",
"0.56604743",
"0.56596273",
"0.56581664",
"0.5655225"
] |
0.0
|
-1
|
Return a string with a link to documentation.
|
def get_help_info
'See the documentation here - https://github.com/blockfrost/blockfrost-ruby'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def link_documentation; end",
"def documentation_url; end",
"def documentation\n return Addressable::URI.parse(@discovery_document['documentationLink'])\n end",
"def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end",
"def documentation_html\n @documentation_html ||= generate_documentation_html\n end",
"def show_link(str)\n cfg = @@cfg\n str.gsub!(' ','-')\n str << '.md'\n show_doc(cfg, str)\n end",
"def docstring\n object.docstring.tr(\"\\n\", \" \")\n end",
"def documentation_url\n @error['documentation_url']\n end",
"def pathSourceDoc\n\t\"./documentation/\"\nend",
"def documentation_url\n data[:documentation_url] if data.is_a? Hash\n end",
"def documentation\n\troot = settings.root + '/doc'\n\tcontent = File.open(\"#{root}/#{@user.default_locale}.textile\", 'r').read()\n\tRedCloth.new(content).to_html\nend",
"def handle_rdoc_link url\n case url\n when /^rdoc-ref:/ then\n $'\n when /^rdoc-label:footmark-(\\d+)/ then\n \"[^#{$1}]:\"\n when /^rdoc-label:foottext-(\\d+)/ then\n \"[^#{$1}]\"\n when /^rdoc-label:label-/ then\n gen_url url, $'\n when /^rdoc-image:/ then\n \"\"\n when /^rdoc-[a-z]+:/ then\n $'\n end\n end",
"def online_docs(word)\n \"<a title=\\\"Search Adobe for #{word}\\\"\n href=\\\"http://community.adobe.com/help/search.html?q=#{word}&x=0&y=0&lbl=flex_product_adobelr&site=communityhelp_platform_aslr&hl=en_US&self=1&area=0\\\">Search Livedocs</a>\"\n end",
"def docstring; end",
"def docstring; end",
"def base_docstring; end",
"def documentation\n attributes.fetch(:documentation)\n end",
"def documentation\n attributes.fetch(:documentation)\n end",
"def documentation\n attributes.fetch(:documentation)\n end",
"def documentation\n attributes.fetch(:documentation)\n end",
"def what_it_does() \"Generate javadoc to '#{@name}' folder\" end",
"def docs api\n\t\tget_html \"#{@options[:docs]}/#{@apis[api][:url]}.htm\"\n\tend",
"def gen_url url, text\n return super unless url =~ /\\Ardoc-ref:/\n\n name = $'\n cross_reference name, text, name == text\n end",
"def docufy(src,i)\n m = /RM_[A-z0-9]+/.match(src[i])\n name = m[0]\n name = name.sub(\"RM_\",\"RedisModule_\")\n proto = src[i].sub(\"{\",\"\").strip+\";\\n\"\n proto = proto.sub(\"RM_\",\"RedisModule_\")\n proto = linebreak_proto(proto, \" \");\n # Add a link target with the function name. (We don't trust the exact id of\n # the generated one, which depends on the Markdown implementation.)\n puts \"<span id=\\\"#{name}\\\"></span>\\n\\n\"\n puts \"### `#{name}`\\n\\n\"\n puts \" #{proto}\\n\"\n puts \"**Available since:** #{$since[name] or \"unreleased\"}\\n\\n\"\n comment = \"\"\n while true\n i = i-1\n comment = src[i]+comment\n break if src[i] =~ /\\/\\*/\n end\n comment = markdown(comment)\n puts comment+\"\\n\\n\"\nend",
"def fulldoc_template; end",
"def to_s; \"Doc-#{target}\\n#{text}\" end",
"def show_documentation req, res\n store, path = documentation_source req.path\n\n if_modified_since req, res, store.cache_path\n\n generator = generator_for store\n\n case path\n when nil, '', 'index.html' then\n res.body = generator.generate_index\n when 'table_of_contents.html' then\n res.body = generator.generate_table_of_contents\n when 'js/search_index.js' then\n documentation_search store, generator, req, res\n else\n documentation_page store, generator, path, req, res\n end\n ensure\n res.content_type ||= 'text/html'\n end",
"def output_help\n RDoc::usage()\n end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end",
"def resource_action_documentation_url\n doco_url = \"http://maestrano.github.io/connec\"\n namespace = entities_name.underscore.gsub('_','-')\n verb = request.method_symbol\n \n # Guess the documentation section\n is_collection = !![/index/,/create/].map{ |re| action_name.match(re) }.compact.first\n if is_collection\n section = \"#{entities_name.underscore.gsub('_','-')}-list\"\n else\n section = resource_name.underscore.gsub('_','-')\n end\n \n return \"#{doco_url}/##{namespace}-#{section}-#{verb}\"\n end",
"def help_link(wiki_entry_name=nil)\n wiki_url = \"https://github.com/indykish/identityprov/wiki\"\n if wiki_entry_name\n wiki_url += \"/#{wiki_entry_name}\"\n link_text = \"Help for #{wiki_entry_name.underscore_humanize}\" \n else\n link_text =\"Help\" \n end\n link_to_ link_text, wiki_url, { :target => '_blank'}\n end",
"def api_html page\n <<-STR\n<html>\n <head>\n <title>#{self.class} Api Documentation</title>\n <style>\n#{API_CSS}\n </style>\n </head>\n <body class=\"indexpage\">\n <div>\n #{RDoc::Markup::ToHtml.new.convert page.to_s}\n </div>\n </body>\n</html>\n STR\n end",
"def documentation\n spec['Documentation']\n end",
"def permalink\n link = object.path.gsub(\"::\", \"%2F\")\n link.tr!(\"?\", \"%3F\")\n link.tr!(\"#\", \":\")\n\n \"#{RUBYDOC_URL}/#{link}\"\n end",
"def html_markup_rdoc(text); end",
"def javadoc(*args)\n Buildr.application.deprecated 'Use Java::Commands.javadoc instead.'\n Commands.javadoc(*args)\n end",
"def docs; end",
"def generate_doc\n\n end",
"def help\n str = \"====[ #{@name} ]====\\nUsage: #{@name} \"\n @doc_args.each do |key, _value|\n str += \"[#{key.upcase}] \"\n end\n @doc_options.each do |key, _value|\n str += \"(--#{key.name}) \"\n end\n str = \"#{str.rstrip}\\nDescription: #{description}\\n#{help_options_args}\"\n str.rstrip\n end",
"def generate_documentation_html\n YARD::Registry.yardoc_file = Dir.mktmpdir('auto_yardoc')\n begin\n YARD::Tags::Library.define_tag('', :request_param, :with_types_and_name)\n YARD::Tags::Library.define_tag('', :request_body, :with_types_and_name)\n YARD::Registry.load([settings.app_file], true)\n template_path = File.join(File.dirname(__FILE__), '../../templates_custom')\n YARD::Templates::Engine.register_template_path(template_path)\n YARD::Templates::Engine.render(:object => YARD::Registry.resolve(nil, self.class.to_s),\n :format => :html)\n ensure\n YARD::Registry.delete_from_disk\n end\n end",
"def to_rdoc\n result = ''\n parts = description.split(\"\\n\") unless description.nil?\n result << \"# #{parts.join(\"\\n# \")}\\n\" unless description.nil?\n result << \"def #{name}=(#{type})\\n @#{name} = #{type}\\nend\\n\\n\"\n return result\n end",
"def url\n @doc.url\n end",
"def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end",
"def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end",
"def documentation_page_path(page)\n \"#{::Documentation::Engine.mounted_path}/#{page.try(:full_permalink)}\"\n end",
"def to_html\n require 'mustache'\n template = File.read(__dir__ + '/app_documentation_tpl.mustache')\n Mustache.render(template, :html_fragment => to_html_fragment)\n end",
"def link(link, title, content)\n link = OodAppkit.files.api(path: @app_path.to_s + '/' + link).to_s if @app_path && relative?(link)\n return \"<a href=\\\"#{link}\\\" rel=\\\"noopener\\\" target=\\\"_blank\\\">#{content}</a>\" unless id_link?(link)\n return \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end",
"def link name, text, code = true\n if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/\n name = $1\n label = $'\n end\n\n ref = @cross_reference.resolve name, text\n\n case ref\n when String then\n ref\n else\n path = ref.as_href @from_path\n\n if code and RDoc::CodeObject === ref and !(RDoc::TopLevel === ref)\n text = \"<code>#{CGI.escapeHTML text}</code>\"\n end\n\n if path =~ /#/ then\n path << \"-label-#{label}\"\n elsif ref.sections and\n ref.sections.any? { |section| label == section.title } then\n path << \"##{label}\"\n else\n if ref.respond_to?(:aref)\n path << \"##{ref.aref}-label-#{label}\"\n else\n path << \"#label-#{label}\"\n end\n end if label\n\n \"<a href=\\\"#{path}\\\">#{text}</a>\"\n end\n end",
"def render_document_link args\n fulltext_path = args[:document][args[:field]] unless args[:document][args[:field]].blank?\n if fulltext_path.present?\n # This all hinges on symbolic link in public directory (to /teeal/documents)\n path = \"/downloads/#{fulltext_path}\"\n link_to path, target: \"_blank\", class: \"btn btn-sm btn-success\" do\n '<i class=\"fa fa-file-text\"></i> View full text'.html_safe\n end\n end\n end",
"def url\n URL_MAPPING[@docid]\n end",
"def help_text\n build_html do\n p <<-P1\n This is the list of changes that a particular defect or\n feature introduced. The changes are grouped by release. Each\n change provides a link to the file or files involved along with a\n link to a diff of the changes for that file. The link to the diff\n is the '->' between the two SCCS ids.\n P1\n end\n end",
"def style_howto\n\t%Q|/<a href=\"http://docs.tdiary.org/en/?#{@conf.style}Style\">How to write</a>|\nend",
"def rdoc_task_description\n 'Build RDoc HTML files'\n end",
"def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end",
"def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end",
"def link(href: nil, issue: nil)\n return \"<a href='#{href}#{issue}'>#{issue}</a>\"\n end",
"def doc_file_path\n \"#{@structure[:working_path]}/docs/#{@structure[:full_relation_name]}.md\"\n end",
"def create_ref_link(index)\n %Q([<a href=\"##{NOTE}-#{index}\">#{index}</a>])\n end",
"def exec_doc\n output = File.join('doc', 'rdoc')\n title = (PACKAGE.capitalize + \" API\").strip\n main = Dir.glob(\"README{,.txt}\", File::FNM_CASEFOLD).first\n template = config.doctemplate || 'html'\n\n opt = []\n opt << \"-U\"\n opt << \"-S\"\n opt << \"--op=#{output}\"\n opt << \"--template=#{template}\"\n opt << \"--title=#{title}\"\n opt << \"--main=#{main}\" if main\n\n if File.exist?('.document')\n files = File.read('.document').split(\"\\n\")\n files.reject!{ |l| l =~ /^\\s*[#]/ || l !~ /\\S/ }\n files.collect!{ |f| f.strip }\n opt << files\n else\n opt << main if main\n opt << [\"lib\", \"ext\"]\n end\n\n opt = opt.flatten\n\n if no_harm?\n puts \"rdoc \" + opt.join(' ').strip\n else\n #sh \"rdoc {opt.join(' ').strip}\"\n require 'rdoc/rdoc'\n ::RDoc::RDoc.new.document(opt)\n end\n end",
"def path\n http_url @store.rdoc.generator.file_dir\n end",
"def help_message\n $stderr.puts <<-EOM\n Usage:\n\n r2doc [options] [names...]\n r2doc [options] --gems gems...\n\n The first format calls rdoc normally with r2doc set as\n the generator. The second format sets rdoc as the\n generator and generates documentation for the named\n gems. One additional option (see below) is specific to\n r2doc. All other options are passed through to rdoc.\n Help for rdoc follows.\n \n r2doc-specifc options:\n \n --rdoc-version version\n Specifices the rdoc version to require.\n The version string is passed to gem.\n\nEOM\nend",
"def docstring=(_arg0); end",
"def link(link, title, content)\n \"#{content} (#{link})\"\n end",
"def description(method)\n desc = method.documented? ? method.description.strip : ''\n if method.is_alias_for\n text = method.is_alias_for.documented? ? '<p>' : '<p class=\"nodoc\">'\n text << 'Alias for ' << link(method, method.is_alias_for) << '</p>'\n append_with_nl desc, text\n end\n if method.see &&\n (@see_standard_ancestors ||\n method.see.parent.full_name !~ /^(Object|Kernel)$/)\n text = method.see.documented? ? '<p>' : '<p class=\"nodoc\">'\n text << (desc.empty? ? 'See ' : 'See also ')\n text << link(method, method.see) << '</p>'\n append_with_nl desc, text\n end\n desc = '<p class=\"nodoc\">(not documented)</p>' if desc.empty?\n unless method.aliases.empty?\n text = '<p>Also aliased as '\n text << method.aliases.map { |a| link(method, a) }.join(', ') << '</p>'\n append_with_nl desc, text\n end\n desc\n end",
"def to_markup\n <<-STR\n= #{self.class} Api\n\n#{sorted_endpoints.map do |e|\n \"=== #{e.http_method} #{e.path}\\n\\n\" +\n \"<em>#{e.description}</em>\\n\\n\" +\n \"Details at link:#{e.path}#{self.class.api_doc_suffix}\"\n end.join \"\\n\\n\" }\n STR\n end",
"def documentation(text)\n @response_schema.documentation = text\n end",
"def link\n '-'\n end",
"def url_for_document(_doc)\n '#'\n end",
"def link\n Html::Link.new(:href => url) << display_name\n end",
"def self_introduction\n \"Hello #{user_link(source_user)}, very nice to meet you!\"\n end",
"def output_documentation_debugging\n\t\tsummary = self.extract_summary\n\t\tdescription = self.extract_description\n\t\thomepage = self.extract_homepage || DEFAULT_HOMEPAGE\n\n\t\tself.prompt.say( \"Documentation\", color: :bright_green )\n\t\tself.prompt.say( \"Authors:\" )\n\t\tself.authors.each do |author|\n\t\t\tself.prompt.say( \" • \" )\n\t\t\tself.prompt.say( author, color: :bold )\n\t\tend\n\t\tself.prompt.say( \"Summary: \" )\n\t\tself.prompt.say( summary, color: :bold )\n\t\tself.prompt.say( \"Description:\" )\n\t\tself.prompt.say( \" \" + description, color: :bold )\n\t\tself.prompt.say( \"Homepage:\" )\n\t\tself.prompt.say( \" \" + homepage, color: :bold )\n\t\tself.prompt.say( \"\\n\" )\n\tend",
"def generate_link(failure_file_details, file_path)\n \"<strong><a href='xdoclet/#{failure_file_details[0].gsub(/\\//, \"_\").gsub(/\\.rb/, \".rb.html\")}' target='_blank'>#{file_path}</a></strong><br/>\"\n end",
"def eds_html_fulltext_link(options = nil)\n values, opt = extract_config_value(options)\n result = Array.wrap(values).reject(&:blank?)\n return unless result.present? && (doc = opt[:document])\n label = I18n.t('ebsco_eds.links.view', default: 'View')\n url =\n url_for(\n controller: Blacklight::Lens.key_for_doc(doc),\n action: :show,\n id: doc.id,\n anchor: FULL_TEXT_ANCHOR\n )\n make_eds_link(label: label, url: url)\n end",
"def link_to(arg)\n text =\n if arg.respond_to?(:name)\n arg.name\n else arg.to_s\n end\n\n Doc::HTML.escape_html(text)\n end",
"def fileset_link_markup(file_name, descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link_markup = \"\"\n fileset = fileset(file_name)\n noid = fileset[\"noid\"]\n unless noid.empty?\n link = fileset[\"doi\"]\n link = fileset[\"link\"][12..-3] if link.nil? or link.empty?\n link_markup = \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end\n return link_markup\n end",
"def doc\n if @spec.key?('doc')\n Comment.new(\"@param #{@spec['name']} #{@spec['doc']}\")\n else\n Comment.new\n end\n end",
"def help_url\n nil\n end",
"def help(lang='en')\n readme.to_s(lang)\n end",
"def link_to_document(doc, opts={:label=>nil, :counter => nil})\n opts[:label] ||= document_show_link_field(doc)\n label = render_document_index_label doc, opts\n link_to label, url_for_document(doc), document_link_params(doc, opts)\n end",
"def doc\n MethodDocRipper.doc_from_source_location(source_location)\n end",
"def show_readme\n readme 'lib/generators/cms/fortress/templates/README'\n end",
"def link() url; end",
"def link() url; end",
"def emit_function_doc(function)\n [\n function.description.strip,\n '',\n 'Arguments:',\n indent(function.arguments.map do |arg|\n [\n \"- #{arg.name}: #{arg.type.split('::').last.downcase}\",\n indent(arg.description.strip.split(\"\\n\"), 2)\n ]\n end, 2),\n (\n unless function.examples.nil?\n [\n '',\n 'Examples:',\n indent(function.examples.map do |eg|\n \"- #{expand_function_vars(function, eg)}\"\n end, 2)\n ]\n end\n ),\n (\n unless function.notes.nil?\n [\n '',\n expand_function_vars(function, function.notes.strip)\n ]\n end\n )\n ].compact.flatten.join(\"\\n\").split(\"\\n\").map { |l| \"# #{l}\".strip }\n end",
"def link\n @link ||= uri.to_s\n end",
"def ssn_help_link\n # unit_test_no_generate: ssn_help_link, a.className(create_ats_regex_string(\"ats-ssnhelplnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-ssnhelplnk\")), __method__)\n end",
"def default_api_doc req, endpoint\n response api_html(endpoint.to_markup)\n end",
"def doc(str)\n @doc << str\n end",
"def documentation\n @docotype = params[:docotype]\n if @docotype.blank?\n flash[:error] = 'Documentation type must be specified. Redirected to default documentation. If you arrived here from a bookmark or link, please update.'\n redirect_to :action => 'documentation', :docotype => 'text'\n return\n else\n @doco_elements = Doco.build_doco(@docotype)\n end\n end",
"def docs_for(code_object)\n if code_object.module_with_yard_docs?\n # yard docs\n code_object.yard_doc\n else\n # normal docs (i.e comments above method/module/command)\n code_object.doc\n end\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end",
"def show_doc \n pp @doc\n end",
"def link(hash = {})\n title = hash[:title]\n prefix = hash[:prefix] || ''\n stem = hash[:stem] || 'document'\n if title\n \"<a href=#{self.url(prefix, stem)}>#{title}</a>\"\n else\n \"<a href=#{self.url(prefix, stem)}>#{self.title}</a>\"\n end\n end",
"def _link(attribute, text=nil)\n link = \"##{attribute}\"\n %{<a href=\"#{link}\">#{text || attribute}</a>}\nend",
"def docpath\n return case type.to_sym\n when :constant, :module, :class\n (namespace.empty?) ? token.to_s : \"#{namespace}::#{token}\"\n when :class_method, :module_function\n \"#{namespace}.#{token}\"\n when :instance_method\n \"#{namespace}##{token}\"\n else\n namespace.to_s # or raise error\n end\n end",
"def docstring(locale = T.unsafe(nil)); end"
] |
[
"0.7857884",
"0.75622004",
"0.72409743",
"0.7212329",
"0.70768553",
"0.67924726",
"0.6751909",
"0.66587406",
"0.6622119",
"0.6590554",
"0.65875274",
"0.6561499",
"0.65330327",
"0.6528061",
"0.6528061",
"0.6510836",
"0.65065944",
"0.65065944",
"0.65065944",
"0.65065944",
"0.647702",
"0.6379111",
"0.6358978",
"0.63494813",
"0.6348938",
"0.6322936",
"0.62914544",
"0.6284567",
"0.6282326",
"0.6282326",
"0.6282326",
"0.6282326",
"0.6276594",
"0.62326026",
"0.6227278",
"0.621323",
"0.62003565",
"0.6171675",
"0.6169836",
"0.61472136",
"0.61346227",
"0.6111937",
"0.6104537",
"0.60862017",
"0.6074029",
"0.6046688",
"0.60464436",
"0.5990911",
"0.59865814",
"0.5977485",
"0.5970203",
"0.59531575",
"0.5950919",
"0.59464437",
"0.5940924",
"0.5937753",
"0.593678",
"0.59239435",
"0.59177816",
"0.59176475",
"0.5898686",
"0.58933514",
"0.58927184",
"0.5878657",
"0.5875304",
"0.5874333",
"0.58711195",
"0.5859634",
"0.58572644",
"0.5854689",
"0.58471",
"0.58411324",
"0.58409077",
"0.584055",
"0.5837599",
"0.5836586",
"0.5832895",
"0.5832685",
"0.5830221",
"0.5824091",
"0.5820676",
"0.58153766",
"0.5815224",
"0.58136404",
"0.5811583",
"0.58101493",
"0.58101493",
"0.5795283",
"0.5792402",
"0.5787814",
"0.57673216",
"0.57666934",
"0.5760308",
"0.57596964",
"0.5737131",
"0.5732897",
"0.5705737",
"0.5704025",
"0.57017726",
"0.570031",
"0.57002866"
] |
0.0
|
-1
|
GET /web/v1/social_media_links GET /web/v1/social_media_links.json
|
def index
@social_media_links = SocialMediaLink.all
render json: @social_media_links
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @social_media_link\n end",
"def index\n @links = @site.site_social_links\n end",
"def get_links(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Entering\")\n link = []\n\n if !blob[\"link\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding link #{blob[\"link\"]}\")\n\n link = ::Api::Helpers::Parser.get_documents({:text => blob[\"link\"]})\n\n #reset the mime to system type. give higher priority to mime found by our system\n mime = ::Api::Helpers::Parser.map_type_to_mime(blob[\"type\"])\n\n link[0][:mime] = mime if mime != AppConstants.mime_remote_link\n\n link[0][:description] = blob[\"description\"]\n link[0][:title] = blob[\"name\"]\n\n link[0][:provider] =~ /facebook.com/ ? link[0][:ignore] = true : link[0][:ignore] = false\n\n link[0][:source_object_id] = blob[\"object_id\"]\n\n #extract image_url\n if !blob[\"picture\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] CGI EXTRACTION #{cgi}\")\n\n u = URI.unescape(blob[\"picture\"])\n cgi = CGI::parse(u)\n\n #internal images are encoded in src(fbcdn) and external are encoded in\n url = cgi[\"url\"]\n url = cgi[\"src\"] if url.blank?\n\n\n if !cgi.blank? and !url.blank?\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding Picture Url #{link[0][:image_url]} \")\n\n link[0][:image_url] = url[0]\n link[0][:image_width] = cgi[\"w\"][0] if !cgi[\"w\"].blank?\n link[0][:image_height] = cgi[\"h\"][0] if !cgi[\"h\"].blank?\n end\n end\n end\n\n #attach embedded links also link array\n #duplicate document is removed in create_activity\n if !blob[\"message\"].blank?\n\n embedded_links = ::Api::Helpers::Parser.get_documents({:text => blob[\"message\"]})\n if link.blank?\n link = embedded_links if !embedded_links.blank?\n else\n embedded_links.each do |elem|\n #remove duplicates ..\n #give priority to attr[links] as they will be mostly resolved\n next if link[0][:url] == elem[:url]\n link << elem\n end\n end\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Leaving \")\n link\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return []\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def links\n data['links']\n end",
"def create\n @social_media_link = SocialMediaLink.new(social_media_link_params)\n\n if @social_media_link.save\n render json: @social_media_link, status: :created\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def handle_links(json) end",
"def index\n @social_media_accounts = SocialMediaAccount.all\n end",
"def get_user_recent_media\n response = @client.get(\"#{@base_url}/v1/users/self/media/recent\", access_token: get_user_access_token)\n medias = JSON.parse(response.body) \n if(medias[\"meta\"][\"code\"] == 200)\n media_url = []\n medias[\"data\"].each do |media|\n url = media[\"images\"][\"standard_resolution\"][\"url\"]\n media_url.push(url)\n end\n media_url \n end\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def index\n render json: @links\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def social_media_links(top50)\n top50.each do |person, _count|\n next if Person.new(person).social_media_links?(@database)\n @database.write(\n 'people-information',\n @social_media.links_for(person),\n Digest::MD5.hexdigest(person)\n )\n end\n end",
"def show\n render json: @social_networking\n end",
"def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end",
"def index\n @links = current_user.links.desc :created_at\n @title = 'Shared By You'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def index\n @api_v1_social_link_segments = Api::V1::SocialLinkSegment.all\n end",
"def selfMedia\n myMedia = Medium.all.filter{|media| media.user_id == decoded_token}\n # ItinActiv = Activity.all.filter{ |activity| activity.itinerary_id == myItin.id }\n render json: myMedia\n end",
"def getUserBy_social_media( name, id)\n params = Hash.new\n params['name'] = name\n params['id'] = id\n return doCurl(\"get\",\"/user/by_social_media\",params)\n end",
"def links\n @data[\"_links\"]\n end",
"def social_media_links(*networks)\n options = networks.last.is_a?(Hash) ? networks.pop : { size: \"21x20\"}\n html = ''\n networks.to_a.each do |n|\n if n == 'rss'\n if options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n q = []\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (default)]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (only screen and (min-width: 1350px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/64x64/#{n}.png\")}, (only screen and (min-width: 1024px) and (max-width: 1349px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/48x48/#{n}.png\")}, (only screen and (max-width: 768px))]\"\n\n image_tag(\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n html += link_to(image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle;\",\n size: options[:size],\n data: { interchange: q.join(\", \") }),\n rss_url(format: \"xml\"), target: \"_blank\")\n else\n html += link_to(image_tag(\"icons/#{n}.png\", style: \"vertical-align: middle;\", size: options[:size]), rss_url(format: \"xml\"), target: \"_blank\")\n end\n\n elsif v = website.value_for(n)\n unless v.blank?\n v = (v =~ /^https/i) ? v : \"https://www.#{n}.com/#{v}\"\n presentation = n\n if options[:style] == \"font-awesome\"\n presentation = fa_icon(\"#{n} 2x\", :\"aria-label\" => n)\n elsif options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n elsif options[:gray]\n presentation = image_tag(\"social/social-gray-#{n.downcase}.png\",\n class: \"no-resize\",\n alt: n,\n :\"aria-label\" => n)\n elsif File.exist?(Rails.root.join(\"app/assets/images/icons\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n end\n html += link_to(presentation, v, target: \"_blank\", :\"aria-label\" => n)\n end\n end\n end\n raw(html)\n end",
"def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end",
"def links\n metadata[:links] || Set.new\n end",
"def index\n @api_v1_news_link_photos = Api::V1::NewsLinkPhoto.all\n end",
"def popular_media\n get '/media/popular', auth_params\n end",
"def githubber_links(url, max_page=1, options={})\n links = []\n if max_page && max_page > 1\n\n # add pagination param\n urls = (1..max_page).map { |i| \"#{url}?page=#{i}\" }\n responses = fetch(urls, options)\n responses.each do |response|\n links += get_profile_url(Nokogiri::HTML(response))\n end\n else\n response = fetch(url)\n links = get_profile_url(Nokogiri::HTML(response))\n end\n links\n end",
"def index\n @picture_links = PictureLink.all\n end",
"def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n \n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def set_media_links_relation\n has_many :media_links, :as => :mediated, :dependent => :destroy\n end",
"def fetch_links!\n return if content_id.blank?\n\n links = Services.publishing_api.get_links(content_id)[\"links\"]\n\n self.lead_organisation_content_ids = links[\"lead_organisations\"] || []\n self.organisation_content_ids = links[\"organisations\"] || []\n self.people_content_ids = links[\"people\"] || []\n self.working_group_content_ids = links[\"working_groups\"] || []\n end",
"def show\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def ensmallen_links\n links = []\n (self.urls + self.media).each do |link|\n links << {\n 'url' => link.url.to_s,\n 'display_url' => link.display_url.to_s,\n 'expanded_url' => link.expanded_url.to_s,\n 'indices' => link.indices\n }\n end\n\n #always sort results, so clients can easily reverse to loop and s//\n links.sort { |x,y| x['indices'][0] <=> y['indices'][0] }\n end",
"def update\n @social_media_link = SocialMediaLink.find(params[:id])\n\n if @social_media_link.update(social_media_link_params)\n head :no_content\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def link\n return unless @data['link']\n link = @data['link']\n # Aozora has embed data, we just need to restructure it a bit\n @link ||= {\n kind: link['type'],\n title: link['title'],\n description: link['description'],\n url: link['url'],\n site_name: link['siteName'],\n image: link['images'].first\n }\n end",
"def new\n # pismo_grab_meta_data\n paginate_all_links\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 index\n @facebooklinks = Facebooklink.all\n end",
"def links_feed\n end",
"def links\n\t self.tweets.collect{|t| t.links}.flatten.compact\n\tend",
"def image_url_instagram(link_url)\n link_url['instagram.com'] = 'instagr.am' if link_url.index 'instagram.com' #instagram's oembed does not work for .com links\n response = http_get \"http://api.instagram.com/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def feed\n user = User.find(params[:id])\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n microposts = Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: params[:id])\n microposts_json = microposts_as_json(microposts.paginate(page: params[:page]))\n next_page = microposts.paginate(page: params[:page]).next_page\n @package = { next_page: next_page,\n microposts: microposts_json,\n is_current_user: (user == current_user) }\n render json: @package\n end",
"def index\n @links = current_user.links\n end",
"def links()\n return @links\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def links\n @links ||= []\n @links\n end",
"def links\n @links.values\n end",
"def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end",
"def social_link_params\n params.require(:social_media_link).permit(:title, :url, :image_url)\n end",
"def index\n @custom_media_entries = CustomMediaEntry.all\n end",
"def media_link &block\n ASObj.generate :media_link,true,&block\n end",
"def links\n if @links.blank?\n @links = []\n link_nodes =\n FeedTools::XmlHelper.combine_xpaths_all(self.channel_node, [\n \"atom10:link\",\n \"atom03:link\",\n \"atom:link\",\n \"link\",\n \"channelLink\",\n \"a\",\n \"url\",\n \"href\"\n ])\n for link_node in link_nodes\n link_object = FeedTools::Link.new\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.href == \"atom10:\" ||\n link_object.href == \"atom03:\" ||\n link_object.href == \"atom:\"\n link_object.href = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@href\"\n ], :select_result_value => true)\n end\n if link_object.href.nil? && link_node.base_uri != nil\n link_object.href = \"\"\n end\n begin\n if !(link_object.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(link_object.href)\n link_object.href = FeedTools::UriHelper.resolve_relative_uri(\n link_object.href,\n [link_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n link_object.href =\n FeedTools::UriHelper.normalize_url(link_object.href)\n end\n link_object.href.strip! unless link_object.href.nil?\n next if link_object.href.blank?\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:hreflang\",\n \"@atom03:hreflang\",\n \"@atom:hreflang\",\n \"@hreflang\"\n ], :select_result_value => true)\n if link_object.hreflang == \"atom10:\" ||\n link_object.hreflang == \"atom03:\" ||\n link_object.hreflang == \"atom:\"\n link_object.hreflang = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@hreflang\"\n ], :select_result_value => true)\n end\n unless link_object.hreflang.nil?\n link_object.hreflang = link_object.hreflang.downcase\n end\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:rel\",\n \"@atom03:rel\",\n \"@atom:rel\",\n \"@rel\"\n ], :select_result_value => true)\n if link_object.rel == \"atom10:\" ||\n link_object.rel == \"atom03:\" ||\n link_object.rel == \"atom:\"\n link_object.rel = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@rel\"\n ], :select_result_value => true)\n end\n unless link_object.rel.nil?\n link_object.rel = link_object.rel.downcase\n end\n if link_object.rel.nil? && self.feed_type == \"atom\"\n link_object.rel = \"alternate\"\n end\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:type\",\n \"@atom03:type\",\n \"@atom:type\",\n \"@type\"\n ], :select_result_value => true)\n if link_object.type == \"atom10:\" ||\n link_object.type == \"atom03:\" ||\n link_object.type == \"atom:\"\n link_object.type = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@type\"\n ], :select_result_value => true)\n end\n unless link_object.type.nil?\n link_object.type = link_object.type.downcase\n end\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:title\",\n \"@atom03:title\",\n \"@atom:title\",\n \"@title\",\n \"text()\"\n ], :select_result_value => true)\n if link_object.title == \"atom10:\" ||\n link_object.title == \"atom03:\" ||\n link_object.title == \"atom:\"\n link_object.title = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@title\"\n ], :select_result_value => true)\n end\n # This catches the ambiguities between atom, rss, and cdf\n if link_object.title == link_object.href\n link_object.title = nil\n end\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@atom10:length\",\n \"@atom03:length\",\n \"@atom:length\",\n \"@length\"\n ], :select_result_value => true)\n if link_object.length == \"atom10:\" ||\n link_object.length == \"atom03:\" ||\n link_object.length == \"atom:\"\n link_object.length = FeedTools::XmlHelper.try_xpaths(link_node, [\n \"@length\"\n ], :select_result_value => true)\n end\n if !link_object.length.nil?\n link_object.length = link_object.length.to_i\n else\n if !link_object.type.nil? && link_object.type[0..4] != \"text\" &&\n link_object.type[-3..-1] != \"xml\" &&\n link_object.href =~ /^http:\\/\\//\n # Retrieve the length with an http HEAD request\n else\n link_object.length = nil\n end\n end\n @links = [] if @links.nil?\n @links << link_object\n end\n end\n return @links\n end",
"def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end",
"def links\n\n @user=current_user\n @links=Link.user_links(current_user.id)\n\n end",
"def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end",
"def get_likes media_id\n url = API + \"media/#{media_id}/likes?access_token=\" + @access_token\n get(url)['data'].map {|data| data}\n end",
"def get_team_social_media_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamApi.get_team_social_media ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling TeamApi.get_team_social_media\"\n end\n # resource path\n local_var_path = '/team/{team_key}/social_media'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Media>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#get_team_social_media\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def link\n object[\"link\"]\n end",
"def get_media\n raise Errors::BadRequestError, \"Bad course site ID #{canvas_course_id}\" if canvas_course_id.blank?\n authorize Canvas::Course.new(canvas_course_id: canvas_course_id), :can_view_course?\n render :json => Canvas::CanvasMediacasts.new(user_id: session[:user_id], course_id: canvas_course_id).get_feed\n end",
"def show\n @social1 = Social.where(id: params[:id])\n if user_signed_in?\n @urls = []\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n @socials = Social.where(city: @location.city_name)\n @contact_author = User.where(name: @social.creator)\n @photo = @social.photos.where(default: true)\n videos = @social.media_urls.map(&:url)\n images = @social.photos.map(&:image_url)\n media_urls = images + videos\n media_urls.each do |url|\n if url.match(Regexp.union(/youtube.com/, /vimeo.com/))\n video = VideoInfo.new(url)\n @urls << video.thumbnail_small\n elsif url.match(/soundcloud.com/)\n soundcloud = HTTParty.get(\"http://api.soundcloud.com/resolve.json?url=#{url}&client_id=8f624be8e4a0dbb19d303b829a85501b\")\n @urls << soundcloud.parsed_response['artwork_url']\n else\n @urls << url\n end\n end\n else\n @socials = Social.all\n @photo = @social.photos.where(default: true)\n @contact_author = User.where(name: @social.creator)\n end\n end",
"def index\n session[:index_page] = request.env['HTTP_REFERER'] || socialmediasites_url\n @socialmediasites = Socialmediasite.search(params[:search])\n @socialmediasites_array = Kaminari.paginate_array(@socialmediasites).page(params[:page]).per(2)\n end",
"def links\n curations = self.curations.select do |curation|\n curation.rating != '0' and curation.status != 'deleted'\n end\n\n links = curations.map do |curation|\n link = Link.find(curation.link_id)\n owner = User.find(link.link_owner)\n link_for_app = {\n curation_id: curation.id,\n link_id: link.id,\n status: curation.status,\n rating: curation.rating,\n date_added: curation.created_at,\n url: link.url,\n url_type: link.url_type,\n title: link.title,\n image: link.image,\n comment: curation.comment,\n shared_with: people_shared_with(link, owner),\n tags: curation.tags,\n owner: {\n name: owner.name,\n phone: owner.phone,\n }\n }\n link_for_app\n end\n links.sort_by { |link| link[:date_added] }.reverse\n end",
"def find_social_media_links_box\n @social_media_links_box = SocialMediaLinksBox.find(params[:id]).current_version\n end",
"def retrieve_media_url(tweet)\n retrieve_media_element(tweet, 'media_url')\n end",
"def find_social_links_on(type)\n social_url = @@social_links[type] || type\n\n # go through all of the website links of this organization\n @item.links.where(:link_type_id => website_link_type_id).map { |website_link|\n # each_item only iterates through the first 8 items in the response\n # search facebook.com for the organization name\n google_search(@item.name, social_url).collect { |result| result.uri }.select { |social_url|\n # search the organization site for a link to that facebook profile\n # if the result has more than 0 results, add it to the links list\n # (returns a boolean because we are in a select block)\n google_search(\"link:#{social_url} AND\", website_link.link_url).estimated_count > 0 and usable_link?(type, social_url)\n }\n }.flatten\n end",
"def get_social_actions share_urns\n path = '/socialActions'\n get(path, ids: share_urns)\n end",
"def dropbox_find_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/list_shared_links\"\n payload = { path: file, direct_only: true }\n\n dropbox_post_json(url, payload: payload) do |json|\n if link = Array(json[\"links\"]).first\n link[\"url\"]\n end\n end\n end",
"def show\n @mwod_video_link = MwodVideoLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def show\n @admin_social_medium = Admin::SocialMedium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_social_medium }\n end\n end",
"def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def index\n @api_v1_news_links = Api::V1::NewsLink.all\n end",
"def get_links(service)\n\t\treturn @transport.get_path(\"links\",service)\n\tend",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def links\n return @links\n end",
"def test_links\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n assert_equal(\n ['list', 'info', 'identify_resource', 'create', 'submit', 'update', 'delete'],\n schema.resource('resource').links.map { |link| link.name })\n end",
"def show\n @message_link = MessageLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_link }\n end\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end",
"def image_url_embedly(link_url)\n response = http_get \"http://api.embed.ly/1/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def links\n self[\"link\"].map { |l| l.href }\n end",
"def show\n @social_network = SocialNetwork.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @social_network }\n end\n end",
"def set_social_links\n @spree_social_links = Spree::SocialLink.all\n end",
"def links\n @mandate_links ||= Links.new(@links)\n end",
"def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @link }\n end\n end",
"def uri\n @json['user']['links']['self']\n end",
"def social\n @data['social']\n end",
"def index\n @broadcaster_social_entries = Broadcaster::SocialEntry.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @media_scopes }\n end\n end",
"def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end",
"def index\n @links = current_user.links\n .includes(:tags, :domain, :user)\n .order(created_at: :desc)\n .page(params[:page])\n .load\n end",
"def index\n @url_links = UrlLink.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end"
] |
[
"0.73398477",
"0.65911365",
"0.6394536",
"0.63804704",
"0.6343071",
"0.6333199",
"0.63124585",
"0.62049234",
"0.61928505",
"0.61536324",
"0.61536324",
"0.6147549",
"0.6114166",
"0.60973096",
"0.602091",
"0.59950614",
"0.5990805",
"0.5989481",
"0.5917229",
"0.5903546",
"0.58783185",
"0.58585334",
"0.5855524",
"0.5811344",
"0.5801724",
"0.5788232",
"0.57842916",
"0.57741964",
"0.5737182",
"0.5734801",
"0.5729939",
"0.57231647",
"0.5713748",
"0.5694419",
"0.5693246",
"0.5685754",
"0.56524915",
"0.563558",
"0.56256056",
"0.5603509",
"0.56009126",
"0.55841917",
"0.55812824",
"0.5567882",
"0.5556313",
"0.5554625",
"0.5547357",
"0.5547357",
"0.5544193",
"0.5538328",
"0.55178833",
"0.5515604",
"0.551397",
"0.55113983",
"0.5510792",
"0.5500161",
"0.5483062",
"0.54782313",
"0.5474363",
"0.5471603",
"0.5464413",
"0.54626834",
"0.54620075",
"0.54518515",
"0.5450036",
"0.5442275",
"0.5442047",
"0.54314923",
"0.5430211",
"0.54120874",
"0.5400096",
"0.5400068",
"0.5394209",
"0.538911",
"0.53789204",
"0.5356272",
"0.5356272",
"0.5356272",
"0.5356091",
"0.5355003",
"0.5350579",
"0.53476775",
"0.53375363",
"0.53375363",
"0.5336139",
"0.5333677",
"0.53277636",
"0.5324392",
"0.5323487",
"0.53218573",
"0.5321056",
"0.5317625",
"0.5311644",
"0.5309553",
"0.5303683",
"0.5301181",
"0.5301181",
"0.5301181",
"0.5301181",
"0.5301181"
] |
0.79115915
|
0
|
GET /web/v1/social_media_links/1 GET /web/v1/social_media_links/1.json
|
def show
render json: @social_media_link
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @social_media_links = SocialMediaLink.all\n\n render json: @social_media_links\n end",
"def create\n @social_media_link = SocialMediaLink.new(social_media_link_params)\n\n if @social_media_link.save\n render json: @social_media_link, status: :created\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def index\n @links = @site.site_social_links\n end",
"def handle_links(json) end",
"def get_links(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Entering\")\n link = []\n\n if !blob[\"link\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding link #{blob[\"link\"]}\")\n\n link = ::Api::Helpers::Parser.get_documents({:text => blob[\"link\"]})\n\n #reset the mime to system type. give higher priority to mime found by our system\n mime = ::Api::Helpers::Parser.map_type_to_mime(blob[\"type\"])\n\n link[0][:mime] = mime if mime != AppConstants.mime_remote_link\n\n link[0][:description] = blob[\"description\"]\n link[0][:title] = blob[\"name\"]\n\n link[0][:provider] =~ /facebook.com/ ? link[0][:ignore] = true : link[0][:ignore] = false\n\n link[0][:source_object_id] = blob[\"object_id\"]\n\n #extract image_url\n if !blob[\"picture\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] CGI EXTRACTION #{cgi}\")\n\n u = URI.unescape(blob[\"picture\"])\n cgi = CGI::parse(u)\n\n #internal images are encoded in src(fbcdn) and external are encoded in\n url = cgi[\"url\"]\n url = cgi[\"src\"] if url.blank?\n\n\n if !cgi.blank? and !url.blank?\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding Picture Url #{link[0][:image_url]} \")\n\n link[0][:image_url] = url[0]\n link[0][:image_width] = cgi[\"w\"][0] if !cgi[\"w\"].blank?\n link[0][:image_height] = cgi[\"h\"][0] if !cgi[\"h\"].blank?\n end\n end\n end\n\n #attach embedded links also link array\n #duplicate document is removed in create_activity\n if !blob[\"message\"].blank?\n\n embedded_links = ::Api::Helpers::Parser.get_documents({:text => blob[\"message\"]})\n if link.blank?\n link = embedded_links if !embedded_links.blank?\n else\n embedded_links.each do |elem|\n #remove duplicates ..\n #give priority to attr[links] as they will be mostly resolved\n next if link[0][:url] == elem[:url]\n link << elem\n end\n end\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Leaving \")\n link\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return []\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def get_user_recent_media\n response = @client.get(\"#{@base_url}/v1/users/self/media/recent\", access_token: get_user_access_token)\n medias = JSON.parse(response.body) \n if(medias[\"meta\"][\"code\"] == 200)\n media_url = []\n medias[\"data\"].each do |media|\n url = media[\"images\"][\"standard_resolution\"][\"url\"]\n media_url.push(url)\n end\n media_url \n end\n end",
"def index\n @links = current_user.links.desc :created_at\n @title = 'Shared By You'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def show\n render json: @social_networking\n end",
"def index\n render json: @links\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def links\n data['links']\n end",
"def getUserBy_social_media( name, id)\n params = Hash.new\n params['name'] = name\n params['id'] = id\n return doCurl(\"get\",\"/user/by_social_media\",params)\n end",
"def index\n @api_v1_social_link_segments = Api::V1::SocialLinkSegment.all\n end",
"def index\n @social_media_accounts = SocialMediaAccount.all\n end",
"def show\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def new\n # pismo_grab_meta_data\n paginate_all_links\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 selfMedia\n myMedia = Medium.all.filter{|media| media.user_id == decoded_token}\n # ItinActiv = Activity.all.filter{ |activity| activity.itinerary_id == myItin.id }\n render json: myMedia\n end",
"def update\n @social_media_link = SocialMediaLink.find(params[:id])\n\n if @social_media_link.update(social_media_link_params)\n head :no_content\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def index\n @api_v1_news_link_photos = Api::V1::NewsLinkPhoto.all\n end",
"def link\n return unless @data['link']\n link = @data['link']\n # Aozora has embed data, we just need to restructure it a bit\n @link ||= {\n kind: link['type'],\n title: link['title'],\n description: link['description'],\n url: link['url'],\n site_name: link['siteName'],\n image: link['images'].first\n }\n end",
"def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def link(link_full_name)\n links = objects_from_response(:get, 'api/info.json', { :id => link_full_name })\n links.first\n end",
"def image_url_instagram(link_url)\n link_url['instagram.com'] = 'instagr.am' if link_url.index 'instagram.com' #instagram's oembed does not work for .com links\n response = http_get \"http://api.instagram.com/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end",
"def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end",
"def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n \n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def link\n object[\"link\"]\n end",
"def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @link }\n end\n end",
"def show\n @social_network = SocialNetwork.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @social_network }\n end\n end",
"def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"def find_social_media_links_box\n @social_media_links_box = SocialMediaLinksBox.find(params[:id]).current_version\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def index\n @picture_links = PictureLink.all\n end",
"def show\n @admin_social_medium = Admin::SocialMedium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_social_medium }\n end\n end",
"def social_media_links(top50)\n top50.each do |person, _count|\n next if Person.new(person).social_media_links?(@database)\n @database.write(\n 'people-information',\n @social_media.links_for(person),\n Digest::MD5.hexdigest(person)\n )\n end\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def show\n @mwod_video_link = MwodVideoLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def show\n @socialmedium = Socialmedium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socialmedium }\n end\n end",
"def show\n @message_link = MessageLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_link }\n end\n end",
"def popular_media\n get '/media/popular', auth_params\n end",
"def show\n @social1 = Social.where(id: params[:id])\n if user_signed_in?\n @urls = []\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n @socials = Social.where(city: @location.city_name)\n @contact_author = User.where(name: @social.creator)\n @photo = @social.photos.where(default: true)\n videos = @social.media_urls.map(&:url)\n images = @social.photos.map(&:image_url)\n media_urls = images + videos\n media_urls.each do |url|\n if url.match(Regexp.union(/youtube.com/, /vimeo.com/))\n video = VideoInfo.new(url)\n @urls << video.thumbnail_small\n elsif url.match(/soundcloud.com/)\n soundcloud = HTTParty.get(\"http://api.soundcloud.com/resolve.json?url=#{url}&client_id=8f624be8e4a0dbb19d303b829a85501b\")\n @urls << soundcloud.parsed_response['artwork_url']\n else\n @urls << url\n end\n end\n else\n @socials = Social.all\n @photo = @social.photos.where(default: true)\n @contact_author = User.where(name: @social.creator)\n end\n end",
"def uri\n @json['user']['links']['self']\n end",
"def dropbox_find_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/list_shared_links\"\n payload = { path: file, direct_only: true }\n\n dropbox_post_json(url, payload: payload) do |json|\n if link = Array(json[\"links\"]).first\n link[\"url\"]\n end\n end\n end",
"def social_media_links(*networks)\n options = networks.last.is_a?(Hash) ? networks.pop : { size: \"21x20\"}\n html = ''\n networks.to_a.each do |n|\n if n == 'rss'\n if options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n q = []\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (default)]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (only screen and (min-width: 1350px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/64x64/#{n}.png\")}, (only screen and (min-width: 1024px) and (max-width: 1349px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/48x48/#{n}.png\")}, (only screen and (max-width: 768px))]\"\n\n image_tag(\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n html += link_to(image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle;\",\n size: options[:size],\n data: { interchange: q.join(\", \") }),\n rss_url(format: \"xml\"), target: \"_blank\")\n else\n html += link_to(image_tag(\"icons/#{n}.png\", style: \"vertical-align: middle;\", size: options[:size]), rss_url(format: \"xml\"), target: \"_blank\")\n end\n\n elsif v = website.value_for(n)\n unless v.blank?\n v = (v =~ /^https/i) ? v : \"https://www.#{n}.com/#{v}\"\n presentation = n\n if options[:style] == \"font-awesome\"\n presentation = fa_icon(\"#{n} 2x\", :\"aria-label\" => n)\n elsif options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n elsif options[:gray]\n presentation = image_tag(\"social/social-gray-#{n.downcase}.png\",\n class: \"no-resize\",\n alt: n,\n :\"aria-label\" => n)\n elsif File.exist?(Rails.root.join(\"app/assets/images/icons\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n end\n html += link_to(presentation, v, target: \"_blank\", :\"aria-label\" => n)\n end\n end\n end\n raw(html)\n end",
"def index\n @facebooklinks = Facebooklink.all\n end",
"def indexUserSocial\n render json: User.where( id: params[:user_id] ).last.socials.page(params[:page] || 1).per(params[:per] || 10) , status: 200\n end",
"def set_social_link\n @social_link = SocialLink.find(params[:id])\n end",
"def links_feed\n end",
"def feed\n user = User.find(params[:id])\n following_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n microposts = Micropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: params[:id])\n microposts_json = microposts_as_json(microposts.paginate(page: params[:page]))\n next_page = microposts.paginate(page: params[:page]).next_page\n @package = { next_page: next_page,\n microposts: microposts_json,\n is_current_user: (user == current_user) }\n render json: @package\n end",
"def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end",
"def index\n @api_v1_news_links = Api::V1::NewsLink.all\n end",
"def fetch_links!\n return if content_id.blank?\n\n links = Services.publishing_api.get_links(content_id)[\"links\"]\n\n self.lead_organisation_content_ids = links[\"lead_organisations\"] || []\n self.organisation_content_ids = links[\"organisations\"] || []\n self.people_content_ids = links[\"people\"] || []\n self.working_group_content_ids = links[\"working_groups\"] || []\n end",
"def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end",
"def links\n metadata[:links] || Set.new\n end",
"def social_link_params\n params.require(:social_media_link).permit(:title, :url, :image_url)\n end",
"def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end",
"def links\n @data[\"_links\"]\n end",
"def media_link &block\n ASObj.generate :media_link,true,&block\n end",
"def show\n @link = @campaign.links.find(params[:id])\n end",
"def image_url_embedly(link_url)\n response = http_get \"http://api.embed.ly/1/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def githubber_links(url, max_page=1, options={})\n links = []\n if max_page && max_page > 1\n\n # add pagination param\n urls = (1..max_page).map { |i| \"#{url}?page=#{i}\" }\n responses = fetch(urls, options)\n responses.each do |response|\n links += get_profile_url(Nokogiri::HTML(response))\n end\n else\n response = fetch(url)\n links = get_profile_url(Nokogiri::HTML(response))\n end\n links\n end",
"def get_likes media_id\n url = API + \"media/#{media_id}/likes?access_token=\" + @access_token\n get(url)['data'].map {|data| data}\n end",
"def ensmallen_links\n links = []\n (self.urls + self.media).each do |link|\n links << {\n 'url' => link.url.to_s,\n 'display_url' => link.display_url.to_s,\n 'expanded_url' => link.expanded_url.to_s,\n 'indices' => link.indices\n }\n end\n\n #always sort results, so clients can easily reverse to loop and s//\n links.sort { |x,y| x['indices'][0] <=> y['indices'][0] }\n end",
"def get_team_social_media_with_http_info(team_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamApi.get_team_social_media ...'\n end\n # verify the required parameter 'team_key' is set\n if @api_client.config.client_side_validation && team_key.nil?\n fail ArgumentError, \"Missing the required parameter 'team_key' when calling TeamApi.get_team_social_media\"\n end\n # resource path\n local_var_path = '/team/{team_key}/social_media'.sub('{' + 'team_key' + '}', CGI.escape(team_key.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'If-Modified-Since'] = opts[:'if_modified_since'] if !opts[:'if_modified_since'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Media>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['apiKey']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#get_team_social_media\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @publink = Publink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publink }\n end\n end",
"def profile_url\n @json['user']['links']['self']\n end",
"def social\n @data['social']\n end",
"def show\n @shared_url = SharedUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shared_url }\n end\n end",
"def set_media_links_relation\n has_many :media_links, :as => :mediated, :dependent => :destroy\n end",
"def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end",
"def index\n @links = current_user.links\n end",
"def index\n @services = Service.all\n @services_hash = @services.map do |s|\n {service: s, medium: s.medium.map { |media|\n media.as_json.merge({ media: url_for(media) })\n }, user: s.user.username, categories: s.categories}#, galleries: s.galleries\n \n end\n render json: @services_hash\n end",
"def link\n\t\t\t@data['link']\n\t\tend",
"def href\n link.gsub(\".json\", \"\")\n end",
"def show\n respond_to do |format|\n format.html\n format.json{\n # if !@youtube_channel.linked\n # @youtube_channel.linked = true\n # @youtube_channel.save\n # end\n json_object = @youtube_channel.json\n url = if request.domain == \"localhost\"\n request.protocol + request.host_with_port\n else\n request.protocol + request.host\n end\n\t\t\t\tjson_object[:phone_number] = if @youtube_channel.google_account.email_account.recovery_phone.present? && @youtube_channel.google_account.email_account.recovery_phone_assigned\n\t\t\t\t\t@youtube_channel.google_account.email_account.recovery_phone.value\n\t\t\t\telse\n\t\t\t\t\t@youtube_channel.phone_number.present? ? @youtube_channel.phone_number : \"\"\n\t\t\t\tend\n json_object[:channel_icon_url] = !@youtube_channel.channel_icon.blank? ? URI::escape(url + @youtube_channel.channel_icon.url(:original), '[]') : \"\"\n json_object[:channel_art_url] = !@youtube_channel.channel_art.blank? ? URI::escape(url + @youtube_channel.channel_art.url(:original), '[]') : \"\"\n render :json => json_object.to_json\n }\n end\n end",
"def show\n @link = Link.find(params[:id])\n @topics = @link.tags\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"def get_permalink\n unless current_permalink_url\n permalink = Permalink.new_with_values!(@user_request.referent, @user_request.referrer_id) \n @user_request.referent.permalinks << permalink\n end\n\n respond_to do |format|\n format.html \n format.json do \n render :json => {:permalink => current_permalink_url}\n end\n end \n end",
"def show\n @useful_link = UsefulLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @useful_link }\n end\n end",
"def find_social_links_on(type)\n social_url = @@social_links[type] || type\n\n # go through all of the website links of this organization\n @item.links.where(:link_type_id => website_link_type_id).map { |website_link|\n # each_item only iterates through the first 8 items in the response\n # search facebook.com for the organization name\n google_search(@item.name, social_url).collect { |result| result.uri }.select { |social_url|\n # search the organization site for a link to that facebook profile\n # if the result has more than 0 results, add it to the links list\n # (returns a boolean because we are in a select block)\n google_search(\"link:#{social_url} AND\", website_link.link_url).estimated_count > 0 and usable_link?(type, social_url)\n }\n }.flatten\n end",
"def showSocial\n social = Social.where( user_id: params[:user_id] ).where( id: params[:id] ).last\n if social\n render json: social , status: 200\n else\n render json: { error: \"شبکه اجتماعی یا کاربر پیدا نشد\" } , status: 404\n end\n end",
"def index\n @custom_media_entries = CustomMediaEntry.all\n end",
"def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"def github\n @data['social']['github']\n end",
"def set_link\n @link = SiteSocialLink.find(params[:id])\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def index\n @links = Link.all\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end"
] |
[
"0.7789854",
"0.64317495",
"0.64153606",
"0.6374051",
"0.6329446",
"0.6279789",
"0.6270436",
"0.6225349",
"0.6202388",
"0.6174492",
"0.6136873",
"0.6134985",
"0.6062893",
"0.605313",
"0.6020355",
"0.601451",
"0.60135466",
"0.600149",
"0.59962684",
"0.59678173",
"0.5967527",
"0.5937226",
"0.5911527",
"0.5899333",
"0.58838624",
"0.58838624",
"0.58687735",
"0.58656245",
"0.5860511",
"0.5858785",
"0.58451325",
"0.57981104",
"0.5796933",
"0.577945",
"0.5778038",
"0.57731795",
"0.57731795",
"0.57729137",
"0.57680553",
"0.5763299",
"0.57605284",
"0.5754278",
"0.571886",
"0.5691049",
"0.5689384",
"0.5686033",
"0.56725997",
"0.5642778",
"0.56396085",
"0.563743",
"0.5634048",
"0.5629596",
"0.5618891",
"0.56152654",
"0.56146145",
"0.5598531",
"0.5584013",
"0.55749506",
"0.55707484",
"0.5569865",
"0.5567287",
"0.5563766",
"0.5559464",
"0.5544068",
"0.55430937",
"0.5540656",
"0.55186397",
"0.55127615",
"0.5511378",
"0.54950273",
"0.54857916",
"0.546322",
"0.54617536",
"0.54566956",
"0.54519445",
"0.545109",
"0.54427403",
"0.5442524",
"0.54389966",
"0.5436106",
"0.5429596",
"0.5419491",
"0.5414005",
"0.54134375",
"0.5407388",
"0.540479",
"0.54045486",
"0.5397032",
"0.5397032",
"0.5391414",
"0.5383905",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5382169",
"0.5371892"
] |
0.7483295
|
1
|
POST /web/v1/social_media_links POST /web/v1/social_media_links.json
|
def create
@social_media_link = SocialMediaLink.new(social_media_link_params)
if @social_media_link.save
render json: @social_media_link, status: :created
else
render json: @social_media_link.errors, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @social_media_links = SocialMediaLink.all\n\n render json: @social_media_links\n end",
"def social_link_params\n params.require(:social_media_link).permit(:title, :url, :image_url)\n end",
"def create\n @link = current_user.links.new link_params\n create_and_respond(@link)\n end",
"def show\n render json: @social_media_link\n end",
"def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end",
"def handle_links(json) end",
"def create_links\n end",
"def create_links\n end",
"def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = current_user.links.build(link_params) # using devise helper \"current_user\"\n logger.debug \" DEBUG :::::::: #{link_params.to_json}\"\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @social_media_link = SocialMediaLink.find(params[:id])\n\n if @social_media_link.update(social_media_link_params)\n head :no_content\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def create\n @link = current_user.links.build(link_params)\n \n @link.num = 2\n @link.user_name = current_user.nickname\n @link.description = current_user.description\n @link.description_permission = current_user.description_permission\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: '투표안건이 성공적으로 작성되었습니다.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, :notice => 'Ссылка была успешно создана' }\n format.mobile { redirect_to @link, :notice => 'Ссылка была успешно создана' }\n format.json { render :json => @link, :status => :created, :location => @link }\n else\n format.html { render :action => \"new\" }\n format.mobile { render :action => \"new\" }\n format.json { render :json => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @link = @campaign.links.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: campaign_links_path }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_media_links_relation\n has_many :media_links, :as => :mediated, :dependent => :destroy\n end",
"def social_media_links(top50)\n top50.each do |person, _count|\n next if Person.new(person).social_media_links?(@database)\n @database.write(\n 'people-information',\n @social_media.links_for(person),\n Digest::MD5.hexdigest(person)\n )\n end\n end",
"def social_link_params\n params.require(:social_link).permit(:name, :url_pattern, :image)\n end",
"def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if (@entity.links << @link)\n flash[:notice] = 'Link was successfully created.'\n furl = link_url(@entity,@link)\n format.html { redirect_to furl}\n format.xml { head :created, :location => furl }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors.to_xml }\n end\n end\n end",
"def postEntitySocialmedia( entity_id, type, website_url)\n params = Hash.new\n params['entity_id'] = entity_id\n params['type'] = type\n params['website_url'] = website_url\n return doCurl(\"post\",\"/entity/socialmedia\",params)\n end",
"def create\n @link = current_user.links.new( link_params )\n # @link = Link.new( link_params )\n # @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link_params\n params.require(:social_link).permit(:social_link_id, :site_id, :user_name)\n end",
"def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n if @link.shortened.nil? or @link.shortened.empty?\n @link.assign_unique_shortened_string\n @link.save\n end\n current_user.links << @link\n current_user.save\n\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_links\n return if @links.nil?\n\n if @links.empty?\n Rentlinx.client.unpost_links_for(self)\n else\n Rentlinx.client.post_links(@links)\n end\n end",
"def create\n @link = Link.new(params[:link])\n \n @link.user_id = current_user_id\n\n respond_to do |format|\n if @link.save\n @post = Post.find(@link.post_id);\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n format.js {}\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_links(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Entering\")\n link = []\n\n if !blob[\"link\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding link #{blob[\"link\"]}\")\n\n link = ::Api::Helpers::Parser.get_documents({:text => blob[\"link\"]})\n\n #reset the mime to system type. give higher priority to mime found by our system\n mime = ::Api::Helpers::Parser.map_type_to_mime(blob[\"type\"])\n\n link[0][:mime] = mime if mime != AppConstants.mime_remote_link\n\n link[0][:description] = blob[\"description\"]\n link[0][:title] = blob[\"name\"]\n\n link[0][:provider] =~ /facebook.com/ ? link[0][:ignore] = true : link[0][:ignore] = false\n\n link[0][:source_object_id] = blob[\"object_id\"]\n\n #extract image_url\n if !blob[\"picture\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] CGI EXTRACTION #{cgi}\")\n\n u = URI.unescape(blob[\"picture\"])\n cgi = CGI::parse(u)\n\n #internal images are encoded in src(fbcdn) and external are encoded in\n url = cgi[\"url\"]\n url = cgi[\"src\"] if url.blank?\n\n\n if !cgi.blank? and !url.blank?\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding Picture Url #{link[0][:image_url]} \")\n\n link[0][:image_url] = url[0]\n link[0][:image_width] = cgi[\"w\"][0] if !cgi[\"w\"].blank?\n link[0][:image_height] = cgi[\"h\"][0] if !cgi[\"h\"].blank?\n end\n end\n end\n\n #attach embedded links also link array\n #duplicate document is removed in create_activity\n if !blob[\"message\"].blank?\n\n embedded_links = ::Api::Helpers::Parser.get_documents({:text => blob[\"message\"]})\n if link.blank?\n link = embedded_links if !embedded_links.blank?\n else\n embedded_links.each do |elem|\n #remove duplicates ..\n #give priority to attr[links] as they will be mostly resolved\n next if link[0][:url] == elem[:url]\n link << elem\n end\n end\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Leaving \")\n link\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return []\n end",
"def create\n @link = Link.new(params[:link])\n @link.user = @current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to link_comments_url(@link), notice: 'Link was successfully created.' }\n format.json { render json: link_comments_url(@link), status: :created, location: link_comments_url(@link) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(params[:link])\n @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @social_networking = Admin::SocialNetworking.new(social_networking_params)\n\n if @social_networking.save\n render json: @social_networking, status: :created\n else\n render json: @social_networking.errors, status: :unprocessable_entity\n end\n end",
"def create\n @social_media_account = SocialMediaAccount.new(social_media_account_params)\n\n respond_to do |format|\n if @social_media_account.save\n format.html { redirect_to @social_media_account, notice: 'Social media account was successfully created.' }\n format.json { render :show, status: :created, location: @social_media_account }\n else\n format.html { render :new }\n format.json { render json: @social_media_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @socialmediasite = Socialmediasite.new(socialmediasite_params)\n # @socialmediasite = current_login.socialmediasites.build(params[:socialmediasite])\n @socialmediasite = current_login.socialmediasites.new(socialmediasite_params)\n respond_to do |format|\n if @socialmediasite.save\n format.html { redirect_to @socialmediasite, notice: 'Socialmediasite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socialmediasite }\n else\n format.html { render action: 'new' }\n format.json { render json: @socialmediasite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(link_params)\n @link.user = current_user\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_raw\n\n @link = Link.new(link_params)\n\n # print params\n puts link_params\n\n # get HTML from saved source\n @link.html_from_url(link_params['html'])\n \n # retrieve thumbnail from URL\n @link.picture_from_url(link_params['screenshot'])\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # pismo_grab_meta_data\n paginate_all_links\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 create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to edit_link_url(@link), notice: 'Link was successfully created.' }\n format.json { render :edit, status: :created, location: edit_link_url(@link) }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dropbox_create_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings\"\n payload = { path: file, settings: { requested_visibility: \"public\" } }\n\n dropbox_post_json(url, payload: payload) do |json|\n json[\"url\"]\n end\n end",
"def create\n\t\tlink = current_user.links.new(link_params)\n\n\t\trespond_to do | format |\n\t\t\tif link.save\n\t\t\t\tformat.html{\n\t\t\t\t\tredirect_to link\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tformat.html{\n\t\t\t\t\trender action: \"new\"\n\t\t\t\t}\n\t\t\tend\n\t\tend \n\t\t\n\tend",
"def create\n @link = Link.new(params[:link].merge(:created_by => current_user)) \n respond_to do |format|\n if @link.save!\n logger.warn(\"#{@link.id}\")\n publish :links, \"#{@link.id}\\0\"\n flash[:notice] = 'Link was successfully created.'\n format.html { redirect_to(@link) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end",
"def create\n @link = Link.new(params[:link])\n puts @link\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(caption: params[:caption], user_id: current_user.id)\n @post.media_item.attach params[:post_image]\n @post.media_url = url_for(@post.media_item)\n if @post.save\n render json: {post_id: @post.id}, status: :ok\n else \n render json: nil, status: :bad\n end\n end",
"def link_data\n params.permit(links: [:url])\n .require(:links)\n .values\n end",
"def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to info_path(@link.slug), notice: \"Link was successfully created.\" }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { redirect_to new_link_path, alert: @link.errors.full_messages.join(\", \") }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mwod_video_link = MwodVideoLink.new(params[:mwod_video_link])\n\n respond_to do |format|\n if @mwod_video_link.save\n format.html { redirect_to @mwod_video_link, notice: 'Mwod video link was successfully created.' }\n format.json { render json: @mwod_video_link, status: :created, location: @mwod_video_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_video_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @social = Social.new(params[:social])\n\n respond_to do |format|\n if @social.save\n format.html { redirect_to @social, notice: 'Social was successfully created.' }\n format.json { render json: @social, status: :created, location: @social }\n else\n format.html { render action: \"new\" }\n format.json { render json: @social.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @picture_link = PictureLink.new(picture_link_params)\n\n respond_to do |format|\n if @picture_link.save\n format.html { redirect_to @picture_link, notice: 'Picture link was successfully created.' }\n format.json { render :show, status: :created, location: @picture_link }\n else\n format.html { render :new }\n format.json { render json: @picture_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n #user = current_user\n if params[:user].nil?\n user = current_user\n else\n user = User.find(params[:user])\n end\n \n email = params[:email].to_s\n\n unless params[:source].nil? || params[:source].empty?\n params[:link] = Hash.new\n\n params[:link][:source] = Hash.new\n params[:link][:source] = params[:source]\n end\n\n \t\tlink = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'}\n\t\tlink.get \"http://img.bitpixels.com/getthumbnail?code=27543&size=200&url=\" + Link.makeAbsolute(params[:link][:source])\n\t\tlink.get(Link.makeAbsolute(params[:link][:source]))\n title = link.page.title \n\n if User.where(:email => /#{email}/).any?\n reciever_id = User.where(:email => /#{email}/i).first.id\n else\n u = User.create!(\n :name => \"Temp User\", \n :email => email, \n :password => \"temppass\", \n :password_confirmation => \"temppass\",\n :isTemp => true \n )\n reciever_id = u.id\n end\n \n @link = user.links.new(params[:link].merge({\n :reciever_id => reciever_id, \n :title => title, \n :source => Link.makeAbsolute(params[:link][:source]),\n }))\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to :back, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_link(links)\n links = [links] if links.is_a?(String)\n self.class.get(\"/action/add/links/grabber0/start1/\"+links.join(\" \"))\n end",
"def create\n @link = @question.links.new(params[:link])\n @link.user_id = current_user.id\n\n respond_to do |format|\n if @link.save\n flash[:notice] = 'link was successfully created.'\n format.html { redirect_to(@question) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { redirect_to @question }\n flash[:notice] = 'Link must start with \"http://\"'\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if !@link.link.include? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def create\n @link = Link.new(params[:link])\n doc = Pismo::Document.new(@link.url) \n #grab metadata from doc\n if doc.title.nil?\n @link.name = doc.description\n else\n @link.name = doc.title\n end\n @link.favicon = doc.favicon\n\n #FOR OFFLINE USE\n #@link.name = \"Offline Description\"\n\n\n\n\n paginate_all_links\n respond_to do |format|\n if @link.save\n #if using bookmarklet foward back to link you came from\n if request.referer =~ /autosave/\n format.html { redirect_to @link.url }\n else\n #if using frontpage redirect to show all links \n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully created.' }\n end\n format.html { redirect_to @link.url, notice: 'Link was successfully created.' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n normalized_url = Link.normalize_url(params[:url])\n if normalized_url.nil?\n render json: LinkResponse.new(ERROR_INVALID_URL, params[:code]), status: 422\n else\n begin\n link = Link.find_or_create(normalized_url, params[:type])\n render json: LinkResponse.new(SUCCESS, link.code), status: 200\n rescue => error\n render json: LinkResponse.new(ERROR_INVALID_URL, params[:code]), status: 500\n end\n end\n end",
"def create_account_link\n render json: Stripe::AccountLink.create(account_params.to_h), status: :created\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def media_link &block\n ASObj.generate :media_link,true,&block\n end",
"def create\n @social_network = SocialNetwork.new(admin_social_network_params)\n\n respond_to do |format|\n if @social_network.save\n format.html { redirect_to admin_videos_url, notice: 'Social network was successfully created.' }\n format.json { render :show, status: :created, location: @social_network }\n else\n format.html { render :new }\n format.json { render json: @social_network.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_links(settings_list, jira_client)\n @settings_list.links.each do |linktype, target|\n link = jira_client.Issuelink.build\n if (target['direction'] == 'inward')\n link.save({\n :type => {:name => linktype},\n :inwardIssue => {:key => target['ticket']},\n :outwardIssue => {:key => @issue.key},\n })\n else\n link.save({\n :type => {:name => linktype},\n :inwardIssue => {:key => @issue.key},\n :outwardIssue => {:key => target['ticket']},\n })\n end\n end\n end",
"def create\n @facebooklink = Facebooklink.new(facebooklink_params)\n\n respond_to do |format|\n if @facebooklink.save\n format.html { redirect_to @facebooklink, notice: 'Facebooklink was successfully created.' }\n format.json { render :show, status: :created, location: @facebooklink }\n else\n format.html { render :new }\n format.json { render json: @facebooklink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url_link = UrlLink.new(url_link_params)\n\n respond_to do |format|\n if @url_link.save\n format.html { redirect_to @url_link, notice: 'Url link was successfully created.' }\n format.json { render :show, status: :created, location: @url_link }\n else\n format.html { render :new }\n format.json { render json: @url_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @song_link ||= params[:song][:link]\n if @song_link\n song = Song.find_or_create_by(link: @song_link)\n render json: song\n end\n end",
"def cms_social_link_params\n params.require(:cms_social_link).permit!\n end",
"def socialParams\n params.permit( :name , :link)\n end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def spree_social_link_params\n params.require(:social_link).permit!\n end",
"def addMediaPackageWithUrl(params)\n missing_params = ['url','flavor','title','filename','workflow'].collect{|field| field if ! params.include?(field) }.compact\n raise Rubyhorn::RestClient::Exceptions::MissingRequiredParams.new(missing_params) if missing_params.present?\n uri = \"ingest/addMediaPackage\"\n uri += \"/#{params[\"workflow\"]}\" unless params[\"workflow\"].nil?\n Rubyhorn::Workflow.from_xml post(uri, params)\n end",
"def create\n @message_link = MessageLink.new(params[:message_link])\n\n respond_to do |format|\n if @message_link.save\n format.html { redirect_to @message_link, notice: 'Message link was successfully created.' }\n format.json { render json: @message_link, status: :created, location: @message_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog_link = BlogLink.new(blog_link_params)\n\n respond_to do |format|\n if @blog_link.save\n format.html { redirect_to @blog_link, notice: 'Blog link was successfully created.' }\n format.json { render action: 'show', status: :created, location: @blog_link }\n else\n format.html { render action: 'new' }\n format.json { render json: @blog_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.new(params[:link])\n puts \"////////////////////////////\"\n puts params\n respond_to do |format|\n if @link.save\n format.html { redirect_to links_url, notice: t('links.create.notice') }\n format.json { render json: @link, status: :created, location: @link }\n else\n @links_a=ManRsc.all\n @links_b=linksb(params[:link][:link_a])\n format.html { render action: \"new\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def facebooklink_params\n params.require(:facebooklink).permit(:name, :url)\n end",
"def create\n @useful_link = UsefulLink.new(params[:useful_link])\n\n respond_to do |format|\n if @useful_link.save\n format.html { redirect_to @useful_link, notice: 'Useful link was successfully created.' }\n format.json { render json: @useful_link, status: :created, location: @useful_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @useful_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n @message[:external_links] = params[:message][:external_links].first.split(\"\\r\\n\").map(&:strip)\n @message.images.attach(params[:message][:images])\n @message.images.attach(params[:message][:vi_images])\n @message.images.attach(params[:message][:zh_cn_images])\n @message.images.attach(params[:message][:zh_tw_images])\n @message.images.attach(params[:message][:hmn_images])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: \"Message was successfully created.\" }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Get the user name and links that have been sent from the extension\n name = params[:name] # received as a string [to be checked]\n urls = params[:urls] # received as an array\n # binding.pry\n # urls = urls.gsub(/[\\[\\]]/, '').split(', ') # Just for testing with Postman\n # Find the corresponding user\n user = User.find_by(name: name)\n # Get access to all the sources\n sources = Source.all\n # Iterate over each of the urls if links received\n if urls\n urls.each do |url|\n # Check the url against each of the sources 'url_base'\n sources.each do |source|\n # If it matches then create a Links table entry with reference to the source and user matched\n regexp = Regexp.new(source.url_base)\n if url.match(regexp)\n Link.create!(url: url, user: user, source: source)\n end\n end\n end\n end\n end",
"def create\n @talk = Talk.new(params[:talk])\n if params[:add_link]\n @talk.talklinks.build\n render :action => 'new'\n elsif params[:remove_link]\n render :action => 'new'\n else\n respond_to do |format|\n if @talk.save\n format.html { redirect_to @talk, notice: 'Talk was successfully created.' }\n format.json { render json: @talk, status: :created, location: @talk }\n else\n format.html { render action: \"new\" }\n format.json { render json: @talk.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def social_media_links(*networks)\n options = networks.last.is_a?(Hash) ? networks.pop : { size: \"21x20\"}\n html = ''\n networks.to_a.each do |n|\n if n == 'rss'\n if options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n q = []\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (default)]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\")}, (only screen and (min-width: 1350px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/64x64/#{n}.png\")}, (only screen and (min-width: 1024px) and (max-width: 1349px))]\"\n q << \"[#{image_path(\"icons/#{options[:style]}/48x48/#{n}.png\")}, (only screen and (max-width: 768px))]\"\n\n image_tag(\"#{website.folder}/logo.png\",\n class: \"no-resize no-resize-for-small\",\n alt: Setting.site_name(website),\n data: { interchange: q.join(\", \") })\n html += link_to(image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle;\",\n size: options[:size],\n data: { interchange: q.join(\", \") }),\n rss_url(format: \"xml\"), target: \"_blank\")\n else\n html += link_to(image_tag(\"icons/#{n}.png\", style: \"vertical-align: middle;\", size: options[:size]), rss_url(format: \"xml\"), target: \"_blank\")\n end\n\n elsif v = website.value_for(n)\n unless v.blank?\n v = (v =~ /^https/i) ? v : \"https://www.#{n}.com/#{v}\"\n presentation = n\n if options[:style] == \"font-awesome\"\n presentation = fa_icon(\"#{n} 2x\", :\"aria-label\" => n)\n elsif options[:style] && File.exist?(Rails.root.join(\"app/assets/images/icons/#{options[:style]}/#{options[:size]}\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{options[:style]}/#{options[:size]}/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n elsif options[:gray]\n presentation = image_tag(\"social/social-gray-#{n.downcase}.png\",\n class: \"no-resize\",\n alt: n,\n :\"aria-label\" => n)\n elsif File.exist?(Rails.root.join(\"app/assets/images/icons\", \"#{n}.png\"))\n presentation = image_tag(\"icons/#{n}.png\",\n style: \"vertical-align: middle\",\n size: options[:size],\n alt: n,\n :\"aria-label\" => n)\n end\n html += link_to(presentation, v, target: \"_blank\", :\"aria-label\" => n)\n end\n end\n end\n raw(html)\n end",
"def create\n @url = request.format.json? ? Url.new(original_link: params[:original_link]) : Url.new(url_params)\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: 'URL was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def link_params\n params.require(:link).permit(:url)\n end",
"def link_params\n params.require(:link).permit(:url)\n end",
"def link_params\n params.require(:link).permit(:link, :name)\n end",
"def social_media_account_params\n params.require(:social_media_account).permit(:name, :url, :media_type)\n end",
"def link_params\n params.require(:link).permit(:address, :title, :summary, :vote_score, :subreddit_id, :user_id, :picture)\n end",
"def link_params\n params.require(:link).permit(:content_link, :image_link, :content_code_matcher, :location, :title, :client_code_matcher)\n end",
"def link_params\n params.require(:link).permit(:title, :URL, :html, :screenshot)\n end",
"def create\n @test_link = TestLink.new(test_link_params)\n\n if @test_link.save\n render :show, status: :created, location: @test_link\n else\n render json: @test_link.errors, status: :unprocessable_entity\n end\n end",
"def associate_social_links(type)\n type_name = type.to_s.capitalize\n lt = LinkType.find_by_name(type_name)\n \n args = [type]\n type_links = @item.links.where(:link_type_id => lt.id)\n if type_links.count > 0\n # do not search for results that have already been added to the item's links\n args << ' AND -link:' + type_links.collect { |l| l.link_url }.join(' -link:')\n end\n city_links = @item.links\n current_size = city_links.size\n extract_social_links(*args).each do |link|\n if !@item.links.map(&:link_url).include?(link)\n @item.links << Link.create(:link_type_id => lt.id, :link_url => link, :name => type_name)\n end\n end\n if current_size < @item.links.size\n WhiskBatter.new(@item).delay.associate_social_links(type)\n end\n end",
"def create\n @resources_and_link = ResourcesAndLink.new(params[:resources_and_link])\n\n respond_to do |format|\n if @resources_and_link.save\n format.html { redirect_to @resources_and_link, notice: 'Resources and link was successfully created.' }\n format.json { render json: @resources_and_link, status: :created, location: @resources_and_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resources_and_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_link(target)\n link = Link.new\n link.target_type = target.class.to_s\n link.target_id = target.id\n #adding a link to the link collection should set the polymorphic assosication\n links << link\n link\n end",
"def link_params\n params.require(:link).permit(:url, :description, :image_url, :user_id, :collection_id )\n end",
"def destroy\n @social_media_link.destroy\n\n head :no_content\n end",
"def create\n @link = Link.new(link_params)\n @link.active = true # make link active by default\n @link.admin_id = SecureRandom.uuid\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to link_admin_path(@link.admin_id), notice: \"Link was successfully created.\" }\n # format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recommended_link = RecommendedLink.new(recommended_link_params)\n\n if @recommended_link.save\n render json: @recommended_link, status: :created, location: @recommended_link\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end",
"def link_params\n params.require(:link).permit(:name, :target, :owners)\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"def post_to_legacy_incoming_webhook(channel:, username:, attachments:, link_names:, icon_url:)\n @client.post(@webhook_url) do |request|\n request.headers['Content-Type'] = 'application/json'\n request.body = {\n channel: channel,\n username: username,\n icon_url: icon_url,\n attachments: attachments,\n link_names: link_names\n }.to_json\n end\n end",
"def create\n \n\t# Cria o hash MD5 da string do link\n params[:link][:token] = Digest::MD5.hexdigest(params[:link][:link]).encode('UTF-8')\n\t\n\t# Obtem o ID do usuario\n\tparams[:link][:user_id] = session[:user_id]\n\t\n\t# Verifica se este hash ja nao existe no banco. MD5 gera conflitos, mas como sao \n\t# poucos links, isto nao sera problema.\n\t@link = Link.find_by_token params[:link][:token]\n\t\n\t# Variavel de verificacao para saber se o link foi salvo\n\tsave = 0\n\t\n\t# Se o link nao existir no banco...\n\tif @link.nil? then\n\t\n\t\t# Obtem os dados do usuario (IP e user agent)\n\t params[:link][:ip] = request.env[\"REMOTE_ADDR\"].encode('UTF-8')\n\t params[:link][:user_agent] = request.env[\"HTTP_USER_AGENT\"].encode('UTF-8')\n\t \n\t # Cria o registro\n\t @link = Link.new(params[:link]) \n\t \n\t # Salva, verifica o salvamento e atualiza a variavel para verificacao do salvamento\n\t save = @link.save ? 1 : 0\n\tend\n \t\n respond_to do |format|\n if save == 1\n format.html { redirect_to @link, notice: 'Link adicionado com sucesso!' }\n format.json { render json: @link, status: :created, location: @link }\n else\n format.html { redirect_to @link, notice: 'Link ja adicionado anteriormente!' }\n format.json { render json: @link, status: :created, location: @link }\n end\n end\n end",
"def create\n @link = Link.new(link_params)\n @link.user_id = session[:user_id]\n respond_to do |format|\n if @link.save\n format.html do\n redirect_to root_path,\n notice: \"Short Url is '#{@link.display_slug}'\"\n end\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users_interests_link = UsersInterestsLink.new(users_interests_link_params)\n\n respond_to do |format|\n if @users_interests_link.save\n format.html { redirect_to @users_interests_link, notice: 'Users interests link was successfully created.' }\n format.json { render :show, status: :created, location: @users_interests_link }\n else\n format.html { render :new }\n format.json { render json: @users_interests_link.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68485725",
"0.65721136",
"0.63500565",
"0.63243645",
"0.63008666",
"0.63003147",
"0.6095128",
"0.6095128",
"0.6065061",
"0.6063351",
"0.60328966",
"0.60203314",
"0.6003894",
"0.5997145",
"0.5907603",
"0.59010804",
"0.587946",
"0.5877939",
"0.58765703",
"0.58732164",
"0.58498985",
"0.5832909",
"0.5831984",
"0.5829303",
"0.58283925",
"0.58268905",
"0.5801219",
"0.578204",
"0.57616967",
"0.5741962",
"0.57373345",
"0.5693684",
"0.5680412",
"0.5679874",
"0.56760764",
"0.5667558",
"0.5658405",
"0.5655374",
"0.5653699",
"0.5642074",
"0.5629801",
"0.5625679",
"0.5613245",
"0.5611637",
"0.55857295",
"0.55794185",
"0.55794024",
"0.5573632",
"0.5569498",
"0.5560249",
"0.55571115",
"0.55534446",
"0.5546316",
"0.5505306",
"0.5501889",
"0.55004174",
"0.5499119",
"0.54975975",
"0.5495663",
"0.54942983",
"0.5491989",
"0.5474149",
"0.5470194",
"0.5463689",
"0.5460751",
"0.54591006",
"0.5457122",
"0.5441733",
"0.5439732",
"0.5429308",
"0.54251266",
"0.54229045",
"0.54182076",
"0.54143757",
"0.5412475",
"0.5409005",
"0.53944",
"0.5387532",
"0.53819615",
"0.53819615",
"0.5379924",
"0.5370997",
"0.53627807",
"0.536128",
"0.535982",
"0.5355352",
"0.5353615",
"0.53350186",
"0.5331992",
"0.5326984",
"0.53255725",
"0.5317459",
"0.5312188",
"0.5302764",
"0.52960694",
"0.52960694",
"0.52912915",
"0.52876097",
"0.5281369",
"0.5277669"
] |
0.7651989
|
0
|
PATCH/PUT /web/v1/social_media_links/1 PATCH/PUT /web/v1/social_media_links/1.json
|
def update
@social_media_link = SocialMediaLink.find(params[:id])
if @social_media_link.update(social_media_link_params)
head :no_content
else
render json: @social_media_link.errors, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n update_and_respond(@link, link_params)\n end",
"def update\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to links_path}\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, :notice => 'Ссылка была успешно обновлена' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @link = @entity.links.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n flash[:notice] = 'Link was successfully updated.'\n format.html { redirect_to link_url(@link) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: campaign_links_path }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @picture_link.update(picture_link_params)\n format.html { redirect_to @picture_link, notice: 'Picture link was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture_link }\n else\n format.html { render :edit }\n format.json { render json: @picture_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: \"Link was successfully updated.\" }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless is_owner? @link\n render :file => \"public/401.html\", :status => :unauthorized\n return\n end\n \n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_social_link_segment.update(api_v1_social_link_segment_params)\n format.html { redirect_to @api_v1_social_link_segment, notice: 'Social link segment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_social_link_segment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_social_link_segment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link.pot, flash: {success: 'Link wurde aktualisiert.'} }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n\n format.html { redirect_to link_admin_path(@link.admin_id), notice: \"Link was successfully updated.\" }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @social_networking.update(social_networking_params)\n render json: @social_networking, status: :ok\n else\n render json: @social_networking.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html do\n redirect_to new_link_path,\n notice: \"Link was successfully updated\"\n end\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: '투표안건이 성공적으로 수정되었습니다.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_news_link_photo.update(api_v1_news_link_photo_params)\n format.html { redirect_to @api_v1_news_link_photo, notice: 'News link photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_news_link_photo }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_news_link_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_news_link.update(api_v1_news_link_params)\n format.html { redirect_to @api_v1_news_link, notice: 'News link was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_news_link }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_news_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link_resource.update(link_resource_params)\n format.html { redirect_to @lab, notice: 'Link resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recommended_link = RecommendedLink.find(params[:id])\n\n if @recommended_link.update(recommended_link_params)\n head :no_content\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end",
"def update\n\t\tupdated_info = params.require(:rlink).permit(:link, :random_string)\n\t\trlink = Rlink.find(params[:id])\n\t\trlink.update_attributes(updated_info)\n\t\tredirect_to rlink\n\tend",
"def update\n @link = Link.find_by_slug(params[:id])\n\n respond_to do |format|\n if @link.user != @current_user\n flash[:error] = 'Unable to update links owned by other users.'\n format.html { render action: \"show\" }\n format.json { head :no_content }\n elsif @link.update_attributes(params[:link])\n format.html { redirect_to link_comments_url(@link), notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @useful_link = UsefulLink.find(params[:id])\n\n respond_to do |format|\n if @useful_link.update_attributes(params[:useful_link])\n format.html { redirect_to @useful_link, notice: 'Useful link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @useful_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @link = args[:link] if args.key?(:link)\n end",
"def update\n respond_to do |format|\n if @facebooklink.update(facebooklink_params)\n format.html { redirect_to @facebooklink, notice: 'Facebooklink was successfully updated.' }\n format.json { render :show, status: :ok, location: @facebooklink }\n else\n format.html { render :edit }\n format.json { render json: @facebooklink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if !@link.link.include? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def update\n @pending_recommended_link = PendingRecommendedLink.find(params[:id])\n\n if @pending_recommended_link.update(pending_recommended_link_params)\n head :no_content\n else\n render json: @pending_recommended_link.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @blog_link.update(blog_link_params)\n format.html { redirect_to @blog_link, notice: 'Blog link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blog_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message_link = MessageLink.find(params[:id])\n\n respond_to do |format|\n if @message_link.update_attributes(params[:message_link])\n format.html { redirect_to @message_link, notice: 'Message link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n if @resources_and_link.update_attributes(params[:resources_and_link])\n format.html { redirect_to @resources_and_link, notice: 'Resources and link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resources_and_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @talk = Talk.find(params[:id])\n if params[:add_link]\n unless params[:talk][:talklinks_attributes].blank?\n for attribute in params[:talk][:talklinks_attributes]\n @talk.talklinks.build(attribute.last.except(:_destroy)) unless attribute.last.has_key?(:id)\n end\n end\n @talk.talklinks.build\n render :action => 'edit'\n elsif params[:remove_link]\n removed_links = params[:talk][:talklinks_attributes].collect { |i, att| att[:id] if (att[:id] && att[:_destroy].to_i == 1) }\n Talklink.delete(removed_links)\n flash[:notice] = \"Links removed.\"\n for attribute in params[:talk][:talklinks_attributes]\n @talk.talklinks.build(attribute.last.except(:_destroy)) if (!attribute.last.has_key?(:id) && attribute.last[:_destroy].to_i == 0)\n end\n render :action => 'edit'\n else\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to @talk, notice: 'Talk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @talk.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n\n @social = Social.find(params[:id])\n\n respond_to do |format|\n if @social.update_attributes(params[:social])\n format.html { redirect_to '/', notice: 'Social was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @social.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @social_media_links_box.attributes = params[:social_media_links_box]\n\n respond_to do |format|\n if @commit_type == 'preview' && @social_media_links_box.valid?\n format.html { render :template => 'admin/shared/update_preview', :locals => { :record => @social_media_links_box }, :layout => 'admin/admin_preview' }\n format.xml { render :xml => @social_media_links_box, :status => :created, :location => @social_media_links_box }\n elsif @commit_type == 'save' && @social_media_links_box.save(:user => current_user)\n format.html { render 'admin/shared/update' }\n format.xml { head :ok }\n else\n format.html { render :template => 'admin/shared/edit', :locals => { :record => @social_media_links_box }, :status => :unprocessable_entity }\n format.xml { render :xml => @social_media_links_box.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n params[:link].delete(\"uploaded_data\") #if params[:link][:uploaded_data] == ''\n if @link.update_attributes(params[:link])\n flash[:notice] = 'Link was successfully updated.'\n format.html { redirect_to :controller => 'admin/links', :action => 'index', :id => @link.id }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n puts link_params\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_social_link\n @social_link = SocialLink.find(params[:id])\n end",
"def update\n @link = Link.find(params[:id])\n \n respond_to do |format|\n if @link.update_attributes(params[:link])\n flash[:notice] = 'Link was successfully updated.'\n format.html { redirect_to(@link) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @url_link.update(url_link_params)\n format.html { redirect_to @url_link, notice: 'Url link was successfully updated.' }\n format.json { render :show, status: :ok, location: @url_link }\n else\n format.html { render :edit }\n format.json { render json: @url_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @shortlink.update(shortlink_params)\n format.html { redirect_to shortlinks_path, notice: 'Shortlink was successfully updated.' }\n format.json { render :show, status: :ok, location: @shortlink }\n else\n format.html { render :edit }\n format.json { render json: @shortlink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attr\n #sanity checks \n @persona = current_persona\n @mediaset = @persona.mediasets.find(params[:id])\n \n respond_to do |format|\n @mediaset.update_attributes( params[:mediaset] )\n format.json{ respond_with_bip(@mediaset) }\n end\n end",
"def update\n\t\tlink = current_user.links.find(params[:id])\n\n\t\trespond_to do | format |\n\t\t\tif link.update_attributes(link_params)\n\t\t\t\tformat.html{\n\t\t\t\t\tredirect_to link\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tformat.html{\n\t\t\t\t\trender action: \"edit\"\n\t\t\t\t}\n\t\t\tend\n\n\t\tend \n\tend",
"def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @link = args[:link] if args.key?(:link)\n end",
"def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to(@link, :notice => 'Link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to(@link, :notice => 'Link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to(@link, :notice => 'Link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to(@link, :notice => 'Link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @file_link.update(file_link_params)\n format.html { redirect_to @file_link, notice: 'File link - объект успешно изменён.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socialmediasite.update(socialmediasite_params)\n format.html { redirect_to @socialmediasite, notice: 'Socialmediasite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socialmediasite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mwod_video_link = MwodVideoLink.find(params[:id])\n\n respond_to do |format|\n if @mwod_video_link.update_attributes(params[:mwod_video_link])\n format.html { redirect_to @mwod_video_link, notice: 'Mwod video link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mwod_video_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @deeplink_info = args[:deeplink_info] if args.key?(:deeplink_info)\n @kg_provider_key = args[:kg_provider_key] if args.key?(:kg_provider_key)\n @media_id = args[:media_id] if args.key?(:media_id)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n @provider_name = args[:provider_name] if args.key?(:provider_name)\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n flash[:notice] = 'Link was successfully updated.'\n format.html { redirect_to(@link) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n flash[:notice] = 'Link was successfully updated.'\n format.html { redirect_to(@link) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @social.update(social_params)\n format.html { redirect_to @social, notice: 'Social was successfully updated.' }\n format.json { render :show, status: :ok, location: @social }\n else\n format.html { render :edit }\n format.json { render json: @social.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @social.update(social_params)\n format.html { redirect_to @social, notice: 'Social was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @social.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @link_attachment.update(link_attachment_params)\n format.html { redirect_to @link_attachment, notice: 'Link attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @social_network.update(admin_social_network_params)\n format.html { redirect_to admin_videos_url, notice: 'Social network was successfully updated.' }\n format.json { render :show, status: :ok, location: @social_network }\n else\n format.html { render :edit }\n format.json { render json: @social_network.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @link = args[:link] if args.key?(:link)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @friend_link.update(friend_link_params)\n format.html { redirect_to admin_friend_link_url(@friend_link), notice: 'Friend link was successfully updated.' }\n format.json { render :show, status: :ok, location: @friend_link }\n else\n format.html { render :edit }\n format.json { render json: @friend_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n if request.referrer.split('/').last == \"preview\"\n format.html { redirect_to link_preview_path(@link), notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n end\n else\n if request.referrer.split('/').last == \"preview\"\n @from_preview = true\n format.html { render \"form_preview\", :layout => \"preview\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @static_link = StaticLink.find(params[:id])\n\n respond_to do |format|\n if @static_link.update_attributes(params[:static_link])\n format.html { redirect_to(static_links_path, :notice => 'Static link was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @static_link.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @link = args[:link] if args.key?(:link)\n @video = args[:video] if args.key?(:video)\n end",
"def social_link_params\n params.require(:social_media_link).permit(:title, :url, :image_url)\n end",
"def update\n respond_to do |format|\n if @externalformlink.update(externalformlink_params)\n format.html { redirect_to @externalformlink, notice: 'Externalformlink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @externalformlink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @link.update(links_params)\n redirect_to link_path(@link)\n else\n flash[:errors] = @link.errors.full_messages\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @users_interests_link.update(users_interests_link_params)\n format.html { redirect_to @users_interests_link, notice: 'Users interests link was successfully updated.' }\n format.json { render :show, status: :ok, location: @users_interests_link }\n else\n format.html { render :edit }\n format.json { render json: @users_interests_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @alternate_link = args[:alternate_link] if args.key?(:alternate_link)\n @id = args[:id] if args.key?(:id)\n @thumbnail_url = args[:thumbnail_url] if args.key?(:thumbnail_url)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @alternate_link = args[:alternate_link] if args.key?(:alternate_link)\n @id = args[:id] if args.key?(:id)\n @thumbnail_url = args[:thumbnail_url] if args.key?(:thumbnail_url)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @child_link = args[:child_link] if args.key?(:child_link)\n @created = args[:created] if args.key?(:created)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @permissions = args[:permissions] if args.key?(:permissions)\n @self_link = args[:self_link] if args.key?(:self_link)\n @starred = args[:starred] if args.key?(:starred)\n @updated = args[:updated] if args.key?(:updated)\n end",
"def update_metadata\n response = Net::HTTP.post(URI('https://api.linkpreview.net'),\n { 'key' => ENV['LINKPREVIEW_API_KEY'],\n 'q' => self.url }.to_json)\n\n body = JSON.parse(response.body)\n self.title = body['title']\n self.image = body['image']\n self.description = body['description']\n save\n end",
"def update_payment_link(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/online-checkout/payment-links/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n @publink = Publink.find(params[:id])\n\n respond_to do |format|\n if @publink.update_attributes(params[:publink])\n format.html { redirect_to @publink, notice: 'Publink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @affiliate_link = AffiliateLink.find(params[:id])\n\n respond_to do |format|\n if @affiliate_link.update_attributes(params[:affiliate_link])\n format.html { redirect_to @affiliate_link, notice: 'Affiliate link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @affiliate_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @social_media_link = SocialMediaLink.new(social_media_link_params)\n\n if @social_media_link.save\n render json: @social_media_link, status: :created\n else\n render json: @social_media_link.errors, status: :unprocessable_entity\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @demo_link.update(demo_link_params)\n format.html { redirect_to @demo_link, notice: 'Demo link was successfully updated.' }\n format.json { render :show, status: :ok, location: @demo_link }\n else\n format.html { render :edit }\n format.json { render json: @demo_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @deeplink_url = args[:deeplink_url] if args.key?(:deeplink_url)\n @provider_mid = args[:provider_mid] if args.key?(:provider_mid)\n end",
"def update\n respond_to do |format|\n if @social_media_account.update(social_media_account_params)\n format.html { redirect_to @social_media_account, notice: 'Social media account was successfully updated.' }\n format.json { render :show, status: :ok, location: @social_media_account }\n else\n format.html { render :edit }\n format.json { render json: @social_media_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @linkpost.update(linkpost_params)\n format.html { redirect_to @linkpost, notice: 'Linkpost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @linkpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @importance_as_embedder = args[:importance_as_embedder] if args.key?(:importance_as_embedder)\n @link_info = args[:link_info] if args.key?(:link_info)\n end",
"def update\n respond_to do |format|\n if @bundlelink.update(bundlelink_params)\n format.html { redirect_to @bundlelink, notice: 'Bundlelink was successfully updated.' }\n format.json { render :show, status: :ok, location: @bundlelink }\n else\n format.html { render :edit }\n format.json { render json: @bundlelink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @external_link = ExternalLink.find(params[:id])\n\n respond_to do |format|\n if @external_link.update_attributes(params[:external_link])\n format.html { redirect_to(backend_social_path, :notice => 'Successfully updated.') }\n format.js { render 'update_lock', :locals => { :link => @external_link } } # Render JS for the confidentiality form call by Ajax\n else\n # We redirect to BackEnd Social path with only the first error in the alert.\n # If many errors happens, only the first one is displayed.\n format.html { redirect_to(backend_social_path, :alert => @external_link.errors.full_messages[0]) }\n end\n end\n end",
"def update\n @storylink = Storylink.find(params[:id])\n\n respond_to do |format|\n if @storylink.update_attributes(params[:storylink])\n format.html { redirect_to @storylink, notice: 'Storylink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storylink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_link\n @link = SiteSocialLink.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @api_v1_news_link_comment.update(api_v1_news_link_comment_params)\n format.html { redirect_to @api_v1_news_link_comment, notice: 'News link comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_news_link_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_news_link_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @account_link.update(account_link_params)\n format.html { redirect_to @account_link.user, notice: 'Account link was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_link }\n else\n format.html { render :edit }\n format.json { render json: @account_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @test_link.update(test_link_params)\n render :show, status: :ok, location: @test_link\n else\n render json: @test_link.errors, status: :unprocessable_entity\n end\n end",
"def update\n @admin_social_medium = Admin::SocialMedium.find(params[:id])\n\n respond_to do |format|\n if @admin_social_medium.update_attributes(params[:admin_social_medium])\n format.html { redirect_to admin_suppliers_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_social_medium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tasklink = Tasklink.find(params[:id])\n\n respond_to do |format|\n if @tasklink.update_attributes(params[:tasklink])\n format.html { redirect_to @tasklink, notice: 'Tasklink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasklink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_news_link_photo\n @api_v1_news_link_photo = Api::V1::NewsLinkPhoto.find(params[:id])\n end",
"def update_link_with_http_info(id, api_link, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#update_link ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling update_link\" if id.nil?\n \n # verify the required parameter 'api_link' is set\n fail \"Missing the required parameter 'api_link' when calling update_link\" if api_link.nil?\n \n # resource path\n path = \"/Projects/{id}/Links\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_link)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'APILink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#update_link\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.6750588",
"0.65170574",
"0.643401",
"0.639264",
"0.63316154",
"0.6331006",
"0.6331006",
"0.6295515",
"0.6276486",
"0.6236992",
"0.61880696",
"0.61870164",
"0.61870164",
"0.61870164",
"0.61870164",
"0.61870164",
"0.6184048",
"0.6168081",
"0.61482316",
"0.61446023",
"0.6133894",
"0.6132312",
"0.6126928",
"0.6126899",
"0.61257374",
"0.6111257",
"0.6089404",
"0.6079235",
"0.60751027",
"0.6061789",
"0.60517573",
"0.60387003",
"0.601574",
"0.6004156",
"0.596222",
"0.5955235",
"0.59508157",
"0.5937635",
"0.5937367",
"0.5933683",
"0.5932917",
"0.59320563",
"0.59271693",
"0.591903",
"0.5912707",
"0.5909947",
"0.5904087",
"0.5901667",
"0.586749",
"0.5859311",
"0.5859264",
"0.5854796",
"0.5852233",
"0.5852233",
"0.5852233",
"0.5852233",
"0.5844442",
"0.5843365",
"0.58412576",
"0.5836289",
"0.5822602",
"0.5822602",
"0.58213866",
"0.581751",
"0.57998335",
"0.5795428",
"0.57830787",
"0.57770973",
"0.5771915",
"0.5757509",
"0.5752614",
"0.57490516",
"0.5746854",
"0.5742985",
"0.5741943",
"0.5732971",
"0.5732971",
"0.572621",
"0.5722379",
"0.57072234",
"0.5674535",
"0.56704706",
"0.5659327",
"0.5654476",
"0.5633764",
"0.5628107",
"0.5615151",
"0.5608921",
"0.55958843",
"0.5594345",
"0.55938745",
"0.5581638",
"0.55815274",
"0.557297",
"0.5554321",
"0.55516934",
"0.5544482",
"0.55430615",
"0.55327016",
"0.55267996"
] |
0.7439518
|
0
|
DELETE /web/v1/social_media_links/1 DELETE /web/v1/social_media_links/1.json
|
def destroy
@social_media_link.destroy
head :no_content
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @socialmediasite.destroy\n respond_to do |format|\n format.html { redirect_to socialmediasites_url }\n format.json { head :no_content }\n end\n end",
"def deleteEntitySocialmedia( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/socialmedia\",params)\n end",
"def destroy\n @social_media.destroy\n respond_to do |format|\n format.html { redirect_to url_back, notice: 'social media was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @social_networking.destroy\n\n render json: @social_networking, status: :ok\n end",
"def destroy\n @external_link = ExternalLink.find(params[:id])\n @external_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(backend_social_path) }\n end\n end",
"def destroy\n @admin_social_medium = Admin::SocialMedium.find(params[:id])\n @admin_social_medium.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_social_media_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socialmedium = Socialmedium.find(params[:id])\n @socialmedium.destroy\n\n respond_to do |format|\n format.html { redirect_to socialmedia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: '투표안건이 성공적으로 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy_and_respond(@link)\n end",
"def destroy\n @social = Social.find(params[:id])\n @social.destroy\n\n respond_to do |format|\n format.html { redirect_to '/' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = @entity.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_v1_social_link_segment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_social_link_segments_url, notice: 'Social link segment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @social.destroy\n respond_to do |format|\n format.html { redirect_to socials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_news_link_photo.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_news_link_photos_url, notice: 'News link photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @externalformlink.destroy\n respond_to do |format|\n format.html { redirect_to externalformlinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully deleted.\" }\n format.json { head :no_content }\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 @facebooklink.destroy\n respond_to do |format|\n format.html { redirect_to facebooklinks_url, notice: 'Facebooklink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_link.destroy\n respond_to do |format|\n format.html { redirect_to blog_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @useful_link = UsefulLink.find(params[:id])\n @useful_link.destroy\n\n respond_to do |format|\n format.html { redirect_to useful_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html do\n redirect_to root_path,\n notice: \"Link was successfully deleted\"\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @affiliate_link = AffiliateLink.find(params[:id])\n @affiliate_link.destroy\n\n respond_to do |format|\n format.html { redirect_to affiliate_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shared_url = SharedUrl.find(params[:id])\n @shared_url.destroy\n\n respond_to do |format|\n format.html { redirect_to shared_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resources_and_link = ResourcesAndLink.find(params[:id])\n @resources_and_link.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_and_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @picture_link.destroy\n respond_to do |format|\n format.html { redirect_to picture_links_url, notice: 'Picture link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to new_link_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @social_network = SocialNetwork.find(params[:id])\n @social_network.destroy\n\n respond_to do |format|\n format.html { redirect_to social_networks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message_link = MessageLink.find(params[:id])\n @message_link.destroy\n\n respond_to do |format|\n format.html { redirect_to message_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @social_media_account.destroy\n respond_to do |format|\n format.html { redirect_to social_media_accounts_url, notice: 'Social media account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @file_link.destroy\n respond_to do |format|\n format.html { redirect_to file_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rede_social.destroy\n respond_to do |format|\n format.html { redirect_to \"/show_rede_social/#{@artist_data.id}/adm/remover\", notice: 'Rede social was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url_link.destroy\n respond_to do |format|\n format.html { redirect_to url_links_url, notice: 'Url link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appdotnet_social = AppdotnetSocial.find(params[:id])\n @appdotnet_social.destroy\n\n respond_to do |format|\n format.html { redirect_to appdotnet_socials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link_attachment.destroy\n respond_to do |format|\n format.html { redirect_to link_attachments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linkpost.destroy\n respond_to do |format|\n format.html { redirect_to linkposts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @static_link = StaticLink.find(params[:id])\n @static_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(static_links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to('/') }\n end\n end",
"def destroy\n @publink = Publink.find(params[:id])\n @publink.destroy\n\n respond_to do |format|\n format.html { redirect_to publinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storylink = Storylink.find(params[:id])\n @storylink.destroy\n\n respond_to do |format|\n format.html { redirect_to storylinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mwod_video_link = MwodVideoLink.find(params[:id])\n @mwod_video_link.destroy\n\n respond_to do |format|\n format.html { redirect_to mwod_video_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @social_network.destroy\n respond_to do |format|\n format.html { redirect_to admin_social_networks_url, notice: 'Social network was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shortlink.destroy\n respond_to do |format|\n format.html { redirect_to shortlinks_url, notice: 'Shortlink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find_by_slug(params[:id])\n @link.comments.each do |c|\n c.destroy\n end\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'BLAM! Link was thoroughly destroyed!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def delete_media_by_id id\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/media/{id}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"id\" => id,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"Content-Type\" => Configuration.content_type\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params headers\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.delete query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n else \r\n puts \"Media ID Deleted\"\r\n end\r\n\r\n response.body\r\n end",
"def destroy\n @facebook_share.destroy\n respond_to do |format|\n format.html { redirect_to facebook_shares_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Review was successfully destroyed.' }\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 @jakeslink = Jakeslink.find(params[:id])\n @jakeslink.destroy\n\n respond_to do |format|\n format.html { redirect_to jakeslinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @media_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to media_interests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def delete(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Delete.new(href, headers)\n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end",
"def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\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 @social_account = SocialAccount.find(params[:id])\n @social_account.destroy\n\n respond_to do |format|\n format.html { redirect_to social_accounts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demo_link.destroy\n respond_to do |format|\n format.html { redirect_to demo_links_url, notice: 'Demo link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_media_entry.destroy\n respond_to do |format|\n format.html { redirect_to custom_media_entries_url, notice: 'Custom media entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_interests_link.destroy\n respond_to do |format|\n format.html { redirect_to users_interests_links_url, notice: 'Users interests link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url = ShortenedUrl.find(params[:id])\n @url.destroy\n\n respond_to do |format|\n format.html { redirect_to shortened_url_index_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 link_delete\n @linkalation = Linkalation.find_by_link_id_and_user_id(params[:link], current_user.id)\n\n @linkalation[0].destroy\n\n render :nothing => true\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @media_share = MediaShare.find(params[:id])\n @media_share.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_shares_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @media_item = MediaItem.find(params[:id])\n @media_item.destroy\n\n respond_to do |format|\n format.html { redirect_to media_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless is_owner? @link\n render :file => \"public/401.html\", :status => :unauthorized\n return\n end\n \n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @medium = Medium.find(params[:id])\n @medium.destroy\n \n respond_to do |format|\n format.html { redirect_to media_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recomendacion_link.destroy\n respond_to do |format|\n format.html { redirect_to recomendacion_links_url, notice: 'Recomendacion link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @linkctr.destroy\n respond_to do |format|\n format.html { redirect_to linkctrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium.destroy\n respond_to do |format|\n format.html { redirect_to media_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maptolinkedin = Maptolinkedin.find(params[:id])\n @maptolinkedin.destroy\n\n respond_to do |format|\n format.html { redirect_to maptolinkedins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @medium = Medium.find(params[:id])\n @medium.destroy\n\n respond_to do |format|\n format.html { redirect_to media_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @media_scope.destroy\n\n respond_to do |format|\n format.html { redirect_to media_scopes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\n unless params[:id]\n render json: {message: \" اطلاعات را به صورت کامل بفرستید \"}, status: 400\n return\n end\n\n social = @current_user.socials.where( id: params[:id]).last\n\n if social\n if social.destroy\n render json: { message: \" شبکه اجتماعی حذف شد \" } , status: 200\n else\n render json: social.errors , status: 400\n end\n else\n render json: { message: \" شبکه اجتماعی مورد نظر یافت نشد \" } , status: 404\n end\n\n end"
] |
[
"0.73718107",
"0.71441627",
"0.71324843",
"0.7110764",
"0.7102097",
"0.70915425",
"0.7089046",
"0.707747",
"0.707747",
"0.707747",
"0.7061057",
"0.7054068",
"0.70427334",
"0.70143884",
"0.70143884",
"0.6983173",
"0.69804746",
"0.6972959",
"0.6968577",
"0.6955308",
"0.69397485",
"0.69303066",
"0.69144017",
"0.68926555",
"0.689216",
"0.6887752",
"0.68563247",
"0.68563247",
"0.68563247",
"0.68563247",
"0.68563247",
"0.68563247",
"0.68563247",
"0.68563247",
"0.6853811",
"0.6850637",
"0.6850302",
"0.68442583",
"0.6842174",
"0.6835585",
"0.6819253",
"0.68180436",
"0.68066967",
"0.680427",
"0.67737514",
"0.67699736",
"0.6767741",
"0.6752332",
"0.6738422",
"0.6729856",
"0.67294866",
"0.6728567",
"0.67261475",
"0.6707696",
"0.66884035",
"0.668192",
"0.6677534",
"0.66717416",
"0.66707635",
"0.66683805",
"0.6649063",
"0.66364735",
"0.6606552",
"0.6603871",
"0.6601604",
"0.6601604",
"0.6601604",
"0.6601604",
"0.6601604",
"0.6601604",
"0.6577329",
"0.6576155",
"0.6567184",
"0.65617645",
"0.6556703",
"0.6553799",
"0.65218204",
"0.6514936",
"0.6508552",
"0.65072787",
"0.6504228",
"0.64924616",
"0.6489402",
"0.6488586",
"0.64854056",
"0.64751744",
"0.64624834",
"0.6458716",
"0.6458242",
"0.64542145",
"0.6433547",
"0.64332193",
"0.6432003",
"0.6427622",
"0.642074",
"0.64096636",
"0.64069337",
"0.640032",
"0.6398776",
"0.6398366"
] |
0.77380455
|
0
|
a new Array that contains all elements from both Array arguments, with the elements taken in alternation. You may assume that both input Arrays are nonempty, and that they have the same number of elements. Example: interleave([1, 2, 3], ['a', 'b', 'c']) == [1, 'a', 2, 'b', 3, 'c'] PEDAC: Understand the Problem: > Input: two arrays > Output: one array (new) > Requirements: must take two arrays as arguments must return new array with elements of each arg arr combined > the elements in return array must alternate bewteen two arg array elements (eg: 1, 'a', 2, 'b' etc) arrays can contain any type of value > Rules: size limit to arrays? nested elements? arrays are not empty arrays have the same number of elements Examples: interleave([1, 2, 3], ['a', 'b', 'c']) == [1, 'a', 2, 'b', 3, 'c'] Data Structures: starting with two arrays, we will create a return_array to hold the alternating values from each of the arguments set counter to 0 start a conditional loop that runs until the size of return_array is equal to the combined sizes of the two arg arrs. if the counter value is 0 or odd, it will shovel arr1 shift into return_array if the counter value is odd, it will shovel arr2 shift into return_array return the new array Algorithm: > Pseudo: START DEFINE interleave(arr1, arr2) SET return_array = [] SET counter = 1 UNTIL arr2 is empty IF counter is odd return_array << arr1.shift counter += 1 ELSE return_array << arr2.shift counter += 1 END END RETURN return_array END Code with Intent: this method works, but removes the values from the arrays, mutating them permanently
|
def interleave(arr1, arr2)
return_array = []
counter = 1
until arr2.empty?
if counter.odd?
return_array << arr1.shift
counter += 1
else
return_array << arr2.shift
counter += 1
end
end
return_array
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def interleave(arr1, arr2)\n new_array = []\n for i in 1..(arr1.size)\n new_array << arr1[(i-1)]\n new_array << arr2[(i-1)]\n end\n new_array\nend",
"def interleave(arr1, arr2)\n return_array = arr1.zip(arr2).flatten\nend",
"def interleave(array1, array2)\n return_array = []\n\n until array2.empty?\n return_array << array1.shift(1)\n return_array << array2.shift(1)\n end\n return_array.flatten\nend",
"def interleave ( arr1 , arr2 )\n\tc = []\n\tif arr1.length > arr2.length \n\t\ta=arr1\n\t\tb=arr2\n\telse\n \t\ta=arr2\n \t\tb=arr1\n\tend\n\tc = a.slice(b.length..a.length-1)\n\treturn b.zip(a).flatten(1).slice!(0..b.length*2 -1) + c\nend",
"def interleave(arr1, arr2)\n counter = 0\n new_arr = []\n while counter < arr1.size\n new_arr << arr1[counter]\n new_arr << arr2[counter]\n counter += 1\n end\n\n new_arr\nend",
"def interleave(array1, array2)\n result = []\n array1.size.times do |index|\n result << array1[index] << array2[index]\n end\n result \nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.size.times{ |idx| new_arr << arr1[idx] << arr2[idx] }\n new_arr\nend",
"def interleave(arr1, arr2)\n output_arr = []\n arr1.size.times do |idx|\n output_arr << arr1[idx]\n output_arr << arr2[idx]\n end\n output_arr\nend",
"def interleave(arr_1, arr_2)\n current_index = 0\n combined_arr = []\n while current_index < arr_1.size\n combined_arr.push(arr_1[current_index])\n combined_arr.push(arr_2[current_index])\n current_index += 1\n end\n \n combined_arr\nend",
"def interleave2(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(arr1, arr2)\r\n combined_arr = []\r\n counter = 0\r\n arr1.size.times do\r\n combined_arr << arr1[counter]\r\n combined_arr << arr2[counter]\r\n counter += 1\r\n end\r\n combined_arr\r\nend",
"def interleave(arr_1, arr_2)\n arr_1.zip(arr_2).flatten\nend",
"def interleave(array1, array2)\n combo_size = array1.size + array2.size\n combo_array = []\n index = 0\n \n until combo_array.size == combo_size\n combo_array << array1[index] << array2[index]\n index += 1\n end\n \n combo_array\nend",
"def interleave(arr1, arr2)\n return_array = []\n arr1.each_with_index do |element, index|\n return_array << element << arr2[index]\n end\nend",
"def interleave(array1, array2)\n results_array = []\n counter = 0 \n loop do \n results_array << array1[counter]\n results_array << array2[counter]\n counter += 1 \n break if counter >= array1.size\n end \n \n results_array\nend",
"def interleave(array_1, array_2)\n interwoven_array = []\n\n array_1.each_with_index do |element, index|\n interwoven_array << element << array_2[index]\n end\n\n interwoven_array\nend",
"def interleave(arr1, arr2)\n\tnew_arr = []\n\tcounter = 0\n\tloop do\n\t\tbreak if counter == arr1.size \n\t\tnew_arr << arr1[counter]\n\t\tnew_arr << arr2[counter]\n\t\tcounter += 1\n\tend\t\n\tnew_arr\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1,arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave2(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(array1, array2)\n new = []\n size = array1.size\n size.times do |x|\n new.push(array1[x], array2[x])\n end\n new\nend",
"def interleave(array1, array2)\n p array1.zip(array2).flatten\nend",
"def interleave(array_1, array_2)\n results_array = []\n array_1.each_with_index do |elem, index|\n results_array << elem << array_2[index]\n end\n results_array\nend",
"def interleave(array1, array2)\n result = []\n array1.each_index { |i| result << [array1[i], array2[i]] }\n result.flatten\nend",
"def interleave(array1, array2)\n new_array = []\n array1.each_with_index do |element, index|\n new_array << element << array2[index]\n end\n new_array\nend",
"def interleave(array_1, array_2)\n new_array = []\n total_elements = array_1.length + array_2.length\n array_1_current_idx, array_2_current_idx = 0 , 0\n\n total_elements.times do |current_iteration|\n if current_iteration.odd?\n new_array.push(array_2[array_2_current_idx])\n array_2_current_idx += 1\n else\n new_array.push(array_1[array_1_current_idx])\n array_1_current_idx += 1\n end\n end\n\n new_array\nend",
"def interleave(arr1, arr2)\n count = arr1.size\n interleaved = []\n count.times do\n interleaved << arr1.shift\n interleaved << arr2.shift\n end\n interleaved\nend",
"def interleave(arr1, arr2)\n index = 0\n results = []\n arr1.size.times do\n results << arr1[index] << arr2[index]\n index += 1\n end\n results\nend",
"def interleave(arr1, arr2)\n # new_arr = []\n # arr1.size.times do |count|\n # new_arr << arr1[count] << arr2[count]\n # end\n # new_arr\n\n # using Array#zip and Array#flatten\n arr1.zip(arr2).flatten\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def interleave(array_1, array_2)\n result = []\n # https://ruby-doc.com/core-2.7.2/Enumerator.html#method-i-each_with_index\n array_1.each_with_index do |element, index|\n result << element << array_2[index]\n end\n result\nend",
"def interleave(arr1, arr2)\n idx = 0\n combined = []\n arr1.size.times do\n combined << arr1[idx] << arr2[idx]\n idx += 1\n end\n combined\nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.each_with_index do |_, index|\n new_arr << arr1[index]\n new_arr << arr2[index]\n end\n new_arr\nend",
"def interleave a,b\n arr1 = []\n for i in (0...a.size)\n arr1 << a[i] << b[i]\n end\n arr1\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |value, index|\n result << value << array2[index]\n end\n result\nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.each_with_index do |element, index|\n new_arr << arr1[index]\n new_arr << arr2[index]\n end\n new_arr\nend",
"def interleave(arr1, arr2)\n interleaved = []\n\n i = 0\n loop do\n interleaved << arr1[i] << arr2[i]\n i += 1\n break if i >= arr1.size\n end\n\n interleaved\nend",
"def interleave(arr1, arr2)\n inter_arr = []\n idx = 0\n\n loop do\n inter_arr << arr1[idx]\n inter_arr << arr2[idx]\n \n idx += 1\n break if idx >= arr2.length\n end\n inter_arr\nend",
"def interleave(arr1, arr2)\n index = 0\n output = []\n loop do |num|\n output << arr1[index] \n output << arr2[index]\n index += 1\n break if index == arr1.size\n end\n output\nend",
"def interleave(a1, a2)\n # new_array = []\n # index = 0\n # while index < a1.size\n # new_array.push(a1[index])\n # new_array.push(a2[index])\n # index += 1\n # end\n # new_array\n # LS solution\n # result = []\n # array1.each_with_index do |element, index|\n # result << element << array2[index]\n # end\n # result\n a1.zip(a2).flatten\nend",
"def interleave(ary1, ary2)\n new_ary = []\n ary1.size == ary2.size ? elements = 3 : elements = 0\n count = 0\n elements.times do\n new_ary << ary1[count]\n new_ary << ary2[count]\n count += 1\n end\n elements != 0 ? new_ary : nil\nend",
"def interleave(arr1, arr2)\n result = []\n arr1.each_with_index do |elem, indx|\n result << elem << arr2[indx]\n end\n result\nend",
"def interleave(arr1, arr2)\n arr3 = []\n arr1.each_with_index do |element, idx|\n arr3 << element << arr2[idx]\n end\n arr3\nend",
"def interleave(first, second)\n new_array = []\n\n first.each_with_index do |element, index|\n new_array << element\n new_array << second[index]\n end\n\n new_array\nend",
"def interleave(array1, array2)\n new_array = []\n if array1.size != array2.size\n puts \"Arrays are different size\"\n else\n array1.each_with_index do |v, i|\n new_array << v \n new_array << array2[i]\n end\n end\n new_array\nend",
"def interleave(arr1, arr2)\n results = []\n arr1.each.with_index do |el,idx|\n results << el << arr2[idx]\n end\n results\nend",
"def interleave(a, b)\n a.zip(b).flatten\nend",
"def interleave(*arrays)\n return [] if arrays.empty?\n inter_array = []\n\n arrays.max_by(&:length).size.times do |index|\n arrays.each { |array| inter_array << array[index] }\n end\n\n inter_array\nend",
"def interleave(arr1, arr2)\n combined = []\n\n arr1.each_with_index do |item, index|\n combined.push(arr1[index])\n combined.push(arr2[index])\n end\n\n combined\nend",
"def interleave(ary1, ary2)\n ary1.zip(ary2).flatten\nend",
"def interleave(ary1, ary2)\n ary = []\n ary1.size == ary2.size ? ary.push(ary1.shift) : ary.push(ary2.shift) until ary2.empty?\n ary\nend",
"def interleave(array1, array2)\n counter = 1\n index = 0\n loop do\n array1.insert(counter, array2[index])\n counter += 2\n index += 1\n break if index >= array2.size\n end\n array1\nend",
"def interleave(a,b)\n longer = smaller = []\n a.size > b.size ? longer = a : longer = b\n a.size > b.size ? smaller = b : smaller = a #can't figure how to shorten this/ make less redundant\n return a.zip(b).flatten.concat(longer[smaller.size..longer.size])\n\n end",
"def interleave(arr1, arr2)\n results = []\n\n arr1.each_with_index do |el, i|\n results << el << arr2[i]\n # results << el << arr2[arr1.index(el)] ## if you wanted to do it without index as block param\n end\n\n results\nend",
"def interleave(list1, list2)\n (list1.zip list2).flatten\nend",
"def interleave(list1, list2)\n combined = []\n list1.each_index do |idx|\n combined << list1[idx]\n combined << list2[idx]\n end\n combined\nend",
"def interzip(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(list1, list2)\n combined_list = []\n list1.each_with_index do |elem, index|\n combined_list << elem\n combined_list << list2[index]\n end\n combined_list\nend",
"def join_arrays array_one, array_two\n\t\tarray_one.shift\n\t\tarray_two.pop\n\t\tarray_one & array_two\n\tend",
"def merge_arrays(arr_one, arr_two)\n ret = []\n while arr_one.length > 0 || arr_two.length > 0\n if arr_one[0] < arr_two[0]\n ret << arr_one.shift\n elsif arr_two[0] < arr_one[0]\n ret << arr_two.shift\n elsif arr_two.empty?\n ret += arr_one\n elsif arr_one.empty?\n ret += arr_two\n else\n ret\n end\n end\n ret\nend",
"def combine_zip(a, b)\n if a.length < b.length\n # fill in if a shorter than b\n a += Array.new(b.length - a.length)\n end\n a.zip(b).flatten!\nend",
"def merge(arr1, arr2)\n arr1 | arr2\nend",
"def merge(arr1, arr2)\n arr1 | arr2\nend",
"def merge(arr1, arr2)\n arr1 | arr2\nend",
"def merge(array1, array2)\n array1 | array2\nend",
"def interleaver(arr1, arr2)\n arr1.map.with_index { |el, idx| [el, arr2[idx]] }.flatten\nend",
"def array_concat(array_1, array_2)\n\tnew_array = []\n\ti = 0\n\twhile i < array_1.length\n\t\tnew_array[i] = array_1[i]\n\t\ti += 1\n\tend\n\tj = 0\n\twhile j < array_2.length\n\t\tnew_array[i+j] = array_2[j]\n\t\tj += 1\n\tend\n\treturn new_array\nend",
"def merger(arr1, arr2)\n merged = []\n\n until arr1.empty? || arr2.empty? # this is an interesting way to do it\n if arr1.first <= arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n\n merged + arr1 + arr2\nend",
"def zip(arr_1, arr_2)\n new_arr = []\n arr_1.size.times do |i|\n new_arr << [arr_1[i], arr_2[i]]\n end\n new_arr\nend",
"def merge(array1, array2)\n merged = []\n\n iterator1 = ArrayIterator.new(array1)\n iterator2 = ArrayIterator.new(array2)\n\n while (iterator1.has_next? and iterator2.has_next?)\n if iterator1.item < iterator2.item\n merged << iterator1.next_item\n else\n merged << iterator2.next_item\n end\n end\n\n # Pick up the leftovers from array1\n while (iterator1.has_next?)\n merged << iterator1.next_item\n end\n\n # Pick up the leftovers from array2\n while (iterator2.has_next?)\n merged << iterator2.next_item\n end\n\n merged\nend",
"def weave_array(array1, array2)\n result = []\n idx1 = 0\n idx2 = 1\n while #some condition\n temp_array = []\n while idx1 < array1.length && idx2 < array2.length\n if\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n if\n temp_array.push(array2[idx2])\n idx2 += 1\n end\n end\n while idx1 < array1.length\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n while idx2 < array2.length\n temp_array.push(array1[idx2])\n idx2 += 1\n end\n result.push(temp_array)\n end\n result\nend",
"def zip(array1, array2)\n iterations = array1.size\n results = []\n iterations.times do |index|\n results << [array1[index], array2[index]]\n end\n results\nend",
"def merge(arr1, arr2)\n merged = []\n\n until arr1.empty? || arr2.empty?\n if arr1.first < arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n\n merged + arr1 + arr2\nend",
"def array_concat(array_1, array_2)\n\n\n newArray = Array.new\n counter = 0\n\n (array_1.length).times do |x|\n newArray[counter] = array_1[x]\n counter = counter + 1\n end\n\n (array_2.length).times do |y|\n newArray[counter] = array_2[y]\n counter = counter + 1\n end\n\n newArray\nend",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def merge_helper(arr1, arr2)\n merged = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n merged << arr2.shift\n elsif arr2.empty?\n merged << arr1.shift\n elsif arr1.first < arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n merged\nend",
"def merge(array1, array2)\n merged = []\n\n iterator1 = ArrayIterator.new(array1)\n iterator2 = ArrayIterator.new(array2)\n\n while iterator1.has_next? && iterator2.has_next?\n if iterator1.item < iterator2.item\n merged << iterator1.next_item\n else\n merged << iterator2.next_item\n end\n end\n\n while iterator1.has_next?\n merged << iterator1.next_item\n end\n\n while iterator2.has_next?\n merged << iterator2.next_item\n end\n\n merged\nend",
"def array_concat(array_1, array_2)\n # PSEUDO\n # Start new empty array (we'll call it answer array)\n # FOR each element in first array\n # add it to answer array\n # FOR each element in second array\n # add it to answer array\n # return answer array\n\n #initial\n# answer_arr = []\n#\n# array_1.each do |el|\n# answer_arr << el\n# end\n#\n# array_2.each do |el|\n# answer_arr << el\n# end\n#\n# return answer_arr\n\n #final with built-in\n\n return array_1.concat(array_2)\n\nend",
"def merge(arr1, arr2)\n arr1 = arr1.dup\n arr2 = arr2.dup # duplicate to prevent mutation of original array\n result = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n result << arr2.shift\n elsif arr2.empty?\n result << arr1.shift\n else\n if arr1[0] <arr2[0]\n result << arr1.shift\n else\n result << arr2.shift\n end\n end\n end\n result\nend",
"def array_concat(array_1, array_2)\n new_array = []\n new_index = 0\n index = 0\n\n while index < array_1.length\n \tnew_array[new_index] = array_1[index]\n \tindex += 1\n \tnew_index += 1\n end\n\n index = 0\n\n while index < array_2.length\n \tnew_array[new_index] = array_2[index]\n \tindex += 1\n \tnew_index += 1\n end\n return new_array\nend",
"def merge(arr1, arr2)\n shift_made = true\n return_arr = arr1 + arr2\n \n until !shift_made\n shift_made = false\n \n 1.upto(return_arr.size - 1) do |i|\n if return_arr[i] < return_arr[i - 1]\n return_arr[i], return_arr[i - 1] = return_arr[i - 1], return_arr[i]\n shift_made = true\n end\n end\n end\n return_arr\nend",
"def zip(arr1, arr2)\n Array.new(arr1.size) do |idx|\n [arr1[idx], arr2[idx]]\n end\nend",
"def array_concat(array_1, array_2)\n newarray = Array.new\n for i in 0..(array_1.length-1)\n newarray[i] = array_1[i]\n end\n for j in 0..(array_2.length-1)\n newarray[array_1.length+j] = array_2[j]\n end\n return newarray\nend",
"def array_concat(array_1, array_2)\n if array_1.empty? && array_2.empty?\n \tfinal_array = []\n else\n \tcount = 0\n \twhile count < array_2.length\n \t\tfinal_array = array_1.push array_2[count]\n \t\tcount += 1\n \tend\n end\n return final_array\nend",
"def join_arrays(arr1,arr2)\n arr1.concat(arr2)\nend",
"def zip(arr1, arr2)\n result = []\n idx = 0\n loop do\n result << [arr1[idx], arr2[idx]]\n idx += 1\n break if idx == arr1.size\n end\n result\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each { |value| new_array << value }\n array_2.each { |value| new_array << value }\n return new_array\nend",
"def merge(first_arr, second_arr)\n return_arr = []\n\n loop do\n break if first_arr.empty? || second_arr.empty?\n if first_arr[0] <= second_arr[0]\n return_arr << first_arr.shift\n else\n return_arr << second_arr.shift\n end\n end\n\n loop do\n break if first_arr.empty? && second_arr.empty?\n if first_arr.empty?\n return_arr << second_arr.shift\n else\n return_arr << first_arr.shift\n end \n end\n\n return_arr\nend",
"def merge(left_array, right_array)\n new_array = Array.new()\n i = 0\n j = 0\n while i < left_array.length && j < right_array.length\n\n if left_array[i] < right_array[j]\n new_array.push(left_array[i])\n i = i +1\n else\n new_array.push(right_array[j])\n j = j + 1\n end\n\n end\n\n # add remaining elements to new array\n new_array += left_array[i..-1]\n new_array += right_array[j..-1]\n return new_array\n end",
"def merge(array1, array2, merged_array=[])\n len_of_a1 = array1.length #Get length of arrays and compare to the array's index\n len_of_a2 = array2.length\n index1 = 0 #Set the starting index for both arrays - always 0 since we are going left to right.\n index2 = 0\n\n while index1 < len_of_a1 and index2 < len_of_a2 #This loop continues until the end of one of the arrays is reached\n if array1[index1] < array2[index2] #It compares the index values of both arrays, and appends the one that is lower in value\n merged_array << array1[index1]\n index1 += 1\n else\n merged_array << array2[index2]\n index2 += 1\n end\n end\n\n if index1 < len_of_a1 #Appends any remaining values to the merged array\n merged_array += array1[index1..-1] \n elsif index2 < len_of_a2\n merged_array += array2[index2..-1]\n end\n merged_array #Returns the merged array\n end",
"def merge(array1, array2, merged_array=[])\n len_of_a1 = array1.length #Get length of arrays and compare to the array's index\n len_of_a2 = array2.length\n index1 = 0 #Set the starting index for both arrays - always 0 since we are going left to right.\n index2 = 0\n\n while index1 < len_of_a1 and index2 < len_of_a2 #This loop continues until the end of one of the arrays is reached\n if array1[index1] < array2[index2] #It compares the index values of both arrays, and appends the one that is lower in value\n merged_array << array1[index1]\n index1 += 1\n else\n merged_array << array2[index2]\n index2 += 1\n end\n end\n\n if index1 < len_of_a1 #Appends any remaining values to the merged array\n merged_array += array1[index1..-1] \n elsif index2 < len_of_a2\n merged_array += array2[index2..-1]\n end\n merged_array #Returns the merged array\n end"
] |
[
"0.83356833",
"0.82461077",
"0.82441443",
"0.8215452",
"0.82132375",
"0.8199686",
"0.81798327",
"0.8177549",
"0.81753564",
"0.81345946",
"0.8131501",
"0.8131501",
"0.8131501",
"0.8127481",
"0.81217295",
"0.81110126",
"0.81100816",
"0.8109411",
"0.80852515",
"0.80760807",
"0.8070096",
"0.8070096",
"0.8070096",
"0.8070096",
"0.8070096",
"0.8070096",
"0.8052483",
"0.804934",
"0.80429924",
"0.80399156",
"0.80347127",
"0.80307317",
"0.8027688",
"0.80173975",
"0.8010923",
"0.801072",
"0.8004941",
"0.80033696",
"0.80033696",
"0.80011654",
"0.7995303",
"0.7989237",
"0.79677373",
"0.7943782",
"0.79424316",
"0.7933176",
"0.79250073",
"0.7906286",
"0.7871838",
"0.78034604",
"0.77965975",
"0.7792165",
"0.77889663",
"0.7788843",
"0.7782557",
"0.77624863",
"0.77435863",
"0.7720698",
"0.7709113",
"0.7632364",
"0.762914",
"0.75240654",
"0.74506783",
"0.7240255",
"0.7150767",
"0.71231276",
"0.69116724",
"0.67699385",
"0.66219664",
"0.65579",
"0.65007454",
"0.65007454",
"0.65007454",
"0.6465402",
"0.63910073",
"0.6369068",
"0.63651615",
"0.6331329",
"0.6312528",
"0.6295373",
"0.6293091",
"0.6272479",
"0.626199",
"0.62555456",
"0.624177",
"0.6237948",
"0.6232883",
"0.62328416",
"0.62244415",
"0.6223138",
"0.6217949",
"0.6216963",
"0.62156224",
"0.6192269",
"0.6170557",
"0.6161454",
"0.61589",
"0.6147752",
"0.6146567",
"0.6146384"
] |
0.80003256
|
40
|
this array uses Enumerableeach_with_index to cycle through the index and shovel the indexed values of each arg arr in sequence
|
def interleave(arr1, arr2)
return_array = []
arr1.each_with_index do |element, index|
return_array << element << arr2[index]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def each_with_index(arr)\n arr.size.times do |i|\n yield(arr[i], i)\n end\n arr\nend",
"def my_each_with_index\n i = 0\n while i < self.to_a.length\n yield self.to_a[i], i\n i += 1\n end\n end",
"def my_each_with_index\n return to_enum unless block_given?\n i = 0\n array = []\n while i < size\n yield to_a[i], i\n array << to_a[i]\n i += 1\n end\n array\n end",
"def my_each_with_index\n i = 0\n while i < self.length\n yield self[i], i\n i += 1\n end\n self\n end",
"def each_index(*_arg0); end",
"def my_each_with_index\n i = 0\n while i < self.length\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_with_index(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i),i) }\n end",
"def my_each_with_index\n i = 0\n while i < self.size\n yield self[i], i\n i += 1\n end\n end",
"def my_each_with_index\n i = 0\n while i < self.size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def my_each_with_index(arr)\n \n\n for element in arr\n index = arr.index(element)\n yield(element, index)\n end\n \n \nend",
"def my_each_with_index\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def each_with_index(&block)\n to_a.each_with_index(&block)\n end",
"def my_each_with_index\n for i in 0...self.length do\n yield(self[i], i)\n end\n return self\n end",
"def map_with_index(array, index = 0, &block)\n result = []\n i = index\n array.each do |element|\n result << block.call(element, i)\n i += 1\n end\n result\nend",
"def map_with_index(array, &block)\n result = []\n index = 0\n array.each do |element|\n result << block.call(element, index)\n index += 1\n end\n result\nend",
"def my_each_with_index\n\t\tself.length.times do |index|\n\t\t\tyield(self[index], index)\n\t\tend\n\tend",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < length\n yield(self[i], i)\n i += 1\n end\n end",
"def roll_call_dwarves(array)\n # .each_with_index(1) --> use 1-based enumerator (start index at 1)\n # each.with_index method takes an optional parameter to offset the starting index\n # each_with_index does the same thing, but has no optional starting index\n array.each.with_index(1) do |name, index|\n puts \"#{index}. #{name}\"\n end\nend",
"def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end",
"def each_with_index # :yields: e, i, j\n (0...hsize).each { |j|\n (0...vsize).each { |i|\n yield self[i,j], i, j\n }\n }\n self\n end",
"def array_sum_by_index(arr)\n\nend",
"def array_sum_with_index(arr)\n arr.map.each_with_index { |a,idx| a*idx }.reduce(:+)\nend",
"def indices(*rest) end",
"def indices(*rest) end",
"def each_with_index\n\t\t@array.each_with_index do |v,i|\n\t\t\tyield v & 0x0F, i * 2 #Bottom Nibble\n\t\t\tyield (v >> 4) & 0x0F, i * 2 + 1#Top Nibble\n\t\tend\n\tend",
"def array_sum_with_index(arr)\n acc = 0\n arr.each_with_index {|int, id| acc += (int * id)}\n acc\nend",
"def array_sum_with_index(arr)\n sum = 0\n arr.each_with_index {|n, i| sum += n*i}\n sum\nend",
"def my_each_with_index\n return self unless block_given?\n\n if is_a? Array\n length.times { |idx| yield(self[idx], idx) }\n elsif is_a? Hash\n keys = self.keys\n vals = values\n length.times { |idx| yield([keys[idx], vals[idx]], idx) }\n else\n warn 'Incompatible type!'\n end\n self\n end",
"def roll_call_dwarves(dwarf_name_array)\n puts dwarf_name_array.each_with_index { |a,b| puts \"(#{b+1} #{a})\" }\n # of \n # dwarf_name_array.each_with_index do |dwarf, index| \n # puts \"#{index+1}. #{dwarf}\" }\n # end\n\n # uses each and with_index separately\n # dwarf_name_array.each.with_index(1) do |dwarf, index| \n # puts \"#{index+1}. #{dwarf}\" }\n # end\n\nend",
"def square_each_idx(array)\n final = Array.new(array.length)\n array.each_index { |i| final[i] = array[i]**2 }\n final\nend",
"def compile_index(scope, arr, index)\n source = compile_eval_arg(scope, arr)\n r = @e.with_register do |reg|\n @e.movl(source, reg)\n @e.pushl(reg)\n \n source = compile_eval_arg(scope, index)\n @e.save_result(source)\n @e.sall(2, @e.result_value)\n @e.popl(reg)\n @e.addl(@e.result_value, reg)\n end\n return [:indirect, r]\n end",
"def each_byte_with_index\n\t\t@array.each_with_index { |a,i| yield a,i }\n\tend",
"def combinations(arr)\n\n arr.each_with_index do |ele, idx|\n puts ele\n puts idx\n end\n\nend",
"def my_each_with_index(&block)\n return to_enum(:my_each_with_index) unless block_given?\n n = 0\n while n < length\n block.call(self[n], n) if is_a?(Array)\n block.call(keys[n], self[keys[n]]) if is_a?(Hash)\n block.call(self[n]) if is_a?(Range)\n n += 1\n end\n self\n end",
"def replace_index!(arr, i,array)\n arr.replace( (arr[0, i] || []) + array + arr[i + 1 .. -1] )\n end",
"def each_index\n (0...hsize).each { |j|\n (0...vsize).each { |i|\n yield i, j\n }\n }\n self\n end",
"def my_each_with_index\n for i in 0..self.length-1\n yield(self[i], i) if block_given?\n end\n self\n end",
"def each(arr)\n # set index value, beginning with the first element at 0\n i = 0\n # while the current index value still exists in the array, run the block of code, stored in yield, on each index, then increase the index value by 1 until the end of the array\n while i < arr.length\n yield(arr[i])\n i += 1\n end\nend",
"def my_each_with_index\n if block_given?\n for i in 0.upto(self.length-1)\n yield self[i], i\n end\n else\n self.to_enum\n end\n end",
"def each_with_index\n\t\t@data.each_index do |y|\n\t\t\t@data[y].each_with_index do |val, x|\n\t\t\t\tyield x,y,val\n\t\t\tend\n\t\tend\n\n\tend",
"def index_array(arr)\n arr_indexed = {}\n\n arr.each_with_index do |item, index|\n arr_indexed[index] = item\n end\n\n arr_indexed\n end",
"def each_value_with_index\n @nz.each do |i, j, v|\n yield v, i, j\n end\n end",
"def my_each_with_index\n \ti = 0\n \twhile i < self.length\n \t\tif block_given?\n \t\t\tyield(self[i], i)\n \t\telse\n \t\t\treturn self\n \t\tend\n \t\ti +=1\n \tend\n \tself\n end",
"def each_index\n return to_enum(__callee__) unless block_given?\n \n each_with_index{ |_, idx| yield(idx) }\n end",
"def multiply_arrnums_by_index(numbers) # array of ints\n new_array = [] # empty array\n i = 0 # start at indice 0\n while i < numbers.length\n new_array << numbers[i] * i # shovel value of int val of the indice * the indice\n # numb_to_mult = numbers[i]\n # numb_multd = numbers[i] * numb_to_mult\n # new_array << numb_multd\n i += 1 # next iteration\n end\n return new_array\nend",
"def indices(start=0, ar_of_indices=[], final=[], level=shape.size-1, &block)\r\n if level >= 0\r\n (0...(shape[level])).each do |s|\r\n new_indices = ar_of_indices.dup\r\n new_indices.unshift(s)\r\n if (new_indices.size == (shape.size - start))\r\n block.call(new_indices)\r\n final << new_indices \r\n end\r\n indices(start, new_indices, final, level-1, &block)\r\n end\r\n end\r\n final\r\n end",
"def map(arr) # creating our own map method\n\tnewArr = [] # declaring an empty array to push our results inside\n\tarr.each do |i| # run the block of code to iterate inside each elements in an array\n\t\tnewArr << yield(i) # push the modified elements inside our newArr []\n\tend\n\tnewArr\nend",
"def each_index\n @block_args.each_index do |i|\n yield i\n end\n end",
"def element_times_index(arr)\n result = []\n i = 0\n while i < arr.length\n result << arr[i] * i\n i+= 1\n end\n return result\nend",
"def index_arr_multiple_add(arr, index)\n # add any two elements to the arr at the index\n return arr.push(index,arr)\n return arr.push(index,arr)\nend",
"def my_each_with_index\n a = (is_a? Hash) ? to_a : self\n i = 0\n while i < a.count\n yield a[i], i\n i += 1\n end\n end",
"def combinations(arr)\n\n arr.each_with_index do |ele1, idx|\n arr.each_with_index do |ele2, idx2|\n puts ele1 + ele2\n end\n end\n\nend",
"def compile_index(scope, arr, index)\n source = compile_eval_arg(scope, arr)\n reg = nil #This is needed to retain |reg|\n @e.with_register do |reg|\n @e.movl(source, reg)\n source = compile_eval_arg(scope, index)\n @e.save_result(source)\n @e.sall(2, @e.result_value)\n @e.addl(@e.result_value, reg)\n end\n return [:indirect, reg]\n end",
"def array_translate(array)\n new_arr = []\n \n array.each_with_index do |subArray, idx|\n if idx % 2 == 1\n subArray = ele\n else\n subArray = num\n \n #num.times { new_arr << ele }\n end\n end\n\n #return new_arr\nend",
"def each_with_index(&block)\n return to_enum :each_with_index unless block\n\n i = 0\n self.each{|*val|\n block.call(val.__svalue, i)\n i += 1\n }\n self\n end",
"def each(arr)\n ndx = 0\n while ndx < arr.size do\n yield(arr[ndx])\n ndx += 1\n end\n arr\nend",
"def map_with_index # :yields: e, i, j\n m = self.class.reserve(self.vsize, self.hsize)\n each_with_index { |e, i, j|\n m[i,j] = yield e, i, j\n }\n m\n end",
"def _multi_array_indexes(i)\n element_list_sizes_tmp = _element_list_sizes\n array_indexes = []\n\n while element_list_size = element_list_sizes_tmp.pop\n i, remainder = i.divmod(element_list_size)\n array_indexes.unshift remainder\n end\n\n array_indexes\n end",
"def roll_call_dwarves(array)\n array.each_with_index{|name, index| puts \"#{index + 1}. #{name}\"}\nend",
"def index\n @array = [45, 6, 32, 0]\n end",
"def each_with_index(&block)\n @delegate.each_with_index(&block)\n end",
"def shift_out_with_index(&block)\n each_with_index(&block)\n end",
"def multi_array_op(func, *args)\n elem = args[0]\n if elem.is_a?(Array)\n elem.each_with_index.collect do |_item, index|\n indexed_args = args.collect { |a| a = a.is_a?(Array) ? a : [a]; a[index] }\n multi_array_op(func, *indexed_args)\n end\n else\n func.call(*args)\n end\n end",
"def each_with_index(zeroes = false, &_block)\n return enum_for :each_with_index, zeroes unless block_given?\n if zeroes\n row_count.times do |row|\n column_count.times do |_col|\n element = self[row, column]\n yield [element, row, column]\n end\n end\n else\n ia.each_cons(2).each_with_index do |indexes, row|\n row_start, row_end = *indexes\n a[row_start...row_end].each_with_index do |element, index|\n yield [element, row, ja[row_start + index]]\n end\n end\n end\n end",
"def __args_index(sexp)\n args = _vector(sexp)\n args_length = length(sexp) + @incr[]\n args + [:pushl, args_length]\n end",
"def element_times_index(numbers)\n \n new_arr = []\n\n i = 0 \n while i < numbers.length\n new_num = numbers[i] * i\n new_arr << new_num\n i += 1\n end\n\n return new_arr\nend",
"def [](index); @args[index] end",
"def multi_map(arr, n = 1, &prc)\n new_arr = arr\n n.times do\n new_arr = new_arr.map {|ele| ele = prc.call(ele)}\n end\n new_arr\nend",
"def my_each_with_index\n return to_enum unless block_given?\n\n index = 0\n my_each do |value|\n yield(value, index)\n index += 1\n end\n end",
"def element_times_index(numbers)\n new_arry = []\n i = 0\n while i < numbers.length\n new_arry << numbers[i] * i\n i += 1\n end\n return new_arry\n\nend",
"def each(arr)\n counter = 0\n \n while counter < arr.length\n yield(arr[counter])\n counter += 1\n end\n \n arr\nend",
"def index=(_arg0); end",
"def element_times_index(nums)\n nums.map.with_index{|num, idx| num * idx}\nend",
"def test_0655_each_with_index\n @@log.debug \"test_0655_each_with_index starts\" if @@log.debug?\n assert_respond_to(@list, :each_with_index, \"test_0655_each_with_index_respond\")\n # Type check\n enum = @list.each_with_index\n result = enum.is_a? Enumerator\n assert(result,\"test_0655_each_with_index_class\") \n # Check each index number\n @list.each_with_index {|item, index|\n case\n when item == @aen\n assert(index == 0, \"test_0655_each_with_index_i0\")\n when item == @bsb\n assert(index == 1, \"test_0655_each_with_index_i1\")\n when item == @cab\n assert(index == 2, \"test_0655_each_with_index_i2\")\n when item == @dad\n assert(index == 3, \"test_0655_each_with_index_i3\")\n else\n flunk(\"test_0655_each_with_index_invalid\")\n end\n }\n#\n# The author's paper copy of the 1.9 Pickaxe implies that each_with_index\n# can be invoked with one or more arguments as shown below.\n#\n# This appears to be incorrect, which can be confirmed by either:\n#\n# * Attempting to run the code shown\n# * Documentation at http://ruby-doc.org/core-1.9/classes/Enumerable.html\n#\n=begin\n # Invoke with argument(s)\n myarg = \"-tag\"\n accum = \"\"\n @list.each_with_index(myarg) {|item, index|\n case\n when item == @aen\n assert(index == 0, \"test_0655_each_with_index_i0a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag0\")\n when item == @bsb\n assert(index == 1, \"test_0655_each_with_index_i1a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag1\")\n when item == @cab\n assert(index == 2, \"test_0655_each_with_index_i2a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag2\")\n when item == @dad\n assert(index == 3, \"test_0655_each_with_index_i3a\")\n assert(myarg == \"-tag\", \"test_0655_each_with_index_tag3\")\n else\n flunk(\"test_0655_each_with_index_invalid\")\n end\n }\n=end\n @@log.debug \"test_0655_each_with_index ends\" if @@log.debug?\n end",
"def element_times_index(numbers)\n \n i = 0 # i represents to the index current index always\n \n new_array = []\n \n while i < numbers.length # We cant do less than or equal to here\n \n new_array << numbers[i] * i # You can shovel directly into a new array\n i += 1\n end\n return new_array\nend",
"def element_times_index(numbers)\n new_nums = []\n \n i = 0\n while i < numbers.length\n new_nums << numbers[i] * i\n \n i += 1\n end\n \n return new_nums\n end",
"def multi_map(arr, n=1, &prc)\n new_arr = []\n\n arr.each do |ele|\n new_ele = ele\n n.times do\n new_ele = prc.call(new_ele)\n end\n\n new_arr << new_ele\n end\n new_arr\n\nend",
"def compile_bindex(scope, arr, index)\n source = compile_eval_arg(scope, arr)\n @e.pushl(source)\n source = compile_eval_arg(scope, index)\n r = @e.with_register do |reg|\n @e.popl(reg)\n @e.save_result(source)\n @e.addl(@e.result_value, reg)\n end\n return [:indirect8, r]\n end",
"def by_index(index)\n @arr[index]\n end",
"def pick_these(arr, i, j)\n\nend",
"def index_by\n\t\t\t\tmap { |n| [yield(n), n] }.to_hash\n\t\t end",
"def array_sum_with_index(array)\n\t\n\tnew_array = []\n\t\n\tnew_array = array.collect { |num| num * array.index(num) }\n\tnew_array.reduce(:+)\n\t\t\nend",
"def sum_sub_arrays_from_index(arr, index)\n for i in (index..arr.count)\n sub_array = arr.slice(index, i)\n $sub_array_hash[sub_array] = sub_array.reduce(0) {|sum, x| sum + x}\n end\nend",
"def each_index\n\t\t@data.each_index do |y|\n\t\t\t@data[y].each_index do |x|\n\t\t\t\tyield x, y\n\t\t\tend\n\t\tend \n\tend",
"def chain_map(value, arr)\n arr.each do |proc_idx|\n value = proc_idx.call(value)\n end\n value\nend",
"def each\n @val.each_with_index { |o, i|\n o.each_with_index { |p, j| yield(i,j,p) }\n }\n end",
"def zip(*arr)\n (0...arr[0].length).map do |i|\n arr.map {|arr| arr[i]}\n end\nend",
"def element_times_index(nums)\n indexed_nums = []\n i = 0\n\n while i < nums.length\n num_indexed = nums[i] * i\n indexed_nums << num_indexed\n i += 1\n end\n\n return indexed_nums\nend",
"def slow_dance(direction, arr)\n arr.each_with_index do |el, i|\n return i if el == direction\n end\nend",
"def map_with_index &block\n index = 0\n map do |element|\n result = yield element, index\n index += 1\n result\n end\n end",
"def mapa(array)\n i = 0\n oarray = []\n while i < array.size\n oarray << yield(array[i])\n i += 1\n end\n oarray\nend",
"def each(array)\n idx = 0\n while idx < array.size\n yield(array[idx]) if block_given?\n idx += 1\n end\n\n array\nend",
"def input_to_index(argument)\n index=argument.to_i-1\n\n # arrray=[\" \",\" \",\" \",\" \",\" \",\" \",\" \",\" \",\" \",]\n # array[index]=\"x\"\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def element_times_index(numbers)\n\tfor i in 0..numbers.length-1\n numbers[i] *= i\n end\n return numbers\nend",
"def print_items(elective_array)\n elective_array.each_with_index do |value, i|\n puts \"#{i+1}. #{value}\"\n end\nend",
"def multi_map(arr, num=1, &proc)\r\n new_arr = arr.clone\r\n arr.each_with_index do |el, i|\r\n num.times { new_arr[i] = proc.call(new_arr[i]) }\r\n end\r\n new_arr\r\nend",
"def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend",
"def map(source_array)\n new_array = []\n index = 0\n while index < source_array.size do \n new_array[index] = yield(source_array[index])\n index += 1\n end\n \n new_array\nend",
"def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i += 1\r\n end\r\nend"
] |
[
"0.7264312",
"0.69628876",
"0.68594354",
"0.6714278",
"0.667085",
"0.6637059",
"0.66255176",
"0.66085607",
"0.65933615",
"0.65340585",
"0.6524714",
"0.6521782",
"0.6521782",
"0.65022194",
"0.64909124",
"0.6473688",
"0.64562106",
"0.643974",
"0.6381347",
"0.63633674",
"0.63455194",
"0.6283913",
"0.62002873",
"0.6191797",
"0.6191797",
"0.6180463",
"0.6172204",
"0.6150332",
"0.61427754",
"0.6127005",
"0.6125687",
"0.6118847",
"0.61065507",
"0.61011755",
"0.60963094",
"0.60951424",
"0.6095125",
"0.60868585",
"0.60827154",
"0.60573065",
"0.6035665",
"0.60277104",
"0.6026767",
"0.6003802",
"0.5985394",
"0.59812945",
"0.59763706",
"0.59649247",
"0.5964656",
"0.5939894",
"0.59369403",
"0.5933309",
"0.59039116",
"0.5871531",
"0.5853917",
"0.5831414",
"0.5831209",
"0.583111",
"0.5819063",
"0.5810282",
"0.58045083",
"0.58012646",
"0.57866836",
"0.5765414",
"0.57568204",
"0.57429993",
"0.57360363",
"0.5727791",
"0.57207924",
"0.5720633",
"0.5710141",
"0.5706439",
"0.57042736",
"0.5700733",
"0.569835",
"0.5679642",
"0.5670825",
"0.56617594",
"0.5659943",
"0.5659204",
"0.5658296",
"0.5655368",
"0.5652198",
"0.5650272",
"0.5642494",
"0.5639069",
"0.5629909",
"0.5629838",
"0.5623663",
"0.5621322",
"0.5620336",
"0.55976975",
"0.55934",
"0.55929226",
"0.55862546",
"0.55826235",
"0.5572009",
"0.55666214",
"0.555585",
"0.555525",
"0.5548419"
] |
0.0
|
-1
|
this makes use of the Arrayzip method to combine the two, requires a flatten
|
def interleave(arr1, arr2)
return_array = arr1.zip(arr2).flatten
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def zip first, second\n first.zip(second).flatten()\nend",
"def zip_and_flatten(array1,array2)\t\n\t\t(array1.zip(array2)).flatten(1).reject{|x| x.nil?}\n\tend",
"def zip(first, second)\n first.zip(second).flatten\nend",
"def custom_zip(arr1, arr2)\n final=[]\n arr1.each_with_index do |item, index|\n nested_array= []\n arr2.each_with_index do |item2, index2|\n if index == index2\n nested_array << item\n nested_array << item2\n final << nested_array\n end\n end\n end\n final\nend",
"def custom_zip (arr1, arr2)\n final = []\n arr1.each_with_index do |item, index|\n final << [item, arr2[index]]\n end\n final\nend",
"def interzip(array1, array2)\n array1.zip(array2).flatten\nend",
"def custom_zip(arr1, arr2)\n final = []\n arr1.each_with_index do |value, index|\n final << [value, arr2[index]]\n end\n final\nend",
"def custom_zip(arr1, arr2)\n result = []\n arr1.each_with_index do |item, index|\n result << [arr1[index], arr2[index]]\n end\n result\nend",
"def zip(ar1, ar2)\n zip_rec = ->(ar1, ar2, result) do\n case [ar1, ar2]\n when [[], []]\n result\n else\n zip_rec.(ar1[1..-1], ar2[1..-1], result << [ar1[0], ar2[0]])\n end\n end\n zip_rec.(ar1, ar2, [])\nend",
"def zip(arr1, arr2)\n zipped = []\n arr1.each_with_index do |el, i|\n zipped << [el, arr2[i]]\n end\n zipped\nend",
"def combine_zip(a, b)\n if a.length < b.length\n # fill in if a shorter than b\n a += Array.new(b.length - a.length)\n end\n a.zip(b).flatten!\nend",
"def zip(arr1, arr2)\n zipped = []\n arr1.each_with_index { |ele, ind| zipped << [ele, arr2[ind]] }\n zipped\nend",
"def custom_zip(arr1, arr2)\n new_nested = []\n arr1.each_with_index do | arr1_value, arr1_index |\n arr2.each_with_index do | arr2_value, arr2_index |\n if arr1_index == arr2_index\n arr3 = [arr1[arr1_index], arr2[arr2_index]]\n new_nested << arr3\n end # end of if\n end # end of do (array 2)\n end # end of do (array 1)\n new_nested\nend",
"def zip(arr1, arr2)\n arr1.each_with_index.with_object([]) do |(el, i), z|\n z << [el, arr2[i]]\n end\nend",
"def zip(array1, array2)\n results = []\n array1.each_with_index do |current_element, current_index|\n results << [current_element, array2[current_index]]\n end\n results\nend",
"def zipper(arr1, arr2)\n arr1.map.with_index { |val, idx| [val] << arr2[idx] }\nend",
"def zip(first, second)\n first.zip(second)\nend",
"def zip(arr1, arr2)\n arr1.each_with_index.with_object([]) do |(el, idx), arr|\n arr << [el, arr2[idx]]\n end\nend",
"def zip(arr_1, arr_2)\n new_arr = []\n arr_1.size.times do |i|\n new_arr << [arr_1[i], arr_2[i]]\n end\n new_arr\nend",
"def my_zip(*given_arrays)\n result = []\n\n self.each_with_index do |el, idx|\n internal_array = [el]\n given_arrays.each { |given_array| internal_array << given_array[idx] }\n result << internal_array\n end\n\n result\n end",
"def zip(*rest) end",
"def zip(arr1, arr2)\n arr1.each_with_index.reduce([]) { |result, (el, idx)| result << [el, arr2[idx]] }\nend",
"def interleave(array1, array2)\n p array1.zip(array2).flatten\nend",
"def lecturer_zip(arr1,arr2)\n final = []\n arr1.each_with_index { |value, index| final << [value, arr2[index]] }\n final\nend",
"def custom_zip(arr1, arr2)\n final = []\n arr1.each_with_index { |name, index| final << [name, arr2[index]] }\n final\nend",
"def zip(array1, array2)\n iterations = array1.size\n results = []\n iterations.times do |index|\n results << [array1[index], array2[index]]\n end\n results\nend",
"def zip(arr1, arr2)\n index = 0\n zipped = []\n while index < arr1.length\n zipped << [arr1[index], arr2[index]]\n index += 1\n end\n zipped\nend",
"def zip(arr1, arr2)\n result = []\n idx = 0\n loop do\n result << [arr1[idx], arr2[idx]]\n idx += 1\n break if idx == arr1.size\n end\n result\nend",
"def interleave(arr_1, arr_2)\n arr_1.zip(arr_2).flatten\nend",
"def interleave2(array1, array2)\n array1.zip(array2).flatten\nend",
"def my_zip(*arrs)\n zipped = []\n self.each_with_index do |ele, i|\n sub = [ele]\n arrs.each do |arr|\n sub << arr[i]\n end\n zipped << sub\n end\n zipped\n end",
"def interleave(arr1,arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def interleave(array1, array2)\n array1.zip(array2).flatten\nend",
"def my_zip(*arrays)\n i = 0\n zipped = []\n while i < self.length\n nest = [self[i]]\n arrays.my_each do |arr|\n if i < arr.length\n nest << arr[i]\n else\n nest << nil\n end\n end\n zipped << nest\n i += 1\n end\n return zipped\n end",
"def interleave2(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def zip(arr1, arr2)\n Array.new(arr1.size) do |idx|\n [arr1[idx], arr2[idx]]\n end\nend",
"def interleave(arr1, arr2)\n # new_arr = []\n # arr1.size.times do |count|\n # new_arr << arr1[count] << arr2[count]\n # end\n # new_arr\n\n # using Array#zip and Array#flatten\n arr1.zip(arr2).flatten\nend",
"def zip( *other_arrays, & block )\n\n load_parent_state\n \n return super\n \n end",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(a, b)\n a.zip(b).flatten\nend",
"def interleave(ary1, ary2)\n ary1.zip(ary2).flatten\nend",
"def interleave(a1, a2)\n # new_array = []\n # index = 0\n # while index < a1.size\n # new_array.push(a1[index])\n # new_array.push(a2[index])\n # index += 1\n # end\n # new_array\n # LS solution\n # result = []\n # array1.each_with_index do |element, index|\n # result << element << array2[index]\n # end\n # result\n a1.zip(a2).flatten\nend",
"def zip_sum(array, array2)\n new_arr = []\n array.length.times do |index|\n new_arr.push(array[index] + array2[index])\n end\n new_arr\nend",
"def zip(*args)\n \n multi = Array.new(args[0].length) {[]}\n\n (0...args.length).each do |i|\n (0...args[0].length).each do |j|\n multi[j] << args[i][j]\n end\n end\n multi\nend",
"def zip(arr1, arr2)\n arr1.map.with_index { |el1, idx| [el1, arr2[idx]] }\nend",
"def zipper(arr1, arr2)\n arr1.map.with_index { |elem, ndx| [elem, arr2[ndx]] }\nend",
"def zip(*arr)\n (0...arr[0].length).map do |i|\n arr.map {|arr| arr[i]}\n end\nend",
"def interleave(array_1, array_2)\n interwoven_array = []\n\n array_1.each_with_index do |element, index|\n interwoven_array << element << array_2[index]\n end\n\n interwoven_array\nend",
"def zip(*arr)\n new_arr = []\n i = 0\n while i < arr[0].length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n new_arr << temp\n i += 1\n end\n new_arr\nend",
"def interleave(array_1, array_2)\n results_array = []\n array_1.each_with_index do |elem, index|\n results_array << elem << array_2[index]\n end\n results_array\nend",
"def multiply_list_zip(array1,array2)\n array1.zip(array2).map {|element| element.reduce(:*)}\n # array 1's element would be spread out into three arrays, 3,5 and 7 being the first elements. Zip then iterates through the argument\n # and mergers these elements into array1 one by one. The documentation then states if a block is given it invoked for EACH ARRAY, so in this case\n # the combined arrays we have now created.\nend",
"def my_zip(*args)\n zipped = Array.new(self.length) {[]}\n\n self.each_with_index { |el, i_arr| zipped[i_arr] << el}\n args.each_with_index do |arg, i_arg|\n (zipped.length).times {|i_arg_el| zipped[i_arg_el] << arg[i_arg_el]}\n end\n zipped\n end",
"def zip(*arrs)\n return [] if arrs.any?(&:empty?)\n [arrs.map(&:first)] + zip(arrs.first.drop(1), arrs.last.drop(1))\nend",
"def custom_zip(arr1, arr2, arr3)\n arr = []\n nest_arr = []\n arr1.each do |i|\n k = [] #initialize a temporary array\n k.push(i) #pushed first val\n k.push(arr2[arr1.index(i)]) #pushed 2nd val\n k.push(arr3[arr1.index(i)]) #pushed 3rd val\n nest_arr = k #assigned to nest_arr\n arr.push(nest_arr) # pushed nest_arr to arr in order to nest in\n end\n\n p arr\nend",
"def interleave(arr1, arr2)\n results = []\n arr1.each.with_index do |el,idx|\n results << el << arr2[idx]\n end\n results\nend",
"def zip_with(a, b, &op)\n result = []\n a.zip(b){ |aa,bb| result << op.call(aa,bb)}\n result\nend",
"def combine_two_lists(array1, array2)\n combined_array = []\n index = 0\n\n loop do\n combined_array << array1[index]\n combined_array << array2[index]\n index += 1\n break if index == array1.size\n \n end\n combined_array\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |value, index|\n result << value << array2[index]\n end\n result\nend",
"def interleave(arr1, arr2)\n combined = []\n\n arr1.each_with_index do |item, index|\n combined.push(arr1[index])\n combined.push(arr2[index])\n end\n\n combined\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def interleave(array1, array2)\n result = []\n array1.each_with_index do |element, index|\n result << element << array2[index]\n end\n result\nend",
"def interleave(arr1, arr2)\n arr3 = []\n arr1.each_with_index do |element, idx|\n arr3 << element << arr2[idx]\n end\n arr3\nend",
"def interleave(arr1, arr2)\n idx = 0\n combined = []\n arr1.size.times do\n combined << arr1[idx] << arr2[idx]\n idx += 1\n end\n combined\nend",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def interleave(arr1, arr2)\r\n combined_arr = []\r\n counter = 0\r\n arr1.size.times do\r\n combined_arr << arr1[counter]\r\n combined_arr << arr2[counter]\r\n counter += 1\r\n end\r\n combined_arr\r\nend",
"def interleave ( arr1 , arr2 )\n\tc = []\n\tif arr1.length > arr2.length \n\t\ta=arr1\n\t\tb=arr2\n\telse\n \t\ta=arr2\n \t\tb=arr1\n\tend\n\tc = a.slice(b.length..a.length-1)\n\treturn b.zip(a).flatten(1).slice!(0..b.length*2 -1) + c\nend",
"def join_arrays array_one, array_two\n\t\tarray_one.shift\n\t\tarray_two.pop\n\t\tarray_one & array_two\n\tend",
"def array_concat(array_1, array_2)\n\treturn (array_1 << array_2).flatten\nend",
"def interleave(arr1, arr2)\n return_array = []\n arr1.each_with_index do |element, index|\n return_array << element << arr2[index]\n end\nend",
"def zany_zip(*arr)\n max_length = 0\n arr.each do |x|\n if x.length > max_length\n max_length = x.length\n end\n end\n result = []\n i = 0\n while i < max_length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n result << temp\n i += 1\n end\n result\nend",
"def interleave(array1, array2)\n new_array = []\n array1.each_with_index do |element, index|\n new_array << element << array2[index]\n end\n new_array\nend",
"def interleave(arr1, arr2)\n results = []\n\n arr1.each_with_index do |el, i|\n results << el << arr2[i]\n # results << el << arr2[arr1.index(el)] ## if you wanted to do it without index as block param\n end\n\n results\nend",
"def interleave(arr1, arr2)\n result = []\n arr1.each_with_index do |elem, indx|\n result << elem << arr2[indx]\n end\n result\nend",
"def interleave(array1, array2)\n result = []\n array1.size.times do |index|\n result << array1[index] << array2[index]\n end\n result \nend",
"def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend",
"def interleave(array_1, array_2)\n result = []\n # https://ruby-doc.com/core-2.7.2/Enumerator.html#method-i-each_with_index\n array_1.each_with_index do |element, index|\n result << element << array_2[index]\n end\n result\nend",
"def interleave(arr1, arr2)\n index = 0\n results = []\n arr1.size.times do\n results << arr1[index] << arr2[index]\n index += 1\n end\n results\nend",
"def interleave(a,b)\n longer = smaller = []\n a.size > b.size ? longer = a : longer = b\n a.size > b.size ? smaller = b : smaller = a #can't figure how to shorten this/ make less redundant\n return a.zip(b).flatten.concat(longer[smaller.size..longer.size])\n\n end",
"def interleave(arr_1, arr_2)\n current_index = 0\n combined_arr = []\n while current_index < arr_1.size\n combined_arr.push(arr_1[current_index])\n combined_arr.push(arr_2[current_index])\n current_index += 1\n end\n \n combined_arr\nend",
"def interleave(arr1, arr2)\n output_arr = []\n arr1.size.times do |idx|\n output_arr << arr1[idx]\n output_arr << arr2[idx]\n end\n output_arr\nend",
"def zip first, second\n answer = Array.new\n first.each.with_index do |letter, index|\n answer << first[index]\n answer << second[index]\n end\n answer\nend",
"def interleave(list1, list2)\n (list1.zip list2).flatten\nend",
"def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend",
"def interleave(array1, array2)\n combo_size = array1.size + array2.size\n combo_array = []\n index = 0\n \n until combo_array.size == combo_size\n combo_array << array1[index] << array2[index]\n index += 1\n end\n \n combo_array\nend",
"def interleave a,b\n arr1 = []\n for i in (0...a.size)\n arr1 << a[i] << b[i]\n end\n arr1\nend",
"def my_zip(*arr)\n answer = Array.new([])\n each_with_index do |item, index|\n answer[index] = [item]\n arr.each do |elem|\n answer[index] << elem[index]\n end\n end\n answer\n end",
"def merge_arrays (first, second)\n\nlarge_array = []\n\n 11.times do |i|\n smaller_array = []\n smaller_array << first[i]\n smaller_array << second[i]\n large_array << smaller_array\n end\n return large_array\n\nend",
"def interleave(array1, array2)\n result = []\n array1.each_index { |i| result << [array1[i], array2[i]] }\n result.flatten\nend",
"def merge(array1, array2)\n array1 | array2\nend",
"def array_concat(array_1, array_2)\n # Your code here\n #Iterate over the length of array\n array_2.each do |section|\n #add each section of the array to the other\n array_1.push(section)\n end\n # Output the combination of both the array\n return array_1\nend",
"def interleave(array1, array2)\n new = []\n size = array1.size\n size.times do |x|\n new.push(array1[x], array2[x])\n end\n new\nend",
"def zany_zip(*args)\n length = args.map(&:length).max\n multi = Array.new(length) {[]}\n\n (0...args.length).each do |i|\n (0...length).each do |j|\n if j >= args[i].length\n multi[j] << nil\n else\n multi[j] << args[i][j]\n end\n end\n end\n multi\nend",
"def interleave(array1, array2)\n return_array = []\n\n until array2.empty?\n return_array << array1.shift(1)\n return_array << array2.shift(1)\n end\n return_array.flatten\nend"
] |
[
"0.7900996",
"0.78792024",
"0.77941084",
"0.7689554",
"0.76665264",
"0.7619041",
"0.76187646",
"0.761795",
"0.7597096",
"0.7564523",
"0.7497517",
"0.7484006",
"0.7464832",
"0.74332714",
"0.7426128",
"0.7420991",
"0.74132323",
"0.7383795",
"0.73754126",
"0.73502827",
"0.73319536",
"0.7328335",
"0.7296156",
"0.7267802",
"0.72530395",
"0.72511387",
"0.724478",
"0.7176383",
"0.7174096",
"0.715882",
"0.7125734",
"0.7124586",
"0.7078608",
"0.7078608",
"0.7078608",
"0.7077403",
"0.7056468",
"0.70425195",
"0.7040713",
"0.70212466",
"0.70130736",
"0.70130736",
"0.70130736",
"0.70130736",
"0.70130736",
"0.70130736",
"0.69827336",
"0.6941486",
"0.69333744",
"0.6903603",
"0.68831754",
"0.6873339",
"0.68538725",
"0.6811443",
"0.67868936",
"0.67455447",
"0.67232704",
"0.6722303",
"0.66804737",
"0.66522795",
"0.66496474",
"0.6643323",
"0.6637845",
"0.6632455",
"0.6612201",
"0.660722",
"0.6594887",
"0.6594887",
"0.6590664",
"0.6584963",
"0.6577815",
"0.6568484",
"0.65408075",
"0.6517441",
"0.651447",
"0.6502417",
"0.6496858",
"0.6495184",
"0.64943475",
"0.6485659",
"0.647557",
"0.6471069",
"0.64702785",
"0.64399445",
"0.6432847",
"0.643095",
"0.64298743",
"0.6429217",
"0.6413582",
"0.6409165",
"0.6376642",
"0.63765913",
"0.63672763",
"0.63573897",
"0.6349213",
"0.6330787",
"0.63124764",
"0.62996924",
"0.6296265",
"0.6292585"
] |
0.691795
|
49
|
Returns a ticket by ticket id ==== Attributes +id+ numerical unique id for record +format+ be sure to include an accept header or add ".xml" or ".json" to the last path element +token+ your API Token for authentication ==== Raises ERROR 403 Forbidden When the token is invalid. ERROR 404 Not found When record to show is not found. ==== Examples To test this method, insert this url or your valid API key and application host into a browser or http client like wget or curl. For example: curl i H "accept: text/xml" X GET curl i H "accept: application/json" X GET
|
def show
@ticket = Ticket.find(params[:id].to_i) rescue nil
respond_to do |format|
unless @ticket.blank?
format.xml { render :xml => ticket_presenter }
format.json { render :json => ticket_presenter }
else
format.xml { head :not_found }
format.json { head :not_found }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def get(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Try to cast response to desired type\r\n if _response.body.instance_of? Hash\r\n begin\r\n Ticket.from_hash(_response.body)\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend",
"def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def get_support_ticket_using_get_with_http_info(support_ticket_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.get_support_ticket_using_get ...'\n end\n # verify the required parameter 'support_ticket_id' is set\n if @api_client.config.client_side_validation && support_ticket_id.nil?\n fail ArgumentError, \"Missing the required parameter 'support_ticket_id' when calling SupportApi.get_support_ticket_using_get\"\n end\n # resource path\n local_var_path = '/support_ticket/{support_ticket_id}'.sub('{' + 'support_ticket_id' + '}', support_ticket_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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SupportTicket')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#get_support_ticket_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_ticket_details( session_key, ticket_id)\n response_xml = self.call( :get_ticket_details, message: {\n api_key: session_key,\n ticket: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def show\r\n # @ticket = Contact::Ticket.find_by_uuid(params[:id])\r\n raise UnknowsAction\r\n end",
"def ticket(*options)\n options.insert(0, id) if options.length > 0\n easy_finder(provider_parent(self.class)::Ticket, :first, options, 1)\n end",
"def GetField id\n\n APICall(path: \"ticket_fields/#{id}.json\")\n\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find_by_reference(params[:id])\n end",
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def get_ticket\n ticket_details = self.class.get(\"/rest/api/2/issue/\", :verify => false)\n File.open(\"custom.txt\", 'w') {|f| f.write(ticket_details) }\n end",
"def get(issue_id)\n HTTParty.get(url(issue_id))\n end",
"def get_request( id )\n url = \"#{self.url}/#{id}?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['details'] if ok?( status ) && response['details']\n return status, ''\n end",
"def get\n url = prefix + \"get\" + id_param\n return response(url)\n end",
"def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def links(id)\n id = id[:id] if id.class == Hash\n id = id.to_s\n type = \"ticket\"\n sid = id\n if id =~ /(\\w+)\\/(.+)/\n type = $~[1]\n sid = $~[2]\n end\n reply = {}\n resp = @site[\"ticket/#{sid}/links/show\"].get\n return {:error => resp, } if resp =~ /does not exist\\.$/\n reply = response_to_h(resp)\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end",
"def get(resource, id)\n Api.new.get(resource, id)\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to edit_ticket_url(@ticket) }\n format.xml { render :xml => @ticket.to_xml }\n end\n end",
"def show\n if @ticket\n if ProjectUser.verify_role(current_user.id, @ticket.project_id, 'client')\n render json: Ticket.build_ticket_object(@ticket, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no ticket found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def find(id, params = {}, header = {})\n request = requester.new(:get, \"#{to_url}/#{id}\", {}, params, header)\n build(request.resource)\n end",
"def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end",
"def get(id:)\n response = client.get(path(id)).parsed_body\n new(response)\n end",
"def find_trade_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TradesApi.find_trade_by_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TradesApi.find_trade_by_id\"\n end\n # resource path\n local_var_path = '/trades/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Trade')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TradesApi#find_trade_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(id, params={})\n response = Shippo.request(:get, \"#{url}/#{CGI.escape(id)}/\", params)\n self.construct_from(response)\n end",
"def get_support_ticket_comment_using_get_with_http_info(support_ticket_comment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.get_support_ticket_comment_using_get ...'\n end\n # verify the required parameter 'support_ticket_comment_id' is set\n if @api_client.config.client_side_validation && support_ticket_comment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'support_ticket_comment_id' when calling SupportApi.get_support_ticket_comment_using_get\"\n end\n # resource path\n local_var_path = '/support_ticket_comment/{support_ticket_comment_id}'.sub('{' + 'support_ticket_comment_id' + '}', support_ticket_comment_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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SupportTicketComment')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#get_support_ticket_comment_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get(id)\n request do\n response =\n connection.get id\n\n parse(response.body)\n end\n end",
"def get(id)\n @service.get(id)\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def get_xtid(xtid, id)\n self.class.headers 'X-tid' => xtid\n self.class.get(\"/aldebaran-recdocs/recdocs/#{id}\", :basic_auth => @auth)\n end",
"def read(id)\n perform(:get, \"#{@resource_type}/#{id}\")\n end",
"def retrieve_ticket\n resp = HTTParty.get('https://localhost/identity/restv1/api/v1/groups')\n\n resp.headers['www-authenticate']\n .split(', ')\n .find { |e| e =~ %r{^ticket} }\n .split('=')[1]\n end",
"def get_support_ticket_using_get(support_ticket_id, opts = {})\n data, _status_code, _headers = get_support_ticket_using_get_with_http_info(support_ticket_id, opts)\n data\n end",
"def show\n @ticket = Ticket.find(params[:id])\n @help_text = \"\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @custom_ticket = CustomTicket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @custom_ticket }\n end\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def get_token_by_id(id)\n submit GetTokenByCaller.new(:token_id => id)\n end",
"def ticket_dashboard\n @user = User.first \n @ticket = Ticket.find_by(id: params[:id])\n end",
"def get_events_for_ticket( session_key, ticket_id)\n response_xml = self.call( :get_events_for_ticket, message: {\n arg0: session_key,\n arg1: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def find_by_id(id)\n resp = get(\"/#{exposed_as}/#{id}\")\n case resp.response.code.to_i\n when 200\n result = MultiJson.load resp.parsed_response\n new(result)\n when 404\n nil\n else\n raise \"#{self.class.name}#try_find with ID #{id.inspect} returned unexpected response: #{resp.inspect}\"\n end\n end",
"def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend",
"def vread(klass, id, version_id, format = nil)\n headers = { accept: \"#{format}\" } if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format, history: { id: version_id } }\n reply = get resource_url(options), fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def show\n @ticket_time = TicketTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_time }\n end\n end",
"def find(ticket)\n\t\t\tself.result.select{ |p| p['Ticket_Number'] == ticket }.first\n\t\tend",
"def accept_intervention(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}/accept'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.post _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Return appropriate type\r\n _response.body\r\n end",
"def find(id, query_options = {})\n raise 'ID is required' unless id\n\n response = request(:get, credentials, \"#{api_model.api_path}/#{id}\", query: query_options)\n api_model.parse(response.parsed_response).first\n end",
"def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end",
"def where(params)\n result = Tessera::Api::TicketSearch.call(params)\n ticket_ids = result['TicketID'] ? result['TicketID'] : []\n new(ticket_ids)\n end",
"def officer_officer_id_format_get_with_http_info(officer_id, format, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EssentialsApi.officer_officer_id_format_get ...\"\n end\n # verify the required parameter 'officer_id' is set\n if @api_client.config.client_side_validation && officer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'officer_id' when calling EssentialsApi.officer_officer_id_format_get\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling EssentialsApi.officer_officer_id_format_get\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json\"\n end\n # resource path\n local_var_path = \"/officer/{officerId}.{format}\".sub('{' + 'officerId' + '}', officer_id.to_s).sub('{' + 'format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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 => 'OfficerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EssentialsApi#officer_officer_id_format_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @ticket_type = TicketType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_type }\n end\n end",
"def GetTopic id\n\n APICall(path: \"topics/#{id}.json\")\n\n end",
"def vread(klass, id, version_id, format=@default_format)\n options = { resource: klass, id: id, format: format, history: {id: version_id} }\n reply = get resource_url(options), fhir_headers(options)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def find(id:)\n request.get(\"#{teamsites_url}/#{id}\")\n end",
"def show\n @ticket_code = TicketCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_code }\n end\n end",
"def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end",
"def show\n Labtech.get_token\n @last_ticket = Labtech.last_labticket\n end",
"def ticket(q)\n Ticket.find(self, q)\n end",
"def show\n @breadcrumb = 'read'\n @ticket_priority = TicketPriority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_priority }\n end\n end",
"def list\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets'\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n \r\n # Try to cast response to list of desired type\r\n if _response.body.instance_of? Array\r\n value = Array.new\r\n _response.body.each do |item|\r\n begin\r\n value << (Ticket.from_hash(item))\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n value\r\n end\r\n end",
"def issue(project, id)\n get(\"/projects/#{url_encode project}/issues/#{id}\")\n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def get_token_by_id_with_http_info(token_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PublicSmtpTokensApi.get_token_by_id ...'\n end\n # verify the required parameter 'token_id' is set\n if @api_client.config.client_side_validation && token_id.nil?\n fail ArgumentError, \"Missing the required parameter 'token_id' when calling PublicSmtpTokensApi.get_token_by_id\"\n end\n # resource path\n local_var_path = '/marketing/v3/transactional/smtp-tokens/{tokenId}'.sub('{' + 'tokenId' + '}', CGI.escape(token_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SmtpApiTokenView'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"PublicSmtpTokensApi.get_token_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: PublicSmtpTokensApi#get_token_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_topic id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get TOPICS, id )\n\t\t\t\tend",
"def get(id)\n raise NotSupportedError\n end",
"def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end",
"def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end",
"def call_authorization_issue_api(ticket, subject, authTime)\n return call_api(\"/api/auth/authorization/issue\", {\n \"ticket\" => ticket,\n \"subject\" => subject,\n \"authTime\" => authTime\n })\nend",
"def issue_from_id(id)\n json_file('partystances').detect { |i| i['id'] == id } \n end",
"def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end",
"def ticket\n case eventable_class\n when \"Ticket\"\n Ticket.get(eventable_id)\n when \"TicketUpdate\"\n TicketUpdate.get(eventable_id).ticket\n when \"Milestone\"\n Milestone.get(eventable_id)\n end\n end",
"def fetch(resource,identifier,params={})\n uri = '/api/' + resource.to_s + '/' + identifier\n http_get(uri,params)\n end",
"def set_ticket\n @ticket = Ticket.friendly.find(params[:id])\n end",
"def GetForum id\n\n APICall(path: \"forums/#{id}.json\")\n\n end",
"def show(id, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/#{id}\")\n end",
"def show(id, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/#{id}\")\n end",
"def get_support_ticket_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.get_support_ticket_all_using_get ...'\n end\n # resource path\n local_var_path = '/support_ticket'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageSupportTicket')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#get_support_ticket_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end",
"def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end"
] |
[
"0.79411954",
"0.7714045",
"0.76178676",
"0.7395754",
"0.6774969",
"0.6678969",
"0.66049993",
"0.6560623",
"0.6551755",
"0.64916295",
"0.6415602",
"0.640632",
"0.63868004",
"0.63689077",
"0.6347163",
"0.63452417",
"0.63293564",
"0.62909126",
"0.6193635",
"0.61785233",
"0.61785233",
"0.61785233",
"0.61785233",
"0.61785233",
"0.61785233",
"0.61494434",
"0.61240786",
"0.611083",
"0.6087245",
"0.60522133",
"0.59902316",
"0.5975173",
"0.5969939",
"0.5969939",
"0.5969939",
"0.5969939",
"0.5969939",
"0.5969939",
"0.59591216",
"0.59361523",
"0.59339726",
"0.5927214",
"0.59082454",
"0.58764815",
"0.5864329",
"0.5855911",
"0.5849657",
"0.5845803",
"0.5826475",
"0.58044755",
"0.57867736",
"0.57771486",
"0.57733566",
"0.57648975",
"0.575151",
"0.5739935",
"0.5731931",
"0.5730298",
"0.5730002",
"0.5721114",
"0.5717589",
"0.571372",
"0.5697469",
"0.56890357",
"0.5685743",
"0.568529",
"0.56830835",
"0.5677482",
"0.56665283",
"0.56435966",
"0.56294125",
"0.5612699",
"0.56060934",
"0.5605038",
"0.5603078",
"0.5592966",
"0.55866635",
"0.5561565",
"0.5547137",
"0.55457515",
"0.5536355",
"0.55362093",
"0.5522514",
"0.55163157",
"0.5513284",
"0.55049914",
"0.5504067",
"0.55011266",
"0.5496171",
"0.5488305",
"0.54881203",
"0.5484714",
"0.5483946",
"0.54584974",
"0.5448136",
"0.54311055",
"0.54311055",
"0.5426188",
"0.542119",
"0.54064876"
] |
0.6352766
|
14
|
Deletes a ticket ==== Attributes +id+ numerical unique id for record +format+ be sure to include an accept header or add ".xml" or ".json" to the last path element +token+ your API Token for authentication ==== Raises ERROR 403 Forbidden When the token is invalid. ERROR 404 Not found When no records are found. ==== Examples To test this method, insert this url or your valid API key and application host into a browser or http client like wget or curl. For example: curl i H "accept: text/xml" X DELETE curl i H "accept: application/json" X DELETE
|
def destroy
@ticket = Ticket.find(params[:id].to_i) rescue nil
respond_to do |format|
if @ticket
success = @ticket.destroy rescue false
if success
format.xml { head :accepted }
format.json { head :accepted }
else
format.xml { render :xml => ticket_presenter, :status => :precondition_failed }
format.json { render :json => ticket_presenter, :status => :precondition_failed }
end
else
format.xml { head :not_found }
format.json { head :not_found }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end",
"def delete_support_ticket_using_delete_with_http_info(support_ticket_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.delete_support_ticket_using_delete ...'\n end\n # verify the required parameter 'support_ticket_id' is set\n if @api_client.config.client_side_validation && support_ticket_id.nil?\n fail ArgumentError, \"Missing the required parameter 'support_ticket_id' when calling SupportApi.delete_support_ticket_using_delete\"\n end\n # resource path\n local_var_path = '/support_ticket/{support_ticket_id}'.sub('{' + 'support_ticket_id' + '}', support_ticket_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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#delete_support_ticket_using_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n authorize @ticket\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to @coll_url }\n format.xml { head :ok }\n end\n end",
"def delete_ticket\n @ticket = Ticket.find(params[:id])\n @ticket.delete\n \n render :nothing => true\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def DeleteField id\n \n APICall(path: \"ticket_fields/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n url = URI.parse('http://hes.zendesk.com/api/v2/tickets/' + self.id)\n http = Net::HTTP.new(url.host, url.port)\n auth = Base64.encode64(\"#{HesZendesk::AuthUser}:#{HesZendesk::AuthPwd}\")\n req = Net::HTTP::Delete.new(url.path, {\n 'Accept' => 'application/xml',\n 'Authorization' => \"Basic #{auth}\",\n 'Content-Type' => 'application/xml'\n })\n res = http.start { |h| h.request(req) }\n raise res.inspect\n case res\n when Net::HTTPSuccess\n location = res['location'].to_s\n puts location\n return t\n else\n return nil\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 @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to tickets_url,\n notice: (crud_notice('destroyed', @ticket) + \"#{undo_link(@ticket)}\").html_safe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @support_ticket = SupportTicket.find(params[:id])\n @support_ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to support_tickets_url }\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 begin\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n rescue Exception => e\n #flash[:notice] = e.message\n flash[:notice] = msg_can_not_delete\n end \n respond_to do |format|\n format.html { redirect_to(tickets_url) }\n format.xml { head :ok }\n end \n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.project, notice: 'Ticket deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tickets_url }\n format.json { head :no_content }\n end\n end",
"def delete(params = {})\n case @api.version\n when 'v1'\n response = self.class.post(@api.delete_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n when 'v2'\n response = self.class.delete(@api.delete_config[:url],\n :query => { :auth_token => @token },\n :headers => @api.headers\n )\n end\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n true\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to admin_tickets_url, notice: 'Ticket delete successfully.' }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n #@ticket = Ticket.find(params[:id])\n #@ticket.destroy\n\n #respond_to do |format|\n # format.html { redirect_to(tickets_url) }\n # format.xml { head :ok }\n #end\n\t\t\n\t\tredirect_to(tickets_url)\n end",
"def destroy\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tickets_url(@project)) }\n format.xml { head :ok }\n end\n end",
"def delete(params = {})\n Client.current.delete(resource_url, params)\n end",
"def destroy\n @ticket_time = TicketTime.find(params[:id])\n @ticket_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La boleta se eliminó satisfactoriamente.'\n redirect_to tickets_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_type = TicketType.find(params[:id])\n @ticket_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_types_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.delete(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: 'Ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.update_attribute(:status, 'deleted')\n respond_to do |format|\n format.html do\n flash[:notice] = \"Ticket was destroyed\"\n redirect_to tickets_url\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket = @event.tickets.find(params[:id])\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to event_tickets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"Ticket was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_file.destroy\n respond_to do |format|\n format.html { redirect_to ticket_files_url, notice: 'Ticket file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_action = TicketAction.find(params[:id])\n @ticket_action.destroy\n\n respond_to do |format|\n format.html { redirect_to(ticket_actions_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url, notice: \"The tickey has been closed\" }\n format.json { head :no_content }\n end\n end",
"def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end",
"def delete id\n\t\t@tickets.delete ['id', id]\n\tend",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @ticket.destroy\n respond_to do |wants|\n wants.html { redirect_to(tickets_url) }\n wants.xml { head :ok }\n wants.json { head :ok }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def delete(path, options={}, format=format)\n request(:delete, path, options, format)\n end",
"def destroy\n @ticket_item.destroy\n respond_to do |format|\n format.html { redirect_to ticket_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket.destroy\n\n respond_with(@story, @ticket)\n end",
"def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end",
"def api_delete(action, data)\n api_request(action, data, 'DELETE')\n end",
"def delete operation, *args\n request(args) do |attrs, headers|\n @oauth_access_token.send(:delete, \"/#{API_VERSION}/#{operation}.#{API_FORMAT}\", headers)\n end\n end",
"def destroy\n @ticket.destroy\n render_destroy_format(\"ticket removed\")\n end",
"def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end",
"def delete\n request(:delete)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete_support_ticket_comment_using_delete_with_http_info(support_ticket_comment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.delete_support_ticket_comment_using_delete ...'\n end\n # verify the required parameter 'support_ticket_comment_id' is set\n if @api_client.config.client_side_validation && support_ticket_comment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'support_ticket_comment_id' when calling SupportApi.delete_support_ticket_comment_using_delete\"\n end\n # resource path\n local_var_path = '/support_ticket_comment/{support_ticket_comment_id}'.sub('{' + 'support_ticket_comment_id' + '}', support_ticket_comment_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(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#delete_support_ticket_comment_using_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\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 @support_ticket.destroy\n respond_to do |format|\n format.html { redirect_to support_tickets_url, notice: 'Support ticket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to @ticket.user, notice: \"Permanentka na #{get_ticket_therapies_string @ticket} úspěšně odstraněna\" }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end"
] |
[
"0.798416",
"0.70793396",
"0.7019936",
"0.6979481",
"0.69711757",
"0.696552",
"0.696552",
"0.696552",
"0.696552",
"0.696552",
"0.696552",
"0.6903327",
"0.6896321",
"0.6894147",
"0.6894147",
"0.6894147",
"0.6894147",
"0.6883122",
"0.6882252",
"0.6882252",
"0.6882252",
"0.6882252",
"0.6882252",
"0.6876111",
"0.6876111",
"0.6876111",
"0.6876111",
"0.6876111",
"0.6876111",
"0.6876111",
"0.6869316",
"0.6848598",
"0.6846251",
"0.68073344",
"0.67958105",
"0.67919827",
"0.6743261",
"0.6741981",
"0.6739942",
"0.6733665",
"0.6724162",
"0.6709856",
"0.6708866",
"0.670508",
"0.66766775",
"0.66709214",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6664991",
"0.6662673",
"0.6662484",
"0.6661217",
"0.66603684",
"0.66603684",
"0.6650051",
"0.6648795",
"0.66344583",
"0.66202676",
"0.66202176",
"0.6614071",
"0.6592505",
"0.65910167",
"0.65852416",
"0.656404",
"0.6557644",
"0.65563774",
"0.65539455",
"0.6538996",
"0.65288836",
"0.6527101",
"0.6526398",
"0.65257215",
"0.651191",
"0.6504007",
"0.65039593",
"0.65032566",
"0.6494903",
"0.6489863",
"0.6489763",
"0.648603",
"0.6473917",
"0.64701796",
"0.64592016"
] |
0.68873286
|
17
|
Private methods below helper for loading the tickets presenter
|
def tickets_presenter
@tickets_presenter ||= V1::TicketsPresenter.new(@tickets, @template)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ticket_presenter\n @ticket_presenter ||= V1::TicketPresenter.new(@ticket, @template)\n end",
"def show_ticket\n end",
"def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end",
"def preload_tickets\n @tickets = if params[:story_id]\n Story.find(params[:story_id]).tickets\n else\n Sprint.find(params[:sprint_id]).tickets\n end\n end",
"def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end",
"def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def show\n if @ticket.present?\n @ticket_replies = @ticket.ticket_replies\n @ticket_reply = TicketReply.new\n end\n end",
"def show\n @tickets = Ticket.get_from_event @event\n end",
"def show\n #@ticket = @support.tickets.new\n @tickets = @support.tickets\n \n end",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def show\n\t\t@tickets = @prospect.tickets.desc(:event_date)\n\t\t@prospect_member = @prospect.prospect_member\n\t\t@ticket = Ticket.new \n\tend",
"def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def all_ticket_entries\n @ac = ApplicationController.new\n @tickets = Ticket.find(:all, :order => \"created_at\")[0..5000].reverse!\n @species = Specie.all\n @woodtypes = WoodType.all\n end",
"def show\n @ticket_details = @ticket.ticket_details\n end",
"def show\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @ticket.blank?\n format.xml { render :xml => ticket_presenter }\n format.json { render :json => ticket_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def show\n @tickets = @event.tickets.find(params[:id])\n end",
"def get_hfi_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_hfi(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def index\n @tickets = get_current_user_ticket_list(@user)\n end",
"def show\n if @ticket\n if ProjectUser.verify_role(current_user.id, @ticket.project_id, 'client')\n render json: Ticket.build_ticket_object(@ticket, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no ticket found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def show\n @event = Event.find(params[:id])\n @ticket = @event.tickets.new\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end",
"def show_tickets_list(page_number)\n @tickets_shown_per_page = 25\n url = \"https://alanli1.zendesk.com/api/v2/tickets.json?page=#{page_number}&per_page=#{@tickets_shown_per_page}\"\n\n res = ApiHelper.make_req_to_api(url)\n @tickets = find_tickets(res)\n @count = res[\"count\"]\n @pages = (@count.to_f / @tickets_shown_per_page).ceil\n return @tickets, @count, @pages\n end",
"def overall_tickets\n\n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def set_ticket\n @ticket = Ticket.includes(:comments).find(params[:id])\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def ticket_dashboard\n @user = User.first \n @ticket = Ticket.find_by(id: params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n @task = Task.find(params[:task_id]) if params[:task_id]\n @task ||= Task.new\n @tasks = @ticket.tasks\n @note = Note.find(params[:note_id]) if params[:note_id]\n @note ||= Note.new\n @notes = @ticket.notes \n end",
"def show\n @ticket = Ticket.find(params[:id])\n @tickets = Ticket.find(:all, :conditions => [\"event_id = ?\", @ticket.event_id])\n @tickets = @tickets.paginate(:page => params[:page])\n \n #Define breadcrumbs\n @l1_link = tickets_path\n @l1_name = \"Tickets\" \n @l2_link = ticket_path\n @l2_name = \"Ticket \" + @ticket.id.to_s\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def show\n @ticket_attachments = @ticket.ticket_attachments.all\n end",
"def index\n users_tickets = if current_employee.manager?\n Ticket::Ticket.all\n elsif current_employee.crew_chief?\n Ticket::Ticket.where(crew_chief: current_employee)\n end\n \n @tickets = users_tickets.not_finalized.decorate\n @tickets_finalized = users_tickets.finalized.decorate\n end",
"def get_tickets(ticket)\n @tickets << ticket\n ticket.passenger ||= self\nend",
"def show\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket_owner }\n end\n end",
"def show\n if !(current_user.id==params[:id] || current_user.admin)\n flash[:warning] = \"You don't have permission to see this.\"\n redirect_to \"/\"\n end\n @renter = Renter.find(params[:id])\n if session[:logged_in]\n if Ticket.exists?(renterID: session[:renter_id])\n @tickets = Ticket.where(renterID: session[:renter_id]).order(checkout: :desc).reorder(active: :desc)\n @tickets = Kaminari.paginate_array(@tickets).page(params[:ticket_page]).per(3)\n else\n @tickets = nil\n end\n end\n end",
"def show\n @conversations = @ticket.conversations\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def create_internal_ticket\n @forum = Forum.find(1)\n @user = User.where(\"lower(email) = ?\", params[:topic][:user][:email].downcase).first\n\n @topic = @forum.topics.new(\n name: params[:topic][:name],\n private: true,\n team_list: params[:topic][:team_list],\n channel: params[:topic][:channel],\n tag_list: params[:topic][:tag_list],\n priority: params[:topic][:priority],\n current_status: params[:topic][:current_status],\n assigned_user_id: params[:topic][:assigned_user_id],\n kind: 'internal'\n )\n if @user.nil?\n create_ticket_user\n else\n @topic.user_id = @user.id\n end\n\n fetch_counts\n respond_to do |format|\n if (@user.save || !@user.nil?) && @topic.save\n @post = @topic.posts.create(\n body: params[:topic][:post][:body],\n user_id: current_user.id,\n kind: params[:topic][:post][:kind],\n screenshots: params[:topic][:screenshots],\n attachments: params[:topic][:post][:attachments]\n )\n\n # track event in GA\n tracker('Request', 'Post', 'New Internal Topic')\n tracker('Agent: Unassigned', 'New', @topic.to_param)\n\n # Now that we are rendering show, get the posts (just one)\n # TODO probably can refactor this\n @posts = @topic.posts.chronologic.includes(:user)\n format.js {\n render action: 'show', id: @topic\n\n }\n format.html {\n render action: 'show', id: @topic\n }\n else\n format.html {\n render action: 'new'\n }\n end\n end\n\n\n end",
"def ticket\n case eventable_class\n when \"Ticket\"\n Ticket.get(eventable_id)\n when \"TicketUpdate\"\n TicketUpdate.get(eventable_id).ticket\n when \"Milestone\"\n Milestone.get(eventable_id)\n end\n end",
"def index\n @menu='tickets' #Set the menu variable\n $title=t(:title_tickets) #Set the title variable\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @page_aux = params[:page] #Retrieve the params from the query string\n @election_id = params[:election_id] #Retrieve the params from the query string\n @page = @page_aux =~ /\\A\\d+\\z/ ? @page_aux.to_i : 0 #Validate if the page_aux param can be parsed as an integer, otherwise set it to cero\n response = Ticket.all(session[:user],@election_id,@page) #Retrieve all the tickets from the model\n if response[0] #Validate if the response was successfull\n @tickets_list = response[1] #Get the tickets list from the response\n @total_pages = response[3].to_i #Get the total numer of pages from the response\n @previous_page = @page > 0 ? @page-1 : -1 #Calculate the previous page number, if we are at the first page, then it will set to minus one\n @next_page = @page+1 < @total_pages ? @page+1 : -1 #Calculate the next page number, if we are at the last page, then it will set to minus one\n elsif response[1] == '404'\n return\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n flash[:danger] = t(:ticket_list_error_flash) #Set the error message to the user\n redirect_to error_general_error_path #Redirect the user to the generic error page\n else\n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end",
"def show\n @response = Response.new\n @responses = @ticket.responses\n end",
"def show\n @admin_ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_ticket }\n end\n end",
"def show\r\n # @ticket = Contact::Ticket.find_by_uuid(params[:id])\r\n raise UnknowsAction\r\n end",
"def index\n if current_user.is? :admin\n if params[:user_id]\n @tickets = User.find(params[:user_id]).tickets.paginate(:page => params[:page])\n elsif params[:team_id]\n @tickets = Team.find(params[:team_id]).tickets.paginate(:page => params[:page])\n else\n @tickets = Ticket.paginate(:page => params[:page])\n end\n else\n @tickets = current_user.tickets.paginate(:page => params[:page])\n end\n\n if params[:status] == \"closed\"\n @tickets = @tickets.closed\n else\n @tickets = @tickets.open\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def get_ticket(ticket)\n @tickets << ticket\nend",
"def show\n @ticket = Ticket.find(params[:id])\n\t\t@reply = @ticket.replies.build\n\t\t\n\t\t@scope = params[:scope]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def index\n respond_with(@tickets)\n end",
"def set_ticket\n # is this ticket belong to him ?\n @ticket = @current_user.ticket(params[:id])\n end",
"def method_missing(method, *args)\n if Show.ticket_types.include?(method.to_s)\n tickets_for_type(method.to_s)\n else\n super\n end\n end",
"def index\n @tickets = current_user.tickets\n end",
"def index\n @tickets = current_user.tickets\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def index\n tickets = Ticket.all_relevant_tickets\n @pagy, @tickets = pagy(tickets)\n ticket_records_with_associations =\n TicketSerializer.new(@tickets, { params: { :ticketlist => true } }).hash_for_collection[:data].map { | ticket |\n ticket[:attributes]\n }\n # When we need pagination lets use the below\n #render json: { data: ticket_records_with_associations,\n # pagy: pagy_metadata(@pagy) }\n paginate json: ticket_records_with_associations\n end",
"def my_tickets\n user = current_user.id if !current_user.nil?\n # OCO\n init_oco if !session[:organization]\n\n @search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !user.blank?\n with :created_by, user\n end\n with(:ticket_status_id).less_than(4)\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n\n @tickets = @search.results\n\n respond_to do |format|\n format.html # my_tickets.html.erb\n format.json { render json: @tickets }\n end\n end",
"def show\n # Get the current user\n @user = User.find(current_user.id)\n # Define arrays to hold open and closed tickets\n @open_tickets = []\n @closed_tickets = []\n # For each request the person has made:\n @user.help_requests.each do |request|\n # If the request is open...\n if request.open?\n # ...add it to the array of open tickets\n @open_tickets << request\n # Else if the ticket is closed...\n elsif !request.open?\n # Add it to the list of closed tickets\n @closed_tickets << request\n end\n end\n end",
"def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end",
"def view_presenters\n\t\t@subject = Subject.find(params[:subject_id])\n\t\t@presenters = @subject.presenters\n\tend",
"def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end",
"def show\n authorize! :read, Show, Ticketrez, Ticketsection\n @ticketrezs = @show.ticketrezs\n @ticketsections = @show.ticketsections\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @show }\n end\n end",
"def index\n @tickets = current_user.tickets.page(params[:page]||1)\n respond_to do |format|\n format.html\n format.xml { render :xml => @tickets }\n format.json { render :json => @tickets }\n end\n end",
"def index\n @tickets = current_user.support_tickets.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page])\n add_breadcrumb \"My Tickets\"\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def ticket\r\n TicketController.instance\r\n end",
"def index\n @tickets = Ticket.all\n render_default_format(@ticket, true)\n end",
"def show_tickets_sold()\n end",
"def index\n @user = User.new unless current_user\n @tickets = Ticket.paginate(page: params[:page])\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n # get last five comments\n @comments_per_page = 5\n @comments = @ticket.comments.limit(@comments_per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @ticket }\n end\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def tickets(*options)\n options.insert 0, id\n easy_finder(provider_parent(self.class)::Ticket, :all, options, 1)\n end",
"def get_events_for_ticket( session_key, ticket_id)\n response_xml = self.call( :get_events_for_ticket, message: {\n arg0: session_key,\n arg1: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def show\n render json: @ticket\n end",
"def show\n @ticket = @project.tickets.find_by_scoped_id!(params[:id])\n @ticket_comment = @ticket.ticket_comments.new\n @ticket_comment.status_to = @ticket.status\n @ticket_comment.responsible_id_to = @ticket.responsible_id\n @ticket_comment.priority_to = @ticket.priority\n @assets = @project.assets.where(:attachable_type=>[Ticket.to_s, TicketComment.to_s]).where(:attachable_id=>([@ticket.id]|@ticket.ticket_comments.all.map{|tc|tc.id})).order('updated_at desc').all\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket }\n end\n end",
"def index\n\n @clients = Ticket.joins(:clients).where(client_id: params[:id])\n # @tickets = Ticket.joins(:computers).where(client_id: params[:id])\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n if params[:search]\n @tickets = Ticket.search(params[:search]).order(\"created_at DESC\").page params[:page]\n else\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n @tickets = Ticket.all.order(:due_date).limit(10).offset(0).page params[:page]\n end\n \n #@client = Ticket.joins(:clients).where(@ticket => client.full_name)\n @open_tickets = Ticket.where.not(\"status_id = 8\").count\n #@computers = @ticket.computer.id\n @new_tickets = Ticket.where(\"status_id = 4\").limit(10).offset(0).page params[:page]\n @diagnostic_tickets = Ticket.where(\"status_id = 9\").page params[:page] \n @parts_tickets = Ticket.where(\"status_id = 6\").page params[:page]\n @waiting_tickets = Ticket.where(\"status_id = 7\").page params[:page]\n @in_progress_tickets = Ticket.where(\"status_id = 5\").page params[:page]\n @completed_tickets = Ticket.where(\"status_id = 8\").limit(10).offset(0).page params[:page]\n @expected_date = Date.today + (@open_tickets / 5) + 3.days\n #@expected_date = Ticket.due_date.created_at + 3.days\n end",
"def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end"
] |
[
"0.6766",
"0.6431827",
"0.6115272",
"0.6099503",
"0.6064466",
"0.606041",
"0.6057969",
"0.60260427",
"0.60033655",
"0.5932982",
"0.5915612",
"0.58907574",
"0.5836348",
"0.57882744",
"0.57817584",
"0.5758822",
"0.57571864",
"0.57474613",
"0.57441497",
"0.57253516",
"0.5713772",
"0.5688629",
"0.5652585",
"0.56280255",
"0.562616",
"0.5621597",
"0.56072134",
"0.5592931",
"0.55894506",
"0.5582928",
"0.55614007",
"0.554494",
"0.5540247",
"0.55256206",
"0.5521813",
"0.5516972",
"0.5513545",
"0.5497189",
"0.54921067",
"0.54916936",
"0.54863036",
"0.5473231",
"0.54633677",
"0.54477876",
"0.5447127",
"0.5441102",
"0.5433388",
"0.54300356",
"0.5424039",
"0.5416014",
"0.54159176",
"0.54071",
"0.53992563",
"0.5393005",
"0.5391051",
"0.5391051",
"0.53880495",
"0.53880495",
"0.53880495",
"0.53880495",
"0.53880495",
"0.53880495",
"0.53880495",
"0.53880495",
"0.5384254",
"0.5379215",
"0.53785187",
"0.53751063",
"0.5374694",
"0.53653514",
"0.53606504",
"0.5357902",
"0.5353304",
"0.5349289",
"0.5345655",
"0.5338919",
"0.5338919",
"0.5338919",
"0.5338919",
"0.5338919",
"0.5338919",
"0.5322929",
"0.5307181",
"0.5303683",
"0.53001815",
"0.529822",
"0.52864474",
"0.5285947",
"0.52713233",
"0.52645016",
"0.5258712",
"0.52464414",
"0.5244822",
"0.52391535",
"0.5239148",
"0.5220697",
"0.5220697",
"0.5220697",
"0.5220697",
"0.5220697"
] |
0.6993174
|
0
|
helper for loading the ticket present
|
def ticket_presenter
@ticket_presenter ||= V1::TicketPresenter.new(@ticket, @template)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def set_ticket\n @ticket = params[:id].present? ? find_ticket(:id) : find_ticket(:ticket_id)\n end",
"def show\n @ticket = Ticket.find(params[:id])\n \n end",
"def set_ticket\n @ticket = Ticket.includes(:comments).find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def show_ticket\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id]) if params[:id]\n end",
"def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def show\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n # is this ticket belong to him ?\n @ticket = @current_user.ticket(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find_by_uid(params[:id])\n end",
"def show\r\n # @ticket = Contact::Ticket.find_by_uuid(params[:id])\r\n raise UnknowsAction\r\n end",
"def set_ticket\n @ticket = Ticket.find(params[:id])\n @task = Task.find(params[:task_id]) if params[:task_id]\n @task ||= Task.new\n @tasks = @ticket.tasks\n @note = Note.find(params[:note_id]) if params[:note_id]\n @note ||= Note.new\n @notes = @ticket.notes \n end",
"def preload_tickets\n @tickets = if params[:story_id]\n Story.find(params[:story_id]).tickets\n else\n Sprint.find(params[:sprint_id]).tickets\n end\n end",
"def show\n @ticket_details = @ticket.ticket_details\n end",
"def set_ticket\n @ticket = Ticket.friendly.find(params[:id])\n end",
"def set_labticket\n @labticket = Labticket.find(params[:id])\n end",
"def show\n @ticket = Ticket.find_by_reference(params[:id])\n end",
"def ticket_dashboard\n @user = User.first \n @ticket = Ticket.find_by(id: params[:id])\n end",
"def set_ticket_file\n @ticket_file = TicketFile.find(params[:id])\n end",
"def set_ticket\n @ticket = current_user.tickets.find_by_id(params[:id])\n end",
"def set_ticket\n @ticket = Ticket.find(params[:ticket_id])\n @ticket_user = User.find(@ticket.user_id)\n end",
"def show\n @breadcrumb = 'read'\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end",
"def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend",
"def ticket\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def show\n #@ticket = @support.tickets.new\n @tickets = @support.tickets\n \n end",
"def login_ticket\n LoginTicket\n end",
"def show\n if @ticket.present?\n @ticket_replies = @ticket.ticket_replies\n @ticket_reply = TicketReply.new\n end\n end",
"def show\n @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count\n @ticket = Helpdesk::Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def get_ticket_granting_ticket\n if tgt_expired?\n # It's expired, so we're going to start this process by resetting the state\n clear_ticket_state\n\n response = RestClient.post(Rails.configuration.x.umls.umls_auth_base_url, { username: Rails.configuration.x.umls.username, password: Rails.configuration.x.umls.password })\n if response.code != 201 # expect a 201/Created response\n return nil\n end\n\n # The actual ticket response is a URL that we pull from the location. The body has an HTML form,\n # which we don't want to have to parse.\n @ticket_granting_ticket = response.headers[:location]\n @last_updated = Time.now.to_i\n end\n\n @ticket_granting_ticket\n end",
"def get_ticket\n ticket_details = self.class.get(\"/rest/api/2/issue/\", :verify => false)\n File.open(\"custom.txt\", 'w') {|f| f.write(ticket_details) }\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def get_ticket_details( session_key, ticket_id)\n response_xml = self.call( :get_ticket_details, message: {\n api_key: session_key,\n ticket: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def show\n @ticket = Ticket.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @ticket.blank?\n format.xml { render :xml => ticket_presenter }\n format.json { render :json => ticket_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end",
"def show\n @event = Event.find(params[:id])\n @ticket = @event.tickets.new\n end",
"def show\n if @ticket\n if ProjectUser.verify_role(current_user.id, @ticket.project_id, 'client')\n render json: Ticket.build_ticket_object(@ticket, current_user.id), status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no ticket found with id of #{params[:project_id]}\" }, status: 404\n end\n end",
"def set_admin_ticket\n @ticket = Ticket.find(params[:id])\n end",
"def set_bug_ticket\n @bug_ticket = BugTicket.find(params[:id])\n end",
"def show\n Labtech.get_token\n @last_ticket = Labtech.last_labticket\n end",
"def set_ticket\n @ticket = policy_scope(Ticket).find(params[:id])\n end",
"def set_ticket_detalle\n @ticket_detalle = TicketDetalle.find(params[:id])\n end",
"def initialize( ticket )\n @ticket = ticket\n @flash = nil\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end",
"def show\n @ticket = Ticket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ticket }\n end\n end"
] |
[
"0.67572457",
"0.6753084",
"0.670794",
"0.66061914",
"0.6578672",
"0.65642905",
"0.6557784",
"0.6557784",
"0.6557784",
"0.6557784",
"0.6557784",
"0.6557784",
"0.6557784",
"0.6557784",
"0.653213",
"0.6505492",
"0.647389",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6460158",
"0.6452985",
"0.6418072",
"0.6414441",
"0.6414441",
"0.6414441",
"0.64071167",
"0.63967884",
"0.63857806",
"0.63548213",
"0.63463247",
"0.63462",
"0.633898",
"0.6207368",
"0.62032044",
"0.61909807",
"0.6180007",
"0.6177352",
"0.6173937",
"0.6150206",
"0.613937",
"0.613014",
"0.6102155",
"0.6058705",
"0.6011863",
"0.6007943",
"0.6004014",
"0.5989285",
"0.5976933",
"0.5965269",
"0.5944457",
"0.59439325",
"0.5918088",
"0.59161264",
"0.5915092",
"0.58887726",
"0.588666",
"0.5884138",
"0.5879927",
"0.5868426",
"0.58630335",
"0.58630335",
"0.58630335",
"0.58630335",
"0.58630335",
"0.58630335"
] |
0.0
|
-1
|
GET /articles GET /articles.json
|
def index
@articles = Article.find(:all, :order => "created_at DESC" )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = current_user.articles\n json_response(@articles)\n end",
"def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end",
"def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end",
"def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end",
"def index\n # GET /articles\n @articles = Article.all\n end",
"def show\n @article = Article.find(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 @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end",
"def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end",
"def index\n @articles = article_all\n respond_with(@articles)\n end",
"def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end",
"def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end",
"def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend",
"def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end",
"def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end",
"def show\n @article = Article.where(id: params[:id]).last\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 @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def articles(page = 'hot', options = {})\n get_resources(\"#{@url}#{page}\", options) do |resource_json|\n Article.new(resource_json['data'])\n end\n end",
"def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = article_get!(params[:id])\n respond_with(@article)\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 @articles = Article.all\n end",
"def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end",
"def index\n @articles = Article.order(\"created_at DESC\").paginate(:page=>params[:page],:per_page=>40)\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @articles }\n end\n end",
"def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end",
"def list\n if params[:search]\n articles = Article.where(status: \"accepted\")\n .where('lower(title) LIKE ?', \"%#{params[:search].downcase}%\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n else\n articles = Article.where(status: \"accepted\")\n .paginate(page: params[:page], per_page: params[:limit] || 10)\n end\n render json: articles, \n only: [ :id, :title, :created_at, :tags ], \n methods: [ :pictures, :created_by ], \n status: :ok\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end",
"def show\n @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end",
"def index\n @articles = Article.all()\n end",
"def index\n authorize! :admin, :dashboard\n @articles = Article.internal.paginate(\n :per_page => 20,\n :page => params[:page],\n :order => 'created_at DESC'\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @articles }\n end\n end",
"def index\n @articles = Article.all\n end",
"def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end",
"def show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(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 show\n @article = Article.includes(:comments).find(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 show\n @article = Article.includes(:comments).find(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 show\n @article = Article.includes(:comments).find(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 GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end",
"def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def all_articles\n json = self.class.get(\"#{QUERY1 + PARAMETERS_API}\")\n puts \"QUERY IS: #{QUERY1 + PARAMETERS_API}\"\n response = json['response']\n articles = response['results']\n\n articles.each do |article|\n parse_article(article, nil)\n end\n end"
] |
[
"0.7823242",
"0.7757662",
"0.77491444",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7650022",
"0.7612499",
"0.75499934",
"0.744125",
"0.73619306",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.7355765",
"0.73300153",
"0.73248166",
"0.731896",
"0.7303591",
"0.72909534",
"0.72858363",
"0.7231521",
"0.7222467",
"0.7098828",
"0.70850784",
"0.706784",
"0.70611477",
"0.7043847",
"0.7021233",
"0.7015075",
"0.6996384",
"0.6981237",
"0.6962511",
"0.6961601",
"0.69489926",
"0.69457155",
"0.69450706",
"0.687617",
"0.68583465",
"0.68425024",
"0.6815636",
"0.68042445",
"0.67870444",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.677967",
"0.67387855",
"0.67351097",
"0.6730302",
"0.6725925",
"0.67240345",
"0.6707688",
"0.67012805",
"0.6698747",
"0.66880673",
"0.66880673",
"0.66880673",
"0.668287",
"0.6680336",
"0.6680336",
"0.6680336",
"0.6680336",
"0.66764",
"0.66719913",
"0.66466206",
"0.66381854",
"0.6630698"
] |
0.0
|
-1
|
GET /articles/1 GET /articles/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.where(id: params[:id]).last\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 @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end",
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 show\n @article = Article.find(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 @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find(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 show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = current_user.articles\n json_response(@articles)\n end",
"def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end",
"def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end",
"def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end",
"def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end",
"def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n # GET /articles\n @articles = Article.all\n end",
"def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end",
"def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end",
"def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\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 @article = Article.find(params[:id])\n if @article==nil\n redirect_to articles_url\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end\n end",
"def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end",
"def show\n @feed = Feed.find(params[:feed_id])\n @article = Article.find(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 @articles = article_all\n respond_with(@articles)\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end",
"def show\n @article = Article.includes(:comments).find(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 show\n @article = Article.includes(:comments).find(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 show\n @article = Article.includes(:comments).find(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 show\n @user_article = UserArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_article }\n end\n end",
"def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end",
"def show\n @article = Article.find(params[:id])\n respond_with(@article)\n end",
"def show\n @articles = Article.all\n end",
"def show\n @article = Article.find(params[:id]) \n end",
"def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end",
"def show\n @article = Article.find(params[:id])\n end",
"def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end",
"def show\n @articleaddressee = Articleaddressee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articleaddressee }\n end\n end",
"def index\n #remove_cache #if params[:page]\n #@articles = #Article.where(:is_published => true)\n @articles = Article.published.paginated(params[:page], 10)\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @article = Article.find params[:id]\n end",
"def index\n @articles = Article.order('published_at DESC').page(params[:page]).per(5)\n\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }\n format.json { render json: @articles }\n end\n end",
"def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end",
"def index\n @articles = Article.all\n end"
] |
[
"0.7745946",
"0.75169533",
"0.7514653",
"0.7483779",
"0.74794465",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.74741095",
"0.7427753",
"0.7427753",
"0.7427753",
"0.7427753",
"0.7427753",
"0.7427753",
"0.74233234",
"0.7375665",
"0.7314243",
"0.7269898",
"0.72290784",
"0.7186836",
"0.7185977",
"0.7129865",
"0.7117525",
"0.70641494",
"0.7049445",
"0.7038603",
"0.70167893",
"0.6988462",
"0.6988366",
"0.69622266",
"0.690541",
"0.6877994",
"0.68634385",
"0.68551",
"0.68446344",
"0.6826926",
"0.68240654",
"0.68178016",
"0.68159276",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.67993987",
"0.6799314",
"0.6771975",
"0.67679214",
"0.67679214",
"0.67679214",
"0.67567056",
"0.6746723",
"0.67406255",
"0.6723691",
"0.670258",
"0.66951174",
"0.6691913",
"0.66887635",
"0.6686846",
"0.66766775",
"0.6673459",
"0.6664146",
"0.6659832",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685",
"0.6653685"
] |
0.0
|
-1
|
POST /articles POST /articles.json
|
def create
@article = Article.new(article_params)
respond_to do |format|
if @article.save
Article.get_barcode(@article.id)
format.html { redirect_to action: 'new', notice: 'Article was successfully created.' }
format.json { render action: 'show', status: :created, location: @article }
else
format.html { render action: 'new' }
format.json { render json: @article.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to root_path, notice: 'Article was successfully created.' }\n format.json { render :index, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article, notice: 'Article was successfully created.'\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created.\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n flash[:success] = 'Article was successfully created.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Dodano artykuł.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(params[:article])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Article was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t @article = Article.new(article_params)\n\n\t respond_to do |format|\n\t if @article.save\n\t format.html { redirect_to @article, notice: 'article was successfully created.' }\n\t format.json { render :show, status: :created, location: @article }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Articulo creado exitosamente' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Članek je bil uspešno ustvarjen!' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n\t\t\t\t# whitelisting certain fields that we want to enter by passing in article_params\r\n\t\t\t\tarticle = Article.new(article_params)\r\n\r\n\t\t\t\t# check similarities\r\n\t\t\t\tif article.save\r\n\t\t\t\t\t# render a response\t\r\n\t\t\t\t\trender json: {status: 'Success', message:'Save artice', data:article}, status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\t# unsuccessfully\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Article not saved', \r\n\t\t\t\t\t\tdata:article.errors}, status: :unprocessable_entity\r\n\t\t\t\tend\t\r\n\t\t\tend",
"def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"L'article a ete correctement cree\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @article = Article.internal.new(params[:article])\n @article.user = current_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_created') }\n format.json { render :json => @article, :status => :created, :location => @articles }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.author = current_user\n if @article.save\n render :show, status: :created\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @article = current_user.articles.create(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @article = Article.new.from_json(params[:article])\n @article.nb_comments = 0\n @article.publication_date = Time.now\n @article.user_id = @user.id\n respond_to do |format|\n if @article.save\n @article.score = Score.create(:score_pos => 0, :score_neg => 0)\n @article.save\n @author = Author.create(:article_id => @article.id, :user_id => @user.id, :job => \"author\")\n @author.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = current_user.articles.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } }\n scraped_article = JSON.parse(response.body)\n @article.update({\n :title => scraped_article['title'],\n :byline => scraped_article['byline'],\n :excerpt => scraped_article['excerpt'],\n :content_html => scraped_article['content'],\n :readerable => scraped_article['readerable'],\n :scraped_at => DateTime.now\n })\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article_datum = ArticleDatum.new(params[:article_datum])\n\n respond_to do |format|\n if @article_datum.save\n format.html { redirect_to @article_datum, notice: 'Article datum was successfully created.' }\n format.json { render json: @article_datum, status: :created, location: @article_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_article = Admin::Article.new(params[:admin_article])\n\n respond_to do |format|\n if @admin_article.save\n format.html { redirect_to @admin_article, notice: 'Article was successfully created.' }\n format.json { render json: @admin_article, status: :created, location: @admin_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end",
"def create\n\t@article = current_user.articles.new(params[:article]) \n#@article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n\tformat.html{ redirect_to(@article, \"article created successfully\")}\n#\tformat.html { redirect_to(@article, :notice => t('articles.create_success')) }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @article = @user.articles.build(article_params)\n respond_to do |format|\n if @article.save\n @user.articles << @article\n format.html { redirect_to @article, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.create(params[:article])\n redirect_to @article\n end",
"def create\n article = Article.create params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n respond_with article\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: '記事の投稿が完了しました' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n set_owners\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = current_user\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.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 create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end",
"def create\n @article_news = ArticleNew.new(article_news_params)\n\n respond_to do |format|\n if @article_news.save\n format.html { redirect_to @article_news, notice: \"Article new was successfully created.\" }\n format.json { render :show, status: :created, location: @article_news }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article_news.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article])\n\n check_admin_or_dziekan\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n# format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(params[:article].except(:author_list))\n if @article.save\n @article.author_list = params[:article][:author_list]\n success = @article.save\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n logger.debug @article.errors.inspect\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 create_article\n return unless request.method == \"POST\"\n\n return if flash_missing_title?\n article = Article.new(title: params[:article][:title],\n body: params[:article][:body],\n user_id: @user.id)\n article.save\n redirect_to(action: \"show_article\", id: article.id)\n end",
"def create\n logger.debug \"request: #{params.inspect}\"\n vari = params.require(:article).permit(:text, :title)\n logger.debug \"SOLO LOS ARTICLES : #{vari}\"\n @article = Article.new(vari)\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n logger.debug \"New article: #{@article.attributes.inspect}\"\n logger.debug \"Article should be valid: #{@article.valid?}\"\n end",
"def create\n @backend_article = Backend::Article.new(article_params)\n\n respond_to do |format|\n if @backend_article.save\n format.html { redirect_to @backend_article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend_article }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = @user\n respond_to do |format|\n if @article.save\n format.html { redirect_to new_article_path, notice: 'Artigo enviado com sucesso' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n setup_images()\n format.html { redirect_to @article, notice: '記事を作成しました。' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def create\n \n @article = Article.new()\n \n set_publishable_params(params[:article], @article)\n \n @article.assign_attributes(article_params)\n @article.user_id = current_user.id\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_article = UserArticle.new(params[:user_article])\n\n respond_to do |format|\n if @user_article.save\n format.html { redirect_to @user_article, :notice => 'User article was successfully created.' }\n format.json { render :json => @user_article, :status => :created, :location => @user_article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user_id = current_user.id\n\n if @article.save\n redirect_to root_path\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @article = Article.new(article_params)\n @article.user = current_user\n @article.status = Rails.configuration.constants['article_status_draft']\n\n authorize @article\n\n if @article.save\n render status: :created, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def create\n @article = current_user.articles.build(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created. #{undo_link}\" }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\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"
] |
[
"0.7153906",
"0.709067",
"0.709067",
"0.709067",
"0.709067",
"0.709067",
"0.709067",
"0.709067",
"0.709067",
"0.70851403",
"0.70658004",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.7056407",
"0.70538",
"0.7040406",
"0.7028991",
"0.7020017",
"0.7009481",
"0.70041686",
"0.69968784",
"0.69968784",
"0.6976499",
"0.6960875",
"0.69339764",
"0.69209814",
"0.6910657",
"0.68993676",
"0.6898835",
"0.6861426",
"0.68215555",
"0.6798591",
"0.6751104",
"0.6724313",
"0.67230284",
"0.67109644",
"0.67049515",
"0.6699464",
"0.6687633",
"0.6677713",
"0.6641552",
"0.6630431",
"0.6607197",
"0.6600519",
"0.65872073",
"0.65673655",
"0.65495265",
"0.654101",
"0.65297586",
"0.652954",
"0.6522812",
"0.65083975",
"0.6503531",
"0.6502983",
"0.6496211",
"0.6488373",
"0.6476068",
"0.64568216",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.64534605",
"0.6450244",
"0.64498496",
"0.6439004",
"0.64379877",
"0.6426534",
"0.64247376",
"0.6419079",
"0.64187133",
"0.64110214",
"0.6408702",
"0.63971984",
"0.6391663",
"0.63867056"
] |
0.0
|
-1
|
PATCH/PUT /articles/1 PATCH/PUT /articles/1.json
|
def update
respond_to do |format|
if @article.update(article_params)
@article.sent = false
@article.save
format.html { redirect_to @article, notice: 'Article was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @article.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_path, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end",
"def update\n @article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n auth_privilege\n\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by_authentication_token(params[:auth_token])\n @newArticle = Article.new.from_json(params[:article])\n @oldArticle = Article.find(@newArticle.id)\n @author = Author.find_by_user_id_and_article_id(@user.id, @newArticle.id)\n if @author != nil\n @oldArticle.content = @newArticle.content\n @oldArticle.category = @newArticle.category\n @oldArticle.title = @newArticle.title\n respond_to do |format|\n if @oldArticle.save\n format.html { redirect_to @oldArticle, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oldArticle.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render json: \"error\" }\n format.json { render json: \"error\" }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_public_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n@article=Article.find(params[:id])\n @article.title=params[:article][:title]\n@article.body=params[:article][:body]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to [:edit, @article], notice: 'Article modifié.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n #check_for_destroys\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @article\n if @article.update(article_params)\n render status: :ok, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n flash[:success] = 'Article was successfully updated.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n # increase edit by 1\n if @article.edit_count\n @article.edit_count = @article.edit_count + 1\n else\n @article.edit_count = 0\n end\n # save\n respond_to do |format|\n if @article.update_attributes(params[:article])\n #format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.html { redirect_to session[:edit_redirect], notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.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 @article.update_attributes(article_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article, notice: 'Article was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @article\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params_for_update)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = current_user.articles.find(params[:id])\n\n if @article.approved?\n params[:article].delete(:title)\n params[:article].delete(:teaser)\n end\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to(:back, :notice => 'article was successfully updated.') }\n format.json { respond_with_bip(@article) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@article) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.'} \n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n expire_one(params[:id])\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to([:admin, @article], :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\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 respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: \"Article was successfully updated.\" }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:article])\n format.html { redirect_to @post, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n @partenaire = @art\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t@article = current_user.articles.find([:id]) \n#@article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\nformat.html { redirect_to(@article, \"article updated succesfully\") }\n#format.html { redirect_to(@article,\n#\t:notice => t('articles.update_success')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\t\tdeny_access_unless(can_edit?(@article))\n\t\t\n\t\topts = {}\n\t\topts = { :as => :editor } if can_edit?(@article)\n\t\topts = { :as => :admin } if admin?\n\n respond_to do |format|\n if @article.update_attributes(params[:article], opts)\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @article\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:alert]= 'Error: '+ @article.errors.full_messages.join(\". \")\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Zmodyfikowano artykuł.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t params.permit!\n\t respond_to do |format|\n\t if @article.update(article_params)\n\t format.html { redirect_to @article, notice: 'article was successfully updated.' }\n\t format.json { render :show, status: :ok, location: @article }\n\t else\n\t format.html { render :edit }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend",
"def update\n\t\trespond_to do |format|\n\t\t\tif @article.update(article_params)\n\t\t\t\tformat.html { redirect_to @article, notice: 'Article was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @article }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @article.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @article = Article.find(params[:id])\n\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n undo_link = view_context.link_to(\"undo\", revert_version_path(@article.versions.last), :method => :post)\n format.html { redirect_to @article, notice: \"Article was successfully updated. #{undo_link}\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.format_title = @admin_article.title.gsub(/ /,\"_\").downcase\n\n respond_to do |format|\n if @admin_article.update_attributes(params[:admin_article])\n format.html { redirect_to @admin_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update\n #@article = Article.find(params[:id])\n #@article = current_user.articles.update_attributes(params[:article])\n @article = Article.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '您已成功修改经验贴' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to article_url(@article) }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @article.errors.to_xml } \n end\n end\n end",
"def update\n setup_images()\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '記事を更新しました。' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @backend_article.update(article_params)\n format.html { redirect_to @backend_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Articulo actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to [@article.issue.magazine, @article.issue, @article], notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to open_article(@article), notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\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 @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\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 @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to(@article, :notice => 'Article was successfully updated.') }\n format.xml { head :ok }\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 article = Article.of(current_user).find params[:id] rescue render status: 500, inline: 'Article not found' and return\n # old_article = article.clone TODO used to update Redis index\n article.update_attributes params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n render status: 204, nothing: true\n end\n end\n \n private\n \n def authenticated?\n if !current_user\n redirect_to login_path and return\n end\n end\n\n def inject_current_user_into_params\n params['article']['user'] = current_user\n end",
"def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Članek je bil uspešno posodobljen!' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n if @article.update(article_params)\n render :show\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end",
"def update\n @bolt_article = Bolt::Article.find(params[:id])\n\n respond_to do |format|\n if @bolt_article.update_attributes(params[:bolt_article])\n format.html { redirect_to :action=>'index', notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bolt_article.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6822808",
"0.67426866",
"0.6710149",
"0.67066306",
"0.66805017",
"0.6678203",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.66669637",
"0.6654977",
"0.6643167",
"0.6633079",
"0.6614886",
"0.6614886",
"0.6614886",
"0.6614886",
"0.6613473",
"0.6586308",
"0.6579698",
"0.6572169",
"0.6557617",
"0.6557617",
"0.65408635",
"0.65133464",
"0.64721566",
"0.64211977",
"0.64022315",
"0.6391588",
"0.6387404",
"0.63845026",
"0.6377924",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.6374309",
"0.636649",
"0.636185",
"0.63466203",
"0.63432413",
"0.6338617",
"0.63291377",
"0.6317967",
"0.63022953",
"0.6265281",
"0.62621754",
"0.6257915",
"0.6253977",
"0.62488335",
"0.6247345",
"0.62460625",
"0.624066",
"0.6231314",
"0.62176013",
"0.6217563",
"0.6209837",
"0.6207177",
"0.619775",
"0.6192646",
"0.61863476",
"0.6182607",
"0.618144",
"0.6181373",
"0.6180833",
"0.61771077",
"0.61557335",
"0.61332554",
"0.61332554",
"0.61332554",
"0.61136353",
"0.61119133",
"0.6110518",
"0.61055523",
"0.61054254"
] |
0.61277884
|
95
|
DELETE /articles/1 DELETE /articles/1.json
|
def destroy
respond_to do |format|
if @article.input
format.html { redirect_to articles_url, notice: 'No es posible eliminar un Artículo que ya ha sido vendido, o alquilado.' }
format.json { render json: @article.errors, status: :unprocessable_entity }
else
@article.destroy
format.html { redirect_to articles_url }
format.json { head :no_content }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\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 @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.internal.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_deleted') }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Recipe was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Usunięto artykuł.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Aritcle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, :notice => \"Successfully destroyed article. #{undo_link}\" }\n format.json { head :ok }\n end\n end",
"def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Članek je bil uspešno izbrisan!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Articulo eliminado exitosamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Straipsnis sekmingai pasalintas.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journalarticle.destroy\n respond_to do |format|\n format.html { redirect_to journalarticles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article ||= Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n # format.html design Template\n format.html { redirect_to articles_url, notice: 'Artigo apagado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Vous avez bien detruit cet article' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html do\n redirect_to articles_url,\n notice: t('shared.msgs.success_destroyed',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @article.destroy\n respond_to do |format|\n format.html do\n redirect_to articles_url, notice: 'Article was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n\n #params.require(:article).permit(:title, :status)\n\n @article.destroy\n\n respond_to do |format|\n\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n\n format.json { head :no_content }\n\n end\n\n end",
"def destroy\n @article.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 @article_datum = ArticleDatum.find(params[:id])\n @article_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to article_data_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7844117",
"0.7832465",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78202105",
"0.78176606",
"0.78176606",
"0.78176606",
"0.78176606",
"0.78176606",
"0.78176606",
"0.7812717",
"0.7772706",
"0.7772706",
"0.7760549",
"0.7760549",
"0.7760549",
"0.7760549",
"0.77592236",
"0.7735811",
"0.76818407",
"0.7666867",
"0.7641783",
"0.7623549",
"0.7615011",
"0.7588779",
"0.75820553",
"0.7519321",
"0.75175774",
"0.7515779",
"0.7508829",
"0.7506538",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.7506414",
"0.75047415",
"0.7500004",
"0.7495304",
"0.7490491",
"0.7484903",
"0.7482936",
"0.74803895",
"0.7472026",
"0.7462497",
"0.74381113",
"0.74381113",
"0.74381113",
"0.74381113",
"0.74381113",
"0.74363416",
"0.74323106",
"0.7431951",
"0.74256855",
"0.7410031"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_article
@article = Article.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 article_params
params.require(:article).permit(:description, :estimated_price, :entry_date, :commission_per, :commission_cash, :status, :provider_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 valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def 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 active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] |
0.0
|
-1
|
Create a new parser initialized with a source file. Refactoring Opportunity: Take data to be parsed and not just a path.
|
def initialize(path)
@path = path.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(source); end",
"def parse(source, options = {})\n new.parse(source, options)\n end",
"def parse(source, path = T.unsafe(nil)); end",
"def initialize(source)\n self.source = source\n self.fields = []\n self.lines = []\n self.parse!\n end",
"def parse(source, options = {})\n opts = Lines.parse_default_options.merge(options.to_hash)\n @parser.parse(source.to_str, opts)\n end",
"def parse(source)\n Parser.parse(source)\n end",
"def parse\n IniParse::Generator.gen do |generator|\n @source.split(\"\\n\", -1).each do |line|\n generator.send(*Parser.parse_line(line))\n end\n end\n end",
"def initialize f\n unless f.instance_of? IO\n f = File.new(f)\n end\n @source = f\n @elements = []\n parse_header f\n parse_body f\n end",
"def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end",
"def build_parser( descriptor, file = nil )\n return RCC::Scanner::Interpreter::Parser.new( @parser_plan, open_source(descriptor, file) )\n end",
"def parse(source)\n @parser.parse(@scanner.scan(source))\n end",
"def initialize(source)\n @source = File.expand_path(source)\n end",
"def open_parser(this_file)\n\t\t@file = this_file\n\t\t@parser = PbfParser.new(file)\n\tend",
"def parse(source, options = T.unsafe(nil)); end",
"def parse(source, options = T.unsafe(nil)); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse\n parse_file\n self\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_from_file filename\n parse File.open(filename)\n end",
"def initialize(filename)\n @filename = filename\n parse()\n end",
"def parse_file(filename); end",
"def initialize(source, info_hash=Hash.new)\n @infos = info_hash\n @infos = Hash.new if @infos == nil\n raise \"The Post source file does not exist (#{source})\" if !File.exist?(source)\n # read the source\n raw = File.read(source)\n # parse the source and get the metadata and content\n parse_source(raw)\n raise \"The Post source file does not contain any metadata (YAML header)\" if @data == nil\n parse_filename(source)\n set_attributes\n end",
"def parse(source)\n template = Template.new\n template.parse(source)\n template\n end",
"def initialize(input_file)\n @input_file = input_file\n @source = File.new(input_file)\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def parse(source)\n buffer = ::Parser::Source::Buffer.new('(string)')\n buffer.source = source\n\n @parser.reset\n @parser.parse(buffer)\n end",
"def initialize(file)\n @file = parse(file)\n end",
"def initialize(source_text = nil)\n super(source_text)\n\n if source_text\n parsed_step_data = parse_source(source_text)\n populate_step(self, parsed_step_data)\n end\n end",
"def initialize parser\n @parser = parser\n end",
"def initialize(source = '', options = {})\n @parent = options[:parent]\n @title = options[:title] || ''\n if options[:file]\n raise InvalidMarkdownPath, \"Could not find markdown file at #{source}\" unless File.exist?(source)\n\n source = File.read(source)\n @title ||= options[:file]\n end\n source = translate(source)\n parse!(source)\n end",
"def parse(input, file_path)\n file_path ||= \"No file path provided to #{self.class}#convert\"\n RubyParser.new.parse(input, file_path)\n end",
"def parse_input (input_file)\nend",
"def initialize file_path\n\t\traise ArgumentError if file_path.nil? or not File.exist?(file_path)\n\n\t\t# Read the file as an array of strings (each line is an entry in the array) and remove unneeded whitespace\n\t\t@grammar_string = File.readlines(file_path).map { |x| x.strip }\n\t\t@production_rules = {}\n\n\t\t#a variable for the marker we use in LR parsing\n\t\t@marker = \".\"\n\n\t\tparse_grammar\n\tend",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parse(source, options = {})\n parse_context = configure_options(options)\n tokenizer = parse_context.new_tokenizer(source, start_line_number: @line_numbers && 1)\n @root = Document.parse(tokenizer, parse_context)\n self\n end",
"def load_source!\n @source = load_file_contents\n end",
"def parse! filename\n parse_! filename\n end",
"def parse filename\n clear\n File.open filename do |f|\n f.each_line &method(:parse_line)\n end\n self\n end",
"def initialize(source = nil)\n parsed_tag = process_source(source)\n\n build_tag(parsed_tag) if parsed_tag\n end",
"def initialize(source)\n @source = source\n @now = Time.now # needed for Time\n @encoding = Encoding::UTF_8\n @current_meta = Ept::Parser::DefaultMeta.dup\n @scanner = StringScanner.new(@source)\n end",
"def initialize(source, filename, options = {})\n #source += \"\\n\" unless source.end_with?(\"\\n\")\n @source, @filename, @options = source, filename, options\n @requires = []\n @required_trees = []\n end",
"def parse(fileName, options={autoVerNs: false})\n @options = options\n @sources = Sources.new(fileName)\n while (@currentSource=@sources.next)\n @currentSource.parse self\n end\n resolveVerify\n self\n end",
"def build_parser\n code = ''\n\n %w[opal/ruby/nodes opal/ruby/parser opal/ruby/ruby_parser].each do |src|\n full = File.join OPAL_PATH, 'opal_lib', src + '.rb'\n compiled = compile_source full\n code += \"opal.register('#{src}.rb', #{compiled});\"\n end\n\n code += build_stdlib 'racc/parser.rb', 'strscan.rb', 'dev.rb'\n code += \"opal.require('dev');\"\n\n code\n end",
"def parse(file)\n puts \"Not yet implemented\"\nend",
"def initialize(source_text = nil)\n super(source_text)\n\n return unless source_text\n\n parsed_tag_data = parse_source(source_text)\n populate_tag(self, parsed_tag_data)\n end",
"def from_string(original_source); end",
"def initialize(filename)\n\t\tbegin\n @sourcefile = filename\n \n\t\t\tFile.open(filename, \"r\") do |objfile|\n\t\t\t\tunless getl(objfile) == \"LINK\"\n\t\t\t\t\tputs \"Invalid file format: \" + filename\n\t\t\t\t\treturn nil\n\t\t\t\tend\n\n\t\t\t\t# Read header info\n\t\t\t\t@nsegs, @nsyms, @nrlocs = getl(objfile).split(' ').collect {|x| x.to_i}\n\t\t\t\t\n\t\t\t\t# Parse segs\n\t\t\t\t@segrecs = [], @segnames = {}\n\t\t\t\tgather_segs(objfile)\n\t\t\t\t\n\t\t\t\t# Parse symbols\n\t\t\t\t@symrecs = [], @symnames = {}\n\t\t\t\tgather_syms(objfile)\n\t\t\t\t\n\t\t\t\t# Parse relocations\n\t\t\t\t@rlocrecs = []\n\t\t\t\tgather_rlocs(objfile)\n\t\t\t\t\n\t\t\t\t# Slurp in data\n\t\t\t\t@segrecs.select {|seg| /P/===seg[:type]}.each do |seg|\n\t\t\t\t\tseg[:data] = getl(objfile).hex2bin\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue\n\t\t\tputs \"Could not open object file: \" + filename\n\t\tend\n\tend",
"def parse document_file_name\n raise ParserNotDefined if @@document_parser.nil?\n \n ext = ActiveDocument::FileUtils.extension_name(document_file_name)\n io = read(document_file_name)\n \n if not @@document_parsers.empty?\n document_parser = parser_for_extension(ext)\n document_data = document_parser.parse(io)\n else\n document_data = @@document_parser.parse(io)\n end\n \n document_data.parser_added_args[:filename] = document_file_name\n \n new document_data\n end",
"def initialize( filename )\n @data = Hash.new\n parse( filename )\n end",
"def parse(source)\n @root = Document.new(tokenize(source))\n self\n end",
"def parse(source)\n parser = Parser::CurrentRuby.new\n parser.diagnostics.all_errors_are_fatal = true\n parser.diagnostics.ignore_warnings = true\n source_buffer = Parser::Source::Buffer.new('script')\n source_buffer.source = source\n parser.parse(source_buffer)\n end",
"def parse(path_to_file)\n file = self.class.get_file(path_to_file)\n\n parser = Parser.new(file)\n @title = parser.get_title\n @authors = parser.get_authors\n @abstract = parser.get_abstract\n @content = parser.get_content\n @references = parser.get_references.map do |r|\n Reference.new(r[:html_id], r[:entry])\n end\n\n # TODO remove after we've switched to online\n file.close\n end",
"def initialize\n compiler = Treetop::Compiler::GrammarCompiler.new\n @where = File.expand_path(File.dirname(__FILE__))\n grammar = File.join(@where, 'seqpar.treetop')\n output = File.join(@where, 'seqpar.rb')\n compiler.compile(grammar, output)\n load output\n File.delete(output)\n @parser = SeqParParser.new\n end",
"def initialize(source_text = nil)\n @tags = []\n @tests = []\n\n super(source_text)\n\n return unless source_text\n\n parsed_rule_data = parse_source(source_text)\n populate_rule(self, parsed_rule_data)\n end",
"def initialize(source_text = nil)\n @tags = []\n @rows = []\n\n super(source_text)\n\n return unless source_text\n\n parsed_example_data = parse_source(source_text)\n populate_example(self, parsed_example_data)\n end",
"def initialize top_level, file_name, content, options, stats\n @top_level = top_level\n @top_level.parser = self.class\n @store = @top_level.store\n\n @file_name = file_name\n @content = content\n @options = options\n @stats = stats\n\n @preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include\n @preprocess.options = @options\n end",
"def initialize(object, file)\n @file = file\n\n @source = PuppetStrings::Yard::Util.ast_to_text(object)\n @line = object.line\n @comments_range = nil\n end",
"def initialize(source = nil)\n @arguments = []\n\n parsed_step = process_source(source)\n\n build_step(parsed_step) if parsed_step\n end",
"def parse_file(path, **options)\n parse(::File.read(path), **options)\n end",
"def initialize(*sources)\n @sources = sources\n\n @list = []\n\n sources.each do |source|\n if File.file?(source)\n parse(source)\n else\n # ignore directories\n end\n end\n end",
"def initialize(source = nil)\n parsed_example = process_source(source)\n\n super(parsed_example)\n\n @tags = []\n @tag_elements = []\n @rows = []\n @parameters = []\n @row_elements = []\n\n build_example(parsed_example) if parsed_example\n end",
"def initialize(opts={})\n if opts[:parser]\n @parser = opts[:parser]\n elsif opts[:grammar_file] and opts[:grammar_class]\n if @@parsers[opts[:grammar_class]]\n # already compiled the grammar, just use it\n @parser = @@parsers[opts[:grammar_class]]\n else\n # load the grammar\n Treetop.load(opts[:grammar_file])\n cls = eval(opts[:grammar_class])\n @parser = cls.new\n end\n else\n raise ArgumentError.new(\"Specify either :parser or :grammar_file and :grammar_class\")\n end\n end",
"def parse\n\t\t\tGlyph.info \"Parsing: #{@context[:source][:name]}\" if Glyph.debug? && @context[:info] && @context[:source][:name]\n\t\t\t@tree = @parser.parse\n\t\t\t@document = Glyph::Document.new @tree, @context\n\t\t\t@document.inherit_from @context[:document] if @context[:document]\n\t\t\t@tree\n\t\tend",
"def initialize(source); end",
"def initialize(source = nil)\n parsed_outline = process_source(source)\n\n super(parsed_outline)\n\n @tags = []\n @tag_elements = []\n @examples = []\n\n build_outline(parsed_outline) if parsed_outline\n end",
"def initialize(source, options); end",
"def parse(source)\n raise \"Attempt to continue parsing using finalized parser\" if @finished\n\n source.each_char() { |char|\n if @mode == :read_comment\n if char == \"\\n\"\n @mode = :find_name\n end\n elsif @in_escape == true\n buffer(case char\n when 'n' then \"\\n\"\n when 'r' then \"\\r\"\n when 'a' then \"\\a\"\n when 'b' then \"\\b\"\n when 'f' then \"\\f\"\n when 't' then \"\\t\"\n when '0' then \"\\0\"\n else char\n end, true)\n @in_escape = false\n else\n case char\n when ' ', \"\\t\"\n if @mode == :read_name\n parsedName(grab_and_reset_buffer())\n @mode = :find_value\n elsif ! ((@consume_whitespace && @last_char == char) || @mode == :find_name || @mode == :find_value)\n buffer char\n end\n\n when '{'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedNodeOpening()\n @depth += 1\n\n when :read_value, :find_name\n parsedValue(grab_and_reset_buffer()) if @mode == :read_value\n if @depth == 0 && @nameless_roots\n @depth += 1\n parsedName('')\n parsedNodeOpening()\n else\n raise error_string('Invalid character { - expected name.')\n end\n\n else\n raise error_string('Invalid character { - expected name.')\n end\n\n @mode = :find_name\n\n when '}'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedValue('')\n\n when :read_value\n parsedValue(grab_and_reset_buffer())\n end\n\n if @depth == 0\n raise error_string(\"Unexpected } - no matching {.\")\n end\n\n @depth -= 1\n @mode = :find_name\n\n parsedNodeClosing()\n\n when \"\\n\", '#', ';'\n case @mode\n when :read_name, :find_value\n parsedName(grab_and_reset_buffer()) if @mode == :read_name\n parsedValue('')\n when :read_value\n parsedValue(grab_and_reset_buffer())\n end\n\n @mode = char == '#' ? :read_comment : :find_name\n\n when \"\\\\\"\n @in_escape = true\n\n else\n if @mode == :find_name\n @mode = :read_name\n elsif @mode == :find_value\n @mode = :read_value\n end\n\n buffer(char)\n\n end\n end\n\n @last_char = char\n\n if char == \"\\n\"\n @line += 1\n @column = 1\n else\n @column += 1\n end\n }\n end",
"def source(src)\n if src.respond_to?(:getc)\n if src.is_a? String\n if File.exist?(src)\n sourc = File.new(src)\n @lexr[:in] = src\n else\n sourc = StringIO.new(src)\n @lexr[:in] = nil\n end\n end\n @source = sourc\n else\n raise SourceError.new(source = sourc)\n end\n end",
"def parser=(_arg0); end",
"def parse src\n @src = src\n @src.push false\n\n @footnotes = []\n @labels = {}\n\n # @i: index(line no.) of src\n @i = 0\n\n # stack for current indentation\n @indent_stack = []\n\n # how indented.\n @current_indent = @indent_stack.join(\"\")\n\n # RDoc::RD::BlockParser for tmp src\n @subparser = nil\n\n # which part is in now\n @in_part = nil\n @part_content = []\n\n @in_verbatim = false\n\n @yydebug = true\n\n document = do_parse\n\n unless @footnotes.empty? then\n blankline = document.parts.pop\n\n document.parts << RDoc::Markup::Rule.new(1)\n document.parts.concat @footnotes\n\n document.parts.push blankline\n end\n\n document\nend",
"def parser\n return nil if self.evaluation_file.nil?\n VivoParser.new(self.evaluation_file.path)\n end",
"def load(source, proc = nil, options = {})\n if source.respond_to? :to_str\n source = source.to_str\n elsif source.respond_to? :to_io\n source = source.to_io.read\n elsif source.respond_to?(:read)\n source = source.read\n end\n result = parse(source, options)\n recurse_proc(result, &proc) if proc\n result\n end",
"def parse(filename)\n Parser::CurrentRuby.parse(File.open(filename, \"r\").read)\n end",
"def initialize(file)\n @file = file\n\n case ext = File.extname(file)\n when '.till', '.til'\n fname = file.chomp(ext)\n else\n fname = file\n end\n\n #@format = File.extname(fname)\n @location = File.dirname(File.expand_path(file))\n\n text = File.read(file).rstrip\n\n # front matter indicator\n if text =~ /\\A---/\n text = text.sub(/---.*?\\n/, '')\n meta, body = *text.split(/^---/)\n else\n meta = nil\n body = text\n end\n\n @content = body\n\n fm = meta ? YAML.load(meta) : {}\n\n self.filters = fm['filter'] || ['erb']\n\n self.format = fm['format'] || File.extname(fname)\n\n if fm['output']\n self.output = fm['output']\n else\n self.output = fname #.chomp(extension) #+ DEFAULT_CONVERSIONS[filters.last]\n end\n\n\n\n #@context = Context.new(@location) # prime context/scope\n end",
"def parser\n @parser ||= parser_klass.new(job_folder)\n end",
"def initialize path, base_dir, defines\n @base_dir = base_dir\n source = File::open(path, \"r\") {|f| f.read }\n preprocessed = InnoSetup::preprocess(source, defines)\n sections = InnoSetup::split_into_sections(preprocessed)\n cs = parse_section sections['Components'], Component\n @components = build_hash(cs) {|c| c.name }\n @file_sets = parse_section sections['Files'], FileSet\n end",
"def from_file(fn, code_type = nil)\n if fn == Pry.eval_path\n f = Pry.line_buffer.drop(1)\n else\n if File.readable?(fn)\n f = File.open(fn, 'r')\n code_type = type_from_filename(fn)\n else\n raise MethodSource::SourceNotFoundError, \"Cannot open #{fn.inspect} for reading.\"\n end\n end\n new(f, 1, code_type || :ruby)\n ensure\n f.close if f.respond_to?(:close)\n end",
"def initialize(filename)\n @filename = filename\n @source = yield\n end",
"def parsed\n return @parsed if instance_variable_defined? :@parsed\n\n if source =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n { metadata: YAML.load($1), content: $' }\n else\n { metadata: {}, content: source }\n end\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def parser\n @parser ||= Parser.new(self)\n end",
"def initialize( givenname_path = File.join(File.dirname(__FILE__), 'givennamelist.txt'),\n surname_path = File.join(File.dirname(__FILE__), 'surnamelist.txt'),\n street_name_path = File.join(File.dirname(__FILE__), 'streetnamelist.txt'),\n postal_town_path = File.join(File.dirname(__FILE__), 'postaltownlist.txt')\n )\n @name_source = NameSource.new( givenname_path, surname_path )\n @address_source = AddressSource.new( street_name_path, postal_town_path )\n @phone_number_source = PhoneNumberSource.new()\n @email_address_source = EmailAddressSource.new()\n end",
"def pluggable_parser; end",
"def initialize(source_string='')\n @source = source_string\n end",
"def initialize(filename)\n @filename = filename\n @source = yield\n end",
"def parser\n Parser.new(self, :mode=>mode)\n end",
"def parse(source_buffer)\n @lexer.source_buffer = source_buffer\n @source_buffer = source_buffer\n\n do_parse || nil # Force `false` to `nil`, see https://github.com/ruby/racc/pull/136\n ensure\n # Don't keep references to the source file.\n @source_buffer = nil\n @lexer.source_buffer = nil\n end",
"def source\n @source ||= begin\n file, line_no = source_location\n raise \"no file provided by source_location: #{self}\" if file.nil?\n raise \"no line number provided for source_location: #{self}\" if line_no.nil?\n tokens = Ripper.lex File.read(file)\n tokens_on_line = tokens.select {|pos, lbl, str| pos[0].eql?(line_no) }\n starting_token = tokens_on_line.detect do |pos, lbl, str|\n TOKEN_PAIRS.keys.include?([lbl, str]) &&\n _actually_starting_a_proc?(tokens, [pos, lbl, str])\n end\n starting_token_type = [starting_token[1], starting_token[2]]\n ending_token_type = TOKEN_PAIRS[starting_token_type]\n source_str = \"\"\n remaining_tokens = tokens[tokens.index(starting_token)..-1]\n nesting = -1\n starting_nesting_token_types = if [TLAMBDA, LBRACE].include?(starting_token_type)\n [TLAMBDA, LBRACE]\n else\n [starting_token_type]\n end\n\n while token = remaining_tokens.shift\n token = [token[1], token[2]] # strip position\n source_str << token[1]\n nesting += 1 if starting_nesting_token_types.include? token\n is_ending_token = token.eql?(ending_token_type)\n break if is_ending_token && nesting.eql?(0)\n nesting -= 1 if is_ending_token\n end\n source_str\n end\n end",
"def initialize(contents, file_path = \"\")\n @file_path = file_path\n @locations = {}\n if contents.to_s.size.zero?\n mf_log \"NON PARSEABLE INPUT: File is empty at path #{file_path.inspect}\\n\\t#{caller.join(\"\\n\\t\")}\"\n else\n parse_code(contents)\n end\n end",
"def parse\n parse_options\n parse_target\n end"
] |
[
"0.71714497",
"0.70523703",
"0.7030028",
"0.6785629",
"0.6783841",
"0.6763006",
"0.6638045",
"0.6579313",
"0.6564139",
"0.6564139",
"0.6557009",
"0.6549441",
"0.6542895",
"0.65389514",
"0.65389514",
"0.65341866",
"0.65341866",
"0.65341866",
"0.6527015",
"0.6508991",
"0.6508991",
"0.6508991",
"0.6508991",
"0.6508991",
"0.6508991",
"0.647139",
"0.6440031",
"0.6436252",
"0.64310694",
"0.6428766",
"0.6409537",
"0.6409107",
"0.6409107",
"0.64069116",
"0.6390945",
"0.63751113",
"0.63746315",
"0.6364181",
"0.6341131",
"0.6313418",
"0.6283259",
"0.62608683",
"0.62608683",
"0.62608683",
"0.62608683",
"0.6237918",
"0.62337005",
"0.623088",
"0.62005544",
"0.61962736",
"0.61835265",
"0.6181737",
"0.6160575",
"0.61577845",
"0.6153896",
"0.61416656",
"0.6121393",
"0.6114929",
"0.61068547",
"0.6105412",
"0.6094448",
"0.6086026",
"0.60744816",
"0.60582197",
"0.60125035",
"0.6007351",
"0.6006903",
"0.6001389",
"0.60001504",
"0.59949344",
"0.5981068",
"0.5966885",
"0.5963124",
"0.59549886",
"0.59510744",
"0.59434265",
"0.59382814",
"0.59201014",
"0.59178275",
"0.59161747",
"0.5911951",
"0.5905013",
"0.58947706",
"0.5884074",
"0.5882065",
"0.58611876",
"0.58602315",
"0.5851822",
"0.58513427",
"0.5848191",
"0.58433485",
"0.58433485",
"0.5833612",
"0.5818804",
"0.5815335",
"0.5808923",
"0.58054245",
"0.58014196",
"0.5800309",
"0.5795174",
"0.57949036"
] |
0.0
|
-1
|
Parse the current file in to a set of records. Refactoring Opportunity: Create a class method 'parse' that takes path and parsing options.
|
def parse(options={})
rows = parse_rows(data)
sort_rows(rows, options[:sort])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse\n parse_file\n self\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse_file path\n self.filename = path\n open path do |f|\n parse f.read\n end\n end",
"def parse filename\n clear\n File.open filename do |f|\n f.each_line &method(:parse_line)\n end\n self\n end",
"def parse_from_file filename\n parse File.open(filename)\n end",
"def parse_file(filename); end",
"def parse_file(path, **options)\n parse(::File.read(path), **options)\n end",
"def parse! filename\n parse_! filename\n end",
"def parse_file(path, options={})\n File.open(path) do |puzfile|\n parse_io(puzfile, options)\n end\n end",
"def parse_file(path, options={})\n path = Pathname.new(path.to_str) unless Pathname === path\n parse(path, options)\n end",
"def parse\n records = []\n files.each do |fname|\n records += parse_file(fname)\n end\n\n @notes = records.sort\n end",
"def parse(file)\n puts \"Not yet implemented\"\nend",
"def parse(report_file, options_trailer = nil)\n file = File.open(report_file,'r')\n build_records_from_file file.readlines\n file.close\n end",
"def parse_file(path)\n if (!File.exists?(path))\n LOGGER.e {\"Unable to open specified file to parse: '#{path}'\"}\n return nil\n end\n \n File.open(path, 'r') do |f|\n parse_stream(f)\n end\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def parse_input (input_file)\nend",
"def parse filename\n doc = Document.new(File.new(filename))\n elements = doc.elements\n # Let each entity definition do it's own lower level parsing\n self.entities.each do |e|\n @instances[e.name] = e.parse(self, elements)\n end\n # Let each relationship definition do it's own lower level parsing\n self.relationships.each do |r|\n r.parse(self, @instances)\n end\n end",
"def perform\n accept(parse_file)\n end",
"def parse\r\n\t\tCSV.foreach(self.filepath) {|row| @list << row}\r\n\t\t@list.flatten!\r\n\tend",
"def parse_file\n @file ||= File.open(@file_name) unless @file_name.nil?\n @text = @file.readlines\n @file.close unless @file.nil?\n parse_text\n end",
"def parse(path_to_file)\n file = self.class.get_file(path_to_file)\n\n parser = Parser.new(file)\n @title = parser.get_title\n @authors = parser.get_authors\n @abstract = parser.get_abstract\n @content = parser.get_content\n @references = parser.get_references.map do |r|\n Reference.new(r[:html_id], r[:entry])\n end\n\n # TODO remove after we've switched to online\n file.close\n end",
"def parse_file(filename)\n File.open(filename, 'r') { |f| parse f }\n end",
"def parse(fileName, options={autoVerNs: false})\n @options = options\n @sources = Sources.new(fileName)\n while (@currentSource=@sources.next)\n @currentSource.parse self\n end\n resolveVerify\n self\n end",
"def parse path\n headers, body = path.read.split(\"\\n\\n\", 2)\n @headers = parse_headers(headers)\n @body = parse_body(self.content_type, body)\n end",
"def parse path\n\t\theaders, body = path.read.split(\"\\n\\n\", 2) # Two newlines marks end of headers\n\t\t@headers = parse_headers(headers)\n\t\t@body = parse_body(self.content_type, body)\n\tend",
"def parse_file\n @filecontent ||= File.read(@filepath)\n end",
"def parse_files(*files); end",
"def parse(input, file_path)\n file_path ||= \"No file path provided to #{self.class}#convert\"\n RubyParser.new.parse(input, file_path)\n end",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def parse\n parse_options\n parse_target\n end",
"def parse_files\n options.each do |type, filename|\n begin\n content[type] = FCSV.read(filename)\n rescue CSV::MalformedCSVError\n $stderr.puts \"Error parsing #{filename}: #{$!.message}\"\n exit 1\n rescue Errno::ENOENT, Errno::EACCES\n $stderr.puts \"Error reading #{filename}: #{$!.message}\"\n exit 1\n end\n end\n end",
"def parse(filename)\n Parser::CurrentRuby.parse(File.open(filename, \"r\").read)\n end",
"def parseFile(fname)\r\n $LOG.debug \"Parser::parseFile( #{fname} )\"\r\n puts \"Parsing file: #{fname}\" if @context.verbose\r\n\r\n # Determine the mode and configure plugins based on the file data.\r\n configureForFileMode(fname)\r\n\r\n line_count = 1\r\n # Open the file and read line by line\r\n df = File.open(fname).each do |ln|\r\n puts line_count.to_s if $DEBUG\r\n line_count += 1\r\n @plugins.each do |plug|\r\n puts \" --> #{plug.class}\" if $DEBUG\r\n break if ( true == plug.execute(@context, ln))\r\n end # plugins.each\r\n end # do file\r\n\r\n puts \"Lines parsed: #{line_count}\" if @context.verbose\r\n end",
"def parse!(file)\n parser = FileParser.new(file)\n parser.parse_download_link_and_names\n\n @color_pairs = parser.parse_colors_and_names\n @download_pairs = parser.parse_download_link_and_names\n end",
"def parse_file\n #needs begin rescue exception handling \n \tbegin \n \t\traise FileNotFoundException.new(\"File not Found\") unless File.exists?(@file_path)\n\t\n \t\tFile.open(@file_path).slice_before(@delimiter).each do |chunk|\n \t\t\tchunk.reject! {|item| item =~ @delimiter }\n \t\ttitle = chunk.shift\n \t\tif @title_hash.has_key?(title)\n \t\t\t@title_hash[title] = @title_hash[title] << chunk \n \t\telse\n \t\t p chunk\n \t\t\t@title_hash[title] = chunk\n \t\tend \t\t\n \t\tend\n \t\t\n \trescue FileNotFoundException => e\n \t\tp e.message\n \tend\n\t\n end",
"def parse_files files\n file_list = gather_files files\n @stats = RDoc::Stats.new @store, file_list.length, @options.verbosity\n\n return [] if file_list.empty?\n\n original_options = @options.dup\n @stats.begin_adding\n\n file_info = file_list.map do |filename|\n @current = filename\n parse_file filename\n end.compact\n\n @stats.done_adding\n @options = original_options\n\n file_info\n end",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def parse(uploaded_file)\n parser_class = \n case uploaded_file.content_type\n when \"application/vnd.ms-excel\"\n ExcelParser\n when \"text/csv\", \"application/octet-stream\", \"text/plain\"\n CSVParser\n else\n self.errors << \"Do not know how to parse #{uploaded_file.original_filename}. \" +\n \"Expects .csv or .xls (Excel) files.\"\n nil\n end\n\n if parser_class\n @data = parser_class.new(self).parse(uploaded_file)\n end\n\n self.valid?\n end",
"def parse_file(file)\n if file && !file.instance_of?(String)\n parse_contents(file)\n elsif file.instance_of?(String)\n data = File.read(file)\n parse_contents(data)\n else\n self.load_errors = \"No file was selected to upload.\"\n end\n end",
"def parse_file(filename)\n # [review] - Rename method input param to filename (more verbose?)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n _relative_path = filename\n _absolute_path = File.absolute_path(filename)\n\n # Error check on input, use input filename to make sure relative path is correct\n if Watson::FS.check_file(_relative_path)\n debug_print \"Opened #{ _relative_path } for parsing\\n\"\n debug_print \"Short path: #{ _relative_path }\\n\"\n else\n print \"Unable to open #{ _relative_path }, exiting\\n\"\n return false\n end\n\n\n # Get filetype and set corresponding comment type\n _comment_type = get_comment_type(_relative_path)\n unless _comment_type\n debug_print \"Using default (#) comment type\\n\"\n _comment_type = ['#']\n end\n\n # Escape out comment type for safety\n # [review] - Is there a way to do inplace join?\n _comment_type = _comment_type.map { |comment| Regexp.escape(comment) }.join(\"|\")\n debug_print \"Comment type #{ _comment_type }\\n\"\n\n # [review] - It is possible to embed the valid tags in the regexp,\n # with a ~5% performance gain, but this would loose the warning about\n # unrecognized tags.\n _tag_format = Regexp.escape(@config.tag_format).gsub('\\\\ ', ' ')\n _tag_format_regex = _tag_format\n .gsub(\"TAG\", '(\\w+)')\n .gsub(\"COMMENT\", '(.+)')\n .gsub(' ' , '\\s+')\n\n _comment_regex = /^(?:\\s*[#{_comment_type}]+\\s*)+#{_tag_format_regex}/\n\n debug_print \"Comment regex: #{_comment_regex}\\n\"\n\n # Open file and read in entire thing into an array\n # Use an array so we can look ahead when creating issues later\n # [review] - Better var name than data for read in file?\n _data = File.read(_absolute_path).encode('UTF-8', :invalid => :replace).lines\n\n # Initialize issue list hash\n _issue_list = Hash.new()\n _issue_list[:relative_path] = _relative_path\n _issue_list[:absolute_path] = _absolute_path\n _issue_list[:has_issues] = false\n @config.tag_list.each do | _tag |\n debug_print \"Creating array named #{ _tag }\\n\"\n # [review] - Use to_sym to make tag into symbol instead of string?\n _issue_list[_tag] = Array.new\n end\n\n # Loop through all array elements (lines in file) and look for issues\n _data.each_with_index do |_line, _i|\n\n # Find any comment line with [tag] - text (any comb of space and # acceptable)\n # Using if match to stay consistent (with config.rb) see there for\n # explanation of why I do this (not a good good one persay...)\n begin\n _mtch = _line.match(_comment_regex)\n rescue ArgumentError\n debug_print \"Could not encode to UTF-8, non-text\\n\"\n end\n\n unless _mtch\n # debug_print \"No valid tag found in line, skipping\\n\"\n next\n end\n\n # Set tag\n _tag = _mtch[1].downcase\n\n # Make sure that the tag that was found is something we accept\n # If not, skip it but tell user about an unrecognized tag\n unless @config.tag_list.include?(_tag)\n formatter = Printer.new(@config).build_formatter\n formatter.print_status \"+\", GREEN\n print \"Unknown tag [#{ _tag }] found, ignoring\\n\"\n print \" You might want to include it in your RC or with the -t/--tags flag\\n\"\n next\n end\n\n # Found a valid match (with recognized tag)\n # Set flag for this issue_list (for file) to indicate that\n _issue_list[:has_issues] = true\n\n # [review] - This could probably be done better, elsewhere!\n # If it's a HTML or Handlebars comment, remove trailing -->, --}}\n if _mtch[0].match(/[<{]+(!--)?(#)?/)\n _title = _mtch[2].gsub(/(--)?(#)?[>}]+/, \"\")\n else\n _title = _mtch[2]\n end\n debug_print \"Issue found\\n\"\n debug_print \"Tag: #{ _tag }\\n\"\n debug_print \"Issue: #{ _title }\\n\"\n\n # Create hash for each issue found\n _issue = Hash.new\n _issue[:line_number] = _i + 1\n _issue[:title] = _title\n\n # Grab context of issue specified by Config param (+1 to include issue itself)\n _context = _data[_i..(_i + @config.context_depth + 1)]\n\n # [review] - There has got to be a better way to do this...\n # Go through each line of context and determine indentation\n # Used to preserve indentation in post\n _cut = Array.new\n _context.each do |_line_sub|\n _max = 0\n # Until we reach a non indent OR the line is empty, keep slicin'\n until !_line_sub.match(/^( |\\t|\\n)/) || _line_sub.empty?\n # [fix] - Replace with inplace slice!\n _line_sub = _line_sub.slice(1..-1)\n _max = _max + 1\n\n debug_print \"New line: #{ _line_sub }\\n\"\n debug_print \"Max indent: #{ _max }\\n\"\n end\n\n # Push max indent for current line to the _cut array\n _cut.push(_max)\n end\n\n # Print old _context\n debug_print \"\\n\\n Old Context \\n\"\n debug_print PP.pp(_context, '')\n debug_print \"\\n\\n\"\n\n # Trim the context lines to be left aligned but maintain indentation\n # Then add a single \\t to the beginning so the Markdown is pretty on GitHub/Bitbucket\n _context.map! { |_line_sub| \"\\t#{ _line_sub.slice(_cut.min .. -1) }\" }\n\n # Print new _context\n debug_print(\"\\n\\n New Context \\n\")\n debug_print PP.pp(_context, '')\n debug_print(\"\\n\\n\")\n\n _issue[:context] = _context\n\n # These are accessible from _issue_list, but we pass individual issues\n # to the remote poster, so we need this here to reference them for GitHub/Bitbucket\n _issue[:tag] = _tag\n _issue[:path] = _relative_path\n\n # Generate md5 hash for each specific issue (for bookkeeping)\n _issue[:md5] = ::Digest::MD5.hexdigest(\"#{ _tag }, #{ _relative_path }, #{ _title }\")\n debug_print \"#{ _issue }\\n\"\n\n\n # [todo] - Figure out a way to queue up posts so user has a progress bar?\n # That way user can tell that wait is because of http calls not app\n\n # If GitHub is valid, pass _issue to GitHub poster function\n # [review] - Keep Remote as a static method and pass config every time?\n # Or convert to a regular class and make an instance with @config\n\n\n # [review] - Use _tag string as symbol reference in hash or keep as string?\n # Look into to_sym to keep format of all _issue params the same\n _issue_list[_tag].push(_issue)\n\n # Increment issue counter for posting status\n @config.issue_count = @config.issue_count.next\n end\n\n # [review] - Return of parse_file is different than watson-perl\n # Not sure which makes more sense, ruby version seems simpler\n # perl version might have to stay since hash scoping is weird in perl\n debug_print \"\\nIssue list: #{ _issue_list }\\n\"\n\n _issue_list\n end",
"def parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=CSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_master_id(\n\t\t\t\t\tline['master_id'],\n\t\t\t\t\t:master_tracker_date => self.master_tracker_date )\n\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes!(\n\t\t\t\t\tline.to_hash.delete_keys!(\n\t\t\t\t\t\t'master_id').merge(\n\t\t\t\t\t\t:master_tracker_date => self.master_tracker_date) )\n\n\t\t\t\tresults.push(icf_master_tracker)\n\t\t\tend\t#\t(f=CSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end",
"def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end",
"def parse_file(file_name)\n state_machine = builder.build\n File.foreach(file_name).with_index do |line, _line_num|\n builder.reset\n state_machine.line = clean_line(line)\n state_machine.execute\n end\n end",
"def parse\n # we need one of them at least\n return nil if !@id.present? && !@filepath.present? \n # get key from filepath if needs\n @id.nil? ? filepath_to_id : id_to_filepath\n # set default locale if null\n @locale ||= I18n.locale.to_s\n # cleanup blanks\n @handler = nil if @handler.blank?\n # set default format\n @format ||= FORMATS[@dir]\n # rebuild key\n @id = [\"\",@dir,@path].compact.join(\"/\")\n # rebuild filepath\n dir = (is_asset? ? \"assets/#{@dir}\" : (is_content? ? \"content/#{@dir}\" : @dir))\n\n @filepath = Grass.app_root + [\"\",dir,@path].compact.join(\"/\") + [\"\",@locale,@format,@handler].compact.join(\".\") \n\n end",
"def parse_files\n @parse_files ||=\n begin\n files = expand_dirs_to_files(@path)\n files = file_sort(files)\n\n if @options['only'].present?\n files = file_accept(files, @options['only'])\n end\n\n # By default, tmp, vender, spec, test, features are ignored.\n %w[vendor spec test features tmp].each do |dir|\n files = file_ignore(files, File.join(@path, dir)) unless @options[dir]\n end\n\n # Exclude files based on exclude regexes if the option is set.\n @options['exclude'].each do |pattern|\n files = file_ignore(files, pattern)\n end\n\n %w[Capfile Gemfile Gemfile.lock].each do |file|\n files.unshift File.join(@path, file)\n end\n\n files.compact\n end\n end",
"def parse(fname)\r\n puts \"Parsing file.\" unless (!verbose?)\r\n ctxListener = ContextListener.new(@context)\r\n ctxListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), ctxListener)\r\n parser.parse\r\n\r\n\r\n puts \"Parsing guideline.\" unless (!verbose?)\r\n gdlListener = GdlListener.new(@context) # Gets rule and ruleset names and aliases.\r\n gdlListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), gdlListener)\r\n parser.parse\r\n\r\n\r\n puts \"Parsing rule XML.\" unless (!verbose?)\r\n ruleListener = RuleListener.new(@context)\r\n ruleListener.verbose = @verbose\r\n parser = Parsers::StreamParser.new(File.new(fname), ruleListener)\r\n parser.parse\r\n end",
"def parse_file(file)\n\n\n File.readlines(file).each do |line|\n command = parse_command(line)\n end\n # File.readlines(file).each do |line|\n # command = parse_command(line)\n # apply_command(command)\n end",
"def parse(filename)\n init\n\n unless File.exist?(filename)\n fail \"File not found: #{filename}\"\n return\n end\n\n puts 'Seeding'\n File.open(filename, 'r').each_line do |line|\n data = line.split(\"\\t\")\n\n getparts(data)\n end\n\n @parsed\n end",
"def read(opts = {})\n filename = opts.fetch(:filename, @filename)\n encoding = opts.fetch(:encoding, @encoding)\n return unless File.file? filename\n\n mode = encoding ? \"r:#{encoding}\" : 'r'\n File.open(filename, mode) { |fd| parse fd }\n self\n end",
"def parse\n logger.debug \"Reading stoage file from: #{self.file.path}\"\n if self.status != 'finished'\n last_parsed_line = self.last_parsed_line\n # make_options\n begin\n # Match the proper parser and build options\n case self.file_type\n when \"1\"\n @parser = Wms::Input::Filetype1\n else\n raise \"Undefined storage type #{file_type}\"\n end\n # when \"wifilocation\"\n # @parser = Wms::Input::AndroidWifiLocation\n # when \"sensor\"\n # @parser = Wms::Input::AndroidSensor\n # when \"audio\"\n # raise \"Not Supported yet storage type #{file_type}\"\n # else\n # raise \"Undefined storage type #{file_type}\"\n # end\n\n @processor = @parser.new\n options = make_options\n @processor.register(options=options)\n\n @processor.run do |data|\n begin\n create_event data\n \n rescue Exception => e\n logger.error \"ERROR #{self.class.name}: #{e} for #{data}\"\n end\n last_parsed_line += 1\n end\n\n \n self.last_parsed_line = last_parsed_line\n self.status = \"finished\"\n self.save\n \n rescue Exception => e\n logger.error \"ERROR: [#{e}]\"\n self.last_parsed_line = last_parsed_line\n self.status = \"error\"\n self.save\n end # end begin\n \n end #end if self.status != 'finished'\n\n\n \n \n end",
"def initialize(filename)\n @filename = filename\n parse()\n end",
"def parse(file)\n erb = ERB.new(File.read(file)).result\n if File.extname(file) == '.json'\n @parse = JSON.parse(erb, :symbolize_names => true) || {}\n else\n @parse = YAML.load(erb) || {}\n end\n end",
"def file(path, opts = {})\n definition = opts[:definition] || opts[:def]\n records = new_collection(opts[:hamster])\n\n File.open(path, 'r').each do |line|\n line = line.force_encoding('ISO-8859-1').encode('utf-8', :replace => nil)\n records = add_to_collection(records, record(line, def: definition))\n end\n\n return records\n end",
"def parse_file\n parsed_result_blocks = get_record_blocks\n\n gff_array = []\n if !parsed_result_blocks.empty?\n parsed_result_blocks.each do |b|\n gff_array << line_to_gff(b)\n end\n end\n return gff_array\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def parse\n end",
"def parse\n wo_lines = IO.readlines( @file_dir )\n @current_group = get_group( \"default\" )\n @current_material_name = \"default\"\n puts(\"+Loading .obj file:\\n \\\"#{@file_dir.sub(ROOT, '')}\\\"\") if @verbose\n # parse file context\n wo_lines.each do |line|\n tokens = line.split\n # make sense of the object tokens\n string = line.sub(\"\\r\", \"\")\n process_line(tokens[0], tokens[1..tokens.length-1], string.sub(\"\\n\", \"\"))\n end\n @object_name = @file_dir.split('/').last\n @object_name.sub!(\".obj\", '')\n # verbose status updates\n puts(\"+Object name is \\\"#{@object_name}\\\" with (#{@objects.size}) Internal Objects.\") if @verbose\n if get_group(\"default\").faces.empty?\n @groups.delete(\"default\")\n end\n @current_group = nil\n @current_material_name = nil\n end",
"def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end",
"def parse(filename)\n file = File.open(filename, \"r\").readlines\n\n $root = Node.new('root')\n $context = $root\n\n file.each_with_index do |line, index|\n process_line(line, index) if line.match(/\\S/)\n end\n\n return $root\n\nend",
"def parser\n @parser ||= parser_klass.new(job_folder)\n end",
"def parse \n raise \"This has not been implemented yet. Due to the variability of report format, will need to implement a series of specialized parsers\"\n end",
"def parse_file!\n File.open(@filepath, 'r') do |f|\n last_line = ''\n while this_line = f.gets\n coll = case this_line\n when /^\\s*def / : @methods\n when /^\\s*class / : @classes\n when /^\\s*module / : @modules\n when /^\\s*(attr_reader|attr_accessor|attr_writer) / : @attrs\n when /^\\s*[^a-z =]+\\s*=/ : @constants\n else nil\n end\n # add a true entry if comment precedes declaration or follows on same line\n coll << is_comment?(last_line) || has_comment?(this_line) if coll\n last_line = this_line\n end\n end\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 parse(file, quick=false)\n @file = file\n @quick = quick\n\n unless @file.valid_encoding?\n filter = proc {|c| c.unpack1('U') rescue 0xFFFD}\n @file = @file.chars.map(&filter).pack('U*').force_encoding('utf-8')\n end\n\n @@parsers.each { |parser| instance_exec(&parser) }\n\n # add index markers for major sections\n CONTENTS.each do |section, index|\n @sections[section][:index] = index if @sections[section]\n end\n\n # quick exit if none found -- non-standard format agenda\n return [] if @sections.empty?\n\n # look for flags\n flagged_reports = Hash[@file[/ \\d\\. Committee Reports.*?\\n\\s+A\\./m].\n scan(/# (.*?) \\[(.*)\\]/)] rescue {}\n\n president = @sections.values.find {|item| item['title'] == 'President'}\n return [] unless president # quick exit if non-standard format agenda\n pattach = president['report'][/\\d+ through \\d+\\.$/]\n # pattach is nil before https://whimsy.apache.org/board/minutes/Change_Officers_to_Serve_at_the_Direction_of_the_President.html\n preports = Range.new(*pattach.scan(/\\d+/)) if pattach\n # cleanup text and comment whitespace, add flags\n @sections.each do |section, hash|\n text = hash['text'] || hash['report']\n if text\n text.sub!(/\\A\\s*\\n/, '')\n text.sub!(/\\s+\\Z/, '')\n unindent = text.sub(/s+\\Z/, '').scan(/^ *\\S/).map(&:length).min || 1\n text.gsub!(/^ {#{unindent - 1}}/, '')\n end\n\n text = hash['comments']\n if text\n text.sub!(/\\A\\s*\\n/, '')\n text.sub!(/\\s+\\Z/, '')\n unindent = text.sub(/s+\\Z/, '').scan(/^ *\\S/).map(&:length).min || 1\n text.gsub!(/^ {#{unindent - 1}}/, '')\n end\n\n # add flags\n flags = flagged_reports[hash['title']]\n hash['flagged_by'] = flags.split(', ') if flags\n\n # mark president reports\n hash['to'] = 'president' if preports&.include?(section)\n end\n\n unless @quick\n # add roster and prior report link\n whimsy = 'https://whimsy.apache.org'\n @sections.each do |section, hash|\n next unless section =~ /^(4[A-Z]|\\d+|[A-Z][A-Z]?)$/\n committee = ASF::Committee.find(hash['title'] ||= 'UNKNOWN')\n unless section =~ /^4[A-Z]$/\n hash['roster'] =\n \"#{whimsy}/roster/committee/#{CGI.escape committee.name}\"\n end\n if section =~ /^[A-Z][A-Z]?$/\n hash['stats'] = 'https://reporter.apache.org/wizard/statistics?' +\n CGI.escape(committee.name)\n end\n hash['prior_reports'] = minutes(committee.display_name)\n end\n end\n\n # add attach to section\n @sections.each do |section, hash|\n hash[:attach] = section\n\n # look for missing titles\n hash['title'] ||= \"UNKNOWN\"\n\n if hash['title'] == \"UNKNOWN\"\n hash['warnings'] = ['unable to find attachment']\n end\n end\n\n # handle case where board meeting crosses a date boundary\n if @sections.values.first['timestamp'] > @sections.values.last['timestamp']\n @sections.values.last['timestamp'] += 86_400_000 # add one day\n end\n\n @sections.values\n end",
"def parse document_file_name\n raise ParserNotDefined if @@document_parser.nil?\n \n ext = ActiveDocument::FileUtils.extension_name(document_file_name)\n io = read(document_file_name)\n \n if not @@document_parsers.empty?\n document_parser = parser_for_extension(ext)\n document_data = document_parser.parse(io)\n else\n document_data = @@document_parser.parse(io)\n end\n \n document_data.parser_added_args[:filename] = document_file_name\n \n new document_data\n end",
"def parse_file(filename)\n start = Time.now\n open filename do |file|\n data = {}\n i = 0\n file.each do |line|\n date, query = line.chomp.split(\"\\t\")\n\n insert(date, query)\n i += 1\n end\n puts \"Successfully read #{i} lines.\"\n end\n puts \"Done in #{Time.now - start} seconds.\"\n end",
"def parse_file(file_path)\n Cabrillo.parse(IO.read(file_path))\n end",
"def parse(source); end",
"def parsed_lines\n eval(file_lines)\n end",
"def load_and_parse\n\n if @infile\n @graph = RDF::Graph.load(@infile)\n end\n\n end",
"def parse(paths: [], execute: false)\n\tfiles = output = Covered::Files.new\n\toutput = Covered::Source.new(output)\n\t\n\tpaths.each do |path|\n\t\toutput.mark(path, 0, 0)\n\tend\n\t\n\tif execute\n\t\tcapture = Covered::Capture.new(output)\n\t\tcapture.start\n\t\tpaths.each do |path|\n\t\t\tload path\n\t\tend\n\t\tcapture.finish\n\t\t\n\t\tfiles.paths = files.paths.slice(*paths)\n\tend\n\t\n\tCovered::Summary.new.call(output, $stderr)\nend",
"def parse\n result = []\n files = []\n \n @paths.each { |path|\n begin\n raise FileNotFoundError unless File.exists?(path)\n \n if File.directory?(path) then\n files += Dir.glob(\"#{path}/**/*.mid\")\n else\n files << path if File.extname(path) == \".mid\"\n end\n rescue\n puts \"Not a valid file path : #{path} => #{$!}\"\n end\n }\n \n \n if files.empty? then\n puts \"No files were added.\"\n else\n files.each { |file_path|\n result << read_midi(file_path)\n }\n end\n \n return result\n end",
"def parse\n fail StandardError.new('parse has not been implemented.')\n end",
"def parse_tree(records)\n\n # build tree, should return a file_header node\n first, *records = *records\n unless first.code == :file_header\n raise ParseError.new('Expecting file header record (01).')\n end\n root = ParseNode.new(first)\n stack = [root]\n\n records.each do |record|\n raise ParseError.new('Unexpected record.') if stack.empty?\n\n case record.code\n\n # handling headers\n when :group_header, :account_identifier\n\n parent = {group_header: :file_header,\n account_identifier: :group_header}[record.code]\n unless stack.last.code == parent\n raise ParseError.new(\"Parsing #{record.code}, expecting #{parent} parent.\")\n end\n\n n = ParseNode.new(record)\n stack.last.children << n\n stack << n\n\n # handling trailers\n when :account_trailer, :group_trailer, :file_trailer\n\n parent = {account_trailer: :account_identifier,\n group_trailer: :group_header,\n file_trailer: :file_header}[record.code]\n unless stack.last.code == parent\n raise ParseError.new(\"Parsing #{record.code}, expecting #{parent} parent.\")\n end\n\n stack.last.records << record\n stack.pop\n\n # handling continuations\n when :continuation\n\n n = (stack.last.children.last || stack.last)\n n.records << record\n\n # handling transactions\n when :transaction_detail\n\n unless stack.last.code == :account_identifier\n raise ParseError.new(\"Parsing #{record.code}, expecting account_identifier parent.\")\n end\n\n stack.last.children << ParseNode.new(record)\n\n # handling special known errors\n else # nil\n raise ParseError.new('Unknown or unexpected record code.')\n end\n end\n\n unless stack == []\n raise ParseError.new('Reached unexpected end of input (EOF).')\n end\n\n # root now contains our parsed tree\n root\n end",
"def parse_file(file, lines)\n\t\traise \"Missing parse_file() implementation for Filter: #{@name}\"\n\tend",
"def parse(source, path = T.unsafe(nil)); end",
"def parse\n IniParse::Generator.gen do |generator|\n @source.split(\"\\n\", -1).each do |line|\n generator.send(*Parser.parse_line(line))\n end\n end\n end",
"def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end",
"def parse\n file = File.read(@file)\n @data = JSON.parse(file)\n end",
"def parse(file_path) \n doc = Nokogiri.parse(File.read(file_path))\n \n lib_node = doc.xpath(\"/plist/dict\")[0]\n lib_metadata = {}\n lib_node.xpath(\"key\").each do |key_node|\n key_sym = key_node.content.downcase.gsub(/ +/,'_').to_sym\n lib_metadata[key_sym] = key_node.next.content\n end\n self.persistent_id = lib_metadata[:library_persistent_id]\n \n track_nodes = doc.xpath(\"/plist/dict/dict/dict\")\n track_nodes.each do |track_node|\n song_metadata = {}\n track_node.xpath(\"key\").each do |key_node|\n key_sym = key_node.content.downcase.gsub(/ +/,'_').to_sym\n song_metadata[key_sym] = key_node.next.content\n end\n track_persistent_id = song_metadata[:persistent_id]\n track = Track.find_by_persistent_id(track_persistent_id)\n if track.nil?\n track = Track.new\n track.parse(song_metadata)\n end\n self.tracks << track\n end\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse_files(options)\n files = options.files\n files = [\".\"] if files.empty?\n\n file_list = normalized_file_list(options, files, true, options.exclude)\n\n return [] if file_list.empty?\n\n jobs = SizedQueue.new(number_of_threads * 3)\n workers = []\n file_info = []\n file_info_lock = Mutex.new\n\n Thread.abort_on_exception = true\n @stats = Stats.new(file_list.size, options.verbosity)\n @stats.begin_adding(number_of_threads)\n\n # Create worker threads.\n number_of_threads.times do\n thread = Thread.new do\n while (filename = jobs.pop)\n @stats.add_file(filename)\n content = read_file_contents(filename)\n top_level = ::RDoc::TopLevel.new filename\n\n parser = ::RDoc::Parser.for(top_level, filename, content, options,\n @stats)\n result = parser.scan\n\n file_info_lock.synchronize do\n file_info << result\n end\n end\n end\n workers << thread\n end\n\n # Feed filenames to the parser worker threads...\n file_list.each do |filename|\n jobs << filename\n end\n workers.size.times do\n jobs << nil\n end\n\n # ...and wait until they're done.\n workers.each do |thread|\n thread.join\n end\n\n @stats.done_adding\n\n file_info\n end",
"def parse\n raise ERROR_FILE_NOT_SET if report.nil? || report.empty?\n raise format(ERROR_FILE_NOT_FOUND, report) unless File.exist?(report)\n\n Oga.parse_xml(File.read(report))\n end",
"def parse\n @line_count = 0\n @text.each do |line|\n @line_count += 1\n case line\n \n when /^DATE: ?(.*)/\n save_current_match\n parse_date($1)\n\n when /^PLAYER: ?(.*)/\n parse_player($1)\n\n when /^SET/\n parse_set\n \n when /^GAME: ?(.*)/\n parse_game($1)\n \n when /^(\\d\\w\\w?)/\n parse_point($1)\n end\n end\n \n save_current_match\n return @matches\n end",
"def initialize(file)\n @file = parse(file)\n end",
"def parse_metadata(file)\n file_name = File.basename(file)\n puts \"\\n#{Time.now.strftime('%T')} Parsing #{file_name}\" unless Rails.env.test?\n attrs = parser.new(file).attributes\n\n if attrs.blank?\n errors << \"Failed to parse file: #{file_name}\"\n elsif record_exists?(attrs)\n # Don't re-import the record if this record already\n # exists in fedora.\n skipped_imports << file_name\n else\n create_record(attrs.merge(metadata_file: file, visibility: visibility, admin_set: admin_set))\n successful_imports << file_name\n end\n rescue => e\n errors << \"#{file_name}: #{e}\"\n end",
"def parse\n\t\t\t\tdata = unpack(File.open(@filename, 'rb') {|io| io.read})\n\t\t\t\t@tunefile = BinReader.new.string_extractor(data, 12728)\n\t\t\t\tif @tunefile[/^[A-Z]:.*/] != @tunefile and File.extname(@tunefile) != \".LTQTune\"\n\t\t\t\t\t@tunefile = BinReader.new.string_extractor(data, 12872)\n end\n\t\t\t\tif @tunefile[/^[A-Z]:.*/] != @tunefile and File.extname(@tunefile) != \".LTQTune\"\n\t\t\t\t\t@tunefile = BinReader.new.string_extractor(data, 13750)\n\t\t\t\tend\n if @tunefile[/^[A-Z]:\\\\/].nil? or File.extname(@tunefile) != \".LTQTune\"\n raise StandardError, \"ParseError: Tunefile doesn't have a drive letter\"\n end\n\t\t\t\t@tunefile\n\t\t\t\tbegin \n\t\t\t\t raise StandardError, \"Failed to correctly parse method file for Tunefile location\" if @tunefile[/^[A-Z]:.*/] != @tunefile and File.extname(@tunefile) != \".LTQTune\"\n\t\t\t\trescue StandardError\n\t\t\t\t @tunefile = nil\n\t\t\t\t puts \"ParseError, skipping tunefile\"\n\t\t\t\tend\n\t\t\tend",
"def parse\n return false unless filecheck\n doc = REXML::Document.new(open(file))\n @result_set = []\n doc.elements.each(RESULT_PATH) do |e|\n result_array = [] # [0]: name, [1]: data type, [2]:null\n get_generic(e, result_array)\n @result_set.push(result_array)\n end\n return true\n end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end"
] |
[
"0.75361913",
"0.7464579",
"0.7464579",
"0.7464579",
"0.7464579",
"0.7464579",
"0.7464579",
"0.7201121",
"0.70735264",
"0.70595956",
"0.6952022",
"0.6859925",
"0.68220687",
"0.66957206",
"0.6658124",
"0.6536995",
"0.65328467",
"0.6527937",
"0.6475216",
"0.6475216",
"0.6334495",
"0.62918967",
"0.6273385",
"0.62706083",
"0.6261035",
"0.61846405",
"0.61811805",
"0.61550957",
"0.6149303",
"0.612205",
"0.6097116",
"0.60911715",
"0.6079201",
"0.60537905",
"0.6051815",
"0.6050294",
"0.60409796",
"0.6008162",
"0.6001377",
"0.5982928",
"0.59821093",
"0.59629035",
"0.59480864",
"0.5946567",
"0.59228194",
"0.59125155",
"0.5849949",
"0.5844182",
"0.5840616",
"0.5836453",
"0.58293414",
"0.58233017",
"0.5813199",
"0.58016163",
"0.5791988",
"0.5780367",
"0.5766205",
"0.57567984",
"0.5754229",
"0.5752637",
"0.5751482",
"0.5742739",
"0.5742739",
"0.5742739",
"0.57385117",
"0.5714132",
"0.57133055",
"0.569558",
"0.56920964",
"0.5688843",
"0.5675142",
"0.56678706",
"0.5657938",
"0.5639726",
"0.56367534",
"0.5616541",
"0.56132305",
"0.5611052",
"0.5607071",
"0.56011003",
"0.5599038",
"0.5595772",
"0.55951256",
"0.5592079",
"0.5580579",
"0.55793834",
"0.5578338",
"0.55780184",
"0.55757403",
"0.5570508",
"0.55693305",
"0.5561358",
"0.55589485",
"0.5555824",
"0.5552325",
"0.55500793",
"0.5548822",
"0.55452156",
"0.55452156",
"0.55452156",
"0.55452156"
] |
0.0
|
-1
|
Get the raw data of the file as a string.
|
def data
return @data unless @data.nil?
if File.exists?(@path)
@data = File.read(@path)
else
raise FileNotFound.new(@path)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\")\n f.each_line do |line|\n data += line\n end\n return data\n end",
"def get_file_as_string(filename)\n data = ''\n f = File.open(filename, \"r\") \n f.each_line do |line|\n data += line\n end\n return data\n end",
"def get_file_as_string(filename)\n data = \"\"\n File.open(filename, \"r\").each_line do |line|\n data += line\n end\n data\n end",
"def get_file_as_string(filename)\n data = ''\n\n File.open(filename, \"r\") { |f|\n data = f.read\n }\n \n return data\nend",
"def raw\n content = ''\n File.open(path) { |f| content = f.read }\n content\n rescue IOError\n raise \"cannot open #{path}\"\n end",
"def raw_contents\n File.read(path)\n end",
"def data\n if @path\n File.open(@path, \"rb\"){|f| f.read} rescue nil\n else\n @memory_io.string.clone\n end\n end",
"def to_s\n if @args[:data].is_a?(StringIO)\n return @args[:data].string\n else\n return File.read(@args[:data].path)\n end\n end",
"def to_s\n @file_text\n end",
"def to_s\n @file_text\n end",
"def get_raw\n\n path = File.join(self.get_dir, self.id.to_s + Email::EXT_RAW)\n\n if File.exist?(path)\n return open(path) { |f| f.read }\n else\n return ''\n end\n end",
"def as_string()\n\n data_map = IniFile.new( :filename => @file_path, :encoding => 'UTF-8' )\n data_map = IniFile.load( @file_path ) if File.file? @file_path\n return data_map.to_s\n\n end",
"def raw_text\n text = ''\n\n objects = get_objects(get_data(@file))\n objects = decode_objects(objects)\n\n objects.each { |o| text += o[:data] if(o[:data] and is_text_header?(o[:header])) }\n\n text\n end",
"def to_s\n @file.to_s\n end",
"def get_data(file)\n f = File.open(file, 'rb')\n buffer = f.read\n f.close\n\n buffer\n end",
"def getRawFileContents(path)\n rtn = ''\n\n begin\n file = File.open(path, 'r')\n file.each{|line|\n rtn += line.strip() + ' '\n }\n rescue\n return ''\n end\n\n return rtn\nend",
"def data\n File.read(path)\n end",
"def raw_output\n self.read(@filename)\n end",
"def raw\n @buffer\n end",
"def data\n @buffer.string\n end",
"def raw_source\n @raw ||= File.read source_path\n end",
"def raw_source\n @raw ||= File.read source_path\n end",
"def get_string_from_file(filename)\n File.open(filename, \"rb\") do |f|\n return f.read\n end\nend",
"def read_file_to_str(filename)\n result = ''\n f = File.open(filename, \"r\")\n begin\n f.each_line do |line|\n result += line\n end\n ensure\n f.close unless f.nil?\n end\n result\n end",
"def contents\n\t\tfin = File.new(@filename,'r')\n\t\tc = fin.read\n\t\tfin.close\n\t\treturn c\n\tend",
"def raw_bytes\n @raw_bytes ||= read_raw_bytes\n end",
"def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end",
"def content\n return IO.read(@file)\n end",
"def raw_file(path)\n good_path = path.gsub(/ /, '-')\n url = URI.parse(good_path)\n res = Net::HTTP.get_response(url)\n return res.body\n end",
"def to_s\r\n\t\tbuffer_as_applesoft_file(@contents)\r\n\tend",
"def to_s\n to_io.read(nil)\n end",
"def pbGetFileString(file)\n file = canonicalize(file)\n if !(safeExists?(\"./Game.rgssad\") || safeExists?(\"./Game.rgss2a\"))\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\") { |f| return f.read } # read all data\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload = true\n str = nil\n begin\n str = load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str = nil\n ensure\n Marshal.neverload = false\n end\n return str\nend",
"def pbGetFileString(file)\n file=canonicalize(file)\n if !(safeExists?(\"./Game.rgssad\") || safeExists?(\"./Game.rgss2a\"))\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\"){|f|\n return f.read # read all data\n }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload=true\n str=nil\n begin\n str=load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str=nil\n ensure\n Marshal.neverload=false\n end\n return str\nend",
"def raw_code\n @raw_code ||= (File.read path).to_s.force_encoding(Encoding::UTF_8)\n end",
"def encoded_file_data(item = nil)\n get_file_data(item)[:data].presence\n end",
"def read\n file.read\n end",
"def raw_body\n if @rev\n @raw_body ||= blob.contents\n else\n @raw_body ||= File.exists?(@filename) ? File.read(@filename) : ''\n end\n end",
"def to_str\n @filename\n end",
"def read\n return nil if FileTest.exist?(@fname)==false\n\n open(@fname,\"rb\") do |file| #Read & Binary mode\n @data = Marshal.load(file)\n end\n @data\n end",
"def data\n self.data_pointer.read_string(self.data_size)\n end",
"def file_content\n self.lines.join\n end",
"def to_string\n io.string\n end",
"def contents\n # give the string contents of the file\n @file.seek 0\n @file.read @filesize\n end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def content\n\t\tif(File.file? filename)\n\t\t\tIO.readlines(filename).join ''\n\t\telse\n\t\t\t\"\"\n\t\tend\n\tend",
"def get_file_contents(fname)\n f_h = File.open(fname,'r')\n readbuf = f_h.read()\n# puts \"Read #{readbuf.length()} bytes from #{fname}.\"\n f_h.close()\n return readbuf\nend",
"def to_s\r\n\t\tbuffer_as_integer_basic_file(@contents)\r\n\tend",
"def read_file_source\n %Q|\n var readFile = function(path) {\n try {\n var file = Components.classes[\"@mozilla.org/file/local;1\"]\n .createInstance(Components.interfaces.nsILocalFile);\n file.initWithPath(path);\n\n var fileStream = Components.classes[\"@mozilla.org/network/file-input-stream;1\"]\n .createInstance(Components.interfaces.nsIFileInputStream);\n fileStream.init(file, 1, 0, false);\n\n var binaryStream = Components.classes[\"@mozilla.org/binaryinputstream;1\"]\n .createInstance(Components.interfaces.nsIBinaryInputStream);\n binaryStream.setInputStream(fileStream);\n var array = binaryStream.readByteArray(fileStream.available());\n\n binaryStream.close();\n fileStream.close();\n file.remove(true);\n\n return array.map(function(aItem) { return String.fromCharCode(aItem); }).join(\"\");\n } catch (e) { return \"\"; }\n };\n |\n end",
"def read_file(file_path)\n return nil unless File.exist?(file_path)\n\n buf = ''\n\n File.open(file_path, 'rb') do |f|\n buf = f.read\n end\n\n buf\n end",
"def raw_data\n @raw_data ||= api_url.open.read\n end",
"def to_s\n tempfile = Tempfile.new('tempfile')\n path = tempfile.path\n write(path)\n\n File.read(path)\n end",
"def string\n @io.string\n end",
"def raw\n\t\treturn @content\n\tend",
"def raw\n\t\treturn @content\n\tend",
"def read\n IO.read(full_path)\n end",
"def data\n dis_data.read\n end",
"def contents\n file_content = self.class.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n if file_content\n buffer = \"\"\n file_content.chunks.reduce([]) do |x,chunk|\n buffer << chunk.data.data\n end\n return buffer\n end\n end",
"def text\n\t\t\t\t::File.open(self.start.file, \"r\") do |file|\n\t\t\t\t\tfile.seek(self.start.offset)\n\t\t\t\t\treturn file.read(self.bytesize)\n\t\t\t\tend\n\t\t\tend",
"def source\n if @source\n @source\n else\n # File is read everytime to avoid memory bloat of large binary files\n File.binread(filename)\n end\n end",
"def payload\n Base64.encode64(File.open(file, 'rb').read)\n end",
"def raw_source\n @raw_source\n end",
"def raw_source\n @raw_source\n end",
"def raw_source\n @raw_source\n end",
"def contents\n\t\tconnection.file_contents(full_path)\n\tend",
"def contents\n\t\tconnection.file_contents(full_path)\n\tend",
"def contents\n read\n end",
"def content\n return @raw if @raw\n\n if self.uri\n @raw = HTTParty.get(self.uri.to_s).body\n # elsif self.precompiled?\n # template = Tilt.new(self.filepath)\n # @raw = template.render\n else\n @raw = File.read(self.filepath)\n end\n end",
"def string\n self.io unless @written\n return @io.string\n end",
"def to_s\n\t\t\treturn @buffer.to_s\n\t\tend",
"def file_data\n @client.get_file @file_url\n end",
"def read_binary(file); end",
"def read\n return unless ::File.exist?(@file)\n\n @data = Bencode.decode(::File.read(@file))\n end",
"def get_raw_buffer\n @buffer\n end",
"def data\n return @data if defined? @data\n\n if path?\n @data = File.read @path\n elsif uri?\n @data = Net::HTTP.get @uri\n elsif stream?\n @data = @stream.read\n end\n\n @data\n end",
"def data\n return @data if defined? @data\n\n if path?\n @data = File.read @path\n elsif uri?\n @data = Net::HTTP.get @uri\n elsif stream?\n @data = @stream.read\n end\n\n @data\n end",
"def get\n File.read(path)\n end",
"def read\n file\n end",
"def contents\n f = self.class.mongo_client.database.fs.find_one({:_id=>BSON::ObjectId.from_string(@id)})\n if f\n buffer = \"\"\n f.chunks.reduce([]) do |x, chunk|\n buffer << chunk.data.data\n end\n return buffer\n end\n end",
"def raw_content(path, ctype=DEFAULT_CTYPE)\n node = @content_tree.lookup(path, ctype)\n node ? node.raw_contents : ''\n end",
"def data\n data = @repo.working_read(@path) rescue nil\n data\n end",
"def pbGetFileChar(file)\n file=canonicalize(file)\n if !(safeExists?(\"./Game.rgssad\") || safeExists?(\"./Game.rgss2a\"))\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\"){|f|\n return f.read(1) # read one byte\n }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload=true\n str=nil\n begin\n str=load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str=nil\n ensure\n Marshal.neverload=false\n end\n return str\nend",
"def pbGetFileChar(file)\n file = canonicalize(file)\n if !safeExists?(\"./Game.rgssad\") && !safeExists?(\"./Game.rgss2a\")\n return nil if !safeExists?(file)\n begin\n File.open(file,\"rb\") { |f| return f.read(1) } # read one byte\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n return nil\n end\n end\n Marshal.neverload = true\n str = nil\n begin\n str = load_data(file)\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES, RGSSError\n str = nil\n ensure\n Marshal.neverload = false\n end\n return str\nend",
"def file_content(path)\n cont = \"\"\n File.open(path) do |fil|\n cont = fil.read\n end\n cont\nend",
"def working_read(filename)\n data = @file_opener.open(filename, \"r\") {|f| f.read }\n data = @filters[\"encode\"].call(filename, data) if @filters[\"encode\"]\n data\n end",
"def data\n response = $postgres.exec_prepared('wsfile_get', [self.id], 1)\n response.to_a.length==1 && response[0][\"data\"] || \"\"\n end",
"def read_data\n unpacker.read\n end",
"def readFile(fileName)\r\nputs open(fileName).read\r\nend",
"def read_data(file_name)\n file = File.open(file_name,\"r\")\n object = eval(file.gets.untaint.encode('UTF-8', :invalid => :replace, :replace => '').gsub('\\n', \"\"))\n file.close()\n return object\nend",
"def to_string\n @metadata[:contents]\n end",
"def read\n @contents ||= File.read @src_path if readable?\n end",
"def source\n f = File.open(File.join(root_path, path))\n data = f.read\n f.close\n data\n end",
"def serialize\n @raw_data\n end",
"def string\n io.pos = start_index unless io.pos == start_index\n io.read(num_bytes)\n end",
"def read_contents\n\t\treturn File.open(self.file_name).read.lines.map(&:chomp) if self.file_name\n\tend",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def to_blob\n File.binread(path)\n end",
"def getFileContents(file)\n fileContent = \"\";\n File.open(file).each do |line|\n fileContent += line;\n end\n fileContent;\nend"
] |
[
"0.78787535",
"0.7871976",
"0.7768824",
"0.7620733",
"0.7560408",
"0.74693704",
"0.73208654",
"0.72229075",
"0.7220505",
"0.7220505",
"0.7193522",
"0.7186675",
"0.7164912",
"0.7056063",
"0.7014338",
"0.7006306",
"0.6973922",
"0.68200815",
"0.66876906",
"0.66814375",
"0.6674875",
"0.6674875",
"0.6666759",
"0.6642541",
"0.66425276",
"0.6614161",
"0.66086483",
"0.65925735",
"0.65844256",
"0.6525578",
"0.6510622",
"0.64937377",
"0.64925015",
"0.644966",
"0.642446",
"0.6414415",
"0.6393429",
"0.6389862",
"0.638293",
"0.6382392",
"0.63608897",
"0.63539577",
"0.6287597",
"0.6237945",
"0.6237945",
"0.62289655",
"0.6185408",
"0.6178204",
"0.61608726",
"0.61571836",
"0.6154134",
"0.6130956",
"0.6111727",
"0.6099382",
"0.6099382",
"0.6084742",
"0.607519",
"0.60737884",
"0.6065843",
"0.60574394",
"0.604273",
"0.60426706",
"0.60426706",
"0.60426706",
"0.60421175",
"0.60421175",
"0.6037396",
"0.60340554",
"0.60326755",
"0.60326177",
"0.6024871",
"0.6022398",
"0.6017966",
"0.60025924",
"0.6001117",
"0.6001117",
"0.59849924",
"0.59675217",
"0.59610325",
"0.59528315",
"0.5952745",
"0.5946797",
"0.59428227",
"0.59395015",
"0.593695",
"0.5926971",
"0.59115565",
"0.59075636",
"0.5907392",
"0.5902798",
"0.590089",
"0.58990127",
"0.5893098",
"0.5883217",
"0.5879811",
"0.5875041",
"0.5875041",
"0.5875041",
"0.5875041",
"0.5866525",
"0.58581996"
] |
0.0
|
-1
|
Infer the separator based on the data (naive but hey). Feature Opportunity: Detect by file extension
|
def inferred_separator
SUPPORTED_SEPARATORS.each do |sep|
return sep if data.scan(sep).length > 0
end
raise UnknownFormat.new(@path)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_delim_filename(delim_type, other_char, suffix = '')\n if delim_type == 'comma'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = ','\n elsif delim_type == 'space'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = ' '\n elsif delim_type == 'tab'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = \"\\t\"\n elsif delim_type == 'other'\n filename = params[:model] + params[:id] + suffix + '.csv'\n delimiter = other_char\n end\n [filename, delimiter]\n end",
"def extension_with_delimiter\n File.extname @filename\n end",
"def identify_delimiter(filename_or_sample)\n #filename_or_sample input can be either a File or an Array or a string - Return delimiter for File or an Array of strings (if found)\n if filename_or_sample.class == String\n if File::exists?(filename_or_sample)\n current_line_number = 0\n File.foreach(filename_or_sample) do |line|\n count_occurances_delimiter(line)\n current_line_number += 1\n if current_line_number > 3\n break\n end\n end\n else\n # count_occurances_delimiter(filename_or_sample)\n return FileNotFound.new\n end\n return_plausible_delimiter\n elsif filename_or_sample.class == Array\n filename_or_sample.each do |line|\n count_occurances_delimiter(line)\n end\n return_plausible_delimiter\n else\n InvalidInput.new\n end\n end",
"def separator(type); end",
"def files_inspected(ext, delimiter = ',', remove = @config.working_dir)\n @path.is_a?(Array) ? @path.split(delimiter) : file_list(@path, ext, remove)\n end",
"def separator(fname)\n f = File.open(fname)\n enum = f.each_char\n c = enum.next\n loop do\n case c[/\\r|\\n/]\n when \"\\n\" then break\n when \"\\r\"\n c << \"\\n\" if enum.peek == \"\\n\"\n break\n end\n c = enum.next\n end\n c[0][/\\r|\\n/] ? c : \"\\n\"\n end",
"def default_separator; end",
"def separator; end",
"def sep; end",
"def sep; end",
"def column_seperator\n self.data.strip.each.first.gsub(/[;,]/).first\n end",
"def preserve_extensions(data)\n data.map do |from, to|\n [from, \"#{to}#{File.extname(from)}\"]\n end\n end",
"def extension\r\n\t\t\"csv\"\r\n\tend",
"def extract_separator\n if meta_tags[:separator] == false\n # Special case: if separator is hidden, do not display suffix/prefix\n prefix = separator = suffix = \"\"\n else\n prefix = extract_separator_section(:prefix, \" \")\n separator = extract_separator_section(:separator, \"|\")\n suffix = extract_separator_section(:suffix, \" \")\n end\n delete(:separator, :prefix, :suffix)\n\n TextNormalizer.safe_join([prefix, separator, suffix], \"\")\n end",
"def extension_without_delimiter\n extension_with_delimiter.from(1).to_s\n end",
"def get_sep_string file_path\n sep_string = \"\\r\"\n IO.foreach(file_path, sep_string) do |line|\n if line.split(\"\\n\").length > line.split(\"\\r\").length\n sep_string = \"\\n\"\n break\n end\n end\n return sep_string\n end",
"def separator\n nil\n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end",
"def period_separator\n '.'\n end",
"def fix_data_characterization!\n self.characterization.mime_type = 'text/csv' if mime_type == 'text/plain' && format_label.include?('Comma Separated Values')\n self.characterization.mime_type = 'text/tab-separated-values' if mime_type == 'text/plain' && format_label.include?('Tab-separated values')\n end",
"def default_separator=(separator); end",
"def file_extension; end",
"def file_extension; end",
"def file_extension; end",
"def separator\n @parts.push(separator: true)\n end",
"def parsed_file_name\n data_file_name.split('.')[0]\n end",
"def fir(arr)\n arr.first.split('.').first\nend",
"def file_ext\n File.extname(@file_name).downcase\n end",
"def custom_delimiters\r\n\t\toutput = []\r\n\t\toutput << input.split(\"]\\n\").first[3..-1].split(\"][\") if input.start_with?('//')\r\n\t\toutput.flatten\r\n\tend",
"def separator\n return @separ if @separ\n str = \"\"\n if @numbering\n str = \"-\"*(rows+1)+@x\n end\n each_column { | c, ix|\n v = c.width\n next if v == 0 ## hidden column\n str << \"-\" * (v+1) + @x \n }\n @separ = str.chop\n end",
"def preferred_delimiters; end",
"def extension\n @file_data.original_filename.split(\".\").last\n end",
"def extension\n @file_data.original_filename.split(\".\").last\n end",
"def extension\n @file_data.original_filename.split(\".\").last\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def split_filename(fn)\n fn.split(/[\\/\\\\]/)\n end",
"def scan_for_dots(token); end",
"def split; end",
"def ext\n file.extension.downcase\n end",
"def correct_formatting\n formatted = [] \n @data.each_with_index do |str, index|\n if str.end_with?('.') && @data[index - 1].end_with?('.')\n formatted << str.chop\n else\n formatted << str\n end\n end\n @data = formatted\n end",
"def normalize_delimiters!\n @content.each { |item| item[:delimiter] = default_delimiter if item[:type] == :value }\n end",
"def fileable\n tr(' ', '_').downcase\n end",
"def lsep\n \"==================================================================================\"\n end",
"def separator\n return @separator\n end",
"def split(file)\n if m = file.match(/^(.*\\/)?([^\\.]+)\\.?(\\w+)?\\.?(\\w+)?\\.?(\\w+)?$/)\n if m[5] # Multipart formats\n [m[1], m[2], \"#{m[3]}.#{m[4]}\", m[5]]\n elsif m[4] # Single format\n [m[1], m[2], m[3], m[4]]\n else\n if valid_extension?(m[3]) # No format\n [m[1], m[2], nil, m[3]]\n else # No extension\n [m[1], m[2], m[3], nil]\n end\n end\n end\n end",
"def split_filename(fn)\n fn.split(/[\\/\\\\]/)\n end",
"def get_file_extension(arr)\n\nend",
"def guess_column_separator(filehandle, options)\n skip_lines(filehandle, options)\n\n delimiters = [',', \"\\t\", ';', ':', '|']\n\n line = nil\n has_header = options[:headers_in_file]\n candidates = Hash.new(0)\n count = has_header ? 1 : 5\n count.times do\n line = readline_with_counts(filehandle, options)\n delimiters.each do |d|\n candidates[d] += line.scan(d).count\n end\n rescue EOFError # short files\n break\n end\n rewind(filehandle)\n\n if candidates.values.max == 0\n # if the header only contains\n return ',' if line.chomp(options[:row_sep]) =~ /^\\w+$/\n\n raise SmarterCSV::NoColSepDetected\n end\n\n candidates.key(candidates.values.max)\n end",
"def split_path; end",
"def sequence_separator; end",
"def _sep\n\n _save = self.pos\n while true # sequence\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comma)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save3 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n break if _tmp\n self.pos = _save3\n _tmp = apply(:_comma)\n break if _tmp\n self.pos = _save3\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_sep unless _tmp\n return _tmp\n end",
"def remove_initial_and_format_change \n @reformated_array = []\n array_of_parse_files.each do |info|\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n @reformated_array << info\n else\n @reformated_array << info\n end\n end\nend",
"def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end",
"def extname() File.extname(@path) end",
"def delimiter\n \" \"\n end",
"def delimiter\n \" \"\n end",
"def trailing_separator\n if defined?(@trailing_separator)\n return @trailing_separator\n else\n return true\n end\n end",
"def separators\n @separators.merge(definition.separators(@children.find(&:segment?)))\n end",
"def extension_whitelist\n %w[csv]\n end",
"def determine_field_delimiter(l)\n if l =~ /[\\,\\|]/ \n /\\s*[\\,\\|]\\s*/\n else\n /\\s/\n end\n end",
"def make_delimiters\n ((self).split(//)*2+['',''])[0,2] # *2 doubles up single delimiters\n end",
"def default_separator(value = T.unsafe(nil)); end",
"def filename\n case File.extname original_filename\n when /.zip/\n \"oag_airlines.xls.zip\"\n when /.xls/\n \"oag_airlines.xls\"\n end\n end",
"def split(parts); end",
"def _FrontmatterSeparator\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"---\")\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Nl)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_FrontmatterSeparator unless _tmp\n return _tmp\n end",
"def check_file_return_mod(file_name_ori)\n mod_file_name = Array.new \n\n if file_name_ori.first.include?(',')\n file_name_ori.each do |x|\n mod_file_name.push x\n end\n else\n file_name_ori.each do |x|\n mod_file_name.push x.to_s.gsub(/\\t/, ',')\n end\n end\n \n return mod_file_name\n end",
"def delim(name, options)\n name = name.split('.').last if name.is_a?(String) && name.include?('.')\n options[:delim] || \"$#{ActiveSupport::Inflector.underscore(name)}_body$\"\n end",
"def replace_separator?(path)\n @replace_separator ? path.gsub(%r{/}, '_') : path\n end",
"def dotted_ext(ext)\n ext = ext.to_s and (ext.empty? or ext.start_with?('.')) ? ext : \".#{ext}\"\n end",
"def sanitize_filename(fname, separator: '_')\n # Replace accented chars with their ASCII equivalents.\n fname = fname.encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n\n # Turn unwanted chars into the separator.\n fname.gsub!(/[^a-z0-9\\-_]+/i, separator)\n\n re_sep = Regexp.escape(separator)\n re_duplicate_separator = /#{re_sep}{2,}/\n re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i\n\n # No more than one of the separator in a row.\n fname.gsub!(re_duplicate_separator, separator)\n\n # Finally, Remove leading/trailing separator.\n fname.gsub(re_leading_trailing_separator, '')\n end",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def readlines(sep=$/) end",
"def readlines(sep=$/) end",
"def delimiter\n @gapi.csv_options.field_delimiter\n end",
"def delimiter\n @gapi.csv_options.field_delimiter\n end",
"def extension_whitelist\n %w(csv)\n end",
"def default_line_separator\n @def_line_sep ||= infer_line_separator\n end",
"def separate(path)\n path.gsub(%r{/}, File::SEPARATOR)\n end",
"def file_type\n\t\tline = @file_desc.gets\n\t\t@file_desc.pos = 0 # Reset our location within the file\n\t\t\t\t\n\t\ttype = case line[line.rindex(' ')-1].chr\n\t\t\twhen ',' then :comma\n\t\t\twhen '|' then :pipe\n\t\t\telse :space\n\t\tend\n\tend",
"def split_to_filename_and_extension path\n extension = File.extname(path).gsub('.', '')\n filename = File.basename(path, '.' + extension)\n return filename, extension\n end",
"def handle_o_dn\n handle_o\n handle_possible(SeparatorSpace)\n handle_dn\n end",
"def raw_mime_dir_value\n parts.join(@delimiter)\n end",
"def parse_data_with_trailing_star(type); end",
"def preferred_file_format\n ''\n end",
"def get_file_extension(arr)\n file_type_array = []\n\n index = 0\n for file in arr\n splited = file.split(\".\")\n\n file_type_array.insert(index, splited[1])\n\n index += 1\n end\n\n return file_type_array\nend",
"def separator(type)\n return \"\" if @options[:use_hidden]\n\n case type\n when :year, :month, :day\n @options[:\"discard_#{type}\"] ? \"\" : @options[:date_separator]\n when :hour\n (@options[:discard_year] && @options[:discard_day]) ? \"\" : @options[:datetime_separator]\n when :minute, :second\n @options[:\"discard_#{type}\"] ? \"\" : @options[:time_separator]\n end\n end",
"def set_delimiter delim\n @lt2_delimiter = case delim\n when Regexp\n delim\n else\n delim.to_s\n end\n end",
"def delimiter\n @view_column[:delimiter] || '-'\n end",
"def extract_separator_section(name, default)\n (meta_tags[name] == false) ? \"\" : (meta_tags[name] || default)\n end",
"def filetype\n if options.filetype.to_sym == :dot then :none else options.filetype.to_sym end\n end",
"def comma_file_parser\n @comma_names = File.open(\"text_files/comma.txt\").readlines.each do |line|\n if line.include?(\"\\n\") # removes '\\n' (line breaker)\n line.gsub!(/\\n/, '')\n else\n line\n end\n end\nend",
"def extract_file_name(file)\n return file.split('/').last.split('.csv').first\nend",
"def separate(path)\n path.gsub(%r{/}, File::SEPARATOR)\n end",
"def format\n @format ||= File.extname(@full_path)[1..-1].intern\n end",
"def answer_split\n arr_of_strings = []\n single_answer = []\n @data.each do |str|\n if str[-1] == '.'\n single_answer << str\n arr_of_strings << single_answer\n single_answer = []\n else\n single_answer << str\n end\n end\n arr_of_strings << single_answer\n @data = arr_of_strings\n end",
"def formato_titulo\n titulo_for=@titulo.split(\".\")\n auxiliar=\"\"\n titulo_for.each do |i|\n \n aux=i.capitalize\n aux+=(\".\")\n auxiliar+=aux\n end\n @titulo=auxiliar\n end",
"def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end",
"def before_and_after begin_delimeter, end_delimeter\n\n Throw.if_nil_or_empty_strings [ self, begin_delimeter, end_delimeter ]\n\n before_after_lines = []\n in_middle_bit = false\n\n self.each do |candidate_line|\n\n is_middle_boundary = !in_middle_bit && candidate_line.downcase.include?(begin_delimeter.downcase)\n if is_middle_boundary\n in_middle_bit = true\n next\n end\n\n unless in_middle_bit\n before_after_lines.push candidate_line\n next\n end\n\n #--\n #-- Now we are definitely in the middle bit.\n #-- Let's check for the middle end delimeter\n #--\n if candidate_line.downcase.include? end_delimeter.downcase\n in_middle_bit = false\n end\n\n end\n\n return before_after_lines\n\n end",
"def extname() File.extname(path) end"
] |
[
"0.6576335",
"0.6539616",
"0.61765844",
"0.6151087",
"0.6131208",
"0.6056232",
"0.60016304",
"0.5880193",
"0.5879092",
"0.5879092",
"0.5867265",
"0.58501166",
"0.5810048",
"0.57507426",
"0.5730546",
"0.5689163",
"0.56833524",
"0.56779134",
"0.56017107",
"0.5599163",
"0.55772406",
"0.5568262",
"0.5491128",
"0.5491128",
"0.5491128",
"0.5478701",
"0.5476444",
"0.54757327",
"0.54642624",
"0.5458705",
"0.5449345",
"0.54486376",
"0.54186445",
"0.54186445",
"0.54186445",
"0.53979576",
"0.5390839",
"0.5388803",
"0.53753996",
"0.5369777",
"0.5366531",
"0.5362187",
"0.53603846",
"0.5347905",
"0.5332088",
"0.5293142",
"0.52748585",
"0.5262591",
"0.5252209",
"0.52511334",
"0.52485716",
"0.5235083",
"0.5213846",
"0.51976687",
"0.51935",
"0.5185696",
"0.5185696",
"0.5182865",
"0.51825666",
"0.51663727",
"0.51594186",
"0.51550287",
"0.51517725",
"0.5131377",
"0.5125437",
"0.5119914",
"0.5115633",
"0.5113156",
"0.51058",
"0.50991106",
"0.5095357",
"0.50927323",
"0.50862473",
"0.5084379",
"0.5082033",
"0.5082033",
"0.50725937",
"0.5070285",
"0.50700736",
"0.5061641",
"0.50591224",
"0.50557184",
"0.505003",
"0.5049259",
"0.50403583",
"0.50354815",
"0.5028854",
"0.502363",
"0.5021343",
"0.50096464",
"0.5008975",
"0.50072277",
"0.49916595",
"0.4985863",
"0.4977934",
"0.4972557",
"0.4962654",
"0.49553815",
"0.4950416",
"0.49477857"
] |
0.72565305
|
0
|
Do the actual parsing of the data. Refactoring Opportunity: Pull this out into its own object like RecordSorter.
|
def parse_rows(data)
csv_options = DEFAULT_OPTIONS.merge(:col_sep => inferred_separator)
CSV.parse(data, csv_options).map(&:to_hash)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse(options={})\n rows = parse_rows(data)\n sort_rows(rows, options[:sort])\n end",
"def parse(data); end",
"def parse\n @file_data.each {|line|\n h = {}\n data_elements = line.split('|').collect(&:strip)\n #LastName | FirstName | MiddleInitial | Gender | FavoriteColor | DateOfBirth\n @data_collection << {:last_name => data_elements[0], :first_name => data_elements[1], :middle_initial => data_elements[2], :gender => (data_elements[3] == 'M') ? 'Male' : 'Female', :favorite_color => data_elements[4], :dob => data_elements[5].gsub('-', '/'), :dob_year => data_elements[5][-4,4]}\n }\n end",
"def parse\n input_data.each do |filename, data|\n rowdata_template = OpenStruct.new\n @preprocess_block.call(filename, rowdata_template) if @preprocess_block\n\n arrived_at_table_data = false\n\n data.split(\"\\r\\n\").each do |line|\n next if line.strip.empty? # Skip blank and whitespace lines\n\n if !arrived_at_table_data\n next if line =~ /\\ACreated by SunData/ # Skip created by line\n if date_match = line.match(/\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\t\\tLocal time is (GMT.\\d+ Hrs)/)\n rowdata_template.date = date_match[1]\n rowdata_template.timezone = date_match[2]\n end\n\n if sunscan_match = line.match(/\\ASunScan probe (v.*)/)\n rowdata_template.sunscan_version = sunscan_match[1]\n end\n\n if matches = line.scan(/\\s*([^\\t:]+)\\s*:\\s*([^\\t:]+)/)\n matches.flatten.map(&:strip).each_slice(2) do |key, value|\n next if value.nil? || value.empty?\n rowdata_template[key.downcase.gsub(\" \", \"_\")] = value\n end\n end\n\n # Once we hit the table hearder we can start processing tabular data.\n # The header is two lines long because of the formatting.\n next if line =~ /\\ATime\\tPlot\\t/\n arrived_at_table_data = true and next if line =~ /\\s+mitted\\s+ent/\n\n\n else\n rowdata = rowdata_template.dup\n table_line = line.split(\"\\t\")\n rowdata.time = table_line[0]\n rowdata.plot = table_line[1]\n rowdata.sample = table_line[2]\n rowdata.transmitted = table_line[3]\n rowdata.spread = table_line[4]\n rowdata.incident = table_line[5]\n rowdata.beam = table_line[6]\n rowdata.zenith_angle = table_line[7]\n rowdata.lai = table_line[8]\n rowdata.notes = table_line[9]\n # Only record output data once the full line data has been captured.\n output_data << rowdata\n end\n end\n end\n end",
"def parse!\n self.fields = []\n\n # split transactions, each transaction starts with a colon after a linebreak\n # do not remove line breaks within transaction lines as they are used to determine field details\n # e.g. :61:-supplementary\n source.split(\"\\n:\").each(&:strip!).each do |line|\n line = \":#{line}\" unless line =~ %r{^:} # prepend lost : via split\n\n if line.match(/\\A:86:/)\n if field = fields.last\n field.add_meta_data(line)\n end\n else\n field = Field.parse(line)\n self.fields << field unless field.nil?\n end\n end\n end",
"def preprocess\n if group_by?\n build_headers\n group_rows\n else\n enumerator.next\n end\n end",
"def parse(report)\n lines = report.split(\"\\n\")\n #puts \"lines: #{lines}\"\n header = lines.shift # remove first line \n lines.collect do |line|\n #puts \"line: #{line}\"\n provider, country, sku, developer, title, version, product_type_id, units, developer_proceeds, begin_date, end_date, currency, country_code, currency_of_proceeds, apple_id, customer_price, promo_code, parent_id, subscription, period = line.split(\"\\t\")\n p = { :provider => provider.strip, \n :country => country.strip, \n :sku => sku.strip, \n :developer => developer.strip, \n :title => title.strip, \n :version => version.strip, \n :product_type_id => product_type_id.strip, \n :units => units.to_i, \n :developer_proceeds => developer_proceeds.to_f, \n :begin_date => Date.strptime(begin_date.strip, '%m/%d/%Y'), \n :end_date => Date.strptime(end_date.strip, '%m/%d/%Y'), \n :currency => currency.strip, \n :country_code => country_code.strip, \n :currency_of_proceeds => currency_of_proceeds.strip, \n :apple_id => apple_id.to_i, \n :customer_price => customer_price.to_f, \n :promo_code => promo_code.strip, \n :parent_id => parent_id.strip, \n :subscription => subscription.strip, \n :period => period\n }\n puts \"parsing failed\".red if p==nil\n p\n end #lines collect\nend",
"def parse\n read_header\n parse_text_segment\n parse_data_segment\n @data = nil\n end",
"def data_sorter\n @file_data.each do |row|\n @trips << Trip.new(row[1], row[2], row[3], row[4]).log_to_driver if row[0] == \"Trip\"\n @drivers << Driver.new(row[1]) if row[0] == \"Driver\"\n end\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def parse(rawdata)\n end",
"def parse_table; end",
"def parse_from_summary(data)\n # \n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def prepare_data\n initial_data_eval \n initial_sorting if self.data_grid.sorting?\n filter\n global_summary_array\n pagination\n summary_array\n self.data_grid.row_styler\n prepare_data_for_filters\n end",
"def splitByPipe data\n data.each { | person | \n element = person.split(\"|\").map(&:strip)\n gender = returnGenderValue(element[3])\n date = returnDateFormated(element[5], '%d-%m-%Y')\n reorderArray(element[0], element[1], gender, date, element[4])\n } \nend",
"def process(csv_data)\n unless csv_data.headers == SOA_CSV_STRUCTURE\n LOGGER.error(\"Structure of #{csv_filename} does not match:\\nExpected: #{SOA_CSV_STRUCTURE.inspect}.\\nActual: #{csv_data.headers.inspect}.\\nContent: #{csv_file}\")\n abort('ABORTED!')\n end\n\n index = 0\n csv_data.delete_if do |row|\n index += 1\n retval = row[:buchungstag].nil? || row[:wertstellung].nil? || row[:umsatzart].nil?\n LOGGER.info(\"- Record nbr. #{index} not processed due to empty field(s): #{row.inspect}\") if retval\n retval\n end\n\n csv_data.sort_by { |row| DateTime.parse(row[:buchungstag]) }\n end",
"def parse\n current = {}\n @data.split(\"\\n\").each do |line|\n line.chomp!\n next if line.empty?\n\n if line == \"^\"\n unless current.empty?\n @transactions<< current\n current = {}\n end\n\n next\n end\n\n f, v = field_value(line)\n current[f] = v\n end\n\n @transactions<< current unless current.empty?\n end",
"def prepare_data \n table=Array.new\n flag=true\n flag2=false\n count=0 \n @reader.pages.each_with_index do |page,i| \n break if i >= @page \n #(?!([a-zA-Z\\-0-9]+))\n #text = page.text.gsub(/\\n\\s{1}+[0-9]{1}+,[0-9]\\s{1}+/,' ')\n rows=page.text.split(/\\n/) \n rows.each_with_index do|row,ind|\n temp=row.split(/\\s{2}+/)\n \n if temp.length == 1 && temp[0].include?('-')\n flag2=true\n rows[ind+1].insert(0, temp[0]) if !rows[ind+1].nil?\n flag2=false;\n end\n if temp.length >9\n temp.delete_at(1) \n end \n if temp.length ==9\n table << temp unless (temp.empty? || row.include?(\"Portfolio Name\"))\n \n end\n if flag && row.include?(\"Portfolio Name\")\n non_standardized_header row\n flag=false\n end\n end\t \n end \n return table\n end",
"def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\ /,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end",
"def parse\n reset!\n\n unless text.nil?\n text.each_line do |line|\n items = parse_line(line)\n unless items.empty?\n if headers?\n set_headers(items)\n else\n items_to_hash(items) do |item_hash|\n @result << item_hash\n end\n end\n end\n end\n end\n\n @result\n end",
"def parse\n records = []\n files.each do |fname|\n records += parse_file(fname)\n end\n\n @notes = records.sort\n end",
"def sorting\n @records = Record.all #Get existing records\n @sortType = params[:sortType] #Get parameters from the form on index\n @sortField = params[:sortField]\n\n @limit = params[:sortNum].to_i # params must be converted from string\n\n if @sortType == \"Decending\" # check if sort direction is decending\n case @sortField #check what header to sort by\n when \"id\" # when table header is ID sort by ID descending\n @sortedSet = Record.order(id: :desc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :desc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :desc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :desc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :desc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :desc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :desc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :desc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :desc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :desc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :desc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :desc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :desc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :desc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :desc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :desc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :desc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :desc).limit(@limit)\n \n end # end case/when\n else # if not decending its ascending\n case @sortField # check header to sort by\n when \"id\" # when table header is ID sort by ID ascending\n @sortedSet = Record.order(id: :asc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :asc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :asc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :asc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :asc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :asc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :asc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :asc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :asc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :asc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :asc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :asc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :asc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :asc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :asc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :asc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :asc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :asc).limit(@limit) \n end\n end\n \n end",
"def parse\n @meta = parse_meta\n @comments = parse_comments\n @sensors = parse_sensors\n @workout = parse_workout\n @intervals = parse_intervals\n @interval_samples = parse_interval_samples\n end",
"def parse\n lines = @text.split(\"\\n\")\n head = lines.shift\n head = head.gsub(/[[:punct:]]/, '')\n #head = head.gsub(/[[:space:]]|\\t/, '')\n head_match = Tables::Header_regex.match(head.strip)\n if head_match then\n @die = head_match[2].to_i\n @header = head_match[3].strip\n end\n lines.each { |l|\n l = l.gsub(/[[:punct:]]/, '')\n ti = Tables::Line_regex.match(l.strip)\n if ti then\n @outcomes << TableItem.new(ti.to_s)\n end\n }\n end",
"def parse_values; end",
"def parse\n end",
"def parse_list; end",
"def parse_list; end",
"def parse_article_from_file article_file_name\n article_values = {}\n article_values[:content] = ''\n article_values[:introduction] = ''\n article_values[:tags] = []\n article_values[:authors] = []\n article_values[:title] = ''\n article_values[:date] = nil\n article_values[:updated_at] = nil\n next_is = ''\n\n puts \"Parsing: #{article_file_name}\"\n File.open(File.join(ARTICLE_PATH, article_file_name), 'r') do |article_file|\n article_file.each_line do |line|\n next if line.blank?\n ##### Checking what next line will be\n # Detect date\n if line.include?(DATE_DELIMITER)\n next_is = 'date'\n # Detect updated_at date\n elsif line.include?(UPDATED_AT_DELIMITER)\n next_is = 'updated_at'\n # Detect introduction\n elsif line.include?(INTRODUCTION_DELIMITER)\n next_is = 'introduction'\n # Detect content\n elsif line.include?(CONTENT_DELIMITER)\n next_is = 'content'\n elsif line.include?(TAGS_DELIMITER)\n next_is = 'tags'\n elsif line.include?(TITLE_DELIMITER)\n next_is = 'title'\n elsif line.include?(AUTHORS_DELIMITER)\n next_is = 'authors'\n else\n case(next_is)\n when 'date' then article_values[:date] = Time.zone.parse(line.strip)\n when 'updated_at' then article_values[:updated_at] = Time.zone.parse(line.strip)\n when 'introduction' then article_values[:introduction] << line.strip\n when 'content' then article_values[:content] << line\n when 'title' then article_values[:title] << line.strip\n when 'authors' then\n line.strip.split(',').each do |author|\n author.strip! # Removing eventual spaces at the begining or at the end\n article_values[:authors] << Author.where(:name => author).first unless Author.where(:name => author).empty?\n end\n when 'tags' then\n line.strip.split(',').each do |tag_name|\n tag_name.strip! # Removing eventual spaces at the begining or at the end\n # If the tag exists, add it to the list of tags\n if Tag.where(:name => tag_name).empty?\n article_values[:tags] << Tag.create(:name => tag_name)\n else\n article_values[:tags] << Tag.where(:name => tag_name).first\n end\n end\n end\n end\n end\n end\n return article_values\nend",
"def parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=FasterCSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n#\t\"Masterid\",\"Motherid\",\"Record_Owner\",\"Datereceived\",\"Lastatt\",\"Lastdisp\",\"Currphone\",\"Vacauthrecd\",\"Recollect\",\"Needpreincentive\",\"Active_Phone\",\"Recordsentformatching\",\"Recordreceivedfrommatching\",\"Sentpreincentive\",\"Releasedtocati\",\"Confirmedcaticontact\",\"Refused\",\"Deceasednotification\",\"Eligible\",\"Confirmationpacketsent\",\"Catiprotocolexhausted\",\"Newphonenumreleasedtocati\",\"Pleanotificationsent\",\"Casereturnedtoberkeleyfornewinf\",\"Casereturnedfromberkeley\",\"Caticomplete\",\"Kitmothersent\",\"Kitinfantsent\",\"Kitchildsent\",\"Kitadolescentsent\",\"Kitmotherrefusedcode\",\"Kitchildrefusedcode\",\"Noresponsetoplea\",\"Responsereceivedfromplea\",\"Senttoinpersonfollowup\",\"Kitmotherrecd\",\"Kitchildrecvd\",\"Thankyousent\",\"Physrequestsent\",\"Physresponsereceived\"\n\n#\n#\tThe IcfMasterTracker will include an after_save or something that will\n#\tdetermine what has changed and update appropriately. It may also\n#\tcreate OperationalEvents to document the data changes. As it is\n#\ttheoretically possible that the Masterid does not exist in the identifiers\n#\ttable, perhaps add a successfully_updated_models flag which could\n#\tbe used?\n#\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_Masterid(line['Masterid'])\n\t\t\t\t#\tNO BANG. Don't want to raise any errors.\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes(line.to_hash)\n#\n#\terrors = icf_master_tracker.errors.full_messages.to_sentence\n#\tThese won't be validation errors as there shouldn't be any.\n#\tPerhaps \"no column by that name\" errors if csv file changes?\n#\n#\tAdd successfully_updated value?\n#\t\ticf_master_tracker.update_attribute(:sucessfully_updated, successfully_updated)\n#\twill the above include the line's attributes?\n#\n#\tAdd update_errors column?\n#\t\ticf_master_tracker.update_attribute(:update_errors, errors)\n#\n\n\t\t\t\tresults.push(icf_master_tracker)\n\n\t\t\tend\t#\t(f=FasterCSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"def arrange_datafields\n min_tag = 863\n last_index = nil\n final_results = []\n # Assumed that sort_combined is sorted\n # in tag order\n @sort_combined.each_with_index do |f,i|\n last_index = i if f.tag.to_i < min_tag\n end\n if last_index == @sort_combined.index(@sort_combined.last)\n final_results = @sort_combined + @field_pairs\n elsif last_index < @sort_combined.index(@sort_combined.last)\n #slice and dice\n temp_array = []\n @sort_combined.slice(0..last_index).each do |i|\n temp_array << i\n end\n @field_pairs.each { |f| temp_array << f }\n start = last_index + 1\n array_last_index = @sort_combined.index(@sort_combined.last)\n final_results = temp_array + @sort_combined.slice(start..array_last_index)\n else\n raise \"ERROR: Please check data\"\n end\n\n final_results\n\n end",
"def parse(data)\n docs = []\n rows = CSV::parse(data)\n if rows.length > 4\n # TODO/FIXME: get Tor Ivan to make a proper csv header\n header = rows[1]\n\n rows[4, rows.length].each do |row|\n doc = Hash[header.zip(row)]\n\n doc.each do |key, val|\n\n # try for int, if that fails, go for float, else string\n begin\n doc[key] = Integer(val)\n rescue ArgumentError\n begin\n doc[key] = Float(val)\n rescue ArgumentError\n end\n end\n\n end\n\n # make the timestamp ours\n toks = doc.delete(\"TIMESTAMP\").split()\n doc[\"measured\"] = toks[0]+\"T\"+toks[1]+\"Z\"\n\n # generate the sha256 digest based on the measurement time and use it as\n # a namespaced UUID seed to prevent duplicate data from entering the database.\n seed = Digest::SHA256.hexdigest doc[\"measured\"]\n doc[\"id\"] = seed[0,8] + \"-\" + seed[8,4] + \"-\" + seed[12,4] + \"-\" + seed[16,4] + \"-\" + seed[20,12]\n\n # point to our schema\n doc[\"schema\"] = \"http://api.npolar.no/schema/weather-bouvet-1.0-rc1\"\n docs << doc\n end\n end\n\n docs\n end",
"def convert(data)\n\t\trecords = []\n\t\tif @data_source == \"uniteu\"\n\t\t\tbegin\n\t\t\t\tdata.each do |row|\n\t\t\t\t\trecord = {}\n\t\t\t\t\t@map.each do |i|\n\t\t\t\t\t\ti.each do |k,v|\n\t\t\t\t\t\t\tfield = k.to_s\n\t\t\t\t\t\t\tv = v.split(\":\")\n\t\t\t\t\t\t\ttype = v[0]\n\t\t\t\t\t\t\tcol = v[1]\n\t\t\t\t\t\t\tif !record.has_key?(type.to_sym)\n\t\t\t\t\t\t\t\trecord[type.to_sym] = {}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\trecord[type.to_sym][col] = row[k]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t# Make Records\n\t\t\t\t\trecord.each do |k,v|\n\t\t\t\t\t\trecords << Record.new(k.to_s,v)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\t\tputs e\n\t\t\tend\n\t\telsif @data_source == \"rpro\"\n\t\t\tbegin\n\t\t\t\trecord = {}\n\t\t\t\tmappy(data).each do |type, fields|\n\t\t\t\t\tfields.each do |item|\n\t\t\t\t\t\tcol = item.keys[0][/[A-Za-z0-9_]+/].to_sym\n\t\t\t\t\t\tcolvalue = item.values[0]\n\t\t\t\t\t\tthisitem = []\n\t\t\t\t\t\tflags = item.keys[0][/[!+\\-#]/]\n\t\t\t\t\t\tif flags != nil\n\t\t\t\t\t\t\tflags = flags.split(//)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tflags = []\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t# Special Instructions\n\t\t\t\t\t\t# We need to process this stuff for the flags present\n\t\t\t\t\t\t# and then make it into records\n\t\t\t\t\t\tif !record.has_key?(type)\n\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif flags.empty?\n\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif flags.include? \"!\"\n\t\t\t\t\t\t\t\traise \"write filter for !\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"#\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\trecords << Record.new(type,record[type])\n\t\t\t\t\t\t\t\t\trecord[type] = {}\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"+\"\n\t\t\t\t\t\t\t\tif record[type].has_key?(col)\n\t\t\t\t\t\t\t\t\tcolvalue = record[type][col]+colvalue\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\trecord[type][col] = colvalue\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif flags.include? \"-\"\n\t\t\t\t\t\t\t\traise \"I didn't think we'd actually have one of these \\\"-\\\"\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\traise e\n\t\t\tend\n\t\tend\n\t\trecords\n\tend",
"def parse\n # TODO: Try to convert lsynth parts, maybe flag parts that are troublesome for manual editing,\n # look up to see if I've stored a conversion from ldraw ID to Bricklink ID,\n # convert Ldraw color IDs to BL color IDs, etc.\n parts = {}\n temp_parts = []\n\n @lines.each_with_index do |line, i|\n # This will stop getting parts for the base model once a submodel is reached\n break if line.match(/0 FILE/) && i > 15\n\n @submodels << line.match(/\\w+\\.ldr/).to_s.downcase if line.match(/^1/) && line.match(/\\.ldr$/)\n @lsynthed_parts << line.gsub('0 SYNTH BEGIN', '').split if line =~ /^0 SYNTH BEGIN/\n next unless line.match(/^1/) && line.match(/.dat$/)\n\n part = line.match(/\\w+\\.dat/).to_s.gsub!('.dat', '')\n next if lsynth_part?(part)\n\n color = line.match(/^1\\s\\d+/).to_s.gsub!('1 ', '')\n bl_part = get_bl_part_number(part)\n temp_parts << [bl_part, color, part]\n end\n\n # Now go through all submodels to determine the parts belonging to the submodels\n temp_parts = handle_submodels(temp_parts)\n\n # Not yet functional\n # handle_lsynthed_parts(temp_parts)\n\n temp_parts.each do |info|\n if parts.key?(\"#{info[0]}_#{info[1]}\")\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] += 1\n else\n parts[\"#{info[0]}_#{info[1]}\"] = {}\n parts[\"#{info[0]}_#{info[1]}\"]['quantity'] = 1\n parts[\"#{info[0]}_#{info[1]}\"]['ldraw_part_num'] = info[2]\n end\n end\n\n parts\n end",
"def parsed; end",
"def parsed; end",
"def parse(data)\n new.parse(data)\n end",
"def prepare_json\n\t\tjson_header\n\t\tjson_assemble\n\t\t#order_by_line_id(@file)\n\t\t#json_sections\n\t\t#json_order_line_by_section\n\n\tend",
"def parse\n @table = []\n rows = @doc.split(/\\r?\\n/)\n rows.each do |row|\n row_array = row.split(\"|\")\n row_array.each(&:strip!)\n @table.push(row_array)\n end\n @table.delete_at(1) if @header # strip header separator\n @table\n end",
"def splitByComma data\n data.each { | person | \n element = person.split(\",\").map(&:strip)\n date = returnDateFormated(element[4], '%m/%d/%Y')\n reorderArray(element[0], element[1], element[2], date, element[3]) \n } \nend",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def process_data(attributes)\n meta_data_from_parent = Hash[*attributes.first]\n attributes.shift\n attributes.each do |element_array|\n column_name_and_obj_id = element_array.first.split(\",\")\n column_name = column_name_and_obj_id.first\n obj_id = column_name_and_obj_id.last.strip\n element_array.shift\n meta_data_hash = Hash[*element_array.first.flatten(1)]\n obj = identify_the_object(obj_id)\n insert_meta_data([meta_data_hash[\"LEFT\"].to_f, meta_data_hash[\"TOP\"].to_f, meta_data_hash[\"BOTTOM\"].to_f, meta_data_hash[\"RIGHT\"].to_f], meta_data_from_parent[\"Page\"], column_name, meta_data_hash[\"WORD\"], meta_data_from_parent[\"Valid\"], obj, meta_data_from_parent[\"Score\"])\n end\n end",
"def parse_imports(params)\n data = params[:rawdata]\n rows = data.split(/[\\n\\r]+/)\n rowsandcolumns = []\n\n\n rows.each do |row|\n columns = row.split(\"\\t\")\n rowsandcolumns.push columns\n end\n\n @data = rowsandcolumns\n end",
"def post_parse(record)\n numeric_fields.each do |field|\n if val = record[field] and val != :absent\n record[field] = record[field].split(\",\")\n end\n end\n end",
"def clean_data(options={})\n \n @final_data.each_index do |i|\n record = @final_data[i]\n if record[:name].nil? # remove no-name records\n @final_data.delete_at(i)\n next\n end\n if record[:address].nil? # remove no-address records, can't display!\n @last_log << \"WARNING: Address Missing for #{record[:name]}!\\n\"\n @final_data.delete_at(i)\n next\n end\n if record[:elder].nil?\n @last_log << \"WARNING: Elder Missing for #{record[:name]}!\\n\"\n end\n if !record[:extra].nil? # if extra data, then assume it is city/state/zip,\n # merge :address and existing :city_state_zip,\n # put :extra data into :city_state_zip\n \n # fix data\n @final_data[i][:address] = \"#{record[:address]}, #{record[:city_state_zip]}\"\n @final_data[i][:city_state_zip] = \"#{record[:extra]}\"\n @final_data[i][:extra] = nil\n \n end\n if record[:address] =~ /Apt/ and record[:address] !=~ /,/\n # insert comma for Apt to make it easier on google\n @final_data[i][:address] = \"#{record[:address].gsub(/ Apt/, \", Apt\")}\"\n# @last_log << \"NOTE: Funny address found for #{record[:name]}!\\n\"\n# @last_log << \" Address: #{record[:address]}!\\n\"\n end\n if !@elders.include?(record[:elder]) # if No elder found, then report\n @last_log << \"WARNING: No Elder found for #{record[:name]}!\\n\"\n if record[:address] !=~ /\\w*\\s\\w*/ and record[:extra].nil?\n # if this is the case, very likely this is the address\n # shift data by 1 record\n @final_data[i][:city_state_zip] = record[:address]\n @final_data[i][:address] = record[:elder]\n @final_data[i][:elder] = \"No Elder\"\n end\n end\n \n # finally filter for problematic addresses that don't seem to picked up by Google Maps Geocoding properly!\n if record[:address] =~ /FM 2222/\n @final_data[i][:address] = \"#{record[:address].gsub(/FM 2222/, \"RM 2222\")}\"\n end\n if record[:address] =~ /Mo Pac/\n @final_data[i][:address] = \"#{record[:address].gsub(/Mo Pac/, \"MoPac\")}\"\n end\n \n end\nend",
"def parse_raw_data(result)\r\n jobs = Array.new\r\n return jobs if result['results'].to_s.empty?\r\n result['results'].each do |offer|\r\n job = Hash.new\r\n job[:jobtitle] = offer['jobtitle'] if offer['jobtitle']\r\n job[:location] = \"#{offer['country']}, #{offer['city']}\"\r\n job[:company] = offer['company']\r\n job[:date] = convert_date_to_format(offer['date'],'%d/%m/%y')\r\n job[:url] = offer['url']\r\n job = convert_empty_to_nil(job)\r\n jobs << OpenStruct.new(job)\r\n end\r\n return jobs\r\n end",
"def process_data(data, header)\n i = 2\n if data.present?\n data.each do |row|\n obj = Transport.new(:academic_year_id => academic_year_id)\n header.each do |name|\n method_n = header_to_method(name)\n send(method_n, obj, row[name].try(:strip)) if row[name].present? or method_n == \"fare\"\n end\n val = obj.save\n log_error(i, obj.errors.full_messages) unless val\n i += 1\n end\n else\n import_failed(1, t(:no_data_present_in_csv))\n end\n end",
"def scrape\n\t\t(2..tot_rec).collect do |row|\n\t\t\taggregate_col_data(row)\n\t\tend\n\tend",
"def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :birth_year, :first_name, :last_name]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end",
"def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :year, :team_id, :game, :at_bats, :runs, :hits, :doubles, :triples, :home_runs, :runs_batted_in, :stolen_bases, :caught_stealing]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\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 sort_entries; end",
"def attribute_data_from_parsed_file\n\n @username = @parsed_data[:userdata][:username]\n @charity_coins = (@parsed_data[:userdata][:charity_coins]).to_i\n @budget = (@parsed_data[:userdata][:budget]).to_i\n\n #this create and push all the charity_causes into the good_causes_array\n @parsed_data[:charity_causes].each do |charity_causes_hash| \n @good_causes_array << CharityCause.new(\n charity_causes_hash[:id], \n charity_causes_hash[:area], \n charity_causes_hash[:country], \n charity_causes_hash[:category], \n charity_causes_hash[:description],\n charity_causes_hash[:charity_name], \n charity_causes_hash[:cost].to_i, \n charity_causes_hash[:completed],\n charity_causes_hash[:presentation])\n end\n\n end",
"def json_parse(url, header_type)\n\n raw_data = open(url)\n parsed = JSON.parse(raw_data.read)\n columns = parsed['meta']['view']['columns']\n if header_type == 1\n headers = columns.map{|column| column['name']}\n ########################\n # for potholes:\n elsif header_type == 2\n headers = [\"sid\",\"id\",\"position\",\"created_at\",\"created_meta\",\"updated_at\",\"updated_meta\",\"meta\",\"Creation Date\",\"Status\",\"Completion Date\",\"Service Request Number\",\"Type of Service Request\",\"CURRENT ACTIVITY\",\"MOST RECENT ACTION\",\"NUMBER OF POTHOLES FILLED ON BLOCK\",\"Street Address\",\"ZIP Code\",\"X COORDINATE\",\"Y COORDINATE\",\"Ward\",\"Police District\",\"Community Area\",\"SSA\",\"Latitude\",\"Longitude\", \"Location\"]\n end\n # binding.pry\n data = parsed['data']\n # sliced_hash_holder = []\n data.each do |row|\n data_hash = Hash[headers.zip(row)]\n slice_hash = data_hash.slice(\"Creation Date\", \"Status\", \"Completion Date\", \"Service Request Number\", \"Type of Service Request\",\n \"Street Address\", \"ZIP Code\", \"Latitude\", \"Longitude\", \"Location\")\n mappings = {\"Creation Date\" => :creation_date, \"Status\" => :status, \"Completion Date\" => :completion_date,\n \"Service Request Number\" => :service_request_number, \"Type of Service Request\" => :type_of_service_request,\n \"Street Address\" => :street_address, \"ZIP Code\" => :zip_code, \"Latitude\" => :latitude, \"Longitude\" => :longitude, \"Location\" => :location}\n # p slice_hash\n Request.create(Hash[slice_hash.map {|k, v| [mappings[k], v] }])\n #Request.create(slice_hash)\n # sliced_hash_holder << slice_hash\n # binding.pry\n end\n # 100.times do |i|\n # Request.create(sliced_hash_holder[i])\n # end\nend",
"def parse_raw_data(result)\n jobs = Array.new\n return jobs if result[:jobs].to_s.empty?\n result[:jobs][:items].each do |offer|\n job = Hash.new\n job[:jobtitle] = offer[:title]\n job[:location] = \"#{offer[:location][:country]}, #{offer[:location][:city]}\"\n job[:company] = offer[:company][:name]\n job[:date] = convert_date_to_format(offer[:published_at], '%d/%m/%y')\n job[:url] = offer[:links][:xing]\n job = convert_empty_to_nil(job)\n jobs << OpenStruct.new(job)\n end\n return jobs\n end",
"def sort_record(response_refill_order)\n list =response_refill_order.pick(\"transferNo\" , \"createScan\" , \"shipDate\" , \"actualDate\" , \"recDate\" , \"status\" , \"poNo\" , \"custPN\" , \"ordQty\" , \"shipQty\" , \"controlNo\" , \"scancode\" , \"binCenter\" , \"binLoc\" , \"trackingNo\")\n response_list = {}\n response_list.compare_by_identity\n list[\"transferNo\"].each_with_index do |transferNo,index|\n response_list[transferNo] = {\n :createScan => list[\"createScan\"][index],\n :shipDate => list[\"shipDate\"][index],\n :actualDate => list[\"actualDate\"][index],\n :recDate => list[\"recDate\"][index],\n :status => list[\"status\"][index],\n :poNo => list[\"poNo\"][index],\n :custPN => list[\"custPN\"][index],\n :ordQty => list[\"ordQty\"][index],\n :shipQty => list[\"shipQty\"][index],\n :controlNo => list[\"controlNo\"][index],\n :scancode => list[\"scancode\"][index],\n :binCenter => list[\"binCenter\"][index],\n :binLoc => list[\"binLoc\"][index],\n :trackingNo => list[\"trackingNo\"][index]\n }\n end\n # COMMENTING FILTER FOR RECDATE AS PER ANTONIO'S FEEDBACK.\n response_list.delete_if {|_,v| v[:recDate] == \"Deleted\" || v[:recDate] == \"Bad fm Stk\" || v[:recDate] == \"Not Recvd\" || v[:recDate] == \"Cancelled\" || v[:recDate] == \"##\" }\n # response_list = Hash[response_list.sort.reverse]\n begin\n sorted_array = response_list.sort do |x,y|\n x <=> y || 0\n end.reverse\n response_hash = {}\n response_hash.compare_by_identity\n sorted_array.each_with_index { |value,key|\n response_hash[value[0]]= value[1]\n }\n rescue\n response_hash = {}\n end\n return response_hash\n end",
"def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end",
"def parse_from_summary(data)\n {} # nothing for college\n end",
"def parse(collector)\n @stream.each_line do |line|\n if match = FORMAT.match(line)\n\n key, value, timestamp = match[:data].split(\"|\")\n\n case match[:type]\n when \"counts\"\n collector.increment(key, value, timestamp)\n when \"gauges\"\n collector.gauge(key, value, timestamp)\n when \"sets\", \"timers\"\n collector.gauge_absolute(key, value, timestamp)\n end\n else\n @errors << \"Unable to process: #{line}\"\n end\n end\n end",
"def parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=CSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_master_id(\n\t\t\t\t\tline['master_id'],\n\t\t\t\t\t:master_tracker_date => self.master_tracker_date )\n\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes!(\n\t\t\t\t\tline.to_hash.delete_keys!(\n\t\t\t\t\t\t'master_id').merge(\n\t\t\t\t\t\t:master_tracker_date => self.master_tracker_date) )\n\n\t\t\t\tresults.push(icf_master_tracker)\n\t\t\tend\t#\t(f=CSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"def initialize(data, delim1 = DELIM_SECTION, delim2 = DELIM_RECORD, delim3 = DELIM_FIELD)\n @fields = self.class.parseData(data, delim1, delim2, delim3)\n end",
"def parse \n raise \"This has not been implemented yet. Due to the variability of report format, will need to implement a series of specialized parsers\"\n end",
"def parse_result(data)\n Parser.process(data)\n end",
"def splitBySpace data\n data.each { | person | \n element = person.split(\" \").map(&:strip)\n gender = gender = returnGenderValue(element[3])\n date = returnDateFormated(element[4], '%d-%m-%Y')\n reorderArray(element[0], element[1], gender, date, element[5])\n } \nend",
"def initialize(data)\n super\n pre_parse!\n end",
"def parse_sort_input(property); end",
"def initialize( data_source, record_delimiter = DefaultRecordSeparator )\r\n case data_source\r\n when Array\r\n @all_records = data_source\r\n when IO\r\n @all_records = data_source.read.split( record_delimiter )\r\n when String\r\n if File.exist?( data_source )\r\n File.open( data_source, :encoding => 'utf-8' ) do |f|\r\n @all_records = f.read.split( record_delimiter )\r\n end\r\n else\r\n @all_records = data_source.split( record_delimiter )\r\n end\r\n else\r\n raise( \"ListRandomizer requires a kind of IO, Array, or String argument.\" )\r\n end\r\n @unused_records = @all_records.dup\r\n super( @all_records )\r\n end",
"def process_record(record_values,row_index,nuix_case)\n\t\t# Determine matcher for this row\n\t\titems = nil\n\t\tmatchers.each do |matcher|\n\t\t\tcolumn_value = record_values[matcher.col_index] || \"\"\n\t\t\tif !column_value.strip.empty?\n\t\t\t\titems = matcher.obtain_items(column_value,nuix_case)\n\t\t\t\tif items.size > 0\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# If we obtained items, run each annotater\n\t\tif items.nil?\n\t\t\tAnnotationCSVParser.log \"Row #{row_index+1}: No matcher columns had a value or yielded any items\"\n\t\telse\n\t\t\t# Some matcher was able to give us some items\n\t\t\tif @remove_excluded_items\n\t\t\t\titems = items.reject{|i| i.isExcluded}\n\t\t\tend\n\n\t\t\tif items.size < 1\n\t\t\t\tAnnotationCSVParser.log \"After removing excluded items, 0 items remain, moving on...\"\n\t\t\telse\n\t\t\t\tannotaters.each do |annotater|\n\t\t\t\t\tcolumn_value = record_values[annotater.col_index] || \"\"\n\t\t\t\t\tannotater.perform_annotation(items,column_value,nuix_case)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def initialize data\n self.data = data\n parse_data\n end",
"def parse_data_for_info(clean_inventory)\n\t\tmost_expensive = Hash.new\n\t\tlong_cds = @helpers.make_hoa\n\t\tbook_cd_authors = @helpers.make_hoh\n\n\t\tcounter,found_data,regx_search,search_info,names_with_years = setup_search_for_value(clean_inventory.keys)\n\n\n\t\tclean_inventory.each do |type,inventory|\n\t\t\tmost_expensive = get_most_expensive(type,inventory,most_expensive)\n\t\t\tlong_cds = get_long_cds(type,inventory,long_cds) if type == \"cd\"\n\t\t\tbook_cd_authors = get_book_cd_authors(type,inventory,book_cd_authors) unless type == \"dvd\"\n\t\t\tnames_with_years = search_for_value(counter,inventory,found_data,regx_search,search_info,type,type)\n\t\tend\n\t\tdup_book_cd_authors = get_dup_auths(book_cd_authors)\n\n\t\treturn most_expensive,long_cds,dup_book_cd_authors,names_with_years\n\tend",
"def parse_records(response, elements, paged_results, base_module, standalone_model = false)\n elements.each do | element |\n new_record = model_class.build_from_node(element, self, base_module, standalone_model)\n if element.attribute('status').try(:value) == 'ERROR'\n new_record.errors = []\n element.xpath('.//ValidationError').each do |err|\n new_record.errors << err.text.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end\n end\n if standalone_model\n if response.response_items.count == 0\n response.response_items << new_record\n else\n # http://developer.xero.com/documentation/payroll-api/settings/\n # tracking categories have subcategories of timesheet categoires and employee groups\n # which we group together here as it's much easier to model\n fields_to_fill = model_class.fields.find_all do |f|\n new_record_field = new_record[f[0]]\n if new_record_field.respond_to?(:count)\n new_record_field.count > 0\n else\n !new_record_field.nil?\n end\n end\n fields_to_fill.each {|field| response.response_items.first[field[0]] = new_record[field[0]]}\n end\n else\n response.response_items << new_record\n end\n new_record.paged_record_downloaded = paged_results\n end\n response.response_items\n end",
"def parse\n\n puts \"==> invoked: #parse\"\n\n {\n # raw_feed: @feed_hash,\n information: @information,\n amenities: @amenities,\n floorplan: @floorplan,\n file: @file,\n }\n end",
"def initialize(arr)\n # tokenize headers \n @headers = arr[0].map { |h| h.strip.downcase.sub(' ', '_').to_sym }\n\n # turn all rows into processing friendly format\n @data = arr[1..arr.count].map do |d|\n Hash[@headers.collect.with_index { |header, idx| [header, d[idx]] }]\n end\n end",
"def prepare_test_data(data)\n case data[:type][1]\n when 'file' then\n data[:file_type] = data[:file_type][1]\n data[:allowed_dirs] = data[:allowed_dirs][1]\n\n when 'relationship' then\n data[:channels] = data[:channels][0]\n data[:categories] = [] #data[:categories][1] #@todo swtich to names?\n data[:authors] = [] #data[:authors][1] #@todo swtich to names?\n data[:statuses] = [] #data[:statuses][1]\n data[:order_field] = data[:order_field][1]\n data[:order_dir] = data[:order_dir][1]\n\n when 'text' then\n data[:field_fmt] = data[:field_fmt][1]\n data[:field_content_type] = data[:field_content_type][1]\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'textarea' then\n data[:field_fmt] = data[:field_fmt][1]\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'rte' then\n data[:field_text_direction] = data[:field_text_direction][1]\n\n when 'checkboxes', 'multi_select', 'radio', 'select' then\n data[:field_fmt] = data[:field_fmt][1]\n end\n\n return data\n end",
"def convert\n STDERR.print \"\\nThis may take 10 minutes or more. Lines processed: \"\n line_in_count = 0\n\n # Create an object to store *all* lines of the *output* CSV\n @csv_out_data = FasterCSV.generate(FCSV_OUT_OPTS){|csv_out| \n\n # Iterate thru each *input* line\n FasterCSV.foreach(@in_file, FCSV_IN_OPTS) {|line_in|\n line_in_count += 1\n if line_in_count == 1\n self.class.verify_csv_in_headers(line_in.headers)\n @csv_out_headers = WILL_INCLUDE_INPUT_COLUMNS ? CSV_OUT_COLUMNS + CSV_IN_COLUMNS : CSV_OUT_COLUMNS\n end\n\n # Iterate thru each *output* column\n line_out = []\n @csv_out_headers.each_with_index{|col,i|\n csv_out << @csv_out_headers if line_in_count == 1 && i == 0\t# Header line\n\n case col\n when RmidItem, PrefixColOwner, PrefixColList\n line_out << line_in[col]\n when HdlItem\n line_out << get_handle_for_rmid(line_in[RmidItem])\n when HdlColOwner\n line_out << get_handle_for_collection_prefix(line_in[PrefixColOwner])\n when HdlColList\n if line_in[PrefixColList]\n prefixes = line_in[PrefixColList].split(VALUE_DELIMITER)\n handles = prefixes.inject([]){|a,prefix| a << get_handle_for_collection_prefix(prefix)}\n line_out << handles.join(VALUE_DELIMITER)\n else\n line_out << \"\"\n end\n end\n }\n csv_out << line_out\n STDERR.print \"#{line_in_count} \" if line_in_count % 200 == 0\n }\n }\n STDERR.puts \"; Total lines #{line_in_count} \"\n end",
"def parse_file status, source_file_obj\n existing_structure = self.loop_item_type.present?\n\n # keep track of the errors\n status[:errors] = []\n\n # keep track of the line and column being analised, for error reporting.\n status[:line] = 0\n status[:column] = 0\n\n # save the headers and the items\n status[:headers] = []\n status[:items] = []\n\n # auxiliar hash, to avoid repetition\n created_items = {}\n\n # read the file into a table\n begin\n if File.open(source_file_obj.source.path, &:readline).match(/;/) == nil\n separator = ','\n else\n separator = ';'\n end\n\n table = CSV.read(source_file_obj.source.path, {\n :quote_char =>'\"',\n :col_sep =>separator,\n :row_sep =>:auto,\n :headers => :first_row\n })\n rescue => e\n status[:errors] << e.message\n return false\n end\n #get the headers\n status[:headers] = table.headers\n item_types = {}\n\n if !self.parse_source_headers(status, item_types, existing_structure)\n return false\n end\n\n default_language = self.questionnaire\n .questionnaire_fields\n .find_by_is_default_language(true)\n .language\n\n table.each do |row|\n status[:line] += 1\n\n # Start with parent as nil (because the first element of each line is the root of the nested set, and looping structure)\n # there is also an hierarchy between items.\n parent = nil\n\n # and then for each item of the row\n row_as_a = row.to_a\n\n row_as_a.each_index do |i| # row_as_a[i][0] => item_type ; row_as_a[i][1] => loop_item_names\n created_items[i.to_s] ||= {}\n\n if row_as_a[i][1].present? # if there's no name, there's no item\n the_val = row_as_a[i][1].squeeze(\" \").strip\n the_type = row_as_a[i][0].squeeze(\" \").strip\n the_type.slice!(0) if the_type[0] == '#'\n status[:column] += 1\n\n if existing_structure && (existing_item=(item_types[the_type].existing_item_with(the_val, parent, default_language)))\n parent = existing_item\n next\n end\n\n # loop_item_names in downcase for comparison purposes. So that the file doesn't need to be case sensitive.\n item_details = {:name => the_val.downcase, :parent => parent.nil? ? \"parent_empty\" : parent.id}\n item_hash = Digest::MD5.hexdigest(item_details.to_s)\n\n # check if item was previously added\n if created_items[i.to_s][item_hash]\n #set this item as the parent\n parent = LoopItem.find(created_items[i.to_s][item_hash])\n else # otherwise create a new item\n son = LoopItem.new()#:item_name => row_as_a[i][1].to_s)\n son.loop_item_type_id = item_types[the_type].id\n # set it's parent, if parent is defined, otherwise it will be a root item.\n if parent\n son.parent = parent\n end\n\n # handle loopItemNames. Find or create it and then add it to the loop_item and loop_item_type and loop_source\n begin\n l_item_name = item_types[the_type].loop_item_name_with(the_val, default_language, self)\n rescue ActiveRecord::RecordInvalid => e\n status[:errors] << \"ERROR: line #{status[:line]} and column #{status[:column]}. Check the character encoding of your file.\"\n next\n end\n son.loop_item_name = l_item_name\n\n # set sort_index => total loop_items before adding the new item to it, so that it is the index of the total of items[0 to total]\n # son.sort_index = item_types[the_type].loop_items.count #set the sort_index to be one more than the parent's. The default is zero, so the parent starts at zero.\n son.sort_index = item_types[the_type].loop_items.empty? ? 0 : item_types[the_type].loop_items.maximum(\"sort_index\") + 1\n\n # save the son\n if son.save\n #add the item to the hash of created items\n created_items[i.to_s][item_hash] = son.id\n status[:items] << son\n\n #redefine the parent for next iteration\n parent = son\n else\n status[:errors] << \"Problem in line \" + status[:line] + \", and column \" + status[:column]\n return false\n end\n end\n end\n end\n\n status[:column] = 0\n end\n end",
"def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend",
"def parse\n @parsed\n end",
"def dissect_to_record_hashes\n end",
"def parse_results(results)\n results.rows.collect do |row|\n record = {}\n row.each_with_index{|val, i| \n val = val.force_encoding('utf-8') if val\n record[results.fields[i].name] = val\n }\n \n record\n end\n end",
"def parse &block\n @parser ||= case @source_data.vendor_name\n when VENDOR_CAPTERRA\n SdParser::CapterraParser.new(@source_data.data,\n @source_data.data_type)\n when VENDOR_SOFTADV\n SdParser::SoftwareadviceParser.new(@source_data.data,\n @source_data.data_type)\n end\n \n @parsed_data = @parser.parse &block\n \n @parsed_data\n end",
"def parse_csv\n i=0\n output_matrix = []\n trim_return_carriage(fulltext).each_line do |line|\n 5.times { |i| avoid_commas_in_special_strings(line) }\n output_matrix << trim_line_ends(line).split(delimiter) unless i == 0\n i+=1\n end\n output_matrix.each do |rec|\n temp_hsh = {}\n (0..rec.size-1).each do |i|\n temp_hsh.merge! object_attributes[i] => rec[i]\n end\n @output_table_object << temp_hsh\n end\n\n output_table_object\n end",
"def parse(data)\n\n # convert to utf-8\n data_utf8 = data.encode('UTF-8', :invalid => :replace, :replace => \"\")\n\n # split into nice rows\n rows = data_utf8.split(/\\r\\n?|\\n/)\n\n # to store units info\n units = {}\n\n # read values, store each doc in array\n docs = []\n\n rows.each do |row|\n doc = {}\n row.split(/\\s+|\\\\t+/).each_with_index do |value, index|\n if index < @@header.length\n name = @@header[index]\n if !value.nil? and !value.empty?\n # try to see if this can be a float\n begin\n value = Float(value.gsub(',', '.'))\n rescue ArgumentError\n end\n\n doc[name] = value\n end\n end\n end\n\n # point to our schema\n doc[\"schema\"] = \"http://api.npolar.no/schema/radiation-zeppelin-1.0-rc1\"\n\n docs << doc\n end\n\n docs\n end",
"def process\n lines = clean_lines\n\n # Peek ahead to get the headers\n unless @file_content.blank?\n CSV.parse(@file_content, {:headers => true, :skip_blanks => true}) do |row|\n @rows_exist = true\n @headers = row.headers\n break\n end\n end\n\n @rows_exist = @rows_exist and !@headers.blank?\n end",
"def organizeData data_filename\n if validFile? data_filename\n else\n Logger.instance.logError(\"The file \" + data_filename + \" is invalid.\")\n raise ArgumentError, \"The file is invalid. Make sure the file exists and is readable\"\n end\n\n data_file = File.open(data_filename)\n\n data_hash = Hash.new\n data_arr = []\n $result_hash = Hash.new\n\n data_file.each do |segment|\n value = segment.split(\"\\t\") # tab is our delimeter\n if value.size != 3\n Logger.instance.logError(\"The segment \" + segment + \" is not in the format [lat] [long] [streetname] delimited by tabs.\")\n else\n if float?(value[0]) and float?(value[1])\n data_hash[Coordinate.new(value[0],value[1])] = value[2].chomp\n else\n Logger.instance.logError(\"Either \" + value[0] + \" or \" + value[1] + \" is not a float.\")\n end\n end\n end\n\n data_file.close\n\n sorted_data = data_hash.sort{|a,b| a[0] <=> b[0]}\n \n cur_coo = Coordinate.new\n sorted_data << [cur_coo,\"END\"] # a special marker at the end so we know we have looked at all the elements\n \n sorted_data.each do |coo|\n if coo[0] != cur_coo\n if data_arr.size > 1\n combo = data_arr.combination(2).to_a # get all possible pairs\n combo.each do |s1,s2|\n if s1 < s2\n key = s1.capitalize + \"_\" + s2.capitalize # capitalize for case-insensitive search\n Logger.instance.log(\"Added key \" + key)\n elsif s2 < s1\n key = s2.capitalize + \"_\" + s1.capitalize\n Logger.instance.log(\"Added key \" + key)\n else\n next\n end\n if $result_hash.has_key? key\n a = $result_hash[key]\n $result_hash[key] << cur_coo if !a.index cur_coo\n else\n $result_hash[key] = [cur_coo]\n end\n end\n end\n data_arr.clear\n data_arr << coo[1]\n cur_coo = coo[0]\n else\n data_arr << coo[1]\n end\n end\nend",
"def preprocess_text data\n parse_formatted_text data\n end",
"def parse_data\n [object_ref, get_symbol, parse]\n end",
"def parse(report_file, options_trailer = nil)\n file = File.open(report_file,'r')\n build_records_from_file file.readlines\n file.close\n end",
"def process_data\n\t\tarr = data.split(\"\\n\")\n\t\t@processed_data = []\n\t\tarr.each_with_index do |string,a|\n\t\t\ttime_index = string.index( /[0-9]min|lightning/ )\n\t\t\tif time_index != nil \n\t\t\t\ttime_arr = []\n\t\t\t\t(0..2).each do |n|\n\t\t\t\t\ttime = string[time_index-n]\n\t\t\t\t\ttime_arr << time if ( time != \" \" && time.index(/[a-z]/)==nil )\n\t\t\t\tend\n\t\t\t\ttime = time_arr.reverse.join(\"\").strip.to_i\n\t\t\t\ttitle = string.gsub(/#{time}min|#{time}lightning/,\"\").strip\n\t\t\t\tif string.index( /lightning/ )==nil\n\t\t\t\t time \n\t\t\t\telse\n\t\t\t\t time = (time == 0? 5 : (time*5))\n\t\t\t\tend\n\t\t\t\tsession = Session.new(a,title,time)\n\t\t\t\t@processed_data << session\n\t\t\tend\n\t\tend\n\tend",
"def reviewDesktopListViewJobs\n @importdatum = Importdatum.find(params[:id])\n\n importData = @importdatum.data\n importData = importData.gsub(\"\\'\", \"\")\n importData = importData.gsub(\"\\\"\", \"\")\n\n #Take out the first column that holds MaxScheduler desktop id data, which is useless. \n require 'csv' \n csv = CSV.parse(importData, {:headers => false, :col_sep => \",\" } )\n @cleanedImportData = ''\n\n #Play with trying to reorder the data according to attribute config in MaxScheduler\n headingRowAry = csv[0]\n numOfAttributes = headingRowAry.length - 1 - 4 #don't count id and 4 trailing columns of schedule data\n @attributes = Attribute.where(\"maxscheduler_id = ?\", @maxschedulerId)\n\n #Loop through the attributes to figure out the data mapping\n @columnMapAry = Array.new\n @attrIndex = 0\n @attributes.each do |attr|\n @attrName = attr.name\n @columnMapAry[@attrIndex] = headingRowAry.index(@attrName)\n @attrIndex = @attrIndex + 1 \n end\n #scheduleDataArray = [ (@attrIndex + 1), (@attrIndex + 2), (@attrIndex + 3), (@attrIndex + 4)]\n #@columnMapAry = @columnMapAry.concat(scheduleDataArray)\n\n\n # @columnMapAry = [5,1,2,3,4]\n\n csv.each do | rowAry | \n rowAry.shift #gets rid of first element of an array in this case the id we don't want. \n #Now apply the columnMapAry to re-arrange the data to fall under the right columns\n @columnMapAry.each do | colMapIndex |\n colMapIndex = colMapIndex.to_i - 1\n entry = rowAry[colMapIndex]\n @cleanedImportData = @cleanedImportData + entry.to_s + \",\"\n end\n @cleanedImportData = @cleanedImportData + \"\\r\\n\"\n end\n\n #binding.pry\n\n #Save change to database\n @importdatum.data = @cleanedImportData\n @importdatum.save\n\n end",
"def process_and_import(data_file)\n items = JSON.load(File.open(data_file))[\"result\"]\n\n items.each do |item|\n date = item[\"/film/film/initial_release_date\"]\n\n next unless date\n\n case date.length\n when 4\n date = date + \"-01-01\"\n when 7\n date = date + \"-01\"\n end\n\n date = Date.parse(date)\n\n # Query current database so that we backfill/update information if the\n # film already exists\n film = Film.where(\n freebase_id: item[\"/type/object/mid\"]\n ).first\n film = Film.where(\n title: item[\"/type/object/name\"],\n year: date.year\n ).first unless film\n\n film = Film.new unless film\n film.title = valid_item?(item[\"/type/object/name\"]) unless film.title\n film.release_date = valid_item?(date) unless film.release_date\n film.year = date.year unless film.year\n film.freebase_id = item[\"/type/object/mid\"] unless film.freebase_id\n film.freebase_guid = item[\"/type/object/guid\"] unless film.freebase_guid\n film.save\n end\n end",
"def parse_table\n @parse_table ||= parse_table_for_rule(start)\n end",
"def parse\n output = File.open out_file, 'w'\n File.open(inp_file).each do |line|\n # CSV parse returns an array of rows - we need only the first\n parsed_line = CSV.parse(line.chomp, col_sep: \"\\t\", liberal_parsing: true).first\n value_map = csv_row_to_map(parsed_line)\n puts value_map[:details]['name'] if verbose\n output.puts value_map.to_json\n end\n output.close\n end",
"def parse\n raise NotImplementedError\n end",
"def load\n super\n slice_records!\n\n self\n end",
"def process!\n if valid?\n # get the csv rows as an array of hashes\n setup_data\n raw_csv_data = compute_csv_data\n # remove duplicate rows in the csv file (by email or name)\n prefilterted_csv_data = prefilter_csv_data raw_csv_data\n # remove the rows that match emails in the database\n new_data = filter_data_through_db prefilterted_csv_data\n\n # crate a new users\n resolved_data = create_new_user_records new_data\n end\n @rejected_user_data\n end",
"def line_parse(validated_line)\n return unless validated_line\n row = validated_line.split(',')\n return unless row.any?\n if @headers.empty?\n @headers = row\n else\n @data_hash.merge!(row_to_hsh(row))\n @valid_rows << @data_hash\n end\n end",
"def get_all_authors(record)\n translator_code = \"trl\"; editor_code = \"edt\"; compiler_code = \"com\"\n primary_authors = []; translators = []; editors = []; compilers = []\n corporate_authors = []; meeting_authors = []; secondary_authors = []\n record.find_all{|f| f.tag === \"100\" }.each do |field|\n primary_authors << field[\"a\"] if field[\"a\"]\n end\n record.find_all{|f| f.tag === '110' || f.tag === '710'}.each do |field|\n corporate_authors << (field['a'] ? field['a'] : '') +\n (field['b'] ? ' ' + field['b'] : '')\n end\n record.find_all{|f| f.tag === '111' || f.tag === '711' }.each do |field|\n meeting_authors << (field['a'] ? field['a'] : '') +\n (field['q'] ? ' ' + field['q'] : '')\n end\n record.find_all{|f| f.tag === \"700\" }.each do |field|\n if field[\"a\"]\n relators = []\n relators << clean_end_punctuation(field[\"e\"]) if field[\"e\"]\n relators << clean_end_punctuation(field[\"4\"]) if field[\"4\"]\n if relators.include?(translator_code)\n translators << field[\"a\"]\n elsif relators.include?(editor_code)\n editors << field[\"a\"]\n elsif relators.include?(compiler_code)\n compilers << field[\"a\"]\n else\n secondary_authors << field[\"a\"]\n end\n end\n end\n\n primary_authors.each_with_index do |a,i|\n primary_authors[i] = a.gsub(/[\\.,]$/,'')\n end\n secondary_authors.each_with_index do |a,i|\n secondary_authors[i] = a.gsub(/[\\.,]$/,'')\n end\n\n {:primary_authors => primary_authors, :corporate_authors => corporate_authors, :translators => translators, :editors => editors, :compilers => compilers,\n :secondary_authors => secondary_authors, :meeting_authors => meeting_authors }\n end"
] |
[
"0.65955055",
"0.6358661",
"0.6271887",
"0.61964655",
"0.6106517",
"0.5934386",
"0.59171027",
"0.5912882",
"0.5912526",
"0.59096944",
"0.58167225",
"0.5779041",
"0.5741791",
"0.573993",
"0.573993",
"0.573993",
"0.57283115",
"0.5694575",
"0.56515867",
"0.56171006",
"0.5614062",
"0.5606932",
"0.5602603",
"0.55950195",
"0.55890536",
"0.5570653",
"0.55680656",
"0.5566532",
"0.5555007",
"0.5543808",
"0.5543808",
"0.5540564",
"0.5525839",
"0.55211145",
"0.5499752",
"0.54970247",
"0.54801124",
"0.54696",
"0.54696",
"0.5438796",
"0.54212654",
"0.54186404",
"0.5401846",
"0.5399417",
"0.5390954",
"0.53798443",
"0.5371815",
"0.5365016",
"0.5358759",
"0.53483826",
"0.53358924",
"0.53311735",
"0.5329135",
"0.5328998",
"0.5325189",
"0.5312521",
"0.53111744",
"0.530606",
"0.5294884",
"0.5293037",
"0.52928305",
"0.52909297",
"0.5289834",
"0.528041",
"0.52738166",
"0.5269428",
"0.52647406",
"0.5262195",
"0.5260684",
"0.52598757",
"0.5249609",
"0.5246335",
"0.5244611",
"0.5233135",
"0.52318895",
"0.52313745",
"0.52109224",
"0.52049863",
"0.5204244",
"0.52026826",
"0.51958877",
"0.51940495",
"0.51937586",
"0.51905966",
"0.5187221",
"0.51839936",
"0.5177936",
"0.517635",
"0.5175202",
"0.5135273",
"0.5134443",
"0.51172084",
"0.511639",
"0.511467",
"0.51130116",
"0.5106389",
"0.5105993",
"0.5102842",
"0.50939214",
"0.5087222",
"0.50825906"
] |
0.0
|
-1
|
Do the sorting of the rows
|
def sort_rows(rows, sorts)
RecordSorter.new(rows).sort(sorts)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_data\n sort_cols = @columns.select{ |col| col.sort_order }.sort_by{ |col| col.sort_order }\n if sort_cols.length > 0\n log.fine \"Sorting by #{sort_cols.map(&:header).to_sentence}\"\n @data.sort! do |a, b|\n ord = nil\n sort_cols.each do |col|\n if col.sort_ascending\n a_val = a[col.column_index]\n b_val = b[col.column_index]\n else\n a_val = b[col.column_index]\n b_val = a[col.column_index]\n end\n ord = a_val <=> b_val || (a_val && 1) || (b_val && -1) || 0\n break unless ord == 0\n end\n ord\n end\n end\n end",
"def sort_rows!(order, *columns)\n correlation = (order == :ascending ? 1 : -1)\n @rows.sort! { |a,b|\n pivot = 0\n columns.each { |column|\n pivot = column\n break if a.cell(column).value != b.cell(column).value\n }\n (a.cell(pivot).value <=> b.cell(pivot).value) * correlation \n }\n end",
"def sort(column=@sort_by, asc = @sort_order)\n column_format = format[index(column)]\n x_sort_string = \"x.data[index('#{column}')]\"\n y_sort_string = \"y.data[index('#{column}')]\"\n \n if !(NUMBER_FORMATS + DATE_FORMATS).include? format[index(column)]\n x_sort_string = x_sort_string + \".to_s\"\n y_sort_string = y_sort_string + \".to_s\"\n end\n \n if NUMBER_FORMATS.include? format[index(column)]\n x_sort_string = x_sort_string + \".to_f\"\n y_sort_string = y_sort_string + \".to_f\" \n end\n\n # Sort the rows:\n # By returning -1 in case the comparison fails, we ensure that the sort never raises an error; however,\n # we may not get a proper sort, but it's better to have the app not fail\n @rows.sort! {|x, y| (instance_eval(x_sort_string) <=> instance_eval(y_sort_string)) || -1}\n \n @rows.reverse! unless asc\n end",
"def sort_entries; end",
"def sort_by!\n return to_enum unless block_given?\n @rownames = Hash[*@rownames.sort_by.with_index do |(rowname, i), rowid| [yield(Row.new(self, rowid, @rows[i])), rowid] end.flatten(1)]\n self\n end",
"def sort_rows(index = sort_index, order = sort_order)\n return if index == -1\n return unless rows\n rows.sort! do |a,b|\n if a[index].nil?\n cmp = -1\n elsif b[index].nil?\n cmp = 1\n elsif a[index] =~ /^[0-9]+$/ and b[index] =~ /^[0-9]+$/\n cmp = a[index].to_i <=> b[index].to_i\n elsif (cmp = ip_cmp(a[index], b[index])) != nil\n else\n cmp = a[index] <=> b[index] # assumes otherwise comparable.\n end\n cmp ||= 0\n order == :forward ? cmp : -cmp\n end\n end",
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = @columns[index].data_comparator.call(row1[index], row2[index])\n comparison_result *= -1 if !is_ascending\n break unless comparison_result == 0\n end\n\n comparison_result\n end\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def sort_data\n store.sort_data!\n end",
"def execute\n rows = File.readlines(infile)\n\n skipped_rows = []\n\n unless headerless\n skipped_rows[0] = \"\"\n skipped_rows[0] = rows.shift while skipped_rows[0].chomp.strip.empty?\n end\n\n if start\n (0...start.to_i).each { |row| skipped_rows << rows.shift } \n end\n\n rows.each_with_index do |line, index|\n filtered = col_type_filter.process(row_filter.process(line, row: index))\n next if filtered.nil?\n sorted_rows << (filtered << index)\n end\n\n File.open(outfile, 'w') do |out|\n skipped_rows.each { |row| out.puts unstring(row) }\n\n if desc\n sorted_rows.compact.sort.reverse.each do |row|\n out.puts unstring(rows[row.last])\n end\n else\n sorted_rows.compact.sort.each do |row|\n out.puts unstring(rows[row.last])\n end\n end\n end\n end",
"def order_by(*sort_heads)\n # Sort the rows in order and add to new_rows.\n key_hash = partition_sort_keys(sort_heads)\n new_rows = rows.sort do |r1, r2|\n # Set the sort keys based on direction\n key1 = []\n key2 = []\n key_hash.each_pair do |h, dir|\n if dir == :forward\n key1 << r1[h]\n key2 << r2[h]\n else\n key1 << r2[h]\n key2 << r1[h]\n end\n end\n # Make any booleans comparable with <=>\n key1 = key1.map_booleans\n key2 = key2.map_booleans\n\n # If there are any nils, <=> will return nil, and we have to use the\n # special comparison method, compare_with_nils, instead.\n result = (key1 <=> key2)\n result.nil? ? compare_with_nils(key1, key2) : result\n end\n\n # Add the new_rows to the table, but mark a group boundary at the points\n # where the sort key changes value. NB: I use self.class.new here\n # rather than Table.new because if this class is inherited, I want the\n # new_tab to be an instance of the subclass. With Table.new, this\n # method's result will be an instance of FatTable::Table rather than of\n # the subclass.\n new_tab = empty_dup\n last_key = nil\n new_rows.each_with_index do |nrow, k|\n new_tab << nrow\n key = nrow.fetch_values(*key_hash.keys)\n new_tab.mark_boundary(k - 1) if last_key && key != last_key\n last_key = key\n end\n new_tab.normalize_boundaries\n new_tab\n end",
"def sorted_processed_rows\n processed_rows.sort.to_h\n end",
"def sorted_rows(rows, done = [])\n return done if rows.empty?\n\n if done.empty?\n done = start_nodes(rows)\n rows -= done\n end\n\n done += next_rows(rows, done)\n rows -= done\n\n sorted_rows(rows, done)\nend",
"def sort_entries=(_arg0); end",
"def sort_norm_data\n store.sort_norm_data!\n end",
"def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end",
"def sort_order\n 0\n end",
"def sort_params; end",
"def sort_params; end",
"def parse(options={})\n rows = parse_rows(data)\n sort_rows(rows, options[:sort])\n end",
"def sort_by(tree, col, direction)\n tree.children(nil).map!{|row| [tree.get(row, col), row.id]} .\n sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) .\n each_with_index{|info, idx| tree.move(info[1], nil, idx)}\n\n tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)})\nend",
"def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def sort_column\n nil\n end",
"def sort!\n sort_if_needed\n self\n end",
"def sort_trophies_by_priority(trophies)\n #number of trophies per row\n per_row_small = 16\n per_row_medium = 4\n per_row_large = 1\n\n\n rows = []\n per_row = per_row_small + per_row_medium + per_row_large\n num_rows = (trophies.size / per_row.to_f).ceil\n (1..num_rows).each {rows << {:far_left => [],:left => [],:center => [],:right => [],:far_right => []}}\n i = 0\n trophies.each do |trophy|\n #fill center first\n if i < num_rows*per_row_large\n rows[i/per_row_large][:center] << trophy\n #fill left and right rows next\n elsif i < (num_rows*per_row_medium+num_rows*per_row_large)\n j = i - num_rows\n if j.even?\n rows[j/per_row_medium][:left] << trophy\n else\n rows[j/per_row_medium][:right] << trophy\n end\n #fill far left and far right rows next\n elsif i < (num_rows* per_row_small + num_rows*per_row_medium+num_rows)\n j = i - num_rows*per_row_medium - num_rows\n if j.even?\n rows[j/per_row_small][:far_left] << trophy\n else\n rows[j/per_row_small][:far_right] << trophy\n end\n end\n i = i + 1\n end\n rows\n end",
"def sort_fields(fields)\n fields.sort {|a,b| (COLUMN_SORTING_MAP[a] || a).to_s <=> (COLUMN_SORTING_MAP[b] || b).to_s }\n end",
"def sort_by_alg_header(algs); end",
"def sort_records(raw_records)\n records = raw_records.clone\n return records if records.size < 2\n (records.size - 2).downto(0) do |i|\n (0 .. i).each do |j|\n records[j], records[j + 1] = records[j + 1], records[j] if records[j].id.to_i < records[j + 1].id.to_i\n end\n end\n records\n end",
"def sortPlayers\r\n\t@table.current_players = @table.sort\r\n\t@table.players = @table.current_players.dup\r\nend",
"def sorted\n all.order(%[ #{quoted_table_name}.\"recorded_at\", #{quoted_table_name}.\"hid\" ])\n end",
"def ascending?(objects)\n column_values_array = []\n objects.each do |row|\n column_values_array << row.text.downcase\n end\n column_values_array == column_values_array.sort\n end",
"def sort!\n @tabs.sort! { |x,y| x.text <=> y.text }\n end",
"def sort_values cells\n cells.collect { |cell| cell.value }.uniq.sort.reverse\n end",
"def sort!\r\n @tabs.sort! { |x,y| x.name <=> y.name }\r\n end",
"def sort_order\n super\n end",
"def sort_params=(_arg0); end",
"def sort_params=(_arg0); end",
"def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n us1[@sortfield] <=> us2[@sortfield]\n elsif us1[@sortfield]\n 1\n elsif us2[@sortfield]\n -1\n else\n 0\n end\n comp * reverse\n }\n end",
"def sort_asc(column_name)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} ORDER BY #{column_name} ASC;\")\n results_as_objects(results)\n end",
"def selection_sort(tabla_hash)\n ordenados = tabla_hash.to_a \n for i in 0..TAMANO-2\n max = i\n for j in i+1..TAMANO-1\n if (ordenados[j])[1] > (ordenados[max])[1]\n max = j\n end\n if (ordenados[i])[1] < (ordenados[max])[1]\n aux = ordenados[i]\n ordenados[i] = ordenados[max]\n ordenados[max] = aux\n end\n end\n end\n return ordenados\n end",
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def tsort_each_node(&block)\n @table_names.each(&block)\n end",
"def sort_by!( &block )\n @data = skip_headers { |d| d.sort_by( &block ) }; self\n end",
"def bigSorting(unsorted)\n\nend",
"def sort_cols(cols)\n cols.sort {|a,b| COLUMN_SORTING_MAP[a].to_s <=> COLUMN_SORTING_MAP[b].to_s }\n end",
"def resort_by_description(cell_row_list, table_condition_descriptions, table_consequence_descriptions)\n ArrayHelper.resort_by_first_item_array(cell_row_list, \n table_condition_descriptions+table_consequence_descriptions)\n end",
"def sort!( &block )\n @data = skip_headers { |d| d.sort( &block ) }; self\n end",
"def order_by *columns\n @order += [columns].flatten\n end",
"def bubble_sort_rec(&prc)\n end",
"def sorting\n @records = Record.all #Get existing records\n @sortType = params[:sortType] #Get parameters from the form on index\n @sortField = params[:sortField]\n\n @limit = params[:sortNum].to_i # params must be converted from string\n\n if @sortType == \"Decending\" # check if sort direction is decending\n case @sortField #check what header to sort by\n when \"id\" # when table header is ID sort by ID descending\n @sortedSet = Record.order(id: :desc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :desc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :desc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :desc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :desc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :desc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :desc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :desc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :desc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :desc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :desc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :desc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :desc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :desc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :desc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :desc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :desc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :desc).limit(@limit)\n \n end # end case/when\n else # if not decending its ascending\n case @sortField # check header to sort by\n when \"id\" # when table header is ID sort by ID ascending\n @sortedSet = Record.order(id: :asc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :asc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :asc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :asc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :asc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :asc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :asc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :asc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :asc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :asc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :asc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :asc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :asc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :asc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :asc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :asc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :asc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :asc).limit(@limit) \n end\n end\n \n end",
"def sort_column(columns)\n columns[params[\"order\"][\"0\"][\"column\"].to_i]\n end",
"def arrange_datafields\n min_tag = 863\n last_index = nil\n final_results = []\n # Assumed that sort_combined is sorted\n # in tag order\n @sort_combined.each_with_index do |f,i|\n last_index = i if f.tag.to_i < min_tag\n end\n if last_index == @sort_combined.index(@sort_combined.last)\n final_results = @sort_combined + @field_pairs\n elsif last_index < @sort_combined.index(@sort_combined.last)\n #slice and dice\n temp_array = []\n @sort_combined.slice(0..last_index).each do |i|\n temp_array << i\n end\n @field_pairs.each { |f| temp_array << f }\n start = last_index + 1\n array_last_index = @sort_combined.index(@sort_combined.last)\n final_results = temp_array + @sort_combined.slice(start..array_last_index)\n else\n raise \"ERROR: Please check data\"\n end\n\n final_results\n\n end",
"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 sort_and_order_sql\n {:sort => ATTACH_MAPPING[@sort], :order => @order}\n end",
"def sort_column\n columns = %w[id]\n columns[params[:iSortCol_0].to_i]\n end",
"def arel_order\n text_columns = if params[:order]\n params[:order].split(' ')\n elsif self.default_sort\n [self.default_sort].flatten\n else\n [model_class.primary_key].flatten\n end\n sort_columns = text_columns.map do |column|\n if column.to_s.include?('.')\n name,direction = column.to_s.split('.',2)\n raise \"Illegal sort direction: #{direction} in #{column}\" unless %w{asc desc}.include?(direction)\n table[name].send(direction)\n else\n table[column]\n end\n end\n sort_columns\n end",
"def is_sorted\r\n false\r\n end",
"def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def sort\n@roster.each do |key,value|\n value.sort!\nend \nend",
"def sort\n return @sort\n end",
"def data_sorter\n @file_data.each do |row|\n @trips << Trip.new(row[1], row[2], row[3], row[4]).log_to_driver if row[0] == \"Trip\"\n @drivers << Driver.new(row[1]) if row[0] == \"Driver\"\n end\n end",
"def sort arr\r\n\trec_sort arr, []\r\nend",
"def sort_records(records)\n sort_order = order.map { |direction| [ direction.target, direction.operator == :asc ] }\n\n records.sort_by do |record|\n sort_order.map do |(property, ascending)|\n Sort.new(record_value(record, property), ascending)\n end\n end\n end",
"def sort(table_name, list, sort_by, order, per_page, default)\r\n\r\n if table_name.has_attribute?(sort_by) && (order == \"asc\" || order == \"desc\")\r\n list = list.sort_by{|item| item[sort_by].to_s.downcase}\r\n if order == \"desc\"\r\n list = list.reverse\r\n end\r\n list \r\n else\r\n # default case\r\n list.sort_by{|item| item[default].downcase}\r\n end\r\n\r\n end",
"def columns_in_order\n @columns.values.sort_by { |c| c.order }\n end",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def sort\n @pokers.sort.reverse\n end",
"def apply_sorting(query, sort_params)\n (sort_params[:sort] || {}).each do |idx, order|\n order = (order.to_i % 2 == 0) ? :asc : :desc\n filter = ajax_filters.find { |f| f.position == idx.to_i }\n\n next if filter.blank?\n\n klass = filter.klass || query.klass\n column = filter.column\n\n if filter.sorter_query.present?\n query = filter.sorter_query.call(query, order)\n else\n query = query.reorder(\"#{klass.table_name}.#{column} #{order} NULLS LAST\")\n end\n end\n\n query\n end",
"def index\n @pacients = Pacient.order(sort_column + \" \" + sort_direction) \n end",
"def sort!(&block)\n return txactions.sort!(&block)\n end",
"def order_results_rows\n\t\tocde_id = params[:ocde_id]\n\t\tocde = OutcomeDataEntry.find(ocde_id)\n\t\toutcome_id = params[:outcome_id]\n\t\t@outcome = Outcome.find(outcome_id)\n\t\t@selected_timepoints = params[:selected_timepoints]\n\t\tnew_pos = params[:new_position].to_i\n\t\tocde.update_display_number(new_pos)\n\t\t\n\t\tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n\t\t#-----------------------------------------\n\t \t# Data for the entry table\n\t \t#-----------------------------------------\n\t \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n \tef = ExtractionForm.find(@extraction_form_id)\n\t\t@project_id = ef.project_id \n\t\trender '/outcome_data_entries/show_entry_table'\n\tend",
"def sortable_sort\n @sortable_sort\n end",
"def sort(block)\n @content.sort(block)\n end",
"def prepared_columns(cols)\n RUBY_VERSION >= '1.9' ? cols.sort : cols.sort_by(&:to_s)\n end",
"def e5115_sublinear_sort(values)\n end",
"def sort_order\n sortable_column_order do |column, direction|\n if resource_handler.model_associations.present? && column.match(/\\./)\n table, column = column.split('.')\n if resource_handler.model_associations.detect { |a| a.table_name == table }\n \"#{table}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n elsif resource_handler.model.column_names.include?(column.to_s)\n \"#{resource_handler.model.table_name}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n end\n end",
"def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend",
"def index\n @people = Person.order(\"#{sort_column} #{sort_direction}\")\n end",
"def query_sort(query)\n return query unless has_sort_params?\n\n apply_sort(query, @table, @sorting[:order_by], @valid_fields + @custom_fields2.keys, @sorting[:direction])\n end",
"def sort(data)\n if should_invert_sort?\n dir = inverted_sort_direction\n else\n dir = sort_direction\n end\n\n sfs = sort_fields\n sort_string = if sfs\n sfs.map { |p| \"#{p} #{dir}\" } * ', '\n else\n ''\n end\n\n data.reorder sort_string\n end",
"def sorted_data &block\n @data.to_a.sort(&block)\n end",
"def sort_files!; end",
"def sort_column\n @houses = \n User.column_names.include?(params[:sort]) ? params[:sort] : \"name\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"email\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"phone\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"house_id\"\n User.column_names.include?(params[:sort]) ? params[:sort] : \"NOT(admin)\"\n end",
"def sort_column\n super \"Room\", \"sort_order\"\n end",
"def sort_column\n super \"Room\", \"sort_order\"\n end",
"def apply_sorting(chain)\n chain\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 sort arr \n\trec_sort arr, []\nend",
"def calls_sort_option\n column = case params[:iSortCol_0].to_s\n when '1'\n 'number'\n when '2'\n 'caller_id'\n when '3'\n 'providers.name'\n when '4'\n 'answered'\n when '5'\n 'busy'\n when '6'\n 'audio_length'\n when '7'\n 'ring_length'\n end\n column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column\n end",
"def sort a\r\n sort_rec a, []\r\nend",
"def sort a\r\n sort_rec a, []\r\nend",
"def sort(array_of_nodes, order); end",
"def sort_by!( &block )\n @sheets = @sheets.sort_by( &block )\n end",
"def table_header\n print '<table class=\"colors sortable\">', \"\\n\"\n print '<col width=\"15%\"><col width=\"20%\"><col width=\"15%\"><col width=\"50%\">'\n\n print '<tr>'\n print '<th class=\"sorttable_nosort\">Swatch</th>', \"\\n\"\n print '<th class=\"clickable\">Color name</th>', \"\\n\"\n print '<th id=\"hex\" class=\"hidden\">' # fake column for colors\n\n print '<th class=\"sorttable_nosort clickable\">', \"\\n\"\n print \"<span title='Sort by triplet' onclick='sortcol(\\\"hex\\\")'>Hex Triplet</span>\", \"\\n\"\n print \"<img id=\\\"arrow\\\" src='css/images/arrow-both.png'/>\", \"\\n\"\n %w[R G B].each do |letter|\n print \"<span title='Sort by #{letter} value' onclick='sortcol(\\\"#{letter}\\\")'>#{letter}</span>\", \"\\n\"\n end\n print '</th>', \"\\n\"\n\n print '<th class=\"sorttable_nosort\"><span class=\"latex\">L<sup>a</sup>T<sub>e</sub>X</span></th>', \"\\n\"\n print '<th id=\"R\" class=\"hidden\"></th>'\n print '<th id=\"G\" class=\"hidden\"></th>'\n print '<th id=\"B\" class=\"hidden\"></th>'\n print '</tr>'\nend",
"def sort\n\t\t#User.order(sort_column + \" \" + sort_direction).page(params[:page])\n\t\tUser.paginate(\t:page => params[:page], per_page: 10, \n\t\t\t\t\t \torder: (sort_column + \" \" + sort_direction))\n\tend",
"def apply\n jobs.sort_by.with_index { |job, ix| order(job, ix) }\n end",
"def change_sort(column_name)\n if sorter.any? && sorter.first.match?(column_name)\n sorter.toggle_order\n else\n sorter.push(column_name)\n end\n self.page = 1\n self\n end",
"def sort_display_data\n if @total_data.has_key?(\"\") or @total_data.has_key?(nil) and @total_data.length > 1\n @total_data = @total_data.sort do|a,b|\n a[0].to_s <=> b[0].to_s\n end\n deleted = @total_data.delete_at(0)\n @total_data.push(deleted)\n else\n @total_data = @total_data.sort\n end\n @total_data\n end"
] |
[
"0.7778085",
"0.72409344",
"0.71106696",
"0.70163196",
"0.6909443",
"0.68433183",
"0.6793622",
"0.668459",
"0.6682888",
"0.65663344",
"0.6506651",
"0.64522296",
"0.64175683",
"0.63811666",
"0.63563365",
"0.6298603",
"0.62733775",
"0.62725073",
"0.62725073",
"0.62631094",
"0.6231393",
"0.62257475",
"0.61345756",
"0.6119734",
"0.61090434",
"0.6108326",
"0.6094237",
"0.6071307",
"0.6068612",
"0.60589665",
"0.60529953",
"0.6052073",
"0.60416174",
"0.60393596",
"0.6029653",
"0.6024117",
"0.5999349",
"0.5999349",
"0.59985346",
"0.59980094",
"0.5996677",
"0.5995532",
"0.59924936",
"0.59838414",
"0.5966177",
"0.5956006",
"0.59532636",
"0.59502584",
"0.5942034",
"0.591549",
"0.5913463",
"0.5911264",
"0.5906451",
"0.5889485",
"0.5870498",
"0.5863401",
"0.58581865",
"0.58579993",
"0.5854953",
"0.5850201",
"0.58491343",
"0.5830652",
"0.58293957",
"0.58191544",
"0.5819101",
"0.58177763",
"0.5817702",
"0.58137286",
"0.5804861",
"0.57982975",
"0.5794005",
"0.57935464",
"0.5792277",
"0.579132",
"0.57823974",
"0.57815385",
"0.5778955",
"0.57753074",
"0.57624984",
"0.5759935",
"0.5759425",
"0.5752125",
"0.57504195",
"0.57486284",
"0.57396525",
"0.57155216",
"0.57155216",
"0.5713835",
"0.57118195",
"0.5711762",
"0.5710046",
"0.570958",
"0.570958",
"0.57041603",
"0.5702153",
"0.5697452",
"0.5696442",
"0.56806785",
"0.56683725",
"0.5667868"
] |
0.71003914
|
3
|
def id object.id.to_s end
|
def fanscnt
object.user_location_favs.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def id\n object.id.to_s\n end",
"def id\n object.id\n end",
"def id\n object.id\n end",
"def id\n object_id\n end",
"def id\n object.object_id\n end",
"def object_id() end",
"def id\n model.id.to_s\n end",
"def id\n object.to_param\n end",
"def id\n object.id.to_i\n end",
"def id\n __id\n end",
"def id\n self._id.to_s if self._id\n end",
"def id\n to_s\n end",
"def id\n record.id.to_s\n end",
"def id\n object[\"id\"]\n end",
"def id_to_s\n self._id.to_s\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def getId()\n @obj.getId()\n end",
"def objname\n id\n end",
"def object_id\n object.object_id\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def id; end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def get_id\n @id\n end",
"def id\n @obj['id']\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n return @id\n end",
"def id\n @id\n end",
"def get_id\n\t\treturn id\n\tend",
"def id() end",
"def id\r\n @id\r\n end",
"def id\n @id\n end",
"def get_id()\n return @id\n end",
"def _id\n @id\n end",
"def to_s\r\n id\r\n end",
"def to_s\n @id\n end",
"def __id; @id || @obj.id; end",
"def id\n @id\n end",
"def id\n @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def id\n return @id\n end",
"def inspect\n self.object_id\n end",
"def id\n self[:id]\n end",
"def identity\n :id\n end",
"def reference\n object.id.to_s\n end",
"def id\n name\n end",
"def id\n name\n end",
"def to_s\n id\n end",
"def id\n self[:id]\n end",
"def id\n self[:identifier]\n end",
"def name\n id.to_s\n end",
"def get_id()\n return @id\n end",
"def id\n name\n end",
"def getId\n return @id\n end",
"def getId()\n\t\t\treturn @_id\n\t\tend",
"def id\n @model.guid\n end",
"def getId\n @id\n end",
"def id\n\t\t@id\n\tend",
"def id()\n #This is a stub, used for indexing\n end",
"def to_s\n id.to_s\n end",
"def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end",
"def to_s\n id\n end",
"def rails_id\n self.object.id\n end",
"def id\n '1234567890'\n end",
"def id\n @record.Id\n end",
"def id\n @attributes[:ID]\n end",
"def getId\n\t\treturn @id\n\tend",
"def id\n self.Id\n end",
"def id\n read_attr :id\n end",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def getId\r\n\t\t\t\t\treturn @id\r\n\t\t\t\tend",
"def name\n id\n end"
] |
[
"0.9406557",
"0.90496683",
"0.90496683",
"0.89560145",
"0.8923576",
"0.8763401",
"0.8691035",
"0.86729944",
"0.8651802",
"0.8637324",
"0.8602584",
"0.85727",
"0.8534798",
"0.847595",
"0.84555256",
"0.8450818",
"0.8450818",
"0.8443215",
"0.8417423",
"0.83880836",
"0.8377963",
"0.8377963",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8376029",
"0.8348842",
"0.8348842",
"0.8348842",
"0.8348842",
"0.83250463",
"0.8317144",
"0.8317144",
"0.8317144",
"0.8317144",
"0.8278672",
"0.8262523",
"0.8256558",
"0.82515615",
"0.8248112",
"0.823441",
"0.82296455",
"0.81979936",
"0.8196738",
"0.8182682",
"0.817982",
"0.81575125",
"0.81575125",
"0.81529653",
"0.81529653",
"0.81529653",
"0.81529653",
"0.81529653",
"0.81529653",
"0.81529653",
"0.8151438",
"0.8139713",
"0.81326634",
"0.80728024",
"0.8061201",
"0.8061201",
"0.80572844",
"0.8046794",
"0.80447054",
"0.80267996",
"0.8026139",
"0.80091727",
"0.80025446",
"0.7989249",
"0.7983343",
"0.79711616",
"0.7964644",
"0.79622465",
"0.7949014",
"0.7938288",
"0.79298186",
"0.79256785",
"0.7920566",
"0.7896243",
"0.78879225",
"0.78868556",
"0.7881867",
"0.7868149",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78645515",
"0.78395563"
] |
0.0
|
-1
|
def get_games url = " response = HTTParty.get(url).parsed_response.to_xml render xml: response, root: 'objects', children: 'object' end
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_request\n doc_content = open(\"#{@baseurl}#{@path}#{@gamer}#{@gamepath}\", \"User-Agent\" => @user_agent)\n @doc = Nokogiri::HTML( doc_content )\n res = self.reformat_games( self.get_json )\n res\n end",
"def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link').inner_html,\n :description => (item/:description).inner_html,\n :gameid => pull_gameid((item/'link').inner_html)\n }\n end\n return games\n end",
"def get_bgg_game\n response = HTTParty.get('https://www.boardgamegeek.com/xmlapi2/thing?id='+ @gameid)\n end",
"def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end",
"def index\n @games = @theme.games.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @games.to_xml }\n end\n end",
"def get_xml(url, options = {})\n\t\t\t\n\t\t\t# better way of doing this?\n\t\t\t# Map custom keys to the HTTP request values\n\t\t\treqs = {\n\t\t\t\t:character_name => 'n',\n\t\t\t\t:realm => 'r',\n\t\t\t\t:search => 'searchQuery',\n\t\t\t\t:type => 'searchType',\n\t\t\t\t:guild_name => 'n',\n\t\t\t\t:item_id => 'i',\n\t\t\t\t:team_size => 'ts',\n\t\t\t\t:team_name => 't',\n\t\t\t\t:group => 'group'\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tparams = []\n\t\t\toptions.each do |key, value|\n\t\t\t\tparams << \"#{reqs[key]}=#{u(value)}\" if reqs[key]\n\t\t\tend\n\t\t\t\n\t\t\tquery = '?' + params.join('&') if params.size > 0\n\t\t\t\n\t\t\tbase = self.base_url(options[:locale], options)\n\t\t\tfull_query = base + url + query\n\t\t\t\n\t\t\tputs full_query if options[:debug]\n\t\t\t\n\t\t\tif options[:caching]\n\t\t\t\tresponse = get_cache(full_query, options)\n\t\t\telse\n\t\t\t\tresponse = http_request(full_query, options)\n\t\t\tend\n\t\t\t\t\t\t\n\t\t\tdoc = Hpricot.XML(response)\n\t\t\terrors = doc.search(\"*[@errCode]\")\n\t\t\tif errors.size > 0\nbegin\n\t\t\t\terrors.each do |error|\n\t\t\t\t\traise Wowr::Exceptions::raise_me(error[:errCode], options)\n\t\t\t\tend\nrescue\nend\n\t\t\telsif (doc%'page').nil?\n\t\t\t\traise Wowr::Exceptions::EmptyPage\n\t\t\telse\n\t\t\t\treturn (doc%'page')\n\t\t\tend\n\t\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def index\n game = Game.find(params[:game_id])\n @player_games = game.player_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @player_games }\n format.json { render :json => @player_games}\n end\n end",
"def index\n @games = @season.games #Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def show\n @games_player = GamesPlayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @games_player }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @game.to_xml }\n end\n end",
"def show\n #@game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def get_games_url\n \"#{@user_url}/games/?tab=all\"\n end",
"def get_games(year, input)\r\n page = 1\r\n query = 'https://www.balldontlie.io/api/v1/games' + '?seasons[]=' + year.to_s + '&team_ids[]=' + input.to_s + '&page=' + page.to_s\r\n response_meta = HTTParty.get(query)[\"meta\"]\r\n response_data = HTTParty.get(query)[\"data\"]\r\n total_pages = response_meta[\"total_pages\"]\r\n games_hash = {}\r\n\r\n while page <= total_pages\r\n\r\n #Go back and maximize the per_page limit to minimize the number of calls\r\n query = 'https://www.balldontlie.io/api/v1/games' + '?seasons[]=' + year.to_s + '&team_ids[]=' + input.to_s + '&page=' + page.to_s + '&per_page=50'\r\n HTTParty.get(query)[\"data\"].each do |i|\r\n\r\n\r\n #change formatting of date\r\n date = i[\"date\"].split(\"-\")\r\n day_value = date[2].split(/T/).shift\r\n key_date = \"#{date[0]}/#{date[1]}/#{day_value}\"\r\n formatted_date = \"#{date[1]}/#{day_value}/#{date[0]}\"\r\n\r\n \r\n\r\n games_hash[key_date] = {\r\n \"date\" => formatted_date,\r\n \"home_team\" => i[\"home_team\"][\"full_name\"],\r\n \"visitor_team\" => i[\"visitor_team\"][\"full_name\"],\r\n \"home_team_score\" => i[\"home_team_score\"],\r\n \"visitor_team_score\" => i[\"visitor_team_score\"]\r\n }\r\n \r\n\r\n end\r\n page += 1 \r\n end\r\n games_hash\r\n end",
"def scrape\n\t\n\t\t\n\t\tplayer = params[:player]\n\t\turl = params[:url]\n\t\tendDate = params[:EndDate]\n\t\tfiller = '&GameType=all&PlayedFor=0&PlayedVs=0&Park=0&PlayerID='\n\t\t\t\n\t\tid = Player.find_by_name(player).number.to_s\n\t\tfullUrl = url + '&EndDate=' + endDate + filler + id\n\t\t\n\t\tpage = Nokogiri::HTML(open(fullUrl))\n\t\t\n\t\ttotalsArray = getTotals(page)\n\t\t\n\t\trender :text => totalsArray.to_json()\n\tend",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def index\n @games = Game.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n format.text { render :text => @games.map { |g| \"#{g.gameid}\\n\" } }\n end\n end",
"def renderObject game\n response = game.as_json\n response['players'] = game.players\n\n respond_to do |format|\n format.json { render :json => { game: response } }\n end\n end",
"def get_team_games(team)\n # Set Up\n doc = getHTML(\"http://espn.go.com/mens-college-basketball/team/schedule/_/id/#{team.webExt}\")\n\n table = doc.xpath('//table[@class = \"tablehead\"]')\n rows = table.css('tr')\n\n # Loop through each row\n rows.each do |row|\n if(row.css('li').count > 3)\n linkHref = row.css('li[@class =\"score\"]')[0].css('a[href]')[0]\n if(linkHref != nil)\n link = linkHref[\"href\"].scan(/(.*=)(\\d+)/)\n gameID = link[0][1] \n if(Game.where(gameID: gameID).empty?)\n # get Date\n date = row.css(\"td\")[0].text\n # get opp\n opp = row.css('li[@class =\"team-name\"]').text\n # get HOME/away (vs/@)\n loc = row.css('li[@class =\"game-status\"]').text\n if(loc == \"@\")\n homeTeam = team.name\n awayTeam = opp\n else\n homeTeam = opp\n awayTeam = team.name\n end\n \n # Creates Game Entry\n game = Game.create(gameID: gameID, date: date, homeTeam: homeTeam, awayTeam: awayTeam)\n # Gets more game stats\n get_game_stats(game)\n end\n end\n end\n end\n end",
"def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end",
"def index\n @games = Game.order('date DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n @bingo_game = BingoGame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bingo_game, callback: params[:callback] }\n format.xml { render xml: @bingo_game }\n format.rss { render 'feed' }\n end\n end",
"def show\n @game_server = GameServer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_server }\n end\n end",
"def show\n @game = Game.find(params[:id])\n @players = @game.players\n @comments = @game.comments\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def index\n @leagueplayers = Leagueplayer.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leagueplayers }\n end\n end",
"def index\n @game_servers = GameServer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @game_servers }\n end\n end",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def game_list\n \n # Get the data and create a new instance of \n # Game for each item in the main list\n @doc.css('item').each do |item|\n name = item.css('name')[0]['value']\n rank = item['rank']\n id = item['id']\n year = item.css('yearpublished')[0]['value']\n\n # Create a new instance of Game with item data\n game = BggHotnessCLI::Game.new(name, id, year, rank)\n end\n\n end",
"def index\n puts params.inspect\n @api_players = Player.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @api_players }\n end\n end",
"def play\n data = self.get_api_response(\"https://opentdb.com/api.php?amount=3&category=11\")[\"results\"][0]\n return data\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n\t\t@game = Game.find(params[:game_id])\n\t\t@players = @game.players\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @players }\n\t\tend\n\tend",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end",
"def get_players_by_team(team_id)\n response = parse_api_request(\"#{BASE_URL}players/2018/#{team_id}\")[\"players\"]\nend",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n render json: @game\n end",
"def games\n self.results.map {|r|;r.game}\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @players = Player.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @players }\n end\n end",
"def show\n render json: @games_leaderboard\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def fetch(title, year = \"\", tomatoes = false, plot = \"short\")\n res = network.call({ t: title, y: year, tomatoes: tomatoes, plot: plot, apikey: @@config[:api_key] })\n\n if res[:data][\"Response\"] == \"False\"\n { status: 404 }\n else\n { status: res[:code], movie: parse_movie(res[:data]) }\n end\n end",
"def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def show\n @league = League.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league }\n end\n end",
"def populate_player (page)\n\n player = Player.new\n\n # find the table with game-by-game stats\n table = page.css('section.stats--table-container')[2]\n\n if !table.nil?\n table = table.css('tbody tr')\n end\n\n # for each row in table create Game and populate it with the stats of that game\n table.each do |xml|\n\n player.games.push(populate_game(xml)) if xml.children.length > 5\n\n end\n\n # Store the link to the player's stats page\n\n player.link = page.uri\n\n player\n\nend",
"def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end",
"def show\n @leagueplayer = Leagueplayer.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @leagueplayer }\n end\n end",
"def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def getPlayers(position,type)\n if type == \"postdraft\"\n begin\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=W;start=0;count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=W;start=0;count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @waivers.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n for i in 0..2 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=FA;start=#{i*25};count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=FA;start=#{i*25};count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"Yes\",@waivers)\n getFAInfo(\"No\",@freeagents)\n rescue\n @freeagents = []\n for i in 0..3 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"No\",@freeagents)\n end\n else\n @freeagents = []\n for i in 0..5 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=OR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=OR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"N/A\",@freeagents)\n end\nend",
"def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @id = @my_team.team_id\n @team_name = Teams.find(@id)\n roster = RestClient.get(\"https://statsapi.web.nhl.com/api/v1/teams/#{@id}/roster\")\n @roster = JSON.parse(roster)[\"roster\"]\n end",
"def show\n @game_races = GameRaces.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_races }\n end\n end",
"def index\n @plays = Play.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @plays.to_xml }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n if @game.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"Game not found.\" }\n end\n else\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game }\n format.json { render :json => @game }\n end\n end\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def show\n @game = Game.find(params[:id])\n @home_team = Team.find(@game.home_team_id)\n @away_team = Team.find(@game.away_team_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def games_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.games_get ...\"\n end\n # resource path\n local_var_path = \"/games\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].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 = []\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 => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#games_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @team = Team.find(params[:id])\n @cards = @team.cards :all, :limit => 10\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game }\n end\n end",
"def index\n @teams = Team.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end",
"def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def show\n @player = Player.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @player.to_xml(:include => :titles) }\n end\n end",
"def index\n listing_games\n end",
"def show\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gameplay }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n @game = Game.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def show\n id = params.keys[1] # Query variable is the ID of the TV show that the user clicks on.\n\n #template = Addressable::Template.new('https://api.themoviedb.org/3/tv/{?query*}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n #url = template.expand({\"query\" => id})\n #response = HTTParty.get(url)\n\n url = Addressable::URI.parse(\"https://api.themoviedb.org/3/tv/#{id}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US\")\n response = HTTParty.get(url)\n\n @show = JSON.parse(response.body, symbolize_names: true) \n end",
"def url_obj (url)\n url_1 = HTTParty.get(url)\n return Nokogiri::HTML(url_1)\nend",
"def do_request url\n Nokogiri::HTML(HTTParty.get(url))\nend",
"def index\n @games = Game.paginate page: params[:page], order: 'created_at desc', per_page: 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def get_stat(year, group)\n print \"Year: #{year} Squad: #{group} ...\"\n url = \"https://www.footballdb.com/stats/teamstat.html?lg=NFL&yr=#{year}&type=reg&cat=T&group=#{group.upcase}&conf=\"\n out_file = File.open(\"#{year}_#{group}.html\",'w')\n response = Faraday.get(url) # otta check for problems, but everything seems to work\n out_file.puts response.body\n out_file.close\n puts \" done.\"\nend",
"def index\n respond_to do |format|\n format.html do \n @last = Game.find(:all, :order => \"created_at DESC\", :limit => 10)\n @games = if (params[:start])\n Game.start(params[:start]).paginate(:page => params[:page],\n :per_page => 15, :include => [:tags,:editions])\n else\n Game.paginate(:page => params[:page], :per_page => 15, :order => 'games.name ASC', \n :include => [:tags,:editions])\n end\n @first_letters = Game.first_letters\n end\n format.json do\n opts = {}\n opts[:conditions] = {:base_game_id => \"\"} if params[:base_game]\n @games = Game.find(:all)\n render :json => @games.to_json(:only => [:id, :name])\n end\n end\n end",
"def list_active\n @games = Game.all.reject{|g| g.started_at.nil?}\n \n if @games.nil? \n respond_to do |format|\n format.all { render :status => :not_found, :text => \"No active games found.\" }\n end\n else\n respond_to do |format|\n format.html { render :action => \"index\", :html => @games }\n format.xml { render :action => \"index\", :xml => @games }\n format.json { render :index, :json => @games }\n end\n end\n end",
"def index\n limit = params[:limit] || 10\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"created_at DESC\"\n\n @bingo_games = BingoGame.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bingo_games, callback: params[:callback] }\n format.xml { render xml: @bingo_games }\n format.rss { render 'feed' }\n end\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def get_details(game) \n\n # HTML.parse is used here to clean up HTML codes like and line breaks\n game.description = Nokogiri::HTML.parse(@doc.css('description').text).text\n\n # These items are pretty easy to grab\n game.minplayers = @doc.css('minplayers')[0]['value']\n game.maxplayers = @doc.css('maxplayers')[0]['value']\n game.minplaytime = @doc.css('minplaytime')[0]['value'] \n game.maxplaytime = @doc.css('maxplaytime')[0]['value'] \n game.minage = @doc.css('minage')[0]['value'] \n\n # Pull the various types of item out of <link> into respective arrays\n game.category = @doc.css('link').select{|link| link['type']==\"boardgamecategory\"}.collect{|link| link['value']}\n game.mechanic = @doc.css('link').select{|link| link['type']==\"boardgamemechanic\"}.collect{|link| link['value']}\n game.publisher = @doc.css('link').select{|link| link['type']==\"boardgamepublisher\"}.collect{|link| link['value']}\n game.designer = @doc.css('link').select{|link| link['type']==\"boardgamedesigner\"}.collect{|link| link['value']}\n\n # The URL formula isn't via API. It's just boardgamegeek's URL scheme.\n game.url = \"https://boardgamegeek.com/boardgame/#{game.id}\"\n end",
"def json_games_arr\n puts(params[:players])\n\n player_strings = params[:players]\n\n stat = params[:stat]\n\n puts stat\n\n response = []\n\n player_strings.each do |player_string|\n player = Player.get(player_string)\n\n name = player.name\n puts name\n\n player_data = {}\n puts player\n season = player.get_season(params[:year])\n\n if season != nil\n season.games.each do |game|\n # puts game.date\n gameDate = game['date']\n\n if gameDate.month > 2\n puts stat\n puts game[stat]\n player_data[gameDate] = game[stat] || 0\n end\n end\n else\n response = [{'error' => \"Season does not exist for \" + player.name}]\n render :json => response\n return\n\n end\n\n response.push({'name' => name, 'data' => player_data})\n\n end\n\n puts response\n\n\n render :json => response\n end",
"def show\n @team_schedule = Schedule.all.where(laxid: params[:laxid]).last[:games]\n ap @team_schedule\n respond_to do |format|\n format.json{render json: @team_schedule}\n end\n end",
"def show\n @game = Game.instance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game }\n end\n end",
"def request(resource, method = \"get\", args = nil)\n \t \n \t @now_playing_url = 'http://62.216.251.203:80/nowplaying'\n \t @submission_url = 'http://62.216.251.205:80/protocol_1.2'\n \t @session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'\n \t \n \t if @base_url == Scrobbler::API_URL\n \t pieces = resource.split('/')\n pieces.shift\n \t api_version = pieces.shift\n if api_version == \"1.0\"\n folder = pieces.shift\n file = pieces.last[0, pieces.last.index('.xml')]\n base_pieces = pieces.last.split('?')\n\n file = if base_pieces.size > 1\n # if query string params are in resource they are underscore separated for filenames\n base_pieces.last.split('&').inject(\"#{file}_\") { |str, pair| str << pair.split('=').join('_') + '_'; str }.chop!\n else\n file\n end\n\n File.read(File.dirname(__FILE__) + \"/../fixtures/xml/#{folder}/#{file}.xml\")\n elsif api_version == \"2.0\"\n method_pieces = pieces.last.split('&')\n api_method = method_pieces.shift\n if api_method == '?method=artist.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/artist.xml\")\n elsif api_method == '?method=album.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/album.xml\")\n elsif api_method == '?method=track.search'\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/search/track.xml\")\n elsif pieces.last =~ /[?&]method=album\\.getinfo/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/album/info.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/toptags.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/search.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettopfans/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/fans.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=artist\\.getsimilar/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/artist/similar.xml\")\n elsif pieces.last =~ /[?&]method=album\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/album/search.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettopartists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/topartists.xml\")\n elsif pieces.last =~ /[?&]method=tag\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/tag/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=track\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/toptags.xml\")\n elsif pieces.last =~ /[?&]method=track\\.gettopfans/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/fans.xml\")\n elsif pieces.last =~ /[?&]method=track\\.search/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/track/search.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getlovedtracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/lovedtracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettopartists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/topartists.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettopalbums/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/topalbums.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettoptracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/toptracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getfriends/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/friends.xml\")\n elsif pieces.last =~ /[?&]method=user\\.gettoptags/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/toptags.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getneighbours/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/neighbours.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getrecenttracks/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/recenttracks.xml\")\n elsif pieces.last =~ /[?&]method=user\\.playlists/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/playlists.xml\")\n elsif pieces.last =~ /[?&]method=event\\.getinfo/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/event/event.xml\")\n elsif pieces.last =~ /[?&]method=event\\.getshouts/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/event/shouts.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklyalbumchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklyalbumchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklyartistchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklyartistchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getweeklytrackchart/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/weeklytrackchart.xml\")\n elsif pieces.last =~ /[?&]method=user\\.getevents/\n return File.read(File.dirname(__FILE__) + \"/../fixtures/xml/user/events.xml\")\n else\n old_request(resource, method, args)\n end\n end\n \t elsif @base_url == Scrobbler::AUTH_URL\n if args[:hs] == \"true\" && args[:p] == Scrobbler::AUTH_VER.to_s && args[:c] == 'rbs' &&\n args[:v] == '0.2.13' && args[:u] == 'chunky' && !args[:t].blank? &&\n args[:a] == Digest::MD5.hexdigest('7813258ef8c6b632dde8cc80f6bda62f' + args[:t])\n \n \"OK\\n#{@session_id}\\n#{@now_playing_url}\\n#{@submission_url}\"\n end\n elsif @base_url == @now_playing_url\n if args[:s] == @session_id && ![args[:a], args[:t], args[:b], args[:n]].any?(&:blank?)\n 'OK'\n end \n elsif @base_url == @submission_url\n if args[:s] == @session_id && \n ![args['a[0]'], args['t[0]'], args['i[0]'], args['o[0]'], args['l[0]'], args['b[0]']].any?(&:blank?)\n 'OK'\n end\n\t end\n\t end"
] |
[
"0.6888933",
"0.6799583",
"0.66903627",
"0.668715",
"0.66693574",
"0.6489586",
"0.64611036",
"0.64611036",
"0.63663805",
"0.6355447",
"0.6337306",
"0.629769",
"0.62881064",
"0.62098414",
"0.6203812",
"0.61982876",
"0.61982876",
"0.61908984",
"0.61767155",
"0.6171713",
"0.61555266",
"0.61408895",
"0.6140259",
"0.6129284",
"0.6119849",
"0.6082379",
"0.6049935",
"0.60091126",
"0.5976216",
"0.5973747",
"0.59630257",
"0.5961266",
"0.5940379",
"0.5927406",
"0.5924255",
"0.5922025",
"0.5891158",
"0.58890045",
"0.58831185",
"0.58728385",
"0.58475953",
"0.5830011",
"0.58283705",
"0.58283705",
"0.58283705",
"0.5827781",
"0.58231974",
"0.58225614",
"0.5810412",
"0.57926875",
"0.5791784",
"0.5786211",
"0.57829446",
"0.5781981",
"0.5781981",
"0.5781981",
"0.5781981",
"0.57770294",
"0.5770598",
"0.57629836",
"0.57428426",
"0.57337874",
"0.573169",
"0.5726757",
"0.57216746",
"0.5719615",
"0.57056385",
"0.5701306",
"0.5691956",
"0.5686943",
"0.56826025",
"0.5682208",
"0.5681459",
"0.5677202",
"0.5676502",
"0.56661505",
"0.56650037",
"0.56588906",
"0.5654923",
"0.56548625",
"0.56548625",
"0.56548625",
"0.56548625",
"0.56548625",
"0.56548625",
"0.56548625",
"0.56517375",
"0.5648109",
"0.5647857",
"0.564247",
"0.5640833",
"0.5640192",
"0.563742",
"0.56355464",
"0.562795",
"0.5625549",
"0.56073123",
"0.5606621",
"0.5605546",
"0.5598752",
"0.55922556"
] |
0.0
|
-1
|
Some posts have an unwatermarked version of the image. Usually it's lower resolution and lower JPEG quality than the watermarked image. Multiimage posts will have only one unwatermarked URL.
|
def unwatermarked_url
return nil if api_response["article_image_url"].nil?
Source::URL.parse(api_response["article_image_url"])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def full_image_uri\n return nil if image.nil?\n return image if image.start_with?('http://')\n return 'http://bookmarket.webhop.org/' + image\n end",
"def latest_image\n attachments.present? ? attachments.last.document.url(:medium) : \"#{APP_URL}/images/missing.png\"\n end",
"def render_small_post_image_for(post)\n if post.image?\n image_tag(post.image_thumb.url, class: 'media-object thumbnail')\n else\n image_tag('fallback/default_image.jpg', class: 'media-object thumbnail', height: '50px', width: '75px')\n end\n end",
"def image_url\n image.url(:medium)\n end",
"def thumbnail_image(size = :medium)\n if !remote_image.blank?\n return \"http://fffff.at/tempt1/photos/data/eyetags/thumb/#{self.attributes['remote_image'].gsub('gml','png')}\"\n # elsif Rails.env == 'development' && !File.exist?(self.image_path(size)) #don't do image 404s in development\n # return \"/images/defaults/tag_#{size.to_s}.jpg\"\n else\n return self.image(size)\n end\n end",
"def sanitize_image_url\n if self.image_url \n if self.image_url.first != \"h\"\n self.image_url = \"http://#{self.image_url}\"\n end\n end\n end",
"def large_image_url\n fb_connected? ? fb_image_url('large') : tw_image_url('reasonably_small')\n end",
"def url() processed_image.try(:url) || fallback_url end",
"def wp_attachment_is_image(post = nil)\n return false if post.nil?\n Rails.cache.fetch('Railspress::' + 'Post.' + 'wp_attachment_is_image' + '/' + (((post.is_a?(Integer) || post.is_a?(String))) ? post : post.id).to_s ) {\n wp_attachment_is('image', post)\n }\n end",
"def small_image_wrapper\n if self.small_image?\n return self.small_image_url\n else\n return \"\"\n end\n end",
"def imgify(tweet)\n return tweet\nend",
"def poster_image\n super.presence || cell.poster_image\n end",
"def image_1_is_from_google?\n !image_1_google_thumb.blank?\n end",
"def test_render_unknown_image\n tag = Jekyll::ThumbnailifyTag.new('t', 'foobaar.png', nil)\n assert_not_nil tag\n\n html = tag.render(@context)\n\n assert_not_nil html\n assert_equal \"File foobaar.png not found in images\", html\n assert_equal 0, @site.static_files.size\n end",
"def featured_image\n if object.featured_image.attached?\n {\n url: rails_blob_url(object.featured_image)\n }\n end\n end",
"def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end",
"def watermark_attachment\n @attributes[:watermark_attachment]\n end",
"def thumbnail_url\n image_url(\"200x200-fix\") || image_url(\"224x148-fix\") || strip_url\n end",
"def update_img\n @post = Post.find(self.id)\n image = @post.image.url(:gallery)\n image = '/public' + image.gsub(/\\?.*/, '')\n\n if !@post.meme_text.nil?\n if File.exists? Rails.root.to_s + image\n PostsHelper.image_writer(image, @post.meme_text, @post.meme_position)\n end\n end\n end",
"def big_image\n return image.gsub(/square/i, \"large\") if image =~ /facebook/ && image =~ /square/\n return image.gsub(/normal/i, \"original\") if image =~ /twitter/ && image =~ /normal/\n image\n end",
"def image_url(style = :slider)\n if self.image.present? && self.image.asset.exists?\n self.image.file.url(style)\n else\n Asset.new(:asset_type => Asset::TYPE[:highlight]).file.url(style)\n end\n end",
"def small_image_url\n \"#{image_url}?type=small\"\n end",
"def image_url\n image.url\n end",
"def image_url\n image.url.split('?').first if image\n end",
"def image_url\n image.url.split('?').first if image\n end",
"def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end",
"def get_large_image image_url\n url = URI.parse(image_url)\n if url.host == 'graph.facebook.com'\n return image_url + '?width=1200&height=900'\n else\n return image_url\n end\n end",
"def image_url\n image_uri\n end",
"def big_main_image\n\t\timage = self.images.first\n\t\timage.asset.url(:large)\n\tend",
"def get_image\n blog_contents = Nokogiri::HTML(self.content)\n\n if blog_contents.xpath(\"//img\").blank?\n self.post_image = nil\n else\n image_link = blog_contents.xpath(\"//img\")[0]['src']\n\n if image_link.include?(\"http://\")\n self.post_image = File.open(image_link)\n else\n image_link = Dir.pwd.concat(\"/public\" + image_link)\n self.post_image = File.open(image_link)\n end\n end\n\nend",
"def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end",
"def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end",
"def giant_url\n is_processed ?\n FileSystem.url(giant_path) : \n orig_image_url\n end",
"def large_image\n self.image.large\n end",
"def large_image_url\n \"#{image_url}?type=large\"\n end",
"def imgurl\n picref.imgurl if picref\n end",
"def medium_photo\n main_photo.url(:medium)\n end",
"def image_url_imgly(link_url)\n image_url_redirect link_url, \"http://img.ly/show/full/\", \"\\r\\n\"\n end",
"def fb_page_thumbnail_url\n \"\"\n end",
"def has_image?\n false\n end",
"def diswimage(image_text)\n image_options = image_text.gsub(/#/, '').gsub(/diswimage:/, '').split(':')\n image_title = image_options[0]\n image_extension = image_options[1]\n option_count = image_options[2]\n image_width = image_options[3]\n return \"!{width: #{image_width}px}http://doitidiot.s3.amazonaws.com/#{image_title}-#{rand(option_count)+1}.#{image_extension}!\"\n end",
"def image_url\n image.present? ? image.url : ''\n end",
"def image_as_medium_thumbnail\n image.variant(resize_to_fill: [350, 350]).processed\n end",
"def float\n super if image_url? || floatable_size?\n end",
"def imgdata\n url_usable = fetchable # fetchable may set the thumbdata\n thumbdata || (url if url_usable)\n end",
"def low\n unless self.url.nil?\n httpsimagepath = self.url.insert(4, 's')\n # httpsimagepath.slice! self.filename\n filename = self.url.split('/').last\n if filename.last(4) == \".jpg\"\n filename_noext = filename.split('.').first\n else\n filename_noext = filename\n end\n version = self.url.split('/').last(2).first\n httpsimagepath.slice! filename\n if version.match('[v]\\d*').to_s == version\n httpsimagepath.slice! version + '/'\n httpsimagepath = httpsimagepath + 'q_auto:low/' + version + '/' + filename_noext\n else\n httpsimagepath = httpsimagepath + 'q_auto:low/' + filename_noext\n end\n return httpsimagepath\n end\n end",
"def medium_640 #_z\n url.gsub(\"_s.jpg\",\"\") + \"_z.jpg\"\n end",
"def decorate_image\n if model.image_processed?\n return h.image_tag model.image_url(:thumb) if model.image?\n else\n return '<em>processing...</em>'\n end\n end",
"def check_image_on_the_feed(imageSize)\n\n page.evaluate_script(\"$('.sl-post-photo').find('a').css('background-image').replace('url(','').replace(')','').match(/#{imageSize}/).toString()\")\n\n end",
"def generate_photo_post(keyword, keyword_suffix)\n klass = @blog + \"_google_media\"\n image = find_google_media(keyword, keyword_suffix, rand(10)*8, klass) # try to start media search from a random page number\n \n # Remove from the @keywords if the given keyword is not one of the original keyword\n @keywords.delete(keyword) if @original_keywords.index(keyword) != nil\n\n if image != nil\n log \"Creating a photo post with image : #{image[:url]}\" \n\n @tumblr.photo(@blog, {\n :source => image[:url],\n :link => \"http://j.mp/1DXwSKd\",\n :caption => image[:titleNoFormatting],\n :tags => sentence_to_tags(keyword)\n })\n else\n log \"No image found, next...\"\n end\n end",
"def replace_blog_image_tags\n @resaving = true\n self.body.gsub!(/[{]blog_image:upload[0-9]+:[a-zA-Z]+[}]/) do |image_tag|\n random_id, size = image_tag.scan(/upload([0-9]+)[:]([a-zA-Z]+)/).flatten\n\n new_id = random_id\n\n matching_image = self.blog_images.reject {|bi| !bi.random_id || bi.random_id != random_id }.first\n\n if matching_image\n new_id = matching_image.id\n end\n\n \"{blog_image:#{new_id}:#{size}}\"\n end\n\n self.save\n @resaving = false\n\n return true\n end",
"def small_image_url\n self.small_image.convert('-resize 50%').url\n end",
"def images; (page.images rescue []); end",
"def images; (page.images rescue []); end",
"def image_url\n self.data['image_url'] || nil\n end",
"def get_thumbnail_url\n nil\n end",
"def extract_image(page)\n imgs = page.css('.thumbimage')\n return unless imgs\n img = imgs.reject { |img| img[:src].starts_with? 'data:' }.first\n img[:src]\n end",
"def imageurl?\n !!self.imageurl\n end",
"def image_url\n self.filename.url \n end",
"def image\n MAIN_CDN + \"headshots/current/168x168/#{@id}.jpg\"\n end",
"def image\n #images = Musicbrainz_db.get_cover_art(self.id)[\"images\"]\n\n images = SearchModule.get_cover_art(self.id)\n if images != nil\n return images[\"images\"].first[\"thumbnails\"][\"large\"]\n else\n return 'http://djpunjab.in/cover.jpg'\n end\n end",
"def og_image(image)\n\t\tbase_image = \"http://i.imgur.com/DfYlA.png\"\n\t\tif image.empty?\n\t\t\tbase_image\n\t\telse\n\t\t\timage\n\t\tend\n\tend",
"def cover_medium_url\n images('medium').first[:src]\n end",
"def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end",
"def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end",
"def image_url\n# Somehow the picture field returns false for 'nil?' regardless of wether it's set or not\n# So we'll have to check if the size of the url is 0 to see if it exists\n# There should be a better way to do this, probably?\nif self.picture.size == 0\n\tself.profile_picture.nil? ? 'image-unknown.jpg' : self.profile_picture\nelse \n\tself.picture.ava\nend\nend",
"def image_url\n object.image_url\n end",
"def is_small_imageable?\n return true\n end",
"def pic_one_url\n \tpic_one.url(:medium)\n end",
"def proxy_image\n multiresimage = Multiresimage.find(params[:id])\n\n src_width = multiresimage.DELIV_OPS.svg_image.svg_width.first.to_f\n src_height = multiresimage.DELIV_OPS.svg_image.svg_height.first.to_f\n\n # Max size is 1600 pixels or less, because we can't give away higher quality versions I guess!\n max_size = [ params[:image_length].to_i, 1600, src_width, src_height ].min\n\n image_url = multiresimage.image_url(max_size)\n\n if can?(:read, multiresimage)\n begin\n send_data( Net::HTTP.get_response(URI.parse(image_url)).body, type: 'image/jpeg' )\n rescue\n default_image = File.open(\"app/assets/images/site/missing2.png\", 'rb').read\n filename = \"missing2.png\"\n send_data( default_image, disposition: 'inline', type: 'image/jpeg', filename: filename )\n end\n end\n end",
"def thumbnail_tiny_url\n album_cover ? album_cover.photo.photo_url_tiny : photos.size > 0 ? photos.first.photo_url_tiny : nil\n end",
"def avatar_for_small(post)\n if post.picture?\n image_tag post.picture.url(:thumb)\n else \n image_tag \"thumb/profile.jpg\"\n end\n end",
"def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end",
"def img_file_white\n return img_file + \"_white\"\n end",
"def thumb\n return if collection?\n\n encoded_thumb if %w[book image manuscript map webarchive-seed].include?(dor_content_type)\n end",
"def mini_url\n object.attachment.url('mini')\n end",
"def background_image\r\n return nil\r\n end",
"def mark_image(image)\n images = Magick::Image.from_blob(image) # from_blob returns array of images\n image = images[0] # method is receiving just one image\n\n mark = Magick::Image.new(image.columns, image.rows)\n\n gc = Magick::Draw.new\n gc.gravity = Magick::CenterGravity\n gc.pointsize = 32\n gc.font_family = \"Arial\"\n gc.font_weight = Magick::BoldWeight\n gc.stroke = 'none'\n gc.annotate(mark, 0, 0, 0, 0, WATERMARK_STRING)\n\n mark = mark.shade(true, 310, 30)\n\n image.composite!(mark, Magick::CenterGravity, Magick::HardLightCompositeOp)\n\n image = image.to_blob\n return image\nend",
"def image\n 0\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def get_image_link(page) # someday use regex here\n\t\t\tsource = getHtml(page)\n\t\t\tsource = source.gsub(\"enlarge()\", \"º\")\n\t\t\tsource = source[source.index(\"º\"), source.length]\n\t\t\tsource = source.gsub(\"http://\", \"$\")\n\t\t\tsource = source[source.index(\"$\"), source.length]\n\t\t\treturn source[1, source.index(\"\\\"\") - 1]\n\t\tend",
"def imgdata fallback_to_url=true\n if picref && (href = picref.imgdata || (fallback_to_url && picref.url)).present?\n href\n end\n end",
"def image_url\n model.image_url.presence || h.asset_path('face.jpg')\n end",
"def non_object_image_url(size: :medium)\n if non_object_image.present?\n url_helpers.url_for(non_object_image.representation(Integral.image_transformation_options.merge!(resize_to_limit: Integral.image_sizes[size])))\n else\n fallback_image_url\n end\n end",
"def show\n @main_image = @camp.images.first&.attachment&.url(:large)\n end",
"def image\n\t\treturn @wiki_img if @wiki_img\n\t\tlogger.info \"finding picture for #{name}\"\n\t\tWikipedia.Configure do\n\t\t\tdomain \"en.wikipedia.org\"\n\t\t\tpath \"w/api.php\"\n\t\tend\n\t\tp = page\n\t\tif p && p.image_urls && p.image_urls.count > 0\n\t\t\t@wiki_img = p.image_urls.last # last one is the one on the right\n\t\t\tself.picture = @wiki_img\n\t\t\tself.save\n\t\t\t@wiki_img\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def stable_image_url(image_name, style = nil, options = {})\n image = send(:\"#{image_name}\")\n if image.processing?\n old_name = Rails.cache.read(\"c_att/#{id}/#{image_name}\")\n return image.url(style, options) unless old_name\n\n # Temporarily set processing to false and the file name to the\n # old file name, so that we can call Paperclip's own url method.\n new_name = image.original_filename\n send(:\"#{image_name}_processing=\", false)\n send(:\"#{image_name}_file_name=\", old_name)\n\n url = image.url(style, options)\n\n send(:\"#{image_name}_file_name=\", new_name)\n send(:\"#{image_name}_processing=\", true)\n\n url\n else\n image.url(style, options)\n end\n end",
"def stable_image_url(image_name, style = nil, options = {})\n image = send(:\"#{image_name}\")\n if image.processing?\n old_name = Rails.cache.read(\"c_att/#{id}/#{image_name}\")\n return image.url(style, options) unless old_name\n\n # Temporarily set processing to false and the file name to the\n # old file name, so that we can call Paperclip's own url method.\n new_name = image.original_filename\n send(:\"#{image_name}_processing=\", false)\n send(:\"#{image_name}_file_name=\", old_name)\n\n url = image.url(style, options)\n\n send(:\"#{image_name}_file_name=\", new_name)\n send(:\"#{image_name}_processing=\", true)\n\n url\n else\n image.url(style, options)\n end\n end",
"def imgur_medium(url)\n\t\turl.match(@@picsize_regex) do |match|\n\t\t\t\"http://i.imgur.com/\"+match[1]+\"m\"+\".\"+match[3]\n\t\tend\n\tend",
"def image_url\n Image.find(image_id).url\n end",
"def thumbnail_is_null_if_false\n self.thumbnail = nil unless self.thumbnail?\n end",
"def image\n meta_og_image || meta_twitter_image\n end",
"def image\n image = Weatherman::Image.new(attribute('image'))\n do_convertions(image, [:width, :to_i], [:height, :to_i], :title, :link, :url)\n end",
"def image_filename\n self['image'] || cached_remote_image_url.to_s.split('/').last\n end",
"def mobile_poster_image_url\n self.show_images.poster.any? ? self.show_images.poster.first.avatar.url(:mobile_poster) : nil\n end",
"def coupen_img_url\n coupen_img = self.coupen_image.url(:original).split('?')[0]\n coupen_img.include?('missing') ? '' : coupen_img\n end",
"def image_hash; end",
"def thumbnail_image\n end",
"def featured_img(img)\n \"background-image: linear-gradient(to bottom, rgba(11, 11, 13, 0.3), rgba(0, 0, 0, 0.923)), url('#{img}')\"\n end"
] |
[
"0.5773438",
"0.5749078",
"0.5728233",
"0.57170796",
"0.57150257",
"0.5693912",
"0.5677273",
"0.5667931",
"0.565587",
"0.5653029",
"0.5647538",
"0.56018394",
"0.55970937",
"0.55582476",
"0.5556569",
"0.5552411",
"0.5534304",
"0.5519076",
"0.5510771",
"0.5475985",
"0.5463372",
"0.54607487",
"0.5435255",
"0.54273444",
"0.54273444",
"0.5408306",
"0.5401468",
"0.53972334",
"0.53859437",
"0.5372893",
"0.5371212",
"0.5371212",
"0.5354626",
"0.5351619",
"0.5346863",
"0.532418",
"0.53219604",
"0.5317093",
"0.5316726",
"0.5312426",
"0.5274581",
"0.52706003",
"0.52686554",
"0.52672195",
"0.5259525",
"0.52576745",
"0.5256503",
"0.5251758",
"0.525156",
"0.52384263",
"0.5237632",
"0.52364594",
"0.52346444",
"0.52346444",
"0.5233682",
"0.52332497",
"0.52291757",
"0.52274513",
"0.5226175",
"0.52152395",
"0.52147245",
"0.52077377",
"0.51973623",
"0.51854354",
"0.51854354",
"0.51826483",
"0.51816446",
"0.51749474",
"0.51748085",
"0.51727515",
"0.5164952",
"0.51609427",
"0.51561815",
"0.5144228",
"0.51376367",
"0.51260114",
"0.51193017",
"0.5119004",
"0.51019454",
"0.5101911",
"0.5101911",
"0.51016665",
"0.509981",
"0.509748",
"0.50932014",
"0.5091983",
"0.50868785",
"0.5078233",
"0.5078233",
"0.5077094",
"0.50759643",
"0.5075937",
"0.5072894",
"0.50699055",
"0.5059392",
"0.50570256",
"0.5054398",
"0.5054244",
"0.50534505",
"0.50522333"
] |
0.6870945
|
0
|
For the server to remove a browser cookie we need to set a cookie of the same name with an expires value to now (or in the past) so that the browser will expire it and remove it. The value is also voided.
|
def remove_session_cookie
headers['Set-Cookie'] = session_cookie "x; expires=#{Time.at(0).httpdate}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_cookie(name)\n cookie = Cookie.new(name, \"\")\n cookie.expires = 1.year.ago \n @context.add_cookie(cookie) \n end",
"def delete_cookie(name)\n set_cookie(name, nil, Merb::Const::COOKIE_EXPIRED_TIME)\n end",
"def delete_cookie(name); end",
"def delete(name, options = {})\n set_cookie(name, \"\", options.merge(\"expires\" => Time.at(0)))\n end",
"def delete_cookie name\n @response.delete_cookie name\n end",
"def destroy\n\t\tcookies.delete 'Vanilla'\n\t\tcookies.delete 'Vanilla-Volatile'\n\t\tsuper\n\tend",
"def delete(name, options = {})\n options.stringify_keys!\n set_cookie(options.merge(\"name\" => name.to_s, \"value\" => \"\", \"expires\" => Time.at(0)))\n end",
"def manually_set_cookie(value, expire_in)\n expire_date = expire_in.from_now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n response['Set-Cookie'] =\n \"cookiePermissions=#{value}; Expires=#{expire_date}; Path=/; SameSite=Lax\"\n end",
"def delete_cookie(key, value = {})\n Rack::Utils.delete_cookie_header!(@headers, key, value)\n end",
"def delete_cookie(name)\n browser.delete_cookie(name)\n end",
"def delete_cookie(name)\n driver.manage.delete_cookie(name)\n end",
"def delete(name)\n set_cookie(\"name\" => name.to_s, \"value\" => \"\")\n end",
"def delete_cookie(name)\n @driver.manage.delete_cookie(name)\n end",
"def clear_cookie\n create_accesses_cookie\n end",
"def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end",
"def uncookie_user\n cookies.delete :auth, :domain => site_domain\n end",
"def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end",
"def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end",
"def cookie_expiration\n super\n end",
"def delete(name)\n @control.delete_cookie(name)\n end",
"def delete_cookie\n cookies.delete :auth_token\n end",
"def unset\n @cookies.delete cookie_name, cookie_options\n end",
"def check_for_removal\n if @value && @unused && @unused[\"unused\"]\n @res.cookies << create_cookie(\"unused\", false, 'flash_unused')\n elsif @value\n @value = nil\n @res.cookies << create_cookie(\"unused\", nil, 'flash_unused')\n @res.cookies << create_cookie(\"message\", nil)\n end\n end",
"def hubssolib_set_secure_cookie_data(name, value)\n if (@hubssolib_have_written_cookie)\n raise \"HubSsoLib: Attmept to set cookie '#{name}' more than once\"\n end\n\n @hubssolib_have_written_cookie = true\n\n # Using cookies.delete *should* work but doesn't. Set the\n # cookie with nil data instead.\n\n data = value.nil? ? nil : HubSsoLib::Crypto.encode_object(value, request.remote_ip)\n\n # No expiry time; to aid security, use session cookies only.\n\n cookies[name] = {\n :value => data,\n :path => HUBSSOLIB_COOKIE_PATH,\n :secure => true\n }\n end",
"def set_cookie(cookie_name, value, expires)\n cookies[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: GlobalConstant::Base.cookie_domain,\n http_only: true,\n secure: Rails.env.production?,\n same_site: :strict\n }\n end",
"def refresh_expiration \n \t self.needs_new_cookie=true \n \tend",
"def delete_cookie(key)\n ::Rack::Utils.delete_cookie_header!(@_headers, key, {})\n end",
"def delete_cookie(key)\n ::Rack::Utils.delete_cookie_header!(@_headers, key, {})\n end",
"def cookie_remove(name)\n return dup_without_response.cookie_remove(name) if response\n\n # Remove just one matching cookie from the end.\n rejected = false\n new_cookies = cookies.reverse.reject do |cookie_name, cookie_value|\n if !rejected && (cookie_name == name)\n rejected = true\n else\n false\n end\n end.reverse\n\n cookies_string = HTTY::CookiesUtil.cookies_to_string(new_cookies)\n if cookies_string\n @headers[COOKIES_HEADER_NAME] = cookies_string\n else\n @headers.delete COOKIES_HEADER_NAME\n end\n self\n end",
"def delete_cookie(cookie_name)\n cookies.delete(\n cookie_name.to_sym,\n domain: GlobalConstant::CompanyApi.cookie_domain,\n secure: Rails.env.production?,\n same_site: :strict\n )\n end",
"def delete key, opts ={}\n return if confined?\n @response.delete_cookie key, opts\n end",
"def clear_cookies\n \tcookies.delete(:auth_token)\n end",
"def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end",
"def log_out\n\t\tcookies.delete(:cookie_id)\n\n\tend",
"def refresh_expiration\n self.needs_new_cookie = true\n end",
"def refresh_expiration\n self.needs_new_cookie = true\n end",
"def send_cookie(name, value = nil)\n @context.add_cookie(name, value)\n end",
"def delete_cookie(name)\n $LOG.info \"deleting cookie #{name}\"\n begin\n $driver.manage.delete_cookie name\n rescue Exception => e\n $LOG.error \"error in deleting cookie #{name} \"+e.message\n raise \"Error in deleting cookie #{name} \"+e.message\n end\n end",
"def delete_cookie(cookie_name)\n cookies.delete(cookie_name.to_sym, domain: request.host, secure: !(Rails.env.development? || Rails.env.staging?), same_site: :strict)\n end",
"def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end",
"def delete_all_cookies; end",
"def destroy( response )\n\t\tself.log.debug \"Destroying session %s\" % [ self.session_id ]\n\t\tself.class.delete_session_data( self.session_id )\n\n\t\tself.log.debug \"Adding expired session cookie to the response\"\n\t\tsession_cookie = Strelka::Cookie.new(\n\t\t\tself.class.cookie_name,\n\t\t\tself.session_id,\n\t\t\tself.class.cookie_options || {}\n\t\t)\n\t\tsession_cookie.expire!\n\n\t\tresponse.cookies << session_cookie\n\tend",
"def clearcookies\n cookies.delete Prismic::PREVIEW_COOKIE\n redirect_to '/'\n end",
"def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end",
"def set_uuid_cookie\n uuid = cookies[:uuid] || UUIDTools::UUID.random_create.to_s\n cookies[:uuid] = { value: uuid, expires: 5.years.from_now }\n end",
"def delete_cookie(cookie_name)\n cookies.delete(\n cookie_name.to_sym,\n domain: GlobalConstant::Base.cookie_domain,\n secure: Rails.env.production?,\n same_site: :strict\n )\n end",
"def reset_cookies\n if !user_signed_in?\n cookies.delete(:truck)\n end\n end",
"def delete(cookie)\n # self\n end",
"def reset_session_expiry\n ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 1.hour.from_now)\n end",
"def destroy\n if cookies[:destroy]\n response.set_cookie(:destroy,\n :value => cookies[:destroy].to_i + 1\n )\n else\n @show_message = true;\n\n # set the visited cookie\n response.set_cookie(:destroy,\n :value => 1,\n :expires => Time.now + (60 * 60 * 2)\n )\n end\n @metal.destroy\n respond_to do |format|\n format.html { redirect_to metals_url, notice: 'Metal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_auth_tkt_cookie\n # reset ticket value of cookie, to log out even if deleting cookie fails\n cookies[:auth_tkt] = { :value => '', :expire => Time.at(0), :domain => DOMAIN }\n cookies.delete :auth_tkt\n end",
"def set_cookie name, value=nil, opts={}\n if Hash === value\n opts = value\n else\n opts[:value] = value\n end\n\n @response.set_cookie name, opts\n end",
"def set_cookie(name, value, expires)\n (headers['Set-Cookie'] ||=[]) << (Merb::Const::SET_COOKIE % [\n name.to_s, \n ::Merb::Request.escape(value.to_s), \n # Cookie expiration time must be GMT. See RFC 2109\n expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n ])\n end",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def cookie_expires(symbol)\n cookies[symbol.to_s].expires\n end",
"def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end",
"def delete_cookies\n if @browser_name != 'poltergeist'\n @log.info('Deleting the ' + @browser_name + ' browser cookies')\n @driver.manage.delete_all_cookies\n end\n end",
"def reset_session\n super\n\n val = Time.now.to_f\n cookies[:_openid_session_timestamp] =\n if ['development', 'test'].include? Rails.env\n val\n else\n { :value => val, :domain => 'ada.edu.au' }\n end\n end",
"def close\n check_cookie\n Native::magic_close(@cookie);\n @cookie = nil\n end",
"def remove_store(key, value)\n begin\n @data = Storage.find(value)\n @data.destroy\n cookies.delete key\n rescue\n end\n session[key] = nil\n end",
"def forget(user)\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def destroy\n cookies.signed[:current_user_id] = nil\n redirect_to new_session_path\n end",
"def store_cookie variable_name\r\n command 'storeCookie', variable_name\r\n end",
"def finish\n @cookies.delete(RACK_SESSION_KEY)\n @cookies.each do |k,v|\n next unless changed?(k)\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end if changed?\n end",
"def clear_cookies(browser)\n if browser.respond_to?(:clear_cookies)\n browser.clear_cookies\n else\n browser.manage.delete_all_cookies\n end\nrescue NoMethodError\n raise 'Browser does not support clear cookies'\nend",
"def force_forget_me!\n current_user.force_forget_me!\n cookies.delete(\n :remember_me_token,\n domain: sorcery_config.cookie_domain\n )\n end",
"def force_forget_me!\n current_user.force_forget_me!\n cookies.delete(:remember_me_token, domain: Config.cookie_domain)\n end",
"def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end",
"def expires=(value)\n @expires = value\n @expires_in = nil\n end",
"def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend",
"def http_cookie=(content)\n logger.debug { content ? \"Setting Cookie: #{content}\" : 'Clearing Cookie' }\n http.cookie = content\n end",
"def do_write!(cookie_name, spec)\n @controller.write_cookie! cookie_name, spec.merge(same_site: self.class.cookie_same_site)\n @controller.write_cookie! \"#{cookie_name}_legacy\", spec\n end",
"def cookie=(val)\n @xmlrpc.cookie = val\n end",
"def save_cookie(requested_lang)\n cookies[:lang] = {\n :value => requested_lang,\n :expires => 1.month.from_now,\n :path => root_path\n }\n end",
"def cookie_value; end",
"def cookie\n # 'frontend=aaa'\n nil\n end",
"def after_save\n cookies['global_properties_for_user'] = nil\n end",
"def forget_user_from_cookie(user)\n user.forget_digest\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\nend",
"def finish\n @cookies.delete(Action::RACK_SESSION)\n if changed?\n @cookies.each do |k, v|\n next unless changed?(k)\n\n v.nil? ? delete_cookie(k) : set_cookie(k, _merge_default_values(v))\n end\n end\n end",
"def forget(user)\n user.unpersist # In the database\n cookies.delete(:user_id) # In the browser\n cookies.delete(:remember_token) # In the browser\n end",
"def delete_cookie(cookie_name:, url:)\n {\n method: \"Page.deleteCookie\",\n params: { cookieName: cookie_name, url: url }.compact\n }\n end",
"def handle_remember_cookie!(new_cookie_flag)\n return unless @current_user\n case\n when valid_remember_cookie? then @current_user.refresh_token # keeping same expiry date\n when new_cookie_flag then @current_user.remember_me \n else @current_user.forget_me\n end\n send_remember_cookie!\n end",
"def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end",
"def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end",
"def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end",
"def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end",
"def forget!(cookies)\n cookies.delete(:remember_me)\n cookies.delete(:authorization_token)\n end",
"def forget(user)\n user.forget\n cookies.delete :id\n cookies.delete :remember_token\n end",
"def logout_user\n cookies.delete(:auth_token)\n end",
"def set_browser_id\n until cookies[:browser_id]\n proposed_browser_id = SecureRandom.uuid\n unless Session.where(:browser_id => proposed_browser_id).exists?\n cookies[:browser_id] = {:value => proposed_browser_id, :expires => 20.years.from_now}\n end\n end\n end",
"def rdaw_logout\n logger.debug(\"[rdaw] killing #{daw_cookie_name} cookie for *.apple.com\") if cookies[daw_cookie_name]\n cookies.delete(daw_cookie_name, :domain => '.apple.com')\n clear_rdaw_session\n end",
"def expire_cache_control\n @response[PRAGMA] = 'no-cache'\n expires EPOCH, :no_cache, :no_store, :must_revalidate, :max_age => 0\n end",
"def forget (user)\n\tuser.forget\n\tcookies.delete(:user_id)\n\tcookies.delete(:remember_token)\nend",
"def set_cookie(name, value, path = '/', httponly = true, secure = true)\n \n cookie = WEBrick::Cookie.new(name, value)\n cookie.path = path\n cookie.httponly = httponly\n cookie.secure = secure\n \n # add cookie to response header\n @header['Set-Cookie'] = cookie.to_s\n end",
"def delete_cookies\n @log.info('Deleting the ' + @browser_name + ' browser cookies')\n @driver.manage.delete_all_cookies\n end",
"def fortune_cookie; end",
"def bake_vote_cookie_for(question)\n cookies[\"voted_for_#{question.id}\"] = {\n :value => '1',\n :expires => 1.year.from_now # Expire not anytime soon.\n }\n end"
] |
[
"0.7805665",
"0.7571338",
"0.7564561",
"0.7373431",
"0.72466165",
"0.718499",
"0.7161379",
"0.704775",
"0.70309216",
"0.6992143",
"0.6965697",
"0.69307023",
"0.68598115",
"0.6761744",
"0.6723766",
"0.6714807",
"0.6679817",
"0.66047597",
"0.6604622",
"0.65977705",
"0.65928954",
"0.65875393",
"0.6572607",
"0.64631724",
"0.644186",
"0.64319694",
"0.64173746",
"0.64173746",
"0.641225",
"0.64057225",
"0.64025986",
"0.63570666",
"0.63526815",
"0.6346346",
"0.6306967",
"0.6306967",
"0.6304365",
"0.6271318",
"0.6268203",
"0.62634075",
"0.6244963",
"0.62357056",
"0.62354463",
"0.6232781",
"0.6215522",
"0.62078625",
"0.6205066",
"0.6204647",
"0.62027085",
"0.61727136",
"0.61627597",
"0.6157312",
"0.61438",
"0.61320645",
"0.61320645",
"0.6111937",
"0.6105716",
"0.61036366",
"0.60927963",
"0.6076613",
"0.60292196",
"0.60264844",
"0.60093623",
"0.600877",
"0.6003365",
"0.5992344",
"0.5989888",
"0.59642965",
"0.59554046",
"0.59545326",
"0.5953703",
"0.59463876",
"0.594586",
"0.594466",
"0.594098",
"0.5935171",
"0.5919134",
"0.59160423",
"0.5911831",
"0.59049636",
"0.58826685",
"0.58815503",
"0.5865683",
"0.58653146",
"0.58650804",
"0.58634096",
"0.5856151",
"0.5856151",
"0.5856151",
"0.5856151",
"0.58508193",
"0.58480805",
"0.5845202",
"0.58411485",
"0.583838",
"0.58375025",
"0.5834262",
"0.58146566",
"0.58129936",
"0.5808676"
] |
0.72842306
|
4
|
Follows the convention of an xcallbackurl action of "addText" matching a class name of "AddText"
|
def action
self.class.name.split("::").last.tap do |class_name|
class_name[0] = class_name[0].downcase
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_text(text); end",
"def set_add_text\n @add_text = AddText.find(params[:id])\n end",
"def create\n @add_text = AddText.new(add_text_params)\n\n respond_to do |format|\n if @add_text.save\n format.html { redirect_to @add_text, notice: 'Add text was successfully created.' }\n format.json { render :show, status: :created, location: @add_text }\n else\n format.html { render :new }\n format.json { render json: @add_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(text, url = nil, options = {})\n options.reverse_merge!(:i18n => true)\n text = translate(text) if options.delete(:i18n)\n url = controller.__send__(:url_for, url) if url\n push [text.to_s, url, options]\n end",
"def _text(text)\n @target << text\n end",
"def insert_text(text:)\n {\n method: \"Input.insertText\",\n params: { text: text }.compact\n }\n end",
"def add(text)\n @text << text\n end",
"def add_text_params\n params.require(:add_text).permit(:text)\n end",
"def add(text, url = nil, options = {})\n options = {i18n: true}.merge(options)\n text = translate(text) if options.delete(:i18n)\n items << [text.to_s, url, options]\n end",
"def quick_add(text)\r\n content = <<EOF\r\n<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gCal='http://schemas.google.com/gCal/2005'>\r\n <content type=\"html\">#{text}</content>\r\n <gCal:quickadd value=\"true\"/>\r\n</entry>\r\nEOF\r\n post_event(content)\r\n end",
"def create\n @api_v1_custom_text = Api::V1::CustomText.new(api_v1_custom_text_params)\n\n respond_to do |format|\n if @api_v1_custom_text.save\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_custom_text }\n else\n format.html { render :new }\n format.json { render json: @api_v1_custom_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text(text)\n @document.add_text(text)\n end",
"def text\n lead = Lead.find(params[:lead_id])\n client = Twilio::REST::Client.new\n if params[:auto_text] || !params[:body].blank?\n client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: lead.phone,\n body: params[:auto_text] ? custom_message(lead.first_name) : params[:body]\n )\n flash[:success] = \"Text Sent!\"\n else\n flash[:alert] = \"NO TEXT SENT\"\n end\n redirect_to \"/leads/#{lead.id}/edit\"\n rescue Twilio::REST::RequestError => error\n redirect_to \"/leads/#{lead.id}/edit\"\n flash[:alert] = \"NO TEXT SENT - #{error}\"\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def show_text(string, *params)\n @content.last << string\n end",
"def show_text(string, *params)\r\n @content.last << string\r\n end",
"def update\n respond_to do |format|\n if @add_text.update(add_text_params)\n format.html { redirect_to @add_text, notice: 'Add text was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_text }\n else\n format.html { render :edit }\n format.json { render json: @add_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_word(word)\r\n \r\n end",
"def new_text=(value)\n @new_text = value\n end",
"def new_text_input\n end",
"def text(name, title, text)\n push(name, {\"title\" => title, \"msg\" => text})\n end",
"def text text\n end",
"def set_text(text); end",
"def add_field\n params.inspect\n #@textos = Array.new(1+1) { Texto.new } # Generate index+1 objects\n #respond_with(@textos)\n end",
"def search_for_content=(text)\n self.text_field(:class=>\"newaddcontent_existingitems_search\").set(\"#{text}\\n\")\n end",
"def send_text\n\nend",
"def add_page(text)\n self.back_to_top\n add_page_button\n wait_for_ajax\n self.send_keys text + \"\\n\"\n end",
"def add_help(id, text)\n url = URI.parse(\"http://#{@@api_url}/helps/add/#{id}.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path+@config[:apikey])\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n\n end",
"def insert_text\n attributes.fetch(:insertText)\n end",
"def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def append(text); end",
"def add_word(word)\n \n end",
"def create\n @text = this_class.new(params[this_key]){|one| one.user_id = current_user.id }\n return forbidden if not authorized? :create\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_this(text, url)\n link_to text, \"http://www.addthis.com/bookmark.php\", :onmouseover => \"return addthis_open(this, '', '#{url}', '');\", :onmouseout => \"addthis_close();\", :onclick => \"return addthis_sendto();\"\n end",
"def handle_text(name, attrs)\n \n end",
"def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end",
"def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end",
"def show_text(string, *params)\n @content.last << string.strip\n end",
"def show_text(string, *params)\n #puts \"#{string.inspect} #{params.inspect}\"\n @content.last << string\n end",
"def add_need(subject, text)\n url = URI.parse(\"http://#{@@api_url}/needs/add.xml#{@config[:apikey]}\")\n req = Net::HTTP::Post.new(url.path)\n\n req.basic_auth(@config[:email], @config[:password])\n req.set_form_data({'text' => text, 'subject' => subject})\n\n response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }\n parse(response.body)\n \n end",
"def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].hadjustment.upper\n puts @glade['scrolledwindow1'].hadjustment.lower\n @talk.buffer.insert @talk.buffer.end_iter,\"#{name || @contact.name}: \", @nickname_tag\n @talk.buffer.insert @talk.buffer.end_iter, \"#{text}\\n\"\n end",
"def create\n @static_text = StaticText.new(static_text_params)\n\n respond_to do |format|\n if @static_text.save\n format.html { redirect_to @static_text, notice: 'Static text was successfully created.' }\n format.json { render :show, status: :created, location: @static_text }\n else\n format.html { render :new }\n format.json { render json: @static_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def text(text)\n @text = text\n end",
"def add_text(widget)\n # File chooser dialog\n chooser = create_chooser @filter, Gtk::Stock::ADD\n\n # Check the user input\n chooser.run do |r|\n if r == Gtk::Dialog::RESPONSE_ACCEPT\n @project.add_text chooser.filename\n @treeView.create_tree @project\n end\n chooser.destroy\n end\n\n end",
"def create\n @text_entry = TextEntry.new(params[:text_entry])\n\n respond_to do |format|\n if @text_entry.save\n format.html { redirect_to statute_type_url(@text_entry.statute_type_id), notice: 'Text entry was successfully created.' }\n format.json { render json: @text_entry, status: :created, location: @text_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_instant_text(text)\n @lines.push(text)\n refresh\n end",
"def create\n @story_text = StoryText.new(params[:story_text])\n\n respond_to do |format|\n if @story_text.save\n flash[:notice] = 'StoryText was successfully created.'\n format.html { redirect_to(@story_text) }\n format.xml { render :xml => @story_text, :status => :created, :location => @story_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def insert_text\n self.frame(:id=>\"elm1_ifr\").body(:id=>\"tinymce\").fire_event(\"onclick\")\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @api_v1_custom_text.update(api_v1_custom_text_params)\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_custom_text }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_custom_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lbText _obj, _args\n \"_obj lbText _args;\" \n end",
"def put_add_text(name, page_number, paragraph, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_add_text_with_http_info(name, page_number, paragraph, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = put_add_text_with_http_info(name, page_number, paragraph, opts)\n else\n raise\n end\n return data\n end",
"def text(name, options={})\n param(:text, name, options)\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def set_Text(value)\n set_input(\"Text\", value)\n end",
"def propnet\n self.add_tx_string(@phgtext)\n end",
"def visit_Text(text, *rest)\n end",
"def text=(text)\n\t\tend",
"def create\n @text_module = TextModule.new(params[:text_module])\n\n respond_to do |format|\n if @text_module.save\n flash[:notice] = 'TextModule was successfully created.'\n format.html { redirect_to(params[:back_to] ) }\n format.xml { render :xml => @text_module, :status => :created, :location => @text_module }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @text_module.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @text = Text.new(text_params)\n notify_android(text_params[:token])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def set_text\n @text = Text.find(params[:id])\n end",
"def add_actions; end",
"def set_text(text)\n @text = text\n self\n end",
"def create\n @api_v1_text_field = Api::V1::TextField.new(api_v1_text_field_params)\n\n respond_to do |format|\n if @api_v1_text_field.save\n format.html { redirect_to @api_v1_text_field, notice: 'Text field was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_text_field }\n else\n format.html { render :new }\n format.json { render json: @api_v1_text_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_text(string, *params)\n @content.last << string.strip\n end",
"def enter_text(textfield, text)\n append_to_script \"enter_text \\\"#{textfield}\\\" , \\\"#{text}\\\"\"\n end",
"def update_action_text(action_id, text)\n put action_path(action_id, \"text\"), value: text\n end",
"def addText(parameters = {})\n options = { text: '', # the text to add\n index: -1, # where to add it (beginning=0, ending=-1, etc)\n scroll: 'false' # scroll to show added text?\n }.merge(parameters)\n someText = options[:text]\n someIndex = options[:index].to_i\n someIndex = @textView.string.length + someIndex + 1 if someIndex < 0\n unless someIndex > @textView.string.length || someText == '' # nothing to add\n if someText.class.to_s.end_with?('AttributedString')\n @textView.textStorage.replaceCharactersInRange( [someIndex, 0],\n withAttributedString: someText)\n else # regular string\n @textView.replaceCharactersInRange( [someIndex, 0],\n withString: someText)\n end\n scrolling = %w[true yes 1].include?(options[:scroll].to_s.downcase)\n @textView.scrollRangeToVisible([someIndex, someText.length]) if scrolling\n end\n @textView.string\n end",
"def create(name, text)\n @driver.addRule([name], [text])\n end",
"def init_post_text_addition(position)\n clear_insert_toolbar_before(@current_edited_node_position)\n @current_edited_node_position = position\n\n modal_open(\n nil,\n t(Components::PostTexts::New, \n {\n on_done: ->(post_node){insert_node(post_node)},\n on_collect: ->(post_text, component){generic_create_node(post_text, component)}\n }\n )\n )\n end",
"def add_content=(text)\n self.frame(:id=>\"elm1_ifr\").body(:id=>\"tinymce\").fire_event(\"onclick\")\n self.frame(:id=>\"elm1_ifr\").send_keys(text)\n end",
"def srch_add(opts={})\n\t\t\t\tsrch_client.add_document(opts)\n\t\t\tend",
"def create_thanks \n end",
"def set_api_v1_custom_text\n @api_v1_custom_text = Api::V1::CustomText.find(params[:id])\n end",
"def add_text(text)\n return if text.empty?\n\n if text.frozen?\n text = text.gsub(/['\\\\]/, '\\\\\\\\\\&')\n else\n text.gsub!(/['\\\\]/, '\\\\\\\\\\&')\n end\n\n with_buffer{@src << \" << '\" << text << @text_end}\n end",
"def add_text(text, tree = T.unsafe(nil), type = T.unsafe(nil)); end",
"def show_text(text, options={})\n add_actor Gamework::Text.new(text, options)\n end",
"def index\n @add_texts = AddText.all\n end",
"def create\n @text = current_user.texts.build(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enter_text(access_type, text, access_name)\n find(:\"#{access_type}\", \"#{access_name}\").set(\"#{text}\")\nend",
"def add_text\n return '' unless @selector.key?(:text)\n\n text = @selector.delete :text\n if !text.is_a?(Regexp)\n \"[normalize-space()='#{text}' or @value='#{text}']\"\n elsif simple_regexp?(text)\n \"[contains(text(), '#{text.source}') or contains(@value, '#{text.source}')]\"\n else\n @selector[:text] = text\n ''\n end\n end",
"def xf_text_field (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"input\", object_name, method, label, attrs)\n end",
"def on_add(clicker)\n end",
"def set_text(text)\n @text = text\n end",
"def handle_text_insertion pos, text\n add_command InsertionCommand.new(pos, text)\n end",
"def add_content text, config={}\n unless @_buffers\n bind_key(?\\M-n, :buffer_next)\n bind_key(?\\M-p, :buffer_prev)\n bind_key(KEY_BACKSPACE, :buffer_prev) # backspace, already hardcoded in textview !\n bind_key(?:, :buffer_menu)\n end\n @_buffers ||= []\n @_buffers_conf ||= []\n @_buffers << text\n if text.is_a? String\n config[:filename] = text\n config[:title] ||= text\n end\n @_buffers_conf << config\n @_buffer_ctr ||= 0\n $log.debug \"XXX: HELP adding text #{@_buffers.size} \"\n end",
"def setUserActionText _obj, _args\n \"_obj setUserActionText _args;\" \n end",
"def add(args)\n # Check input is valid\n receipt_code, fail_reason = handle_input(args['word'].to_s.strip.downcase,\n args['from'].to_s.strip.downcase, \n args['tags'].to_s.strip, \n args['time'].to_s.strip.downcase,\n args['worker'].to_s.strip,\n args['lang'].to_s.strip.downcase)\n \n # Success page else failure page\n return compose_template('receipt', binding) if receipt_code\n return compose_template('fail', binding)\n end",
"def text(*)\n super\n end",
"def api_v1_custom_text_params\n params.fetch(:api_v1_custom_text, {})\n end",
"def add_error_text(text)\n self.error_text = \"\" if self.error_text.nil?\n self.error_text += text + \"\\n\"\n end",
"def add_book(title)\n \nend",
"def create\n @text = Text.new(text_params)\n\n @comment = Comment.new\n @comment.text = @text\n\n @user = current_user\n\n respond_to do |format|\n if @text.save\n format.html {redirect_to @text, notice: 'Text was successfully created.'}\n format.json {render :show, status: :created, location: @text}\n else\n format.html {render :new}\n format.json {render json: @text.errors, status: :unprocessable_entity}\n end\n end\n end",
"def text=(text)\n end",
"def entering text, options = {}\n widget = find_widget options[:into]\n widget.insert_text text, widget.position\n process_events\nend"
] |
[
"0.7379703",
"0.6640188",
"0.65295076",
"0.6264892",
"0.62057465",
"0.6166358",
"0.6140011",
"0.61306936",
"0.61046857",
"0.60945755",
"0.6069782",
"0.6066314",
"0.58717775",
"0.5803748",
"0.5803748",
"0.5803748",
"0.58003515",
"0.5745676",
"0.57391936",
"0.5720754",
"0.56832665",
"0.568128",
"0.566199",
"0.56527275",
"0.5650348",
"0.56495225",
"0.56413925",
"0.56313",
"0.5618774",
"0.5609276",
"0.55952406",
"0.55857414",
"0.5578678",
"0.5516761",
"0.55032563",
"0.5498444",
"0.54632956",
"0.54500353",
"0.5441164",
"0.54328835",
"0.541042",
"0.5386126",
"0.53852135",
"0.5363094",
"0.5362667",
"0.5361339",
"0.5353796",
"0.53501904",
"0.5349819",
"0.5346889",
"0.53467417",
"0.534602",
"0.5345409",
"0.5345092",
"0.5333361",
"0.5333361",
"0.5333361",
"0.5328012",
"0.5323712",
"0.53235686",
"0.5323323",
"0.532328",
"0.53202885",
"0.53202885",
"0.53202885",
"0.53202885",
"0.53202885",
"0.53106475",
"0.5302457",
"0.5290614",
"0.5274146",
"0.52670574",
"0.5261554",
"0.52596146",
"0.5241886",
"0.5240479",
"0.52096105",
"0.52020514",
"0.5199793",
"0.51852185",
"0.5184749",
"0.51822925",
"0.51783216",
"0.51738656",
"0.5173382",
"0.5173311",
"0.5168183",
"0.51609033",
"0.51583517",
"0.5158344",
"0.51564026",
"0.5155325",
"0.51402617",
"0.51360273",
"0.5135184",
"0.5135076",
"0.5123575",
"0.5117572",
"0.5117143",
"0.5117097",
"0.5110653"
] |
0.0
|
-1
|
Need to CGI escape strings to allow characters like & through the xcallback URL, but for some reason not spaces
|
def cgi_escape(string)
CGI.escape(string).gsub("+", " ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def uri_escape(input); end",
"def cgi_escape(input); end",
"def safe_escape(uri); end",
"def check_and_escape(url)\n check url\n CGI.escape url\n end",
"def uri_escape\n str = xml_escape.gsub(/\\+/, '+')\n str = str.gsub(/\\s/, '+')\n end",
"def escape_uri(s); Rack::Utils.escape(s); end",
"def url_encode(string)\n string = CGI.escape string\n end",
"def pre_escape_query(query)\n # have to include apostrophe in here too, even though it's NOT\n # in the docs reserved list (and does not generally require URI escaping,\n # in theory) -- still need to double escape it to avoid YBoss returning\n # ' in suggestions! \n #\n # Do not need to double escape spaces even though they do need URI escaping. \n #\n # We are telling it ONLY to escape our list of punctuation that causes\n # trouble for YBoss unless double-escaped. Which means it won't escape\n # diacritics and other non-latin. Which means the output is still UTF8, \n # but ruby URI.escape incorrectly tags it \"ascii\", which causes probelms\n # later with illegal bytes -- so we need to retag as UTF-8 \n return URI.escape(query, \"/?&;:@,$=%\\\"#*<>{}|[]^\\\\`()'\").force_encoding(\"UTF-8\")\n end",
"def escape(str)\n URI.escape str, /[:?\\/']/\nend",
"def escape(string); end",
"def escape(s)\n URI.encode_www_form_component(s)\n end",
"def encodeURI s\n URI.escape s, /[^A-Za-z0-9;,\\/?:@&=+$\\-_.!~*'()#]/\nend",
"def escape(str); end",
"def uri_escape(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')\n end\n end",
"def encoded_url\n CGI.escape(url)\n end",
"def _encode(source)\n source.gsub(' ','_').gsub(/%.<.+?>/) { |match|\n CGI.escape(match[3..-2]).gsub('%', match[1..1])\n }\n end",
"def quoteparam_part(part); part.gsub('&&', \"\\x00\\x00\\x00\").gsub(\"|\", \"\\x00\\x00\"); end",
"def uri_escape_key(string)\n if string.nil?\n nil\n else\n CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~').gsub(\"%2F\", \"/\")\n end\n end",
"def safe_encode(string)\n CGI::escape(string).gsub(/\\+/, '%20')\n end",
"def uri_escape\n CGI.escape(self)\n end",
"def url_encode\n Rack::Utils.escape self\n end",
"def safe_encode value\n value = URI.encode_www_form_component(value).gsub(/\\+/,'%20').gsub(/\\*/,'%2A').gsub(/%7E/,'~')\n end",
"def url_escape(string)\n return '' if string.blank?\n\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\n end",
"def escape_value(value)\n CGI.escape(value.to_s).gsub('%20', '+')\n end",
"def escape(str)\n CGI.escape(str)\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def uri_escape(str)\n str.split(//).map {|c| c.match(URI::UNSAFE) ? sprintf('%%%02x',c.ord).upcase : c }.join\nend",
"def u(str)\n CGI.escape(str)\n end",
"def encode_param text\n CGI::escape(text).gsub(\"+\", \"%20\").gsub(\"%\", \"%25\")\n end",
"def uri_escape(uri)\n URI::DEFAULT_PARSER.escape(uri).gsub('[', '%5B').gsub(']', '%5D')\n end",
"def e(value)\n CGI.escape(value)\n end",
"def urlencode\n #URI.escape(self)\n _rfc2396_parser.escape(self)\n end",
"def escape(value)\n URI.escape(value, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def escape(str)\n str.to_s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\").force_encoding('US-ASCII')\n end",
"def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end",
"def escape_query_value(s)\n s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/u) {\n '%'+$1.unpack('H2'*bytesize($1)).join('%').upcase\n }.tr(' ', '+')\n end",
"def escapeRFC3986(str)\r\n return URI.escape(str, /[^A-Za-z0-9\\-_.~]/)\r\nend",
"def xml_escape(input); end",
"def escape(string)\n string.gsub(/([\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '_')\n end",
"def encode(string)\n URI.escape(string)\n end",
"def url_utf8(raw_url)\n URI::escape(raw_url)\n end",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\nend",
"def escape(input); input.to_s.gsub('\"', '\\\\\"'); end",
"def escape_characters(string)\n ['&','-','?','|','!',\"'\",'+'].each do |syn_char|\n string = string.gsub(syn_char,'\\\\\\\\' + \"#{syn_char}\")\n end\n return string\n end",
"def escape(s)\n s.gsub(/[&<>`]/, \"&\" => \"&\", \"<\" => \"<\", \">\" => \">\", \"`\" => \"`\")\n end",
"def full_escape str\n str = str.gsub(\"+\",\"%2B\")\n str = ERB::Util.url_encode(str)\n\n if str[0] && str[0] == \".\"\n str = \"%2E\" + str[1..-1]\n end\n\n str\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def url_encode(string) \r\n encoded_string = ''\r\n string.each_char do |char|\r\n char = (\"%%%02X\" % char.ord) if char.match(/[A-Za-z0-9]/) == nil\r\n encoded_string << char\r\n end\r\n return encoded_string\r\n end",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end",
"def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end",
"def h(str)\n URI.escape(str)\n end",
"def escape(string)\n #This is a stub, used for indexing\n end",
"def percent_encoded_raw_user_search_query\n CGI.escape(@q)\n end",
"def uri_encode(text)\n URI.escape(text, Regexp.new(\"[^#{URI::PATTERN::UNRESERVED}]\"))\n end",
"def escape(str)\n str.gsub(' ', '%20')\n end",
"def safe(str)\n CGI.unescape(str)\n end",
"def escape(s)\n s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {\n '%' + $1.unpack('H2' * bytesize($1)).join('%').upcase\n }.tr(' ', '+')\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def esc(word)\n word.gsub(\"&\", \"&\").gsub(\"<\", \"<\")\n end",
"def escape(str)\n str.to_s.gsub(/[^*\\-.0-9A-Z_a-z]/) { |c| TBLENCWWWCOMP_[c] }\n end",
"def percent_encode(str)\n # Replaced deprecated URI.escape with CGI.escape\n # CGI.escape replaces spaces with \"+\", so we also need to substitute them with \"%20\"\n CGI.escape(str).gsub('+', '%20')\n end",
"def escape_special_chars(data)\n data = data.dup\n data.gsub! /&/n , \"&\"\n data.gsub! /\\\"/n , \""\"\n data.gsub! />/n , \">\"\n data.gsub! /</n , \"<\"\n data.gsub! /'/ , \"'\"\n return data\n end",
"def fn_convt(url)\n\tCGI.escape(url.gsub(/\\//,'_').gsub(/:|\\./,'_').scan(/http(.*)/)[0][0])\nend",
"def set_url_params_non_cgi_esc(params)\n if params\n params_str = Array.new\n params.each do |key, value|\n params_str.push(\"#{key}=#{value}\")\n end\n self << \"?\" << params_str.join(\"&\")\n end\n self\n end",
"def escape(string)\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\t\n\tend",
"def consume_escaped; end",
"def erb_escape(text)\n # Do not only replace '<%' ! or <r:t>min</r:t>% ==> <% ...\n text.gsub(SECURE_REGEXP) {|code| SAFE_CODE[code]}\n end",
"def url_escape_gbk(str)\r\n ind = str.index('subitem')\r\n str[0...ind] + URI.escape(str[ind..-1])\r\nend",
"def escape(s)\n s.to_s.gsub(\"+\", \"%2B\")\n end",
"def escape_content\n content.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\") \n end",
"def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end",
"def escape_query(query)\n # backslash escape doesn't seem to work\n #query.gsub(/([\\\\\\(\\)\\:])/) do |match|\n # \"\\\\#{$1}\"\n #end\n query.gsub(/([\\\\\\(\\)\\:])/, ' ')\n end",
"def fix_double_escape(escaped)\n escaped.gsub(/&([a-z]+|(#\\d+));/i) { \"&#{$1};\" }\n end",
"def escape_custodian_for_search(custodian)\n\treturn custodian.encode(\"utf-8\")\n\t\t.gsub(\"\\\\\",\"\\\\\\\\\\\\\") #Escape \\\n\t\t.gsub(\"?\",\"\\\\?\") #Escape ?\n\t\t.gsub(\"*\",\"\\\\*\") #Escape *\n\t\t.gsub(\"\\\"\",\"\\\\\\\"\") #Escape \"\n\t\t.gsub(\"\\u201C\".encode(\"utf-8\"),\"\\\\\\u201C\".encode(\"utf-8\")) #Escape left smart quote\n\t\t.gsub(\"\\u201D\".encode(\"utf-8\"),\"\\\\\\u201D\".encode(\"utf-8\")) #Escape right smart quote\n\t\t.gsub(\"'\",\"\\\\\\\\'\") #Escape '\n\t\t.gsub(\"{\",\"\\\\{\")\n\t\t.gsub(\"}\",\"\\\\}\")\nend",
"def escape(string)\n return \"\" if string.nil?\n string = ':' + string.to_s if string.kind_of? Symbol\n string.gsub(\"\\\\\", \"\\\\\\\\\").gsub(\"&\", \"\\&\").gsub(\":\", \"\\:\").gsub(\"/\", \"\\/\")\n end",
"def escape_redirect(url)\n uri = URI.parse(url)\n \"\".html_safe + uri.path + '?' + uri.query.html_safe\n end",
"def escape_text(text)\n text\n end",
"def escape_sitemap_url(url)\n CGI::escape(url)\n end",
"def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") \n end",
"def escape(string)\n string.gsub(/([^a-zA-Z0-9_.\\-~\\/]+)/) {\n \"%\" + $1.unpack(\"H2\" * $1.bytesize).join(\"%\").upcase\n }\n end",
"def parse_escaped_chars; end",
"def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.~]/n) { |m|\n sprintf(\"%%%02X\", m.unpack1(\"C\"))\n }\n end",
"def url_encode(s)\n s.to_s.b.gsub(/[^a-zA-Z0-9_\\-.]/n) { |m|\n sprintf(\"%%%02X\", m.unpack(\"C\")[0])\n }\n end",
"def escape(string)\n encoding = string.encoding\n string.b.gsub(/([^ a-zA-Z0-9_.\\-~]+)/) do |m|\n '%' + m.unpack('H2' * m.bytesize).join('%').upcase\n end.tr(' ', '+').force_encoding(encoding)\n end",
"def encode_spaces_in_uri str\n (str.include? ' ') ? (str.gsub ' ', '%20') : str\n end",
"def url_encode(h); h.map { |k,v| \"openid.#{Rack::Utils.escape(k)}=#{Rack::Utils.escape(v)}\" }.join('&') end",
"def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end",
"def term(req)\n CGI.escapeHTML(req.params['q'])\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end",
"def escape(string)\r\n # Globally replace characters based on the ESCAPE_CHARACTERS constant\r\n string.to_s.gsub(/[&\"><]/) { |special| ESCAPE_CHARACTERS[special] } if string\r\n end"
] |
[
"0.7766201",
"0.7629957",
"0.7440827",
"0.70544904",
"0.70077366",
"0.7001111",
"0.69713885",
"0.6958147",
"0.68568796",
"0.68485373",
"0.6837421",
"0.6821976",
"0.68179744",
"0.6746517",
"0.67192465",
"0.67021126",
"0.669054",
"0.66335946",
"0.66237587",
"0.6602335",
"0.65922916",
"0.6591428",
"0.6590674",
"0.6548731",
"0.64713985",
"0.64637583",
"0.64625823",
"0.64625823",
"0.6435374",
"0.64287966",
"0.64041555",
"0.637838",
"0.6373187",
"0.63688135",
"0.6348391",
"0.6306404",
"0.630606",
"0.62962514",
"0.6293066",
"0.62406784",
"0.6227028",
"0.61986285",
"0.61892724",
"0.61876917",
"0.6184204",
"0.6184021",
"0.6174847",
"0.6154646",
"0.6154646",
"0.61260146",
"0.61260146",
"0.61161774",
"0.6098223",
"0.609687",
"0.60960793",
"0.60908496",
"0.6064677",
"0.60425246",
"0.60418373",
"0.60357136",
"0.6029663",
"0.6026526",
"0.601749",
"0.60116374",
"0.60075974",
"0.60041475",
"0.59825134",
"0.5981593",
"0.5980422",
"0.5978969",
"0.5977747",
"0.5975635",
"0.5974753",
"0.59725857",
"0.5968311",
"0.5966552",
"0.5964862",
"0.5963475",
"0.5958189",
"0.5956323",
"0.59552073",
"0.5949794",
"0.5946973",
"0.5944653",
"0.5936217",
"0.592265",
"0.5920476",
"0.5913794",
"0.59135693",
"0.5910602",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367",
"0.5909367"
] |
0.6133315
|
49
|
GET /boats GET /boats.json
|
def index
if params[:search].present? and !params[:search].empty?
@search_location = params[:search]
@boats = Boat.complete.near(search_params, 20, unit: :km, order: 'distance').select(&:can_be_published?)
@search_results_count = @boats.size # count doesn't work with near
if @boats.empty?
@boats = Boat.complete.near(search_params, 99999, unit: :km, order: 'distance').select(&:can_be_published?)
@boats = Boat.all if @boats.empty?
end
else
@boats = Boat.complete.all.select(&:can_be_published?)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n @boats = Boat.all\n end",
"def index\n @boats = Boat.all\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n #@boats = Boat.order(sort_column + ' ' + sort_direction)\n # @boats = Boat.all\n # if params[:search]\n @boats = Boat.search(params[:search])\n # else\n # @boats = Boat.order(sort_column + ' ' + sort_direction)\n # end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boats }\n end\n end",
"def index\n @kind_of_boats = KindOfBoat.all\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def show\n @company = Company.find(params[:id])\n @company_boats = @company.boats\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end",
"def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end",
"def index\n\t\tboats = Assignment.all\n \trender json: boats, status: 200\n\tend",
"def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\n end\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def index\n @chats = Chat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chats }\n end\n end",
"def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n @dockyard_spot = DockyardSpot.find_by_boat_id(@boat.id)\n @dockyard = Dockyard.find(@dockyard_spot.dockyard_id) unless @dockyard_spot.nil?\n @berth = Berth.where(:boat_id => @boat.id).first\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boat }\n end\n end",
"def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end",
"def index\n @boks = Bok.all\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @boats_assigned = @job.boats\n @boats = Boat.all\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend",
"def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end",
"def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end",
"def index\n @lobbies = Lobby.all\n\n respond_with @lobbies, {:except => [:id, :user_id]}\n end",
"def index\n @boats = Boat.all\n #filtering, may suffer from SQL injection.\n #https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/\n @boats = @boats.state(params[:state]) if params[:state].present?\n @boats = @boats.city(params[:city]) if params[:city].present?\n @boats = @boats.capacity(params[:capacity]) if params[:capacity].present?\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end",
"def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end",
"def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end",
"def index\n @chats = Chat.all\n render json: {\n messages: \"Request Successfull!\",\n is_success: true,\n data: { chats: @chats }\n }\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def index\n @my_boices = MyBoice.all\n end",
"def index\n # only list current user's hangouts\n @hangouts = current_user.hangouts.order(\"start_date_time DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hangouts }\n end\n end",
"def index\n @bikes = current_user.bikes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bikes }\n end\n end",
"def index\n @meats = Meat.all\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end",
"def index\n @at_bats = AtBat.all\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def index\n\t\tif @boat.present?\n\t\t\tadd_breadcrumb(@boat.name, boat_path(@boat)) if current_user_present?\n\t\t\tif @booking.present? # for booking's reviews [path: /boats/:boat_id/bookings/:booking_id/reviews]\n\t\t\t\tadd_breadcrumb _(\"Bookings\"), boat_bookings_path(@boat) if can? :edit, @boat\n\t \tadd_breadcrumb @booking.title, boat_booking_path(@boat, @booking)\n\t\t\t\t@reviews = @booking.reviews\n\t\t\telse # for boat's reviews [path: /boats/:boat_id/reviews]\n\t\t\t\t@reviews = @boat.reviews\n\t\t\tend\n\t\telse # for current_user's reviews [path: /reviews]\n\t\t\tauthenticate_user!\n\t\t\t@sent_reviews = current_user.sent_reviews\n\t\t\t@received_reviews = current_user.received_reviews\n\t\t\t@reviews = @sent_reviews + @received_reviews\n\t\tend\n\tend",
"def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @basketball = Basketball.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basketball }\n end\n end",
"def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end",
"def index\n @coats = Coat.all\n end",
"def get_battery\n if params[:building].present?\n @batteries = Building.find(params[:building]).batteries\n else\n @batteries = Building.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {batteries: @batteries}\n }\n end\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend",
"def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end",
"def show\n render json: @bid\n end",
"def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def bid_lists\n\t\tauction_item_bids = @auction.auction_item_bids.where(user_id: current_user.id)\n\t\trender json: @auction_item_bids.as_json\n\tend",
"def index\n @boat_attachments = BoatAttachment.all\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def show\n @bubble_tea = BubbleTea.find(params[:id])\n render json: @bubble_tea\n end",
"def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end",
"def index\n 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 @activities = Activity.all\n render json: @activities\n end",
"def index\n @beats = Beat.all\n end",
"def index\n @bets = Bet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bets }\n end\n end",
"def index\n @bancos = Banco.all\n end",
"def index\n render json: Bill.all\n end",
"def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end",
"def battery\n if params[:building].present?\n @battery = Battery.where(building_id:params[:building])\n else\n @battery = Battery.all\n end\n\n respond_to do |format|\n format.json {\n render json: {battery: @battery}\n }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"def index\n @ballots = Ballot.all\n end",
"def index\n @ballots = Ballot.all\n end",
"def index\n @friends = Friend.all\n render json: @friends\n end"
] |
[
"0.7905412",
"0.7756258",
"0.7506124",
"0.72863954",
"0.72863954",
"0.72091883",
"0.6894622",
"0.6795003",
"0.679307",
"0.6743202",
"0.6687222",
"0.66762817",
"0.6672628",
"0.65975404",
"0.6589081",
"0.6501594",
"0.6459849",
"0.6435166",
"0.6421407",
"0.63603795",
"0.633779",
"0.63266474",
"0.6322046",
"0.6286666",
"0.6278641",
"0.627611",
"0.6264374",
"0.6253274",
"0.62447846",
"0.6238766",
"0.6231841",
"0.62236845",
"0.62234473",
"0.62172496",
"0.62032413",
"0.6201334",
"0.61983037",
"0.6196961",
"0.6186233",
"0.61848336",
"0.6173338",
"0.61729693",
"0.6172412",
"0.6172412",
"0.6172412",
"0.617128",
"0.6169706",
"0.61482716",
"0.6147134",
"0.6146473",
"0.6145919",
"0.6143576",
"0.61208296",
"0.60848755",
"0.60751206",
"0.6071576",
"0.60713136",
"0.60608274",
"0.6048395",
"0.6046534",
"0.6039696",
"0.6029259",
"0.6026041",
"0.60132366",
"0.60045063",
"0.6002597",
"0.60010105",
"0.5997265",
"0.5997042",
"0.598969",
"0.5987753",
"0.59820426",
"0.5980784",
"0.5977638",
"0.5973158",
"0.5970363",
"0.59694874",
"0.5969449",
"0.59669757",
"0.59663093",
"0.59656",
"0.59605116",
"0.59514827",
"0.5942494",
"0.5941447",
"0.59223586",
"0.59195733",
"0.5918621",
"0.591736",
"0.59124595",
"0.5910074",
"0.5903916",
"0.5903151",
"0.5895276",
"0.58952045",
"0.5893708",
"0.5890409",
"0.5887605",
"0.5886871",
"0.5886871",
"0.5885537"
] |
0.0
|
-1
|
GET /boats/1 GET /boats/1.json
|
def show
@booking = @boat.bookings.build(user: current_user)
@booking.start_time = Time.zone.tomorrow + 9.hours
@booking.end_time = Time.zone.tomorrow + 18.hours
@booking.people_on_board = 1
#TODO disable also booked(accepted) days
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end",
"def index\n @boats = Boat.all\n end",
"def index\n @boats = Boat.all\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n @dockyard_spot = DockyardSpot.find_by_boat_id(@boat.id)\n @dockyard = Dockyard.find(@dockyard_spot.dockyard_id) unless @dockyard_spot.nil?\n @berth = Berth.where(:boat_id => @boat.id).first\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boat }\n end\n end",
"def show\n @company = Company.find(params[:id])\n @company_boats = @company.boats\n end",
"def index\n @kind_of_boats = KindOfBoat.all\n end",
"def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat }\n end\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def index\n #@boats = Boat.order(sort_column + ' ' + sort_direction)\n # @boats = Boat.all\n # if params[:search]\n @boats = Boat.search(params[:search])\n # else\n # @boats = Boat.order(sort_column + ' ' + sort_direction)\n # end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boats }\n end\n end",
"def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end",
"def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def index\n\t\tboats = Assignment.all\n \trender json: boats, status: 200\n\tend",
"def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end",
"def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end",
"def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end",
"def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end",
"def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\n end\n end",
"def show\n @job = Job.find(params[:id])\n @boats_assigned = @job.boats\n @boats = Boat.all\n end",
"def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end",
"def show\n @basketball = Basketball.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basketball }\n end\n end",
"def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def show\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boy }\n end\n end",
"def show\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beat }\n end\n end",
"def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end",
"def index\n @boks = Bok.all\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def index\n @batting_lines = BattingLine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batting_lines }\n end\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def show\n @bubble_tea = BubbleTea.find(params[:id])\n render json: @bubble_tea\n end",
"def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end",
"def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end",
"def index\n @lobbies = Lobby.all\n\n respond_with @lobbies, {:except => [:id, :user_id]}\n end",
"def index\n @birds = Bird.where(visible: true)\n render json: @birds, status: 200\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end",
"def show\n render json: @bid\n end",
"def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\n end\n end",
"def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end",
"def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend",
"def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end",
"def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end",
"def index\n @my_boices = MyBoice.all\n end",
"def battery\n if params[:building].present?\n @battery = Battery.where(building_id:params[:building])\n else\n @battery = Battery.all\n end\n\n respond_to do |format|\n format.json {\n render json: {battery: @battery}\n }\n end\n end",
"def show\n @bill = Bill.find(params[:id])\n\n render json: @bill\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def show\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weibo }\n end\n end",
"def show\n @batting_line = BattingLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batting_line }\n end\n end",
"def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end",
"def show\n @bet = Bet.find_all_by_id(params[:id])\n # session[\"last_bet_id\"] = @bet.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\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 current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def index\n @boats = Boat.all\n #filtering, may suffer from SQL injection.\n #https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/\n @boats = @boats.state(params[:state]) if params[:state].present?\n @boats = @boats.city(params[:city]) if params[:city].present?\n @boats = @boats.capacity(params[:capacity]) if params[:capacity].present?\n end",
"def index\n @chats = Chat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chats }\n end\n end",
"def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def show\n @lobby = Lobby.find_by_id_str(params[:id])\n\n respond_with @lobby, {:except => [:id, :user_id]}\n end",
"def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end",
"def show\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bagtype }\n end\n end"
] |
[
"0.7809086",
"0.7719782",
"0.7498109",
"0.7456902",
"0.7159893",
"0.7159893",
"0.6808315",
"0.6722324",
"0.66718364",
"0.66601306",
"0.6596522",
"0.6591887",
"0.6546317",
"0.65167475",
"0.65091014",
"0.6507481",
"0.64649594",
"0.6461716",
"0.6444277",
"0.6404183",
"0.6393024",
"0.6369141",
"0.6343522",
"0.6339966",
"0.63325685",
"0.6319634",
"0.63158756",
"0.6315355",
"0.63065475",
"0.63010454",
"0.62888813",
"0.62228966",
"0.62228376",
"0.62159806",
"0.6192935",
"0.6174091",
"0.6174091",
"0.6170132",
"0.61683184",
"0.6161931",
"0.61525303",
"0.6145916",
"0.6134083",
"0.6133052",
"0.6132306",
"0.61267006",
"0.61244375",
"0.60918456",
"0.60879254",
"0.60875666",
"0.60871387",
"0.6086052",
"0.6084615",
"0.60764545",
"0.60764545",
"0.60764545",
"0.60666525",
"0.60631984",
"0.606042",
"0.6045671",
"0.6039802",
"0.60382766",
"0.60313237",
"0.6030821",
"0.602962",
"0.6027632",
"0.6025644",
"0.60215795",
"0.6007168",
"0.60032177",
"0.60013556",
"0.60002816",
"0.59911084",
"0.5983827",
"0.59833884",
"0.59807384",
"0.5978753",
"0.5978753",
"0.5978753",
"0.5978753",
"0.59775925",
"0.59768736",
"0.5976622",
"0.5975668",
"0.5975668",
"0.5975668",
"0.5973385",
"0.5970765",
"0.59549475",
"0.5946231",
"0.5945766",
"0.59422827",
"0.59402233",
"0.5930311",
"0.59120965",
"0.5906797",
"0.5905743",
"0.59047747",
"0.5903664",
"0.5902871",
"0.5901843"
] |
0.0
|
-1
|
POST /boats POST /boats.json
|
def create
@boat = current_user.boats.build(boat_params)
@boat.create_boat_features_set
respond_to do |format|
if @boat.save
format.html { redirect_to edit_boat_path(@boat), notice: _("Boat was successfully created") }
format.json { render :edit, status: :created, location: @boat }
else
# pictures must be rebuilt to make the field appear in the form
@boat.pictures.build unless @boat.pictures.any?
format.html { render :new }
format.json { render json: @boat.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend",
"def create\n @boat = Boat.new(boat_params)\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n format.json { render :show, status: :created, location: @boat }\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = @harbour.boats.build(boat_params)\n @boat.save\n redirect_to harbour_boats_path(@harbour)\n # respond_to do |format|\n # if @boat.save\n # format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n # else\n # format.html { render :new }\n # format.json { render json: @boat.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @boat = Boat.new(boat_params)\n @boat.user_id = current_user.id\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n format.js\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @new_boat = Boat.create(\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n )\n\n\n\n if @new_boat\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :new)\n end\n end",
"def create\n begin\n @boat = Boat.new(params[:boat])\n @boat.save!\n flash[:notice] = \"New boat created\"\n rescue Exception => e\n RAILS_DEFAULT_LOGGER.info \"error creating boat: #{e}\"\n flash[:error] = \"Unable to create boat: #{e}\"\n end\n\n return redirect_to(:action => :index)\n end",
"def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"def create\n @kind_of_boat = KindOfBoat.new(kind_of_boat_params)\n\n respond_to do |format|\n if @kind_of_boat.save\n format.html { redirect_to @kind_of_boat, notice: 'Kind of boat was successfully created.' }\n format.json { render :show, status: :created, location: @kind_of_boat }\n else\n format.html { render :new }\n format.json { render json: @kind_of_boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bounty = Bounty.new(bounty_params)\n\n respond_to do |format|\n if @bounty.save\n format.html { redirect_to @bounty, notice: 'Bounty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bounty }\n else\n format.html { render action: 'new' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat = Boat.new(boat_params)\n @boat.user_id = current_user.id\n if @boat.save\n redirect_to boats_path\n else\n redirect_to new_boat_path, :notice => \"Please ensure that your boat name is unique (boat names are case sensitive), that your boat's max capacity is at least 1, and that you have selected a location\"\n end\n\n end",
"def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end",
"def create\n @at_bat.attributes = params[:at_bat]\n\n respond_to do |format|\n format.js do \n render :update do |page|\n # use transaction to rollback any changes in the event of an exception with redis\n AtBat.transaction do\n # assumes everything is going to be saved correctly because there are no validations\n @at_bat.save\n page.insert_html :top, \"at_bats\", :partial => 'at_bats/at_bat', :locals => { :at_bat => @at_bat }\n end\n end\n end\n end\n end",
"def create\n @my_boice = MyBoice.new(my_boice_params)\n\n respond_to do |format|\n if @my_boice.save\n format.html { redirect_to @my_boice, notice: 'My boice was successfully created.' }\n format.json { render :show, status: :created, location: @my_boice }\n else\n format.html { render :new }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n eqs = []\n puts params\n params[:boat][:equipments].each do |i|\n eqs << Equipment.find(i)\n end\n params[:boat][:equipments] = eqs\n @boat = Boat.new(params[:boat])\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to(@boat, :notice => 'Boat was successfully created.') }\n format.xml { render :xml => @boat, :status => :created, :location => @boat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @batter = Batter.new(batter_params)\n\n respond_to do |format|\n if @batter.save\n format.html { redirect_to @batter, notice: 'Batter was successfully created.' }\n format.json { render :show, status: :created, location: @batter }\n else\n format.html { render :new }\n format.json { render json: @batter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def boat_params\n params.require(:boat).permit(:name, :containers, :location)\n end",
"def create\n @boat = Boat.new(boat_params)\n\n respond_to do |format|\n if @boat.save\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully created.'}\n format.json {render json: @boat, status: :created, location: @boat}\n else\n format.html {render action: \"new\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @boats_arr = Boat.all\n @new_job = Job.create(\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n )\n# params for checkbox when creating new job\n params[:boat][:boat_ids].each do |boat_id|\n @id = boat_id.to_i\n @new_job.boats << Boat.find(@id)\n end\n\n\n if @new_job\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :new)\n end\n\n\n end",
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bet = Bet.new(params[:bet])\n\n respond_to do |format|\n if @bet.save\n format.html { redirect_to @bet, notice: 'Bet was successfully created.' }\n format.json { render json: @bet, status: :created, location: @bet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo_game = BingoGame.create(numbers: BingoNumber.all.shuffle.to_json, index: -1, current_number: nil)\n content = { 'id': '', 'instruction': 'Waiting to start'}\n ActionCable.server.broadcast 'bingo', content: content\n\n respond_to do |format|\n if @bingo_game.save\n format.html { redirect_to @bingo_game, notice: 'bingo game was successfully created.' }\n format.json { render json: @bingo_game, status: :created, location: @bingo_game }\n else\n format.html { render action: \"index\" }\n format.json { render json: @bingo_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.created', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def index\n @boats = Boat.all\n end",
"def index\n @boats = Boat.all\n end",
"def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goat = Goat.new(params[:goat])\n\n respond_to do |format|\n if @goat.save\n format.html { redirect_to @goat, notice: 'Goat was successfully created.' }\n format.json { render json: @goat, status: :created, location: @goat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bacon = Bacon.new(bacon_params)\n\n respond_to do |format|\n if @bacon.save\n format.html { redirect_to @bacon, notice: 'Bacon was successfully created.' }\n format.json { render json: { bacon: @bacon }}\n else\n format.html { render action: 'new' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"def create\n booking = Booking.create(booking_params)\n render json: booking\n end",
"def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @betting = Betting.new(betting_params)\n\n respond_to do |format|\n if @betting.save\n format.html { redirect_to @betting, notice: 'Betting was successfully created.' }\n format.json { render :show, status: :created, location: @betting }\n else\n format.html { render :new }\n format.json { render json: @betting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boat_params\n params.require(:boat).permit(:name, :image)\n end",
"def create\n #@buddy = Buddy.new(buddy_params)\n @buddy = current_user.buddies.build(buddy_params)\n\n respond_to do |format|\n if @buddy.save\n format.html { redirect_to @buddy, notice: \"Buddy was successfully created.\" }\n format.json { render :show, status: :created, location: @buddy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boleta = Boleta.new(boleta_params)\n\n respond_to do |format|\n if @boleta.save\n format.html { redirect_to @boleta, notice: 'Boleta was successfully created.' }\n format.json { render :show, status: :created, location: @boleta }\n else\n format.html { render :new }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bet = Bet.new(bet_params)\n\n respond_to do |format|\n if @bet.save\n format.html { redirect_to @bet, notice: 'Bet was successfully created.' }\n format.json { render :show, status: :created, location: @bet }\n else\n format.html { render :new }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ballot = Ballot.new(ballot_params)\n\n respond_to do |format|\n if @ballot.save\n format.html { redirect_to ballots_url, notice: 'Thank you for voting.' }\n format.json { render :show, status: :created, location: @ballot }\n else\n format.html { render :new }\n format.json { render json: @ballot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boat_params\n params.require(:boat).permit(:name, :capacity, :size, :price_per_day, :description, :picture)\n end",
"def create\n @bowl = Bowl.new(params[:bowl])\n \n # set the current user's id and the creation time for this bowl\n @bowl.user_id = session[:user].userid.to_i\n @bowl.created = Time.now\n \n respond_to do |format|\n if @bowl.save\n\n Rails.logger.info \"Adding contents for bowl\"\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n \n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully created.' }\n format.json { render :json => @bowl, :status => :created, :location => @bowl }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @blivot = Blivot.new(blivot_params)\n\n respond_to do |format|\n if @blivot.save\n format.html { redirect_to @blivot, notice: 'Blivot was successfully created.' }\n format.json { render :show, status: :created, location: @blivot }\n else\n format.html { render :new }\n format.json { render json: @blivot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:bet][:user_id] = current_user.id\n @bet = Bet.new(bet_params)\n\n respond_to do |format|\n if @bet.save\n format.html { redirect_to @bet, notice: 'Bet was successfully created.' }\n format.json { render :show, status: :created, location: @bet }\n else\n format.html { render :new, status: 422 }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat_attachment = BoatAttachment.new(boat_attachment_params)\n\n respond_to do |format|\n if @boat_attachment.save\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully posted.' }\n format.json { render :show, status: :created, location: @boat_attachment }\n else\n format.html { render :new }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @berth_order = BerthOrder.new\n @berth_order.status = Status.find_by(status: \"Under behandling\")\n if berth_order_params[\"boat_id\"].blank?\n @boat = Boat.new\n @boat.name = params[:boat][:name]\n @boat.width = params[:boat][:width].gsub(',', '.')\n @boat.user = current_user\n @boat.save\n @berth_order.boat = @boat\n else\n @berth_order.boat_id = berth_order_params[:boat_id]\n end\n\n @berth_order.season_id = berth_order_params[:season_id]\n\n #.. And finally:\n respond_to do |format|\n if @berth_order.save\n format.html { redirect_to @berth_order, notice: 'Berth order was successfully created.' }\n format.json { render :show, status: :created, location: @berth_order }\n else\n format.html { render :new }\n format.json { render json: @berth_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat_document = BoatDocument.new(boat_document_params)\n\n respond_to do |format|\n if @boat_document.save\n format.html { redirect_to @boat_document, notice: 'Boat document was successfully created.' }\n format.json { render :show, status: :created, location: @boat_document }\n else\n format.html { render :new }\n format.json { render json: @boat_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to @banco, notice: 'Banco fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render json: @banco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend",
"def create\n @borad = Borad.new(params[:borad])\n\n respond_to do |format|\n if @borad.save\n format.html { redirect_to @borad, :notice => 'Borad was successfully created.' }\n format.json { render :json => @borad, :status => :created, :location => @borad }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @buffet = Buffet.new(buffet_params)\n\n respond_to do |format|\n if @buffet.save\n format.html { redirect_to @buffet, notice: 'Buffet was successfully created.' }\n format.json { render :show, status: :created, location: @buffet }\n else\n format.html { render :new }\n format.json { render json: @buffet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stationary_batteries_battery_bank = StationaryBatteriesBatteryBank.new(stationary_batteries_battery_bank_params)\n\n respond_to do |format|\n if @stationary_batteries_battery_bank.save\n format.html { redirect_to @stationary_batteries_battery_bank, notice: 'Stationary batteries battery bank was successfully created.' }\n format.json { render :show, status: :created, location: @stationary_batteries_battery_bank }\n else\n format.html { render :new }\n format.json { render json: @stationary_batteries_battery_bank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boat_params\n params.require(:boat).permit(\n :name, :address, :capacity, :description,\n :model, :gender, :price, :city, photos: []\n )\n end",
"def create\n @boat = Boat.new(boat_params)\n @boat.owner_name = current_user.first_name + ' ' + current_user.last_name\n @boat.ownerid = current_user.id\n @boat.file_link = params[:boat][:file_position]\n @boat.video_link = params[:boat][:video_position]\n\n respond_to do |format|\n\n if @boat.save\n params[:boat_attachments]['image'].each do |a|\n @boat_attachment = @boat.boat_attachments.create!(:image => a)\n end\n #below notice will cause strange position for rent button, will fix this later\n #format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n format.html { redirect_to @boat}\n format.json { render :show, status: :created, location: @boat }\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @boite = Boite.new(boite_params)\n\n respond_to do |format|\n if @boite.save\n format.html { redirect_to @boite, notice: 'Boite was successfully created.' }\n format.json { render :show, status: :created, location: @boite }\n else\n format.html { render :new }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boy = Boy.new(params[:boy])\n\n respond_to do |format|\n if @boy.save\n format.html { redirect_to @boy, notice: 'Boy was successfully created.' }\n format.json { render json: @boy, status: :created, location: @boy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boy = Boy.new(params[:boy])\n\n respond_to do |format|\n if @boy.save\n format.html { redirect_to @boy, notice: 'Boy was successfully created.' }\n format.json { render json: @boy, status: :created, location: @boy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def create\n @balada = Balada.new(balada_params)\n\n respond_to do |format|\n if @balada.save\n format.html { redirect_to @balada, notice: 'Balada was successfully created.' }\n format.json { render :show, status: :created, location: @balada }\n else\n format.html { render :new }\n format.json { render json: @balada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bitch = Bitch.new(bitch_params)\n\n respond_to do |format|\n if @bitch.save\n format.html { redirect_to @bitch, notice: 'Bitch was successfully created.' }\n format.json { render :show, status: :created, location: @bitch }\n else\n format.html { render :new }\n format.json { render json: @bitch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bourbon = Bourbon.new(bourbon_params)\n\n respond_to do |format|\n if @bourbon.save\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bourbon }\n else\n format.html { render action: 'new' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boat_params\n params.require(:boat).permit(:ownerid, :name, :width, :depth, :height, :water, :capacity, :state, :city, :description, :available_date, :price, :location, :video, boat_attachments_attributes: [:id, :boat_id, :image])\n end",
"def create\n @brave_burst = BraveBurst.new(brave_burst_params)\n\n respond_to do |format|\n if @brave_burst.save\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully created.' }\n format.json { render action: 'show', status: :created, location: @brave_burst }\n else\n format.html { render action: 'new' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end",
"def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: \"Baby was successfully created.\" }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @boat_type = BoatType.new(boat_type_params)\n respond_to do |format|\n if @boat_type.save\n format.html { redirect_to edit_boat_type_path(@boat_type)}\n format.json { render json: @boat_type.hash_view('control'), status: :created, location: @boat_type }\n else\n format.html { render :new }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def create\n @bb = Bb.new(params[:bb])\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render json: @bb, status: :created, location: @bb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baby = Baby.new(baby_params)\n\n respond_to do |format|\n if @baby.save\n format.html { redirect_to @baby, notice: 'Baby was successfully created.' }\n format.json { render :show, status: :created, location: @baby }\n else\n format.html { render :new }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to bancos_url, notice: 'Banco was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @cat_blok = CatBlok.new(cat_blok_params)\n\n respond_to do |format|\n if @cat_blok.save\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully created.' }\n format.json { render :show, status: :created, location: @cat_blok }\n else\n format.html { render :new }\n format.json { render json: @cat_blok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bloque = Bloque.new(params[:bloque])\n\n if @bloque.save\n render json: @bloque, status: :created, location: @bloque\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end",
"def create\n #birdspotter id must be present\n if params[:birdspotter].blank?\n render json: {\n status: 400,\n message: \"Skaparens id saknas.\" \n }\n end\n \n #at least one bird must be present\n if params[:bird].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla minst en fågel.\" \n }\n end\n \n #latitude and longitude must be present\n if params[:latitude].blank? || params[:longitude].blank?\n render json: {\n status: 400,\n message: \"En birdspot måste innehålla latitud och longitude.\" \n }\n end\n \n #check if birdspotter exists\n if Api::V1::Birdspotter.exists?(params[:birdspotter])\n \n #if exists find birdspotter\n @birdspotter = Api::V1::Birdspotter.find_by_id(params[:birdspotter])\n \n #create a new spot and append to birdspotter\n @spot = Api::V1::Spot.create(:latitude => params[:latitude], :longitude => params[:longitude])\n if @spot.save\n @birdspotter.spots << @spot\n \n #iterate through all birds and append each bird to newly created spot\n params[:bird].tr(' ','').split(',').each do |bird_id|\n if Api::V1::Bird.exists?(bird_id)\n @bird = Api::V1::Bird.find_by_id(bird_id)\n @spot.birds << @bird\n else\n render json: {\n status: 404,\n message: \"En eller flera fåglar med det id:t finns inte.\"\n }\n end\n end\n else\n render json: {\n status: 400,\n message: @spot.errors.full_messages \n }\n end\n else\n render json: {\n status: 404,\n message: \"Skapare med det id:t finns inte.\" \n }\n \n end\n \n render json: { \n status: 201,\n message: \"Din birdspot är registerad. Tack!\", \n spots: Api::V1::SpotSerializer.new(@spot) \n }\n end",
"def create\n # @bonu = Bonus.new(bonus_params)\n #\n # if @bonus.save\n # render :show, status: :created, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end",
"def create\n @banned = Banned.new(banned_params)\n\n respond_to do |format|\n if @banned.save\n format.html { redirect_to @banned, notice: 'Banned was successfully created.' }\n format.json { render :show, status: :created, location: @banned }\n else\n format.html { render :new }\n format.json { render json: @banned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @betum = Betum.new(params[:betum])\n\n respond_to do |format|\n if @betum.save\n format.html { redirect_to :back, notice: 'You have been successfully registered!' }\n format.json { render json: @betum, status: :created, location: @betum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @betum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meat = Meat.new(meat_params)\n\n respond_to do |format|\n if @meat.save\n format.html { redirect_to @meat, notice: 'Meat was successfully created.' }\n format.json { render :show, status: :created, location: @meat }\n else\n format.html { render :new }\n format.json { render json: @meat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @billboard = Billboard.new(billboard_params)\n\n respond_to do |format|\n if @billboard.save\n format.html { redirect_to @billboard, notice: 'Billboard was successfully created.' }\n format.json { render :show, status: :created, location: @billboard }\n else\n format.html { render :new }\n format.json { render json: @billboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boat\n @boat = Boat.find(params[:boat_id])\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @biotop = Biotop.new(biotop_params)\n\n respond_to do |format|\n if @biotop.save\n format.html { redirect_to @biotop, notice: 'Biotop was successfully created.' }\n format.json { render :show, status: :created, location: @biotop }\n else\n format.html { render :new }\n format.json { render json: @biotop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @buoy = Buoy.new(buoy_params)\n\n respond_to do |format|\n if @buoy.save\n format.html { redirect_to @buoy, notice: 'Buoy was successfully created.' }\n format.json { render :show, status: :created, location: @buoy }\n else\n format.html { render :new }\n format.json { render json: @buoy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boat_params\n\t\tparams.require(:boat).permit(:capacity, :name)\n\tend",
"def create\n begin\n @bird = Bird.new(bird_params)\n @bird.visible = false if @bird.visible.nil?\n @bird.added = Date.today\n @bird.continents = bird_params[:continents].uniq\n if @bird.save\n render json: @bird, status: :created, location: @bird\n else\n render json: @bird.errors, status: 400\n end\n rescue Exception => e\n render json: \"\", status: 400\n end\n end",
"def create\n @bow = Bow.new(bow_params)\n\n respond_to do |format|\n if @bow.save\n format.html { redirect_to @bow, notice: 'Bow was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bow }\n else\n format.html { render action: 'new' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end",
"def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end",
"def create\n @bowling = Bowling.new(bowling_params)\n\n respond_to do |format|\n if @bowling.save\n format.html { redirect_to @bowling, notice: 'Bowling was successfully created.' }\n format.json { render :show, status: :created, location: @bowling }\n else\n format.html { render :new }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auction = Auction.find(params[:auction_id])\n params[:bid].reverse_merge!({owner_id: current_user.id})\n @bid = @auction.bids.build(params[:bid])\n \n respond_to do |format|\n if @bid.save\n format.html { redirect_to @auction, notice: 'You submitted a bid!'}\n format.json { render json: @bid, status: :created, location: @bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scribble = Scribble.new(params[:scribble])\n @scribble.posted_by_uid=current_user.beamer_id\n @scribble.posted_by=current_user.first_name+\" \"+current_user.last_name\n @scribble.ups=0\n @scribble.downs=0\n respond_to do |format|\n if @scribble.save!\n format.html { redirect_to root_path }\n format.json { render :json => @scribble, :status => :created, :location => @scribble }\n else\n format.html { redirect_to root_path }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end",
"def create\n @bathroom = Bathroom.new(bathroom_params)\n\n respond_to do |format|\n if @bathroom.save\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @repuesto_bolet = RepuestoBolet.new(repuesto_bolet_params)\n\n respond_to do |format|\n if @repuesto_bolet.save\n format.html { redirect_to @repuesto_bolet, notice: 'Repuesto bolet was successfully created.' }\n format.json { render :show, status: :created, location: @repuesto_bolet }\n else\n format.html { render :new }\n format.json { render json: @repuesto_bolet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def create\n @bagtype = Bagtype.new(params[:bagtype])\n\n respond_to do |format|\n if @bagtype.save\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully created.' }\n format.json { render json: @bagtype, status: :created, location: @bagtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7413428",
"0.7193006",
"0.6988092",
"0.6965062",
"0.63574076",
"0.63102376",
"0.6267455",
"0.622307",
"0.6166601",
"0.6127176",
"0.6101744",
"0.60850495",
"0.605931",
"0.6048728",
"0.6020868",
"0.6008816",
"0.6000906",
"0.59235674",
"0.5884312",
"0.5881562",
"0.5802847",
"0.57994163",
"0.5793554",
"0.5785938",
"0.5776275",
"0.5776275",
"0.57720226",
"0.57509065",
"0.5734924",
"0.5734497",
"0.57038546",
"0.5699592",
"0.5688601",
"0.5686041",
"0.56844294",
"0.56841356",
"0.568394",
"0.5681497",
"0.5677631",
"0.56673115",
"0.5663599",
"0.5645588",
"0.56450015",
"0.56446224",
"0.5641757",
"0.5639357",
"0.5635372",
"0.56238633",
"0.56207806",
"0.5618062",
"0.56089926",
"0.560302",
"0.5598468",
"0.5595808",
"0.5595372",
"0.5593103",
"0.5593103",
"0.558951",
"0.5582444",
"0.5561087",
"0.5555712",
"0.55491805",
"0.5540163",
"0.55399656",
"0.55385953",
"0.55355465",
"0.5534584",
"0.5528007",
"0.55239356",
"0.5518334",
"0.5515243",
"0.5512386",
"0.5509083",
"0.5508145",
"0.5502065",
"0.5499194",
"0.549641",
"0.54908496",
"0.5484348",
"0.5483215",
"0.5480947",
"0.547841",
"0.547629",
"0.54742926",
"0.5470583",
"0.5465765",
"0.5455765",
"0.54531133",
"0.5447542",
"0.54403216",
"0.54399997",
"0.5437019",
"0.54352635",
"0.54350007",
"0.543114",
"0.5424242",
"0.542295",
"0.542295",
"0.542295",
"0.54210716"
] |
0.63135606
|
5
|
PATCH/PUT /boats/1 PATCH/PUT /boats/1.json
|
def update
respond_to do |format|
if @boat.update(boat_params)
format.html { redirect_to @boat, notice: _("Boat was successfully updated") }
format.js
format.json { render :show, status: :ok, location: @boat }
else
format.html { render :edit }
format.js
format.json { render json: @boat.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n @boat.update({\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n })\n\n if (@boat)\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :edit)\n end\n end",
"def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kind_of_boat.update(kind_of_boat_params)\n format.html { redirect_to @kind_of_boat, notice: 'Kind of boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @kind_of_boat }\n else\n format.html { render :edit }\n format.json { render json: @kind_of_boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(boat_params)\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n begin\n @boat = Boat.find(params[:id])\n @boat.update_attributes! params[:boat]\n flash[:notice] = \"Boat updated\"\n return redirect_to(:action => :index)\n rescue ActiveRecord::RecordNotFound\n @entry = nil\n flash[:error] = \"Unable to find boat with id #{params[:id]}\"\n return redirect_to(:action => :index)\n rescue Exception => e\n flash[:error] = \"Unable to update boat: #{e}\"\n end\n\n respond_to do |format|\n format.html { render :action => :edit }\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @batter.update(batter_params)\n format.html { redirect_to @batter, notice: 'Batter was successfully updated.' }\n format.json { render :show, status: :ok, location: @batter }\n else\n format.html { render :edit }\n format.json { render json: @batter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n if @goat.update_attributes(params[:goat])\n format.html { redirect_to @goat, notice: 'Goat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat_document.update(boat_document_params)\n format.html { redirect_to @boat_document, notice: 'Boat document was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_document }\n else\n format.html { render :edit }\n format.json { render json: @boat_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boat_attachment.update(boat_attachment_params)\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_attachment }\n else\n format.html { render :edit }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n if @bet.update_attributes(params[:bet])\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end",
"def update\n respond_to do |format|\n if @boleta.update(boleta_params)\n format.html { redirect_to @boleta, notice: 'Boleta was successfully updated.' }\n format.json { render :show, status: :ok, location: @boleta }\n else\n format.html { render :edit }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bitch.update(bitch_params)\n format.html { redirect_to @bitch, notice: 'Bitch was successfully updated.' }\n format.json { render :show, status: :ok, location: @bitch }\n else\n format.html { render :edit }\n format.json { render json: @bitch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end",
"def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.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 @blivot.update(blivot_params)\n format.html { redirect_to @blivot, notice: 'Blivot was successfully updated.' }\n format.json { render :show, status: :ok, location: @blivot }\n else\n format.html { render :edit }\n format.json { render json: @blivot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @baby.update(baby_params)\n format.html { redirect_to @baby, notice: 'Baby was successfully updated.' }\n format.json { render :show, status: :ok, location: @baby }\n else\n format.html { render :edit }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @baby.update(baby_params)\n format.html { redirect_to @baby, notice: \"Baby was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baby }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bolt.update(bolt_params)\n format.html { redirect_to @bolt, notice: 'Bolt was successfully updated.' }\n format.json { render :show, status: :ok, location: @bolt }\n else\n format.html { render :edit }\n format.json { render json: @bolt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boat\n @boat = Boat.find(params[:boat_id])\n end",
"def update\n respond_to do |format|\n if @boite.update(boite_params)\n format.html { redirect_to @boite, notice: 'Boite was successfully updated.' }\n format.json { render :show, status: :ok, location: @boite }\n else\n format.html { render :edit }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boolio.update( boolio_params )\n format.html { redirect_to @boolio, notice: 'Boolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @boolio }\n else\n format.html { render :edit }\n format.json { render json: @boolio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stalking = Stalking.find(params[:id])\n @stalking.user_id = current_user.id\n\n respond_to do |format|\n if @stalking.update_attributes(app_params)\n format.html { redirect_to @stalking, flash: { success: 'Stalking was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stalking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @beat = Beat.find(params[:id])\n\n respond_to do |format|\n if @beat.update_attributes(params[:beat])\n format.html { redirect_to @beat, notice: 'Beat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def set_boat\n @boat = Boat.find(params[:id])\n end",
"def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @buddy.update(buddy_params)\n format.html { redirect_to @buddy, notice: \"Buddy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @buddy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @buddy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n if @sugar_bag.update_attributes(params[:sugar_bag])\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @buffet.update(buffet_params)\n format.html { redirect_to @buffet, notice: 'Buffet was successfully updated.' }\n format.json { render :show, status: :ok, location: @buffet }\n else\n format.html { render :edit }\n format.json { render json: @buffet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n if @banana.update_attributes(params[:banana])\n format.html { redirect_to @banana, :notice => 'Banana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cat_blok.update(cat_blok_params)\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_blok }\n else\n format.html { render :edit }\n format.json { render json: @cat_blok.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ipc_boeing.update(ipc_boeing_params)\n format.html { redirect_to @ipc_boeing, notice: 'Ipc boeing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_boeing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n if @bidding.update_attributes(params[:bidding])\n format.html { redirect_to @bidding, notice: 'Bidding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @super_bowl_pick = SuperBowlPick.find(params[:id])\n\n respond_to do |format|\n if @super_bowl_pick.update_attributes(params[:super_bowl_pick])\n format.html { redirect_to @super_bowl_pick, notice: 'Super bowl pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_bowl_pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boeking.update(boeking_params)\n format.html { redirect_to @boeking, notice: 'Boeking was successfully updated.' }\n format.json { render :show, status: :ok, location: @boeking }\n else\n format.html { render :edit }\n format.json { render json: @boeking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n if @bico.update_attributes(params[:bico])\n format.html { redirect_to @bico, notice: 'Bico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boat = Boat.find(params[:id], :include => [:members])\n @dockold = Dock.find(params[:Laituri]) unless params[:Laituri].blank?\n @berthold = @berth = Berth.where(:dock_id => @dockold.id, :number => params[:Laituripaikka]) unless params[:Laituri].blank?\n #@boat = Boat.find(params[:id])\n #changejnoToId\n parse_jno_from_omistajatxtbox\n change_jno_to_id_for_update\n if params[:boat][:BoatsMembers_attributes] == nil\n @onkoOk = false\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n\n respond_to do |format|\n if @onkoOk && check_for_only_one_payer && @boat.update_attributes(params[:boat])\n check_dock_and_berth(format)\n format.html { redirect_to @boat, notice: 'Veneen muokkaus onnistui.' }\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Virhe.'\n render action: \"edit\"\n }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scribble = Scribble.find(params[:id])\n\n respond_to do |format|\n if @scribble.update_attributes(params[:scribble])\n format.html { redirect_to @scribble, :notice => 'Scribble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @scribble.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n if @bl.update_attributes(params[:bl])\n format.html { redirect_to @bl, notice: 'Bl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bourbon.update(bourbon_params)\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @b = B.find(params[:id])\n\n respond_to do |format|\n if @b.update_attributes(params[:b])\n format.html { redirect_to @b, notice: 'B was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @b.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill.type_of_bill_id = 1\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to bills_url, notice: 'Счет успешно обновлен.' }\n format.json { render :show, status: :ok, location: @bill }\n log(current_user.id,\"Обновил счет\",\"\")\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n\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 @brend = Brend.find(params[:id])\n\n respond_to do |format|\n if @brend.update_attributes(params[:brend])\n format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n if @bottle.update_attributes(params[:bottle])\n format.html { redirect_to(@bottle, :notice => 'Bottle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bottle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n if @blocking_client.update_attributes(params[:blocking_client])\n format.html { redirect_to @blocking_client, notice: 'Blocking client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blocking_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bet.update(bet_params)\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet }\n else\n format.html { render :edit }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n balloon = Balloon.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n balloon = nil\n end\n \n if balloon != nil && balloon.update_attributes(balloon_params) \n render json: {status: 'SUCCESS', message:'Updated balloon', data:balloon},status: :ok\n else\n render json: {status: 'ERROR', message:'Balloon not updated', data:\"balloon.error - balloon id doesnt exist\"},status: :unprocessable_entity\n end\n end",
"def update\n if @bet.update(bet_params)\n head :no_content # renders empty response\n else\n render json: @bet.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bid.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 respond_to do |format|\n if @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @auction, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lobby = Lobby.find_by_id_str(params[:id])\n\n respond_to do |format|\n if @lobby.update_attributes(params[:lobby])\n format.html { redirect_to(@lobby, :notice => 'Lobby was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lobby.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.75139743",
"0.7205898",
"0.7205898",
"0.7205898",
"0.7149097",
"0.70022035",
"0.67328215",
"0.66688395",
"0.6633111",
"0.65329206",
"0.6529358",
"0.6501237",
"0.6298703",
"0.62954086",
"0.6290583",
"0.62341624",
"0.62328416",
"0.62252235",
"0.621522",
"0.6211749",
"0.62059844",
"0.62059844",
"0.6177698",
"0.61594886",
"0.6145372",
"0.6138398",
"0.6138121",
"0.61321336",
"0.6126911",
"0.61251163",
"0.61209476",
"0.61032593",
"0.6102559",
"0.6086687",
"0.6085188",
"0.608437",
"0.6065864",
"0.60562617",
"0.6049549",
"0.6044313",
"0.60343295",
"0.6029289",
"0.602711",
"0.60251015",
"0.60251015",
"0.60251015",
"0.60251015",
"0.6023843",
"0.60217106",
"0.60130924",
"0.6009332",
"0.6006078",
"0.5999447",
"0.5999447",
"0.5999447",
"0.5997689",
"0.5996509",
"0.5994137",
"0.59885776",
"0.59802705",
"0.597973",
"0.5979539",
"0.59774435",
"0.5976581",
"0.5962244",
"0.5961821",
"0.5942724",
"0.5940307",
"0.5927965",
"0.59236634",
"0.59227526",
"0.59217095",
"0.5921515",
"0.5921515",
"0.5921515",
"0.59213793",
"0.5913335",
"0.5912587",
"0.59080327",
"0.58990765",
"0.58947456",
"0.58866763",
"0.5886601",
"0.5882885",
"0.588228",
"0.5875441",
"0.5875356",
"0.5872847",
"0.587174",
"0.587174",
"0.587174",
"0.58713704",
"0.58711594",
"0.5870918",
"0.5866638",
"0.58574605",
"0.5851304",
"0.5850926",
"0.585034",
"0.58490914"
] |
0.6840953
|
6
|
DELETE /boats/1 DELETE /boats/1.json
|
def destroy
@boat.destroy
respond_to do |format|
format.html { redirect_to boats_url, notice: _("Boat was successfully destroyed") }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\n format.json {head :no_content}\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to(boats_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: 'Boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat.destroy\n\n head :no_content\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n redirect_to boats_path\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kind_of_boat.destroy\n respond_to do |format|\n format.html { redirect_to kind_of_boats_url, notice: 'Kind of boat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @beat = Beat.find(params[:id])\n @beat.destroy\n\n respond_to do |format|\n format.html { redirect_to beats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_boice.destroy\n respond_to do |format|\n format.html { redirect_to my_boices_url, notice: 'My boice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boy = Boy.find(params[:id])\n @boy.destroy\n\n respond_to do |format|\n format.html { redirect_to boys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'home', action: 'bounty_market' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bath.destroy\n respond_to do |format|\n format.html { redirect_to baths_url, notice: 'Bath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boite.destroy\n respond_to do |format|\n format.html { redirect_to boites_url, notice: 'Boite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bacon.destroy\n respond_to do |format|\n format.html { redirect_to bacons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bico = Bico.find(params[:id])\n @bico.destroy\n\n respond_to do |format|\n format.html { redirect_to bicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blivot.destroy\n respond_to do |format|\n format.html { redirect_to blivots_url, notice: 'Blivot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @borad = Borad.find(params[:id])\n @borad.destroy\n\n respond_to do |format|\n format.html { redirect_to borads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to(bowls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format.html { redirect_to brends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baby.destroy\n respond_to do |format|\n format.html { redirect_to babies_url, notice: 'Baby was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bingo.destroy\n respond_to do |format|\n format.html { redirect_to bingos_url, notice: \"Bingo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baby.destroy\n respond_to do |format|\n format.html { redirect_to babies_url, notice: \"Baby was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to bananas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @breach.destroy\n respond_to do |format|\n format.html { redirect_to breaches_url, notice: 'Breach was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to bancos_url, notice: 'Banco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Bouquets = Bouquet.find(params[:id])\n @Bouquets.destroy\n\n respond_to do |format|\n format.html { redirect_to bouquets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boleta.destroy\n respond_to do |format|\n format.html { redirect_to boletas_url, notice: 'Boleta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat_attachment.destroy\n respond_to do |format|\n format.html { redirect_to boat_attachments_url, notice: 'Boat attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @buddy.destroy\n respond_to do |format|\n format.html { redirect_to buddies_url, notice: \"Buddy was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bb.destroy\n respond_to do |format|\n format.html { redirect_to bbs_url, notice: 'Bb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blast = Blast.find(params[:id])\n @blast.destroy\n\n respond_to do |format|\n format.html { redirect_to blasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basketball = Basketball.find(params[:id])\n @basketball.destroy\n\n respond_to do |format|\n format.html { redirect_to basketballs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brony.destroy\n respond_to do |format|\n format.html { redirect_to bronies_url, notice: 'Brony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bathroom.destroy\n respond_to do |format|\n format.html { redirect_to bathrooms_url, notice: 'Bathroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bathroom.destroy\n respond_to do |format|\n format.html { redirect_to bathrooms_url, notice: 'Bathroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @blar.destroy\n respond_to do |format|\n format.html { redirect_to blars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boc.destroy\n respond_to do |format|\n format.html { redirect_to bocs_url, notice: 'Boc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @bouncer = Bouncer.find(params[:id])\n @bouncer.destroy\n\n respond_to do |format|\n format.html { redirect_to(bouncers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @batter.destroy\n respond_to do |format|\n format.html { redirect_to batters_url, notice: 'Batter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lobby = Lobby.find_by_id_str(params[:id])\n @lobby.destroy\n\n respond_to do |format|\n format.html { redirect_to(lobbies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @boook.destroy\n respond_to do |format|\n format.html { redirect_to boooks_url, notice: 'Boook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy #DESC: Eliminar hobbies\n @hobbie = Hobbie.find(params[:id])\n @hobbie.destroy\n\n respond_to do |format|\n format.html { redirect_to(hobbies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @b_log = BLog.find(params[:id])\n @b_log.destroy\n\n respond_to do |format|\n format.html { redirect_to b_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @battalion = Battalion.find(params[:id])\n @battalion.destroy\n\n respond_to do |format|\n format.html { redirect_to(battalions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to auction_bids_url(@auction) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\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 @beat.destroy\n respond_to do |format|\n format.html { redirect_to beats_url, notice: \"Beat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(bids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bogey = Bogey.find(params[:id])\n @bogey.destroy\n\n respond_to do |format|\n format.html { redirect_to(bogeys_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @breet.destroy\n respond_to do |format|\n format.html { redirect_to breets_url, notice: 'Breet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bolt.destroy\n respond_to do |format|\n format.html { redirect_to bolts_url, notice: 'Bolt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_dados_banco.destroy\n respond_to do |format|\n format.html { redirect_to socio_dados_bancos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bay.destroy\n respond_to do |format|\n format.html { redirect_to bays_url, notice: 'La bahía fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brohoof = Brohoof.find(params[:id])\n @brohoof.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat_blok.destroy\n respond_to do |format|\n format.html { redirect_to cat_bloks_url, notice: 'Cat blok was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ballot.destroy\n respond_to do |format|\n format.html { redirect_to ballots_url, notice: \"ballot was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borc = Borc.find(params[:id])\n @borc.destroy\n\n respond_to do |format|\n format.html { redirect_to borcs_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.75705564",
"0.7438568",
"0.74197197",
"0.73656553",
"0.7349286",
"0.7349286",
"0.7349286",
"0.72071075",
"0.71894634",
"0.7050117",
"0.7036506",
"0.697863",
"0.6862241",
"0.68438214",
"0.6821779",
"0.67834526",
"0.67803717",
"0.6767131",
"0.6737287",
"0.6729381",
"0.6725936",
"0.6725936",
"0.6714465",
"0.6712887",
"0.6712887",
"0.66946715",
"0.6690481",
"0.66630447",
"0.6639792",
"0.6636552",
"0.6630905",
"0.65932125",
"0.65894943",
"0.65862966",
"0.6584505",
"0.6579451",
"0.65761113",
"0.65761113",
"0.65742034",
"0.65722394",
"0.6568091",
"0.6560616",
"0.65526783",
"0.65520895",
"0.6546625",
"0.65442383",
"0.65399444",
"0.6537557",
"0.6532279",
"0.65244865",
"0.6522233",
"0.6516541",
"0.6513593",
"0.6511555",
"0.65103537",
"0.6509583",
"0.65073645",
"0.64929986",
"0.6482746",
"0.64700276",
"0.6469963",
"0.6462411",
"0.6461724",
"0.64607745",
"0.64607745",
"0.6446777",
"0.64448094",
"0.644205",
"0.6441316",
"0.6440038",
"0.6437397",
"0.64353794",
"0.6428726",
"0.6428303",
"0.64246106",
"0.6421735",
"0.64180875",
"0.64128196",
"0.64101505",
"0.64100945",
"0.6406614",
"0.6402486",
"0.6401966",
"0.639981",
"0.639552",
"0.6392883",
"0.6391043",
"0.63901985",
"0.63901985",
"0.63890547",
"0.6386926",
"0.6384679",
"0.63842475",
"0.63835245",
"0.6382164",
"0.6381966",
"0.6381575",
"0.6380943",
"0.63806355",
"0.63803333"
] |
0.7368521
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_boat
@boat = Boat.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 boat_params
create_params = [
:name,
:manufacturer,
:daily_price,
:year,
:model,
:length,
:guest_capacity,
:boat_category_id,
:description,
:fuel_type,
:with_license,
:rental_type,
:address,
:horse_power,
pictures_attributes: [:id, :image, :_destroy]
]
update_params = create_params + [ boat_features_set_attributes: [:id] + BoatFeaturesSet::FEATURES ]
if action_name == "create"
params.require(:boat).permit(create_params)
elsif action_name == "update"
params.require(:boat).permit(update_params)
end
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 /projects/1 GET /projects/1.json
|
def show
@project = Project.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @project }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list\n get 'projects'\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def projects\n resource 'projects'\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n end",
"def index\n @projects = Project.all\n render json: @projects\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @user = User.find_by(id: params[:user_id])\n @project = @user.projects\n if @project \n render :json => @project\n else\n render :json => 422\n end\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def project(project_id, params = {})\n make_get_request(\"/projects/#{project_id}\", params)\n end",
"def index\n @projects = Project.visible\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"def show\n render json: Project.where(id: params.fetch(:id))\n end",
"def show \n project= Project.find(params[:id])\n\n render json: project\n end",
"def index\n @projects = Project.all_for_user(current_user.id)\n render json: @projects.to_json(include: :project_detail), status: 200\n end",
"def project(project_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def project(project_id, query_params = nil)\n get(\"/projects/#{project_id}\", query_params)\n end",
"def index\n @projects = Project.all\n render json: @projects, layout: false\n end",
"def project(project_id)\n resource \"projects/#{project_id}\"\n end",
"def getProjectID()\n result = RestClient.get GITHUB_API + PROJECTS_PATH, :accept => 'application/vnd.github.inertia-preview+json', :'Authorization' => 'token ' + CONFIG['OAUTH']\n result = JSON.parse(result) \n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def projects\n records \"project\", \"/project/list\"\n end",
"def index \n\n @projects = Project.all\n respond_to do |format|\n format.html {render :template => \"projects/index\"}\n format.json { render json: @projects }\n end\n end",
"def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end",
"def index\n @projects = current_user.projects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @project = Project.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project }\n end\n end",
"def show\n render json: @project\n end",
"def show\n repo = ProjectRepo.new current_user\n @v_project = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_project }\n end\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def find_project(name)\n get(\"/projects/#{name}\")\n end",
"def show\n @project = Project.find_by(id: params[:id])\n if @project\n render :json => @project\n else\n render :json => 422\n end\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def project\n request :project\n end",
"def project\n return forbidden unless current_account and params[:id] and (request.format.json? || request.format.js? || request.format.text?)\n project = Project.accessible(current_account).find(params[:id].to_i)\n return not_found unless project\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'project' => project.canonical(opts)}\n render_cross_origin_json\n end",
"def show \n render :json => Project.find_by_id(params[:id])\n end",
"def show\n @ourproject = Ourproject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def get_project(project_id)\n http = Net::HTTP.new(@city_db_url, @port)\n http.read_timeout = 1000\n if @city_db_is_https\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n request = Net::HTTP::Get.new(\"/projects/#{project_id}.json\")\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.basic_auth(ENV['URBANOPT_USERNAME'], ENV['URBANOPT_PASSWORD'])\n\n response = http.request(request)\n if response.code != '200' # success\n @runner.registerError(\"Bad response #{response.code}\")\n @runner.registerError(response.body)\n @result = false\n return {}\n end\n\n result = JSON.parse(response.body, symbolize_names: true)\n return result\n end",
"def index\n @projects = Project.with_permissions_to(:read)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n @projectresource = Projectresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectresource }\n end\n end",
"def index\n @projects = Project.where user: current_user\n render json: @projects, each_serializer: Projects::IndexSerializer\n end",
"def show \n respond_to do |format|\n format.json {\n\n @project = Project.find_by_id(params[:id])\n\n if @project\n render :json => @project\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n @current_project = CurrentProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_project }\n end\n end",
"def show\n respond_with(@project) do |format|\n format.json { render json: @project.as_json }\n format.html\n end\n end",
"def show\n @show_project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @show_project }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def show\n\n render json: Project.all\n\n end",
"def projects(params = {})\n fetch_all('projects', 'projects', params)\n end",
"def index\n @about_projects = AboutProject.last(1)\n\n respond_to do |format|\n format.json {render json: @about_projects[0], :only => [:description]}\n end\n end",
"def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end",
"def show\n @projects = find_projects\n end",
"def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show_by_gitpath\n @project = Project.includes(:users).includes(:technos).find_by_gitpath(params[:gitpath])\n\n respond_to do |format|\n format.json { render json: @project, status: 200 }\n end\n end",
"def project\n @client.project(:id => project_id)\n end",
"def list_projects\n handle_action_exceptions(__method__) do\n cmd_line = ['listprojects']\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end",
"def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end",
"def get_projects_of_user\n respond_to do |format|\n format.json {\n #param = params[:payload]\n #@user = User.find_by_id(param[:id])\n @projects = Project.where(:user_id => @current_user.id)\n if @projects\n render :json => @projects\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def get\n render json: Project.select(:id, \"name as label\")\n end",
"def index\n @projects = Project.includes(:user).all\n respond_with(@projects) do |format|\n format.json { render :json => {:list => @projects.as_json, :current_user => current_user.as_json} }\n format.html\n end\n end",
"def details\n get(\"project/details\")[\"project\"]\n end",
"def show\n @unfinished_project = UnfinishedProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unfinished_project }\n end\n end",
"def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end",
"def show\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def get(project_name)\n response = get_request(\"/projects/#{project_name}/\")\n TheShiningSource::Project.new(response)\n end",
"def show_project\r\n @project = Project.find(params[:id])\r\n @id = @project.id\r\n respond_to do |format|\r\n format.html { render 'project_control/view' }\r\n format.json { render json: @project }\r\n end\r\n end",
"def getProject(project)\r\n\t\t\t\tproject_json = JSON.parse project\r\n\t\t\t\tproject_array = project_json[\"projects\"]\r\n\t\t\t\treturn jsonToProject(project_array[0])\r\n\t\t\tend",
"def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects }\n #format.json { render json: @project.as_json(:include => [:client, :project_participants] ) }\n end\n end",
"def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end",
"def index\n @projects = @projects.includes(:latest_iteration).where(:tenant_id => current_user.tenant).order(\"name\").page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n\n respond_with @projects\n end",
"def show\n respond_to do |format|\n format.html {render :show}\n format.json {render json: @project}\n end\n end",
"def show\n @project = Project.find(params[:id])\n\t@user = User.find(@project.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def find(project_id)\n raw_response = get_request(\"projects/#{project_id}\")\n parse_response(raw_response, :project)\n end"
] |
[
"0.7869151",
"0.76985043",
"0.76807874",
"0.7612022",
"0.75345093",
"0.7527008",
"0.7493986",
"0.7493986",
"0.7493986",
"0.7493986",
"0.7493986",
"0.7493986",
"0.7493986",
"0.74937606",
"0.74849236",
"0.74796486",
"0.7444702",
"0.74304223",
"0.7423762",
"0.74148554",
"0.7385338",
"0.7380726",
"0.73801005",
"0.7376173",
"0.7357006",
"0.735326",
"0.73525846",
"0.7343614",
"0.7341823",
"0.7324943",
"0.73037773",
"0.7289164",
"0.7274069",
"0.72740257",
"0.72546357",
"0.7252338",
"0.7250994",
"0.724376",
"0.7241754",
"0.7227832",
"0.7227832",
"0.72140294",
"0.7210373",
"0.72031194",
"0.7196124",
"0.7184834",
"0.7156371",
"0.71509415",
"0.71487904",
"0.712094",
"0.71128213",
"0.7107486",
"0.7087363",
"0.708444",
"0.7080066",
"0.7052593",
"0.7051497",
"0.704476",
"0.70426226",
"0.70265174",
"0.7025207",
"0.7005273",
"0.7004345",
"0.700279",
"0.7000567",
"0.6986968",
"0.6984759",
"0.698041",
"0.69801223",
"0.6978835",
"0.6978741",
"0.69702023",
"0.6966923",
"0.69642866",
"0.6962488",
"0.6962467",
"0.6962188",
"0.6961261",
"0.6957218",
"0.6942892",
"0.69370997",
"0.69343174",
"0.69177604",
"0.69132227",
"0.6910236",
"0.69052416"
] |
0.73618454
|
34
|
GET /projects/new GET /projects/new.json
|
def new
@project = Project.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html\n format.json { render json: @project }\n end\n end",
"def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @projectresource = Projectresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectresource }\n end\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @current_project = CurrentProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @current_project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html { render layout: 'project'}\n format.json { render json: @project }\n end\n end",
"def new\n @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\n end\n end",
"def new\n @project = Project.new :company_id => params[:company_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new_project\n if current_admin.present? || current_client.present?\n @project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else\n redirect_to new_admin_session_path and return\n end\n end",
"def new\n @isgrey = true;\n @current_page = \"ADD PROJECT\"\n @project = Project.new\n @project_attachment = @project.project_attachments.build\n @slider_object = @project.slider_objects.build\n @project_field = @project.project_fields.build\n @project_other_field = @project.project_other_fields.build\n\n @types = Type.all\n @new_nav = true;\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end",
"def new\n @project = Project.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n \t@pagenav = Page.find_all_by_published('true')\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def new\n if signed_in?\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n else \n redirect_to \"/\"\n end\n end",
"def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end",
"def new\n authenticate_user!\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @file_project = FileProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_project }\n end\n end",
"def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end",
"def new\n @projects_person = ProjectsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @project_entry = ProjectEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_entry }\n end\n end",
"def new\n propose_nr = Integer(Project.order(\"nr desc\").first.nr) + 1\n @project = Project.new(:nr => propose_nr, :active => true)\n @project.tasks.new(:name => \"Project Mgmt\", :description => \"\")\n @project.tasks.new(:name => \"Pre-P\", :description => \"Moodboards | Examining project data, plans, briefing, etc.\")\n @project.tasks.new(:name => \"Web\", :description => \"Flatfinder/Boligvelger (eve-Estate) | CMS/Website (eve-Publisher) | Landingpage\")\n @project.tasks.new(:name => \"Undividable 3D work for exteriors\", :description => \"Modeling/texturing of buildings and their surroundings. Populating/detailing with plants, outdoor furniture, traffic, etc.\")\n @project.tasks.new(:name => \"Undividable 3D work for interiors\", :description => \"Modeling/texturing of X apartments. Setting up furniture, accessories, decoration according to moodboards.\")\n @project.tasks.new(:name => \"#{propose_nr}-01_e\", :description => \"Scene setup, lighting and detail adjustments, rendering with subsequent post-production/compositing.\")\n @project.tasks.order(:name)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @project }\n end\n end",
"def new\n @project =\n if params[:project]\n Project.where(name: params[:project][:name]).first || Project.new(project_params)\n else\n Project.new\n end\n\n respond_to do |format|\n format.html {\n redirect_to edit_embed_project_url(@project) if @project.persisted?\n }\n format.json { render json: @project }\n end\n end",
"def new\n session[:return_to] ||= request.referer\n @project = Project.new\n @project.user_id = current_user.id\n\n # we use list of projects and contexts on the view, need to prepare them\n @projects = Project.all_active_projects(params[:context_id],current_user.id )\n @contexts = Context.where(\"user_id = ?\",current_user.id)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def project_new\n new_project.click\n end",
"def new\n @unfinished_project = UnfinishedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unfinished_project }\n end\n end",
"def new\n @project = Project.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end",
"def new\n @campaign = Campaign.find(params[:campaign_id])\n @project = @campaign.projects.new(params[:project])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @project_detail = ProjectDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_detail }\n end\n end",
"def new\n @past_project = PastProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @past_project }\n end\n end",
"def new\n\t\t@project = Project.new({:project_state_type_id => ProjectStateType.find_by_code('preparation').id})\n\t\tputs @project.inspect\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @project }\n\t\tend\n\tend",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n\n @project = Project.new\n @main_projects = Project.roots.where(creator_id: current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @project = Project.new\n end",
"def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end",
"def new\n @project = Project.new\n #@project.build_ci\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @assigned_project = AssignedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned_project }\n end\n end",
"def ajaxnew\n @project = Project.new\n\n respond_to do |format|\n format.html { render :layout => false } # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new(:user_id => current_user[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @task = Task.new(:project_id => params[:id])\n\t\t@projects = Project.sorted\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @project }\n end\n end",
"def new\n @user = User.find( params[:user_id] )\n @project = Project.new( :title => \"New Project\" )\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end"
] |
[
"0.81725097",
"0.81171846",
"0.80850273",
"0.80848",
"0.8061288",
"0.8030936",
"0.79504395",
"0.792672",
"0.79045373",
"0.7865987",
"0.7758509",
"0.7751187",
"0.77291125",
"0.7706384",
"0.7698888",
"0.7685731",
"0.7672869",
"0.7655707",
"0.76342",
"0.7632482",
"0.7619905",
"0.7612697",
"0.76019526",
"0.7579514",
"0.75643575",
"0.75576305",
"0.75530607",
"0.7552181",
"0.7532463",
"0.75238603",
"0.7521173",
"0.74954855",
"0.7472716",
"0.74714875",
"0.7468618",
"0.7468332",
"0.74637985",
"0.74482524",
"0.7444269",
"0.7438458",
"0.74200654",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.73890764",
"0.7388426",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.73828655",
"0.7367906",
"0.7361138",
"0.73421776",
"0.73386914",
"0.7318866",
"0.7279783",
"0.72779024",
"0.72771907",
"0.72716326"
] |
0.8165836
|
23
|
POST /projects POST /projects.json
|
def create
@project = Project.new(params[:project])
respond_to do |format|
if @project.save
format.html { redirect_to @project, notice: 'Project was successfully created.' }
format.json { render json: @project, status: :created, location: @project }
else
format.html { render action: "new" }
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end",
"def test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end",
"def create\n\t\t@project = current_user.projects.new(project_params)\n\n\t\trespond_to do |format|\n\t\t\tif @project.save\n\t\t\t\tformat.json { render :show, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @projects = current_user.projects\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @projects << @project\n format.html { redirect_to user_projects_path(current_user), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: :created, location: @project }\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @project = current_user.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attributes={})\n raw_response = post_request('projects', project: attributes)\n parse_response(raw_response, :project)\n end",
"def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.json { render :json => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end",
"def create\n @user = current_user\n @project = @user.projects.build(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html {redirect_to \"/projects\", notice: \"Project was successfully created.\"}\n format.json {render :show, status: :created, location: @project}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @project.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: \"Project was successfully created.\" }\n User.find(current_user.id).projects << Project.find(@project.id)\n @projects_user = ProjectsUser.find_by(user_id: current_user.id, project_id: @project.id)\n format.json { render :show, status: :created, location: @project }\n\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: t('models.project.create') }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_project = Project.new(api_project_params)\n\n respond_to do |format|\n if @api_project.save\n format.html { redirect_to @api_project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @api_project }\n else\n format.html { render :new }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @client.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @client, notice: 'Project was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = @user.id\n if @project.save\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Project was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if project.save\n format.html { redirect_to project, notice: 'Project was successfully created.' }\n format.json { render json: project, status: ':created', location: project }\n else\n format.html { render action: 'new' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.new(project_params)\n if @project.save\n render :show\n else\n render json: { errors: @project.errors }\n end\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, flash: {success: 'Project was successfully created.'} }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # authenticate_user!\n @project = Project.new\n @project[:category] = params[:category]\n @project[:title] = params[:title]\n @project[:body] = params[:body]\n @project[:location] = params[:location]\n @project[:image_link] = params[:image_link]\n @project[:project_url] = params[:project_url]\n @project[:year] = params[:year]\n @project[:likes] = params[:likes]\n @project.save\n\n render json: @project\n end",
"def create\n @project = Project.new(project_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @project.save\n format.json { render :show, status: :created, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client = Client.find(params[:client_id])\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully created.' }\n format.json { render json: client_projects_path(@client), status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes un nuevo proyecto. A trabajar!' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create project_params\n current_user.memberships.create(\n project_id: @project.id,\n owner_at: Time.now\n )\n\n if @project.save\n render 'projects/create', status: 201\n else\n render 'projects/error', status: 422\n end\n end",
"def create\n @project = @client.projects.build(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was successfully created.') }\n format.xml { render xml: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_project = current_user.projects.build(params[:project])\n flash[:notice] = \"Project #{@create_project.description} successfully created\" if @create_project.save\n respond_with(@create_project, layout: !request.xhr?)\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def create\t\t\t\t\t\t\t\t\t# Creates record in db and redirects (porbably to index)\n\t\t@project = Project.new(projects_params)\t# Passes only title and desc.\n\n \trespond_to do |format|\t\t\t\t\t# All this is doing is rendering stuff in case of json\n \t\tif @project.save\n \t\tformat.html { redirect_to @project, notice: 'Created a new project!' }\n \t\tformat.json { render :show, status: :created, location: @project }\n \t\telse\n \t\tformat.html { render :new }\n \t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def create\n if params[:project_id]\n cloned_from = Project.find(params[:project_id])\n @project = cloned_from.clone(params, @cur_user.id)\n else\n @cloned_project = nil\n @project = Project.new project_params\n @project.user_id = @cur_user.id\n end\n\n respond_to do |format|\n if @project.save\n format.html do\n redirect_to @project, notice: 'Project was successfully created.'\n end\n format.json do\n render json: @project.to_hash(false),\n status: :created, location: @project\n end\n else\n flash[:error] = @project.errors.full_messages\n format.html { redirect_to projects_path }\n format.json do\n render json: @project.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create_project(key, name, params = {})\n params[:key] = key\n params[:name] = name\n post('projects', params)\n end",
"def create\n @project = Project.new(project_params)\n @project.owner = current_user unless @project.owner\n if @project.save\n render :show, status: :created, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:pattern] = '/projects'\n\t\targs[:query]['Action'] = 'CreateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tself.run(args)\n\tend",
"def projects\n resource 'projects'\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n build_projects_user\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n project_attrs = params[:project].merge(validate_repo_connectivity: true)\n @project = current_user.owned_projects.create(project_attrs, as: :owner)\n respond_with @project do |format|\n format.json do\n if @project.valid?\n render json: decorate(@project).to_json, status: :created\n else\n render json: {project: @project.errors.as_json}.to_json, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n\t\t@project.user_id =current_user.id\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.skills = params[:skills]\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.create(project_params)\n if @project.errors.blank?\n flash[:success] = t('controllers.projects.create.success', project: @project.name)\n else\n flash.now[:alert] = @project.errors.full_messages.unshift(t('controllers.projects.create.failure'))\n end\n respond_with @project, location: projects_url\n end",
"def create\n @new_nav = true;\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n if params[:project_attachments]\n create_attachments\n end\n\n if params[:project_fields]\n create_fields\n end\n\n if params[:slider_objects]\n create_slider_objects\n end\n\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user = current_user\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n begin\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @project.destroy\n respond_to do |format|\n format.html { render :new }\n format.json { render json: e.as_json, status: :service_unavailable }\n end\n end\n end",
"def project_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/projects.json\",\n body: project_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end",
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n @project.user_projects.create(:user_id => current_user.id, :status => true, :role => 1)\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n respond_to do |format|\n if @project.save\n flash[:alert] = \"Project created successfully.\"\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if is_organization_admin? and @project.save\n @project.team_members.create(user_id: @project.organization.owner_id)\n render json: {\n name: @project.name,\n organization: @project.organization.name,\n url: project_dashboard_path(@project.id)\n }\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def create\n @project = Project.new(project_params)\n\n if params[\"project\"][\"client_id\"] != \"\"\n @project.client = Client.find params[\"project\"][\"client_id\"]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Novo projeto cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end",
"def create\n find_projects(params[:api_key])\n end",
"def create\n\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n\n format.html { redirect_to @project, success: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(:project_title => params[:project_title], :start_date => params[:startDate], :end_date => params[:endDate],\n :status => params[:project_status])\n\n @project.user_id = current_user.id\n\n\n respond_to do |format|\n if @project.save\n p \"pass on projects controller\"\n format.html { redirect_to @project}\n format.json { render json: \"ok\" }\n else\n p \"fail on projects controller\"\n end\n end\n\n\n end",
"def create_project_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProjectApi.create_project ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_project_body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Project'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"ProjectApi.create_project\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectApi#create_project\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to :projects, notice: \"Project was successfully created.\" }\n format.json { render :show, status: :created, location: @project }\n else\n format.html do\n @teams = Team.order(:name)\n render :new\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n @project.team.touch\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n render_errors(format, @project.errors, :new)\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to [:user, @project], notice: 'Project temp was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(params[:project])\n @project.status = \"Etat zero\"\n creator = current_user\n ProjectUser.create(:project => @project, :user => creator, :admin => true)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = @projectable.projects.new(params[:project])\n\n respond_to do |format|\n if @project.save\n track_activity @project\n format.html { redirect_to [@projectable, @project], notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n #Acá se retorna de la vista New (o de cualquier lugar que llame a create con POST). Le llega el hash project_params con \n # los datos que retornó la vista.\n\n #Crea el nuevo usuario.\n @project = Project.new(project_params)\n\n respond_to do |format| #Esta linea es curiosa. Si el request le llegó por HTML, entonces fue un navegador. Si le llego\n #por JSON, entonces probablemente fue otra cosa, un app movil por ejemplo.\n if @project.save #Esto guarda el proyecto nuevo en la base de datos y retorna True si no hubo problema, y False si hubo un error.\n # Es importante notar que al llamar .save, primero pasa por el modelo, el cual revisa que no falte ningún dato.\n # Por ejemplo, si el modelo necesita que se incluya el nombre del proyecto, si o si, y no se le pasó el nombre,\n # Entonces el modelo va a guardar ese error en un hash llamado errors, dentro de el mismo (@projects.errors)\n # y va a hacer que .save retorne False.\n\n\n format.html { redirect_to :controller => \"misc\", :action =>\"about\", notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7338948",
"0.73139244",
"0.7308003",
"0.7299582",
"0.7227503",
"0.7225945",
"0.71982473",
"0.71170384",
"0.7104803",
"0.7095263",
"0.7070636",
"0.70408624",
"0.70358187",
"0.7024969",
"0.70191896",
"0.7009597",
"0.698481",
"0.697517",
"0.6963753",
"0.6963096",
"0.6944626",
"0.69397265",
"0.6938008",
"0.69204897",
"0.6911497",
"0.6908809",
"0.6907813",
"0.6894293",
"0.689054",
"0.68847734",
"0.6879909",
"0.68794346",
"0.6879012",
"0.68784195",
"0.6868972",
"0.68664163",
"0.68660194",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.68657774",
"0.6865554",
"0.68598175",
"0.6858278",
"0.6846567",
"0.6828604",
"0.68193066",
"0.6806436",
"0.678643",
"0.6784763",
"0.6773288",
"0.675545",
"0.6750235",
"0.67379624",
"0.6718913",
"0.6716745",
"0.67009157",
"0.66877806",
"0.6686259",
"0.668621",
"0.66856426",
"0.66838706",
"0.6680505",
"0.66770595",
"0.6670888",
"0.6668133",
"0.66572726",
"0.66528344",
"0.66518456",
"0.66511416",
"0.6649628",
"0.6649045",
"0.6642436",
"0.6638429",
"0.6634081",
"0.66324985",
"0.6629944",
"0.6628171",
"0.66263485",
"0.66259176",
"0.66255814"
] |
0.6948756
|
26
|
PUT /projects/1 PUT /projects/1.json
|
def update
@project = Project.find(params[:id])
respond_to do |format|
if @project.update_attributes(params[:project])
format.html { redirect_to @project, notice: 'Project was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end",
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end",
"def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render :show, status: :ok, location: @project }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @project.update(project_params)\n\t\t\t\tformat.json { render :show, status: :ok }\n\t\t\telse\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, :notice => 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = @client.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to([@client, @project], notice: 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.json { render json: @project, status: 200 }\n else\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: @project\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n @project = current_user.projects.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to add_path(@project), notice: 'Project was successfully updated.' }\n format.json { render :add, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@project = Project.find(params[:id])\t# Taken out because of the before action GENIUS!\n\n\t\trespond_to do |format|\n \t\t if @project.update(projects_params)\n \t\tformat.html { redirect_to @project, notice: 'Project was successfully updated.' }\n \t\tformat.json { render :show, status: :ok, location: @project }\n \t\telse\n \t\tformat.html { render :edit }\n \t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n\tend",
"def update\n project = Project.find(params[:id])\n\n respond_to do |format|\n if project and project.update_attributes(params[:project])\n format.html { redirect_to project }\n else\n format.html { redirect_to projects_path }\n end\n end\n end",
"def update\n\t\t@project = Project.find(params[:id])\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @project.update_attributes(params[:project])\n\t\t\t\tformat.html { redirect_to @project, notice: t('app.projects.updated') }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @project.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def project_updates\n @project = Project.find(params[:id])\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Projeto atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @edit_project = Project.find(params[:id])\n\n respond_to do |format|\n if @edit_project.update_attributes(params[:project])\n format.html { redirect_to @edit_project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @edit_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find_by_slug(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @workspaces = current_user.workspaces\n @project = Project.find(params[:id])\n @workspace = Workspace.find(params[:workspace_id])\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to workspace_project_tasks_path(@workspace , @project), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client = Client.find(params[:client_id])\n @project = Project.find(params[:id])\n \n respond_to do |format|\n if @project.update_attributes(project_params)\n format.html { redirect_to client_projects_path(@client), notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: client_projects_path(@client).errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if project.update(project_params)\n format.html { redirect_to project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: project.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_project.update(api_project_params)\n format.html { redirect_to @api_project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_project }\n else\n format.html { render :edit }\n format.json { render json: @api_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n \t\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: \"#{I18n.t 'project.project_updated'}\"}\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @project\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authenticate_user!\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:body]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: projects_path }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, info: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_path, notice: \"Project was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7380123",
"0.7308916",
"0.7181629",
"0.7167707",
"0.7132476",
"0.7125153",
"0.7081923",
"0.7008695",
"0.700572",
"0.70002675",
"0.69908255",
"0.6983146",
"0.69805205",
"0.69805205",
"0.6977218",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6970257",
"0.6963203",
"0.69558555",
"0.69558555",
"0.69316417",
"0.69316417",
"0.69121134",
"0.6909549",
"0.6909549",
"0.6907606",
"0.6899985",
"0.6882347",
"0.68728536",
"0.6871025",
"0.68494964",
"0.6827485",
"0.68246746",
"0.68156993",
"0.6811469",
"0.6806959",
"0.6792689",
"0.6763389",
"0.67555934",
"0.6752375",
"0.6733649",
"0.67315173",
"0.6723834",
"0.6723834",
"0.6722183",
"0.6716266",
"0.6709668",
"0.6708001",
"0.67078745",
"0.67071617",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964",
"0.67055964"
] |
0.6989358
|
13
|
DELETE /projects/1 DELETE /projects/1.json
|
def destroy
@project = Project.find(params[:id])
@project.destroy
respond_to do |format|
format.html { redirect_to projects_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n project = Project.find(params[:id])\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end",
"def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def delete(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_delete\")\n end",
"def delete\r\n\t\t\trender json: Project.delete_by_id(params[:id])\r\n\t\tend",
"def destroy\n\t\t@project.destroy\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_projects_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:message=>\"OK\",:id=>@project.id}, :staus=>:ok}\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\t\t\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Successfully deleted project.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n head :no_content\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: t('models.project.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end",
"def destroy\n @project.destroy\n\n head :no_content\n end",
"def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end",
"def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { render :json => {:valid => true} }\n end\n end",
"def destroy\n @api_project.destroy\n respond_to do |format|\n format.html { redirect_to api_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_path, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find_by_permalink(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def delproject(project)\n post('delproject.json', project: project)\n end",
"def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\n Rails.logger.info \"We are deleting project\"\n @todo_project.destroy\n respond_to do |format|\n format.html { redirect_to todo_projects_url, notice: 'Project was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = @projectable.projects.find(params[:id])\n @project.destroy\n track_activity @project\n\n respond_to do |format|\n format.html { redirect_to [@projectable, :projects] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.destroy\n @project.users.delete_all\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticate_user!\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @project.destroy\n render json: {message: 'Projeto Excluido'}, status: :ok\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find_by_slug(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"#{I18n.t 'project.project_destoy'}\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Admin::Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_projects_url) }\n format.xml { head :ok }\n end\n end",
"def delete_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'DeleteProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :project_name\n\t\t\targs[:path]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n @project = current_user.active_projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :delete, @project\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n standard_destroy(Project, params[:id])\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: \"Project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78952813",
"0.7859671",
"0.77783555",
"0.7771835",
"0.7758944",
"0.77311707",
"0.7730795",
"0.7730795",
"0.7730795",
"0.7730795",
"0.7730795",
"0.7724859",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7705122",
"0.7700347",
"0.7699523",
"0.76826304",
"0.7669593",
"0.76600164",
"0.76497924",
"0.7649785",
"0.7641361",
"0.76325774",
"0.76154137",
"0.76148826",
"0.7611129",
"0.7606996",
"0.7605129",
"0.7599008",
"0.75988954",
"0.7593884",
"0.7590968",
"0.75897366",
"0.7572066",
"0.75720257",
"0.7561604",
"0.75439465",
"0.7538311",
"0.7532768",
"0.7530638",
"0.75241685",
"0.75241685",
"0.7519492",
"0.7507657",
"0.7504314",
"0.7500005",
"0.74949217",
"0.7487267",
"0.7481541",
"0.7477921",
"0.7469758",
"0.7465491",
"0.74613893",
"0.74613893",
"0.7452573",
"0.74489385",
"0.7446737",
"0.74451",
"0.7442433",
"0.74413913",
"0.74375004",
"0.7437462",
"0.743698",
"0.743698",
"0.743698",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766",
"0.74366766"
] |
0.7718807
|
15
|
=begin Split the sentence Initiate an empty hash with a default value of 0 Iterate over the sentence with each Increment the value of the key =end
|
def word_sizes(sentence)
hash = Hash.new(0)
sentence.split.each do |word|
hash[word.size] += 1
end
hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def word_hash(sentence)\n letters = Hash.new(0)\n sentence.split.each { |word| letters[word.length] += 1 }\n letters\nend",
"def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend",
"def word_count(sentence)\n arr = sentence.split(\" \")\n result = Hash.new(0) # add default value as 0 for each new keys\n arr.each {|word| result[word] += 1 } # increment key 0 -> 1 -> 2..\n result # last expression of a method is returned\nend",
"def letter_counter2(string)\n string.split.each_with_object({}) do | word, hash| # word (calling on array)\n if hash.has_key?(word.size) \n hash[word.size] += 1\n else\n hash[word.size] = 1\n end\n end\nend",
"def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend",
"def wc\n words = @str.split(/[\\s,.]+/)\n h=Hash.new(0)\n words.each do |w|\n if h.has_key?(w) == true then\n val = h.fetch(w)\n val = val+1\n h.store(w,val)\n else\n h.store(w,1)\n end\n end \n h.each_pair do |key,val|\n puts \"#{val} #{key}\"\n end\nend",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def count_words(string) \n words_hash = Hash.new(0)\n string.downcase.gsub(/\\b/, '').split().each do |i| \n words_hash[i] += 1 \n end\n words_hash \nend",
"def letter_counter(string)\n hash = {}\n string.split.each do |word|\n if hash.has_key?(word.size)\n hash[word.size] += 1\n else \n hash[word.size] = 1\n end\n end\n hash\nend",
"def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend",
"def word_sizes(str)\n str.split.each_with_object({}) do |word, hsh|\n hsh[word.size] ||= 0\n hsh[word.size] += 1\n end\nend",
"def count_words(string)\r\n texts = string.split(\" \").map(&:downcase)\r\n result = texts.each_with_object(Hash.new (0)) {|item, hash| hash[item] += 1}\r\n result.each do |key, value|\r\n puts \"#{key} #{value}\"\r\nend\r\nend",
"def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend",
"def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"For\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n }\nend",
"def count_words(string)\n string = string.downcase\n split_string = string.split(' ')\n \n word_hash = Hash.new\n word_hash.default = nil\n\n split_string.each do |s|\n s = s.gsub(/[^a-z]/, '')\n if word_hash[s]\n word_hash[s] = word_hash[s] + 1 \n else\n word_hash[s] = 1\n end\n end\n puts word_hash\nend",
"def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end",
"def procipher(sentence, hash)\n new_sentence = []\n sentence.split(' ').each do |word|\n new_word = word\n hash.each do |k, v|\n new_word = v.call(new_word) if k.call(word)\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend",
"def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n h1 = Hash.new(0)\n str.split.each do |element|\n h1[element.size] += 1\n end\n h1\nend",
"def count_words\r\n array = []\r\n hash = Hash.new(0)\r\n input = gets.chomp\r\n input.downcase!\r\n array = input.split\r\n array.each do |word|\r\n hash[word] += 1\r\n end\r\n hash.each do |a,b|\r\n puts \"#{a} #{b}\"\r\n end\r\nend",
"def word_sizes(str)\n hash = {}\n idx = 0\n\n loop do \n break if idx == (str.split.size)\n word = str.split[idx]\n hash[word.size] = 0 unless hash.keys.include?(word.size)\n hash[word.size] += 1\n idx += 1\n end\n\n hash\nend",
"def word_count(string)\n words = string.split\n count = Hash.new(0)\n words.each { |word| count[word] += 1 }\n count\nend",
"def create(string,hash)\n string.split(\" \").each do |item| \n hash[item] = 1\n end\nend",
"def word_count(statement)\n words = {}\n wordsArr = statement.split(\" \")\n\n wordsArr.each do |word_key|\n words[word_key] ||= 0\n words[word_key] += 1\n end\n words\nend",
"def picky_procipher(sentence, hash)\n new_sentence = []\n sentence.split(' ').each do |word|\n proc_count = 0\n new_word = word\n hash.each do |k, v|\n if k.call(word) && proc_count < 1\n new_word = v.call(new_word)\n proc_count +=1\n end\n end\n new_sentence << new_word\n end\n new_sentence.join(' ')\nend",
"def word_count(str)\n str_splt= str.split\n word_h = {}\n str_splt.each {|word| p word_h[word]; word_h[word.to_sym] = str_splt.count(word) }\n\n word_h\n end",
"def word_count(phrase)\n result = Hash.new(0)\n phrase.split(\" \").each { |word| result[word] += 1 }\n result\nend",
"def word_sizes(str)\n arr = str.split(' ')\n hsh = Hash.new(0)\n \n arr.each {|word|\n hsh[word.length] += 1\n }\n \n hsh\nend",
"def word_lengths(sentence)\n split = sentence.split(\" \")\n hash = {}\n\n split.each do |word|\n hash[word] = word.length\n end\n\n return hash\nend",
"def word_count(string)\n hash = {}\n splitstring = string.split(\" \")\n splitstring.each {|element| element.downcase.gsub(/[^a-z]/i, \"\")}\n p splitstring\n splitstring.each{|element| if hash[element].nil?\n hash[element]=1\n else\n hash[element]+=1\n end}\n p hash\n return hash\nend",
"def count_words(words)\r\n word_hash = Hash.new(0)\r\n words.downcase.split.each do |word|\r\n word_hash[word] += 1\r\n end\r\n return word_hash\r\n\r\n\r\nend",
"def count_words(phrase)\r\n words_hash = Hash.new(0)\r\n phrase.split(\" \").each do |word|\r\n words_hash[word.downcase]+=1\r\n end\r\n print_word_count(words_hash)\r\n return words_hash\r\nend",
"def word_sizes(string)\n hash = Hash.new(0)\n string.split.each do |word|\n hash[word.size] += 1\n end\n hash\nend",
"def word_lengths(sentence)\n\twords = sentence.split(\" \")\n \thash = {}\n words.each {|word| hash[word] = word.length}\n return hash\n \nend",
"def word_count(string)\n words=string.split()\n unique=words.uniq\n amount={}\n unique.each do |word|\n amount[word.to_sym]=words.count(word)\n end\n p amount\nend",
"def make_hash(word)\n hash = {}\n word.each do |i|\n if hash.has_key?(i)\n hash[i] += 1\n else\n hash[i] = 1\n end\n end\n return hash\nend",
"def letter_counts(word)\n letter_counts = Hash.new(0)\n\n word.split(\"\").each do |ele| \n letter_counts[ele] += 1\n end\n letter_counts\nend",
"def word_sizes(string)\n word_count = Hash.new(0)\n\n string.split.each do |element|\n word_count[element.size] += 1\n end\n word_count\nend",
"def word_count(string)\n words = string.split(\" \")\n count = Hash.new(0)\n words.each { |word| count[word] += 1}\n count\nend",
"def word_sizes(str)\n arr = str.split(' ')\n hsh = Hash.new(0)\n \n arr.each {|word|\n hsh[word.delete('^A-Za-z').length] += 1\n }\n \n hsh\nend",
"def declare(map, start, string)\n count = start\n string.split(\" \").each do |token|\n map[token] = count\n count += 1\n end\nend",
"def word_sizes(text)\n word_size = Hash.new(0)\n text.split.map do |word|\n word.delete \"^A-Za-z\"\n word_size[word.size] += 1\n end\n word_size\nend",
"def letter_counts(word)\n wordArray = word.split(\"\")\n hash = {}\n wordArray.each do |element|\n if hash[element] == nil\n hash[element] = 1\n else\n hash[element] += 1\n end\n end\n return hash\nend",
"def foo(x)\r\n \r\n line = x.split\r\n words = Hash.new(0)\r\n for i in 0..line.length-1 do\r\n words[line[i].chomp(\"\").length]+=1\r\n end \r\n words=words.sort_by {|key, _val| key}.to_h\r\n return words\r\nend",
"def word_count(text)\n\tnew_text = text.split(\" \") #-->Use text.split to turn text into an array that breaks(splits) at each space.\n\t\n \tcounter = Hash.new(0) #-->Next create an empty hash for your results with count = Hash.new (0)\n\n \tnew_text.each {|word| counter[word] += 1} #-->Use a method that will take each word in the array\n\n \tputs counter #-->This will give us our results printed on the screen\nend",
"def word_lengths(sentence)\n hassh = Hash.new(0)\n sentence.split(\" \").each {|w| hassh[w] = w.length }\n return hassh\nend",
"def procipher(sent, hash)\r\n new_sent = []\r\n sent.split(\" \").each do |word|\r\n new_word = word.clone\r\n hash.each do |k, v|\r\n if k.call(word)\r\n new_word = v.call(new_word)\r\n found = true\r\n end\r\n end\r\n new_sent << new_word\r\n end\r\n new_sent.join(\" \")\r\nend",
"def hash_word(word)\n word_count = Hash.new(0)\n word.each_char do |c|\n word_count[c] += 1\n end\n return word_count\nend",
"def word_sizes(txt)\n arr = txt.split\n hsh = {}\n arr.each do |e|\n hsh.has_key?(e.size) ? hsh[e.size] += 1 : hsh[e.size] = 1\n end\n hsh\nend",
"def punctuation(sentence)\n\n # Breaks the sentence into characters\n chrs = sentence.chars\n # Creates a list of the desired characters\n marks = [\"?\", \"-\", \":\", \".\", \"!\"]\n hash = Hash.new(0)\n\n # Compares each character in the sentence\n # to the punctuation marks array and increments the hash value by one if it contains a match\n\n chrs.each do |charac|\n\n if marks.include?(charac)\n hash[charac] += 1\n end\n end\n\n puts hash.values.reduce(:*)\n\nend",
"def word_sizes(string)\n\n arr_words = string.split \n hash_counts = Hash.new(0)\n\n arr_words.each do |word|\n size = word.size\n hash_counts[size] += 1\n end\n\n hash_counts\nend",
"def generate_code(str)\n word_arr = str.split(\" \")\n word_arr_simple = str.downcase.split(\" \").each {|x| x.gsub!(/\\W+/, '')}\n\n word_hash = {}\n counter = 1\n\n word_arr_simple.each do |word|\n if word_hash[word] != nil\n else\n word_hash[word] = counter\n counter += 1\n end\n end\n\n $new_array = []\n\n word_arr_simple.each_with_index do |word, index|\n $new_array << [word_arr[index], word_hash[word]]\n end\n\n # $new_array = word_arr_simple.map{|x| [x, word_hash[x]]}\n\nend",
"def word_sizes(str)\n word_count = Hash.new(0)\n\n str.split(' ').each do |word|\n word_count[word.size] += 1\n end\n\n word_count\n\nend",
"def initialize *args\n @attempts = Hash.new(nil)\n @sentence = args[0] || DEFAULT_SENTENCE\n @words = args[1] || ENGLISH_NUMBERS\n @words = @words.dup\n @thirty_plus = args[1] || ENGLISH_THIRTY_PLUS\n count = 30\n @thirty_plus.each do |word|\n @words[count] = word\n count += 10\n end\n\n extend_wordlist MAX_COUNT\n #puts \"@sentence=#{@sentence}\"\n # only add one the first time, all the others already have the extra one\n\n @result = letter_frequency @sentence\n @result.each { |k,v| @result[k] += 1 }\n #puts full_sentence( @result )\n self\n end",
"def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend",
"def word_sizes(words)\n result_hash = Hash.new(0)\n words.split.each do |word| \n word = word.gsub(/[^a-z]/i,\"\")\n result_hash[word.length] += 1\n end\n result_hash\nend",
"def new_list (string)\nitem_hash= hash.new\nitem_array = string.split\nitem_array.each do |item|\n item_hash[item] = 1\nend\nitem_hash\nend",
"def word_sizes(words)\n count_hash = Hash.new(0)\n words.split.each do |word|\n count_hash[word.size] += 1\n end\n p count_hash\nend",
"def count_words\n # clean up string\n str = self.downcase.gsub(/[^a-z0-9\\s]/, '') # only keep letters, numbers, and whitespace\n str = str.gsub(/\\s+/m, ' ') # remove excess whitespace\n\n # add each word to the hash\n hash = Hash.new(0)\n str.split.each do |word|\n hash[word] += 1\n end\n\n hash\n end",
"def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend",
"def histogram(a_string)\n an_array = Array.new(a_string.length)\n ls_compact_string = a_string.delete(' ')\n an_array = ls_compact_string.downcase\n str_hash = Hash.new(0)\n for idx in 0..an_array.length\n item = an_array[idx]\n str_hash[item] += 1\n end\n return str_hash\nend",
"def substrings(string, dictionary)\r\n\tresult = Hash.new(0)\r\n\tarr = string.downcase.split(\" \")\r\n\tarr.each do |word|\r\n\t\tdictionary.each do |sub|\r\n\t\t\tresult[sub] += 1 if word[sub]\r\n\t\tend\r\n\tend\r\n\tresult\r\nend",
"def product_punctuation(str)\n\n p new_hash = Hash.new(0)\n # p new_hash2 = {}\n str.split(\"\").each do |el|\n if \",.-;?!\".include?(el)\n new_hash[el] += 1\n end\n end\n new_hash.values.reduce(:*)\nend",
"def list(words)\n arr = words.split(\" \")\n hash_list = {}\n arr.each {|key| hash_list[key] = 0}\n return hash_list\nend",
"def create_list(items)\n hash = Hash.new(0)\n items.split(\" \").each do |item|\n hash[item] += 1\n end\n p hash\nend",
"def make_smart_dictionary\n\t\t@smart_dictionary = {}\n\t\t@dictionary.each do |el|\n\t\t\tel.chomp.split(\"\").each do |key|\n\t\t\t\tif @smart_dictionary.keys.include?(key)\n\t\t\t\t @smart_dictionary[key] += 1\n\t\t\t\telse\n\t\t\t\t\t@smart_dictionary[key] = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@hash_to_sort = @smart_dictionary.sort_by { |k,v| v }.map { |k,v| k }\n\tend",
"def ae_count(str)\n # Write your code here\n arr=str.scan(/./)\n my_list = Hash.new(0)\n num = 1\n # puts \";Hey #{sentence}\"\n\n arr.each do |chr|\n if chr == 'e' || chr == 'a'\n my_list[chr] += num\n end\n end\n Hash[my_list.sort]\nend",
"def letter_count(str)\n letters_hash = {}\n letters_array = str.split(\"\")\n \n letters_array.delete(\" \")\n \n letters_array.each {|x| letters_hash[x] = (letters_hash[x] or 0) + 1}\n letters_hash\nend",
"def word_count(str)\n words = Hash.new(0)\n str.downcase.split.each do |word|\n word = word.tr('^a-z', \"\")\n words[word] += 1\n end\n words\nend",
"def letter_counts(word)\n letters = word.split(\"\")\n letter_hash = Hash.new(0)\n letters.each {|char| letter_hash[char]+= 1}\n letter_hash\nend",
"def substrings text,dictionary\n\ttext.downcase!\n\thash = {}\n\tdictionary.each do |word|\n\t\tcount = text.scan(word.downcase).length\n\t\thash[word] = count if count > 0\n\tend\n\thash\nend",
"def string_to_hash(string)\n words = string.split(\" \")\n array_length = words.length\n hash = Hash.new\n i = 0\n for i < array_length\n hash += words[i]\n end\n return hash\nend",
"def count_words(string)\n string.gsub!(/(\\W|\\d)/, \" \")\n string.gsub!(/\\s+/, \" \")\n puts(string)\n\n map = Hash.new\n stringAsArray = string.split(/ /)\n stringAsArray.each do |word|\n if map[word] == nil\n map[word] = 1\n else\n temp = map[word]\n map[word] = temp+1\n end\nend\nputs map\nend",
"def word_lengths(sentence)\n words_lengths = Hash.new\n words = Array.new\n lengths = Array.new\n\n words = sentence.split\n\n words.each do |word|\n lengths << word.length\n end\n\n words_lengths = Hash[words.zip(lengths)]\n\n puts words_lengths\n\nend",
"def count_words(input)\r\n result = Hash.new(0)\r\n input.split(\" \").each do |word|\r\n result[word.downcase] += 1\r\n \r\n end\r\n word_count(result)\r\n return result\r\nend",
"def cuenta_palabras(s)\n\t\tkey = s.split(/\\W+/)\n\t\th = Hash.new(0)\n\t\tkey.each {|v| h[v] +=1}\n\t\th\n\tend",
"def word_lengths(str)\n hsh = Hash.new\n str.split.each do |word|\n hsh[word] = word.length\n end\n hsh\nend",
"def substrings (word, dict)\n\tbigarray = []\t\n\twordray = word.downcase.split \t\n \t\n \tfor i in wordray \t\t\n\t\tnn = dict.select { |w| i.include?(w) }\t\t\t\n\t\tbigarray = bigarray+nn\t\n\tend\t\t\n\t\t\n\tbigash = Hash.new(0).tap { |h| bigarray.each { |word| h[word] += 1 } }\n\treturn bigash\t\nend",
"def sub_strings(arr,text)\n text = text.downcase\n result = Hash.new(0)\n arr.each do |word|\n result[word] += 1 unless text.scan(word.downcase).empty?\n end\n result\nend",
"def hashify(key)\n array = key.split('')\n count = array.count\n array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n end",
"def count\n @letters = Hash.new(0)\n puts \"Hey let's find how many times each letter shows up in your sentence\"\n input = gets.strip.gsub(' ','').split('').sort\n input.each do |x|\n @letters[x] += 1\n end\n \n @letters.each do |key, value|\n puts \"Ther letter #{key} is in your sentence #{value} times.\"\n end\n\nend",
"def word_sizes(str)\n length_hsh = {}\n\n str.split(' ').each do |word|\n if length_hsh.key?(word.length)\n length_hsh[word.length] += 1\n else\n length_hsh[word.length] = 1\n end\n end\n\n length_hsh\nend",
"def letter_counts(word)\n counter = Hash.new(0)\n word.split('').each do |letter| #could also do each_char instead of split\n counter[letter] += 1\n end\n counter\nend",
"def count_words( string )\n h = Hash.new\n arr = string.downcase.gsub(/[^a-z ]/, '').split.each { |word|\n if h.include?( word )\n h[word] = h[word].next\n else\n h[word] = 1\n end\n }\n return h\nend",
"def word_sizes(input)\n\n occurrences = Hash.new(0)\n\n input.split.each do |element|\n occurrences[element.size] += 1\n end\n \n occurrences\nend",
"def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend",
"def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end",
"def substrings(phrase,dictionary)\n word_freq = Hash.new(0)\n phrase.split().each do |word|\n dictionary.each do |dict|\n if word.downcase.include?(dict)\n word_freq[dict]+=1\n end\n end\n end\n puts word_freq\nend",
"def count_words(string)\n#names=string.downcase.split(/\\W+/)\n#puts names\ncounts = Hash.new(0)\nstring.downcase.split(/\\W+/).each { |name| counts[name] += 1 }\nputs counts\nend",
"def substrings(input, dictionary)\n\thash = {}\t\t\t\t\t# Initialize empty hash\n\tdictionary.each do |word|\n\t\t# For each word, count the number of times it appears\n\t\tcount = input.downcase.scan(word.downcase).length\n\t\tif count > 0\n\t\t\t# If greater than 0:\n\t\t\thash[word] = count\t# Add word => count to hash\n\t\tend\n\tend\n\thash\nend",
"def word_sizes(text)\n word_size = Hash.new(0)\n words = text.split\n words.each { |word| word_size[word.size] += 1 }\n word_size\nend",
"def list_creation(str)\r\n\r\n list = {}\r\n str.split(' ').each { |item| list[item] = 1 }\r\n\r\n list\r\nend",
"def hashit\n n = 0\n Chars.split(\"\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n @rotor_hash\n end",
"def create_list(string)\n list = {}\n string = string.split \n\n string.each { |item| \n list[item] = 1\n }\n\n printhash(list)\n\n list\nend",
"def word_sizes(string)\n cleaned_string = string.gsub(/[^\\w\\s]/, '') \n #cleaned_string = string.delete('^A-Za-z ')\n # puts cleaned_string\n result = Hash.new(0)\n cleaned_string.split.each do |word| \n result[word.size] += 1\n end\n result\nend",
"def word_lengths(str)\n ans = Hash.new\n str.split.each do |word|\n ans[word] = word.length\n end\n ans\nend",
"def word_lengths(str)\n hash = {}\n str.split.each do |word|\n hash[word] = word.length\n end\n hash\nend",
"def count_words(str)\n\n frase = str.gsub!(/\\W|\\_\\d/,\" \").split(\" \")\n frase.each do |palabra|\n\n veces = frase.count(palabra)\n hash[palabra] = veces\n\n end\n hash\n\n\n\n end",
"def savvy_shuffled_sentence(s1,s2)\n hash1,hash2 = Hash.new(0),Hash.new(0)\n s1.split(' ').each {|word| hash1[word] += 1}\n s2.split(' ').each {|word| hash2[word] += 1}\n hash1 == hash2\nend",
"def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend",
"def word_sizes(str)\n counts = Hash.new(0)\n if str == \"\"\n return {}\n else\n str.gsub!(/[^0-9A-Za-z\\s]/, \"\").split.each do |word|\n counts[word.size] += 1\n end\nend\n counts\n\nend"
] |
[
"0.738351",
"0.6912374",
"0.68913656",
"0.6877054",
"0.66581875",
"0.66301024",
"0.65555286",
"0.6554611",
"0.65495664",
"0.65027773",
"0.64794147",
"0.64735574",
"0.64562494",
"0.64534694",
"0.64375323",
"0.6434497",
"0.6421537",
"0.64114994",
"0.6409853",
"0.6404675",
"0.64013094",
"0.6391627",
"0.6377186",
"0.63761425",
"0.63738656",
"0.6359402",
"0.63547033",
"0.63189334",
"0.62920177",
"0.62915266",
"0.6277832",
"0.6277642",
"0.62762696",
"0.6242979",
"0.62356156",
"0.6228424",
"0.6225322",
"0.6207397",
"0.61910117",
"0.618478",
"0.61824936",
"0.6170765",
"0.6164175",
"0.61602503",
"0.61543274",
"0.6153285",
"0.6149092",
"0.61489165",
"0.61456394",
"0.6140011",
"0.6137733",
"0.61357033",
"0.61095554",
"0.61076355",
"0.6107111",
"0.61066055",
"0.61065614",
"0.60998625",
"0.60909015",
"0.60775644",
"0.60766965",
"0.60679024",
"0.60645425",
"0.60620797",
"0.60612905",
"0.60593194",
"0.6058325",
"0.6054617",
"0.6050215",
"0.6048354",
"0.6043645",
"0.60414237",
"0.6015998",
"0.6013157",
"0.6009163",
"0.60038525",
"0.6000348",
"0.59982014",
"0.5989387",
"0.59858197",
"0.5984969",
"0.5984597",
"0.59813184",
"0.59757316",
"0.5971326",
"0.59704876",
"0.59626496",
"0.59604913",
"0.5953306",
"0.59499896",
"0.5930177",
"0.5928632",
"0.5928507",
"0.59278387",
"0.5925347",
"0.5917476",
"0.59162635",
"0.59108263",
"0.5905698",
"0.5902775"
] |
0.6968999
|
1
|
end m = Parameter.get_float('markup rate') + 1
|
def cost(op)
{labor: 4.38, materials: 0}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rate; end",
"def rate; end",
"def rate=(_arg0); end",
"def rate=(_arg0); end",
"def effective_rate; end",
"def base_markup_price\n @base_price + (@base_price * Flat_Markup_Rate)\n end",
"def add_markup_materials\n if Material_Markup_Rate[\"#{@material}\"]\n markup = Material_Markup_Rate[\"#{@material}\"]\n else\n markup= 0.00\n end\n base_markup_price * markup\n end",
"def rate_scale; end",
"def exp_rate; CPanel::EXPRATE; end",
"def markup_tirerack(price)\n (((price + 12.50) * 1.35) * 1.16) \n end",
"def rates; end",
"def rates; end",
"def pmt(rate,n,amount)\n\n\ttop = 0.0\n\ttop = rate*(1+rate)**n\n\tbot = 0.0\n\tbot = (1+rate)**n-1\n\tresult = 0.0\n\tresult =amount*top/bot\n\treturn result \n\nend",
"def rate\n return @rate\n end",
"def numerator() end",
"def initialize\n @rate = 0.10\n end",
"def flamegraph_sample_rate=(_arg0); end",
"def amount_multiplier\n 1000\n end",
"def band_a\n 1000\n end",
"def add_markup_person\n base_markup_price * @person * Person_Markup_Rate\n end",
"def mp_rate\r\n mmp > 0 ? @mp.to_f / mmp : 0\r\n end",
"def prec_i() end",
"def initialize\n @rate = 0.90\n end",
"def flamegraph_sample_rate; end",
"def debt_rate\n ten_year_treasury + bps(200)\n end",
"def tag_rate\n marc.load_source false\n ((marc.all_tags.map{|e| e.tag}.uniq.size.to_f / (template_tags(record_type).uniq.size.to_f * 100)) * 100).round(2)\n end",
"def rate_scale=(_arg0); end",
"def rate\n @rate * ONE_NANOS\n end",
"def boost\n 1.0\n end",
"def final_price\n base_markup_price + add_markup_person + add_markup_materials\n end",
"def UpdateRate=(arg0)",
"def UpdateRate=(arg0)",
"def dealer_markup\n (origin_price*0.08).round\n end",
"def shiny_rate\n 16\n end",
"def final_rate_adjustment rate\n (rate/100.0).ceil - 0.01\n end",
"def parse_block_math; end",
"def boost\n 1.0 #self.rating / 2.0\n end",
"def get_markup(code) \n @markups_for_codes.each do |key, value| \n return value/100.00 if key.include?(code.to_i)\n end \n @default_markup/100.00\nend",
"def us_treas_10_year_rate\n # In real life call a web service to get it, but I will return a constant here\n 0.02124\n end",
"def prec_f() end",
"def prec(*) end",
"def weight; end",
"def amount; end",
"def ap_rate; CPanel::APDRATE; end",
"def parse_inline_math; end",
"def gold_rate; CPanel::GOLDRATE; end",
"def balloon_speed\r\r\n return 15\r\r\n end",
"def pmt(interest_rate,payments,principal)\n numerator =interest_rate*principal*(1 + interest_rate)**payments\n denominator= (1+ interest_rate)**payments - 1\n return numerator/denominator.to_f\nend",
"def ca_plus_mse\n total_formative * (100 - examweight)/100\n end",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def money; end",
"def quota()\n (@quota) + (@experience / 2)\nend",
"def precision; end",
"def quota\n @quota = 50 + @exp/2\n \n end",
"def fractional; end",
"def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end",
"def rate=(value)\n @rate = value\n end",
"def price_in_sterling \n\t\tprice * 1.5\n\tend",
"def update_rate\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:update_rate]\n attr = Sketchup.active_model.get_attribute('MSPhysics', 'Update Rate', default)\n return AMS.clamp(attr.to_i, 1, 100)\n end",
"def medical_use; end",
"def tp_rate\r\n @tp.to_f / 100\r\n end",
"def get_inflation_rate()\r\n #assume a inflation rate between 2% and 7%\r\n inflation_rate=(rand(7)*0.01)\r\n if inflation_rate > 0.02\r\n return inflation_rate\r\n else\r\n return 0.02\r\n end\r\nend",
"def next_exp\n lvl * 100\n end",
"def measure\n\t\t1\n\tend",
"def bmr\n\n # Convert the recent rate from G to LBs\n recent_weight = self.recent_most_weight\n recent_weight = recent_weight.nil? ? nil : self.recent_most_weight.value.to_s + \"g\"\n recent_weight = recent_weight.nil? ? nil : recent_weight.to_unit.convert_to(\"lbs\").scalar.to_i\n\n user_age = self.age\n\n # Require at least these parameters before being able to calculate BMR\n return nil if preferences[\"height\"].blank? || user_age.nil? || recent_weight.nil?\n\n # If there's no sex stated, assume the person is female (because it estimates lower)\n sex = preferences[\"sex\"] == \"m\" ? \"m\" : \"f\"\n\n # Our activity levels correspond to a percentage above\n activity = preferences[\"activity_level\"].blank? ? 2 : preferences[\"activity_level\"].to_i\n activity_multiplier = 1 + (activity / 10)\n\n # Calculate our height from CM to IN\n height = preferences[\"height\"] + \"cm\"\n height = height.to_unit.convert_to(\"in\").scalar.to_i\n\n bmr = 0\n if sex == \"m\"\n bmr = 66 + (6.3 * recent_weight) + (12.9 * height) - (6.8 * user_age)\n else\n bmr = 655 + (4.3 * recent_weight) + (4.7 * height) - (4.7 * user_age)\n end\n return (bmr * activity_multiplier).ceil\n end",
"def pmt rate, nper, pv\n\n\tpay = 0.0\n\tnumerator = 0.0\n\tdenominator = 0.0\n\n\tnumerator = pv * rate * (1 + rate) ** nper\n\n\tdenominator = ((1 + rate) ** nper) - 1\n\n\tpay = numerator / denominator\n\n\treturn pay.round(2)\n\nend",
"def vat_rate\n end",
"def pmt (interest_rate, nper, pv)\n\t#monthly_payment = 1.00\n\tmonthly_payment = (pv*interest_rate*((1+interest_rate)**nper))/(((1+interest_rate)**nper)-1)\n\treturn monthly_payment\nend",
"def pmt(rate, nper, pv)\n\n # =========================================================\n #the required output already accounts for monthly nature by dividing the 0.0404 by 12. it also already puts the percentage in decimal form so no need to adjust for rate on the back end\n part1 = (pv * rate)\n part2 = 1 - (1 + rate)**-nper\n\n monthly_payment = part1 / part2\n\n # Your code to implement the method goes here.\n # You shouldn't have to write or change code anywhere else.\n # =========================================================\nend",
"def denominator() end",
"def auto_price(multiplier)\n return unless @blueprint\n @markup = (self.base_price * multiplier) - self.base_price\n end",
"def masterwork_prob_bonus; 0; end",
"def default_rate_in_pounds\n default_rate_pence / 100\n end",
"def min_shutter_speed; end",
"def max_descent_speed; end",
"def promo_code_multiplier\n return 1.0 unless promo_code.present?\n\n (100 - promo_code.discount) / 100.0\n end",
"def phat\n @phat ||= 1.0 * positive/total\n end",
"def weight\n 2 # ounces\n end",
"def text_rate(rate)\n BestiaryConfig::TEXT_RATE[rate]\n end",
"def mass\n 10\n end",
"def progress_rate\n 1\n end",
"def rating(u,m)\n\t\tresult=@db.get_rate(u,m,:base)\n\t\tif result\n\t\t\treturn result.to_i\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def body_math_index\n weight / (height * height)\n end",
"def gain_multiplier(delta)\n self.multiplier += delta\n if multiplier < 0\n delta -= multiplier\n self.multiplier = 0\n end\n delta\n end",
"def ratio(m_d,m)\n\n if @target == \"max\"\n return \" \" if m_d==0.0\n r = Metric.op(m,m_d,\"/\")\n else\n return \" \" if m==0.0\n r = Metric.op(m_d,m,\"/\")\n end\n\n return \"#{r}\"\n\n\n end",
"def income_tax(income=0,inc_tax_rate=0.1)\n income*inc_tax_rate\nend",
"def income_tax(income=0,inc_tax_rate=0.1)\n income*inc_tax_rate\nend",
"def mambo_no_5; end",
"def pmt(rate,nper,pv,fv =0,type = 0)\n #- pv/((1 - (1 / (1 + rate)**nper )) / rate)\n pv = -pv\n\n k = [1,1+rate][type]\n\n -(pv + (pv - fv)/((1+rate) ** nper - 1))* -rate/k #added some extra neg signs to get it to work\n end",
"def rating; \"Д/379 (stub)\"; end",
"def autosizedMaximumFlowRate\n\n return self.model.getAutosizedValue(self, 'Design Size Maximum Flow Rate', 'm3/s')\n \n end",
"def decimal_mark; end",
"def max_shutter_speed; end",
"def set_update_rate(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.set_update_rate(rate) if sim\n return rate\n end",
"def param_buff_rate(param_id)\r\n @buffs[param_id] * 0.25 + 1.0\r\n end",
"def add_rate(from, to, rate); end",
"def quantum_number\n @l + @m + @n\n end",
"def percentage; end",
"def multiplier\n Misc.pos_neg_read_multip(pos,neg,read)\n end",
"def get_update_rate\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:update_rate]\n attr = Sketchup.active_model.get_attribute('MSPhysics', 'Update Rate', default)\n return AMS.clamp(attr.to_i, 1, 100)\n end",
"def weight\n 0\n end"
] |
[
"0.7347682",
"0.7347682",
"0.70341593",
"0.70341593",
"0.693174",
"0.6668449",
"0.6599934",
"0.65176076",
"0.6514493",
"0.64854443",
"0.6388965",
"0.6388965",
"0.63847077",
"0.6339105",
"0.6279815",
"0.6242342",
"0.6225584",
"0.6222308",
"0.62050426",
"0.6187526",
"0.61742777",
"0.6157041",
"0.6121359",
"0.60712594",
"0.6049617",
"0.6031906",
"0.60300267",
"0.60265213",
"0.60082227",
"0.60064834",
"0.6005174",
"0.6005174",
"0.60026145",
"0.5998111",
"0.5991093",
"0.5990957",
"0.59658706",
"0.59642893",
"0.594646",
"0.594119",
"0.59351707",
"0.592107",
"0.5907812",
"0.5849529",
"0.58301276",
"0.58208126",
"0.5803205",
"0.5787698",
"0.5776418",
"0.5763234",
"0.5760598",
"0.5757193",
"0.5749951",
"0.5747938",
"0.57351106",
"0.5732327",
"0.5732204",
"0.57222867",
"0.5718524",
"0.57153475",
"0.57127655",
"0.57127136",
"0.57067335",
"0.5696583",
"0.5695582",
"0.5686508",
"0.56814486",
"0.56752646",
"0.56729585",
"0.56577057",
"0.5655561",
"0.56531453",
"0.56443435",
"0.5644321",
"0.56216836",
"0.5621305",
"0.5606679",
"0.5604197",
"0.5595971",
"0.55934495",
"0.5593364",
"0.5592941",
"0.55876416",
"0.55826175",
"0.5580871",
"0.5574803",
"0.5574803",
"0.55688655",
"0.5567058",
"0.5566574",
"0.5566399",
"0.5565612",
"0.55611426",
"0.5556135",
"0.5555763",
"0.5555278",
"0.55491984",
"0.5546986",
"0.5543827",
"0.554007",
"0.55395406"
] |
0.0
|
-1
|
GET /recommenders/1 GET /recommenders/1.json
|
def show
@recommender = User.where(username: params[:username]).first.recommender
if @recommender.nil?
render json: "No Recommender of this user found"
else
render json: @recommender.to_json(only: :latest_recommendation)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recommendations\n\t @recommendations = Restaurant.find(params[:id]).recommendations\n\t \n\t respond_to do |format|\n\t\t format.html # recommendations.html.erb\n\t \t format.json { render json: @recommendations.to_json(except: [ :created_at, :updated_at ]) }\n\t end\n end",
"def show\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommend }\n end\n end",
"def show\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommender }\n end\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recommendation }\n end\n end",
"def get_recommendations\n SpotifyApiAdapter.get_recommendations(self)\n end",
"def index\n @collection = current_user.collections.find(params[:collection_id]) \n @recommenders = @collection.recommenders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recommenders }\n end\n end",
"def index\n @recommendations = Recommendation.all\n end",
"def get_recommendation(recommendation_name)\n request_body = {\n identification: identification,\n max_products: 16,\n \trequest: [\n \"details\",\n \"results\"\n ]\n }.compact\n search_response = request_tagalys(\"/recommendations/\" + recommendation_name, request_body)\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n end",
"def recommendations\n unless params[:user_id].present?\n render json: { response: 'User id not present' }, status: :bad_request\n end\n\n user = User.find_by_id(params[:user_id])\n recommendations = []\n\n user.movies.each do |movie|\n recommendations_for_movie = Tmdb::Movie.recommendations(movie[:id])\n recommendations_for_movie[:results].each do |recommendation|\n recommendations << recommendation\n end\n end\n\n render json: { response: recommendations }, status: :ok\n end",
"def recommendations\n @recommendations = []\n @connection.response_data.map do |rec|\n recommendation = {}\n recommendation['name'] = rec[\"name\"]\n recommendation['rating'] = rec[\"rating\"] \n recommendation['price'] = rec[\"price_level\"]\n recommendation['address'] = rec[\"vicinity\"]\n @recommendations << recommendation\n end\n @recommendations\n end",
"def new\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommender }\n end\n end",
"def recommendations_for item, options = {}\n options = options.reverse_merge(default_options)\n\n klass = item.is_a?(Hash) ? item.delete(:class) : item.class.to_s.downcase\n object_id = item.is_a?(Hash) ? item.delete(:object_id) : item.id\n\n data = request_object.object_types.send(klass).object.recommendations.page(options[:page]).limit(options[:limit]).get(object_id)\n return [] if data[\"recommendations\"].blank?\n ids = data[\"recommendations\"].map { |d| d[\"recommendation_id\"] }\n return klass.classify.constantize.where(id: ids) if options[:load]\n ids\n end",
"def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end",
"def show\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t#sleep 1\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend",
"def index\n @recommendations = Recommendation.select(\"note, user_id, recommendations.id, movies.id AS movie_id, title, release_date, overview, poster_path, api_id\").joins(\"INNER JOIN movies ON recommendations.movie_id = movies.id\")\n render json: @recommendations.to_json\n end",
"def recommendations\n check_preference_setup \n check_last_played_time\n add_personality_recommendations\n\n @recommendations\n end",
"def index\n @book_recommendations = BookRecommendation.all\n end",
"def index\n @load_content = preload_content\n @recommendations = policy_scope(\n @parent.recommendations.preload(preload_content))\n render 'api/v1/recommendations/index'\n end",
"def user\n recommendations 'user'\n end",
"def show\n @user = User.find(params[:id])\n @recommendation = @user.recommendations.build if logged_in?\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def show\n @recommendation = Recommendation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def new\n\t\t@recommendation = Recommendation.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @recommendation }\n\t\tend\n\tend",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def set_recommendation\n @recommendation = Recommendation.find(params[:id])\n end",
"def recommend_by_id(id, opts = {})\n post 'recommend-by-id', { document_id: id }.merge(opts)\n end",
"def index\n @recommendeds = Recommended.all\n end",
"def list_recommendations_by_next_token(next_token)\n operation('ListRecommendationsByNextToken')\n .add('NextToken' => next_token)\n\n run\n end",
"def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end",
"def user_recommendations user_id, options = {}\n options = options.reverse_merge(default_options)\n klass = options.delete(:object_type) || options.delete(:class)\n\n if klass.present?\n data = request_object.user.send(klass).recommendations.page(options[:page]).limit(options[:limit]).get(user_id)\n else\n data = request_object.user.recommendations.page(options[:page]).limit(options[:limit]).get(user_id)\n end\n return [] if data[\"recommendations\"].blank?\n\n if options[:load]\n return klass.classify.constantize.where(id: data[\"recommendations\"].map { |d| d[\"recommendation_id\"] }) if klass.present?\n return data[\"recommendations\"].map { |d| d[\"object_type\"].classify.constantize.where(id: d[\"recommendation_id\"]).first }.reject(&:nil?)\n end\n data[\"recommendations\"].map { |d| { type: d[\"object_type\"], id: d[\"recommendation_id\"] } }\n end",
"def set_book_recommendation\n @book_recommendation = BookRecommendation.find(params[:id])\n end",
"def index\n @blog_recommendations = Blog::Recommendation.all\n end",
"def recommendation=(value)\n @recommendation = value\n end",
"def new\n @recommendation = Recommendation.new\n @rr = RecommendationRequest.find(params[:request])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommendation }\n end\n end",
"def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end",
"def create\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.new(params[:recommender])\n\n respond_to do |format|\n if @recommender.save\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully created.' }\n format.json { render json: @recommender, status: :created, location: @recommender }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @recommendation = App.find(params[:id])\n if @recommendation.nil?\n redirect_to action: :index\n end\n end",
"def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end",
"def rec_like\n @beer_types_to_try = @user.recommend_liked_beer.map{|type| [type.id, type.name]}\n render json: @beer_types_to_try\n end",
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def personalized_recommendations(customer_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.recommended(['product']).map { |product| product.sub('product', '').to_i }\n end",
"def recommend_articles\n @user = User.find(params[:user_id])\n @articles = @user.recommend_articles.accessibles(current_user).order_by_recommendations_count_desc.paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::RECOMMEND)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end",
"def create\n if params[:recommend][:recommended_type] ==\"Item\"\n @object_id=Item.find_by_url(params[:recommend][:recommended_id]).id\n elsif params[:recommend][:recommended_type] ==\"Matter\" \n @object_id=Matter.find_by_id(params[:recommend][:recommended_id]).id\n elsif params[:recommend][:recommended_type] ==\"Brand\"\n @object_id=Brand.find_by_id(params[:recommend][:recommended_id]).id\n else\n @object_id=params[:recommend][:recommended_id].to_i\n end\n\n params[:recommend][:recommended_id]=@object_id\n @recommend = Recommend.new(params[:recommend]) unless \\\n Recommend.find_by_recommended_type_and_recommended_id(params[:recommend][:recommended_type], @object_id )\n\n respond_to do |format|\n if @recommend and @recommend.save\n format.json { render json: @recommend, status: :created, location: @recommend }\n else\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if (current_user && !current_user.advertiser?)\n @advertisements = Advertisement.find_recommendations_for(current_user)\n \n @advertisements += Advertisement.for_homepage(current_user).excluding_ids(@advertisements.collect(&:id))\n else\n @advertisements = Advertisement.for_homepage(current_user)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advertisements }\n end\n end",
"def recommendation\n return @recommendation\n end",
"def get_user_recommendations\n recommendations = []\n csv = open( CONFIG['SPREADSHEET_URL'] ).read\n CSV.parse( csv ).each_with_index do |line,i|\n next if i == 0 # Skip header\n date, title, category, url, note, person = *line\n next if category.match(/^Other/) # Looking at specific categories - Other is too broad\n if matches = url.match(%r{/(?:dp|product|ASIN)/([^/]*)})\n recommendations << {\n :id => matches[1],\n :category => category\n }\n end\n end\n recommendations\n end",
"def recommendations_for(obj)\n recommend_by_item_based obj\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 recommendation()\n @type.recommendation(self)\n end",
"def predictions\n raise \"Err\"\n buyer_suggestions = PropertyBuyer.suggest_buyers(params[:str]).select([:id, :name, :image_url]).limit(20)\n render json: buyer_suggestions, status: 200\n end",
"def related\n Birdman::Requester.get(\"movies/#{id}/related\")\n end",
"def review\n learnables =\n current_user\n .rated_learnables\n .for_review\n .limit(MAX_NUMBER_OF_RATINGS_PER_REQUEST)\n\n @status = status\n @learnables_serializer =\n ActiveModel::Serializer::CollectionSerializer.new(learnables, {})\n end",
"def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\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 review\n fetch('restaurant.review')\n end",
"def update\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.find(params[:id])\n\n respond_to do |format|\n if @recommender.update_attributes(params[:recommender])\n format.html { redirect_to collection_recommenders_path(@collection), notice: 'Recommender was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommender.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n #deeply nested... so starts with gyms,goes to trainers,goes to clients.\n #since clients belongs to trainer we use trainer here..\n #but in trainers_controller the trainers belongs to gyms so gyms is used orignally.\n @product=Product.find(params[:product_id])\n @reviews=Review.where(product_id: @product.id)\n render json:@reviews, status: :ok\n end",
"def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reviewer }\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end",
"def recommendations(options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n return [] if likes.count + dislikes.count == 0\n\n unioned_predictions = \"#{self.class}:#{id}:predictions\"\n Recommendable.redis.zunionstore unioned_predictions, Recommendable.recommendable_classes.map {|klass| predictions_set_for(klass)}\n \n recommendations = Recommendable.redis.zrevrange(unioned_predictions, 0, options[:count]).map do |object|\n klass, id = object.split(\":\")\n klass.constantize.find(id)\n end\n \n Recommendable.redis.del(unioned_predictions) and return recommendations\n end",
"def update_recommend\n if params[:recommender_id]\n begin\n\t@reservation = get_reservation\n rescue ActiveRecord::RecordNotFound\n\terror \"cannot find reservation #{session[:reservation_id]}\"\n\trender(:nothing => true) and return\n end\n @reservation.update_attributes :recommender_id => params[:recommender_id].to_i\n end\n render(:nothing => true)\n rescue => err\n error err.to_s\n end",
"def recommender\n @recommender = Octo::Recommender.new unless @recommender\n @recommender\n end",
"def index\n @page_title = 'Movie Recommendations'\n @pagy, @recommendations = pagy(MovieUserRecommendation.includes(:user, :movie).all, items: 99)\n end",
"def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end",
"def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end",
"def set_movie_user_recommendation\n @recommendation ||= MovieUserRecommendation.find(params[:id])\n end",
"def update_recommendations\n Recommendable.recommendable_classes.each {|klass| update_recommendations_for klass}\n end",
"def get_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: Product.order(created_at: :desc).limit(20).map(&:simple_info.with(follower)),\n status: :ok\n end",
"def recommendations_for(klass, options = {})\n defaults = { :count => 10 }\n options = defaults.merge options\n \n return [] if likes_for(klass).count + dislikes_for(klass).count == 0 || Recommendable.redis.zcard(predictions_set_for(klass)) == 0\n \n recommendations = []\n i = 0\n until recommendations.size == options[:count]\n prediction = Recommendable.redis.zrevrange(predictions_set_for(klass), i, i).first\n return recommendations unless prediction # User might not have enough recommendations to return\n \n object = klass.to_s.classify.constantize.find(prediction.split(\":\")[1])\n recommendations << object\n i += 1\n end\n \n return recommendations\n end",
"def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"def create\n @recommendation = current_user.recommendations.new(\n :article_id => params[:article_id])\n authorize @recommendation\n if @recommendation.save\n ArticleRankingWorker.perform_async(params[:article_id])\n render 'api/v1/recommendations/show', status: :created\n else\n render json: @recommendation.errors, status: :unprocessable_entity\n end\n end",
"def index\n @inchef_recommendations = InchefRecommendation.all\n end",
"def recommendations_generate(num)\n sort_my_list\n RSpotify::Recommendations.generate(limit: num, seed_artists: @artists, seed_genres: @genres, seed_tracks: @tracks)\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @user_rating = @restaurant.user_rating(current_user)\n @average_rating = @restaurant.average_rating\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @restaurant.application_hash(current_user).to_json }\n end\n end",
"def recommended_by_current_user\n if current_user\n extract = Csvarchive.find(params[:id])\n e_rec = extract.recommendations\n u_rec = current_user.recommendations\n all_rec = e_rec & u_rec\n if !all_rec.empty?\n @recommended = true\n else\n @recommended = false\n end\n else\n @recommended = false\n end\n end",
"def recommendation_params\n params.require(:recommendation).permit(:name, :detail, :rating)\n end",
"def index\n if !params[:cuisine]\n query = params[:search][:term].split(\",\")\n result = Restaurant.get_results_from_google_places(query, current_user)\n @restaurants = result\n else\n query = params[:cuisine]\n result = Restaurant.get_results_from_google_places(query, current_user, true)\n @restaurants = result\n end\n\n # so that we render the links only when we have recommendations from friends\n @found_recommendations = []\n @restaurants.each do |restaurant|\n recommendations = Recommendation.get_friend_recommedation_by_restaurant(restaurant[\"id\"], @registered_friends)\n if recommendations.empty?\n @found_recommendations << false\n else\n @found_recommendations << true\n end\n end\n end",
"def show\n RestaurantReview.find(params[:id])\n end",
"def create\n @recommendation = Recommendation.new\n\n respond_to do |format|\n if @recommendation.save\n format.html { redirect_to @recommendation, notice: 'Recommendation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recommendation }\n else\n format.html { render action: 'new' }\n format.json { render json: @recommendation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_researcher\n @researcher = Researcher.find(params[:id])\n end",
"def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def new\n @recommendation = Recommendation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recommendation }\n end\n end",
"def recommended_articles\n @user = User.find(params[:user_id])\n @articles = @user.articles.accessibles(current_user).recommended.order_by_recommendations_count_desc.paginate(page: params[:page], per_page: Article::PER_PAGE) unless @user.blank?\n @more_link_path = more_articles_path(user_id: params[:user_id], page: @articles.next_page, articles_type: Article::List::Type::RECOMMENDED)\n respond_to do |format|\n format.html { render 'articles_by_user' }\n end\n unless @articles.any?\n flash[:alert] = get_resource 'no_article'\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def destroy\n\t\t@recommendation = Recommendation.find(params[:id])\n\t\t@recommendation.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to recommendations_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def recommended_artists()\n get(:session, {:method => \"user.getRecommendedArtists\"})\n end",
"def recommend(num)\n system('clear')\n recommendations = recommendations_generate(num)\n cleaned_recs = recommendations.tracks.map { |t| \"#{t.name} by #{t.artists[0].name}\" }\n puts '》 RECOMMENDATIONS 《'.colorize(:light_green)\n puts 'Select the recommendations you want to add to your playlist!'\n selections = @prompt.multi_select('Hit enter with none selected to skip.', cleaned_recs)\n clean_recommendations(selections)\n end",
"def update\n @recommend = Recommend.find(params[:id])\n\n respond_to do |format|\n if @recommend.update_attributes(params[:recommend])\n format.html { redirect_to @recommend, notice: 'Recommend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n helpers.beers_update_watchlist(params[:id])\n @reviews = Review.where(beer: Beer.find(params[:id]))\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def show\n @participant_rating = ParticipantRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_rating }\n end\n end",
"def show\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_review }\n end\n end"
] |
[
"0.79008543",
"0.7453154",
"0.7189911",
"0.71554375",
"0.71158415",
"0.7095146",
"0.70482963",
"0.6965189",
"0.68616146",
"0.6840237",
"0.6716086",
"0.6675281",
"0.6574772",
"0.6528001",
"0.65098447",
"0.6474761",
"0.6448644",
"0.6434182",
"0.64237267",
"0.6373494",
"0.6372642",
"0.6372001",
"0.6372001",
"0.63561004",
"0.6335295",
"0.62912714",
"0.62883073",
"0.62883073",
"0.6180509",
"0.61762863",
"0.614506",
"0.6139354",
"0.61216503",
"0.6119457",
"0.61110955",
"0.6066419",
"0.6063987",
"0.6025091",
"0.6015887",
"0.6007382",
"0.5976389",
"0.59500116",
"0.59464794",
"0.593174",
"0.5903735",
"0.5898735",
"0.5891176",
"0.5885966",
"0.58772236",
"0.58573693",
"0.5824678",
"0.58153236",
"0.581008",
"0.58036524",
"0.57940406",
"0.5784257",
"0.5778935",
"0.5772997",
"0.57644045",
"0.5753361",
"0.57532567",
"0.57415086",
"0.5738249",
"0.5721495",
"0.57195055",
"0.5716245",
"0.5713235",
"0.57060975",
"0.57049555",
"0.5704185",
"0.5703493",
"0.56892294",
"0.5677558",
"0.56758326",
"0.5672755",
"0.566199",
"0.5649679",
"0.56455034",
"0.5643076",
"0.5637962",
"0.5635048",
"0.5626186",
"0.56255627",
"0.56223226",
"0.56167",
"0.5599628",
"0.5599628",
"0.55823",
"0.5562205",
"0.5562205",
"0.5562205",
"0.5555412",
"0.5555213",
"0.55513",
"0.554894",
"0.55475557",
"0.55460227",
"0.55460227",
"0.55435514",
"0.5542216"
] |
0.69300073
|
8
|
private if i have no supervisor, return me
|
def get_tree_top_id(person)
person.direct_supervisors.empty? ? person.id : person.direct_supervisors.first.id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def supervisor(options)\n\n end",
"def minimumSupervisorLevel\n \tsupervisions.count + 1\n end",
"def is_supervisor?\n not under_supervision_clinics.empty?\n end",
"def super_user\r\n caller[0] =~ /`(.*)'/ #`\r\n skipping(\"not super user\", $1)\r\n end",
"def validate_supervisor_or_admin \r\n return validate_supervisor if @current_user.is_supervisor?\r\n return @current_user.is_administrator?\r\n end",
"def super_master\n master ? master.super_master : self\n end",
"def super?\n group_name == 'super'\n end",
"def sign_in_as_supervisor\n sign_in(Supervisor.first || create(:supervisor))\n end",
"def super_user?\n super_user\n end",
"def supervisor(&block)\n\t\t\t\tname = File.join(@root, \"supervisor\")\n\t\t\t\tenvironment = merge(name, :supervisor, &block)\n\t\t\t\t\n\t\t\t\tenvironment[:root] = @root\n\t\t\t\t\n\t\t\t\t@configuration.add(environment.flatten)\n\t\t\tend",
"def current_user\n super || guest_user\n # super = dont change anything, I want the same feature of the method we are overriding\n end",
"def employer; super; end",
"def supercommand!() __supercommand__ end",
"def supervised_task(guard, task_to_supervise, *args)\n guard.send(task_to_supervise, *args)\n rescue Exception\n UI.error(\"#{guard.class.name} guard failed to achieve its <#{task_to_supervise.to_s}> command: #{$!}\")\n ::Guard.guards.delete guard\n UI.info(\"Guard #{guard.class.name} has just been fired\")\n return $!\n end",
"def running_as_superuser?\n\tKitchenplan::Log.debug \"#{self.class} : Running as superuser? UID = #{Process.uid} == 0?\"\n\tProcess.uid == 0\n end",
"def initialize(*args)\n self.supervisor = Celluloid::SupervisionGroup.run!\n super\n end",
"def super_method; end",
"def current_user\r\n super || guest_user\r\n end",
"def current_user\r\n super || guest_user\r\n end",
"def super_class\n return nil\n end",
"def super?\n logged_in? && current_user.super\n end",
"def current_user\n super || guest_user\n end",
"def current_user\n super || guest_user\n end",
"def current_user\n super || guest_user\n end",
"def supervisor\n @supervisors = Allocation.all.order(created_at: :desc).where(student_id: current_student.id)\n end",
"def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end",
"def super(&block)\n # First, we resolve the super ref.\n frame, callable = @calltable.resolve_super( current_frame )\n\n # If the ref is nil then we couldn't resolve, otherwise invoke.\n if( frame.nil? )\n raise NameError, \"No super found for #{current_frame}\", caller\n else\n block = block_for_frame(current_frame) if block.nil?\n invoke(frame, callable, &block)\n end\n end",
"def running?\n super\n end",
"def running?\n super\n end",
"def is_super_user?\n @super_user\n end",
"def super_class; end",
"def super_class; end",
"def run\n supervisors.map(&:run).each(&:join)\n end",
"def lookup_super(obj, super_level)\n return nil if !obj\n\n sup = obj.super(super_level)\n if !sup\n raise Pry::CommandError, \"No superclass found for #{obj.wrapped}\"\n else\n sup\n end\n end",
"def parent_command; end",
"def superdomain; end",
"def super_user? \n current_user.role.role == \"Super\" \n end",
"def hypervisor\n data[:hypervisor]\n end",
"def smux_subagent\n super\n end",
"def manage?\n super || (@user && @user.is_curator?)\n end",
"def running_as_normaluser?\n\tKitchenplan::Log.debug \"#{self.class} : Running as superuser? UID = #{Process.uid} != 0?\"\n\tProcess.uid != 0\n end",
"def running_as_normaluser?\n\tKitchenplan::Log.debug \"#{self.class} : Running as superuser? UID = #{Process.uid} != 0?\"\n\tProcess.uid != 0\n end",
"def is_super?\n current_teacher && current_teacher.id == 1\n end",
"def superset\n @superset ||= @superobject.send(@superset_name) if superset?\n end",
"def super_method \n \n puts \"Method of superclass\"\n end",
"def current_user\n super\n end",
"def current_user\n super\n end",
"def supervise_d\n @supervise = true\n @logger.info \"monitor{#@id} - Launching supervisor daemon...\"\n if jobs.length > 0 \n while @supervise do\n @jobs.each do |job|\n job_report(job)\n end\n sleep(5)\n end\n else\n @logger.warn \"monitor{#@id} - Not supervising any jobs\"\n return\n end \n @logger.warn \"monitor{#@id} - Supervisor daemon terminated\"\n return\n end",
"def remember_me\n # (super == nil) ? '1' : super\n true\n end",
"def user\n self.class == User ? self : super\n end",
"def super_method \n puts \"Method of a superclass\"\n end",
"def super_teacher\n Teacher.first\n end",
"def superadmin #all admin roles need to include this method.\n role.name == \"admin\"\n end",
"def user\n super || create_user\n end",
"def teacher_is_super( teacher)\n teacher == Teacher.first\n end",
"def validate_supervisor\r\n return false unless @current_user.is_supervisor?\r\n expense = Expense.find(params[:id]) rescue nil\r\n return false if expense.blank?\r\n expense.user.supervisor_id == @current_user.id || expense.project.supervisor_id == @current_user.id\r\n end",
"def user\n raise NotImplementedError\n end",
"def sufia\n self\n end",
"def current_user\n \tsuper || guest_user\n \t#Super quiere decir que exactamente con los valores \n \t#del metodo original sin cambiar nada\n end",
"def superuser?\n member_of_group?(\"Superusers\")\n end",
"def super\n @teacher = Teacher.first",
"def supervisor?(area)\n self.student? and return false\n self.area_ids.include?(area.id) \n end",
"def supervisors\n (self.managers + self.trustees).uniq\n end",
"def caller; end",
"def super_class!\n raise \"No super_class for class #{name}\" unless super_class_name\n s = super_class\n raise \"superclass not found for class #{name} (#{super_class_name})\" unless s\n s\n end",
"def superadmin?\n current_user.has_role? :superadmin\n end",
"def receiver\n self.kase.person if self.kase\n end",
"def students_advisor\n return nil if self.advisor? || self.provisional?\n\n self.current_sections.first.advisor\n end",
"def remember_me\n (super == nil) ? '1' : super\n end",
"def owner\n performer\n end",
"def is_super_admin?\n self.is_admin?\n end",
"def current_user\n return @current_user if @current_user\n \n @current_user = super.decorate if super\n @current_user\n end",
"def remember_me\n\t\t(super == nil) ? '1' : super\n\tend",
"def before_save_goal\n\t\t# \n\t\tif self.current_user_role == 'sm'\n\t\t\traise \"Super Manager don't need goal\"\n\t end\n\tend",
"def current_user\n #super the main class of devise current_user\n super || guest_user\n end",
"def calls_super # :nodoc:\n false\n end",
"def super_class\n return nil unless super_class_name\n Parfait.object_space.get_class_by_name(super_class_name)\n end",
"def new\n # 注册的时候放开\n if current_manager.blank?\n super\n else\n super\n end\n end",
"def called_from; end",
"def called_from; end",
"def super_admin?\n self.role == \"Super Admin\"\n end",
"def super_user\n return nil unless session[:admin_user]\n @current_admin ||= User.find_by_id(session[:admin_user])\n end",
"def main\n super\n return self\n end",
"def is_superuser?\n superuser? && supermode?\n end",
"def is_super_admin\n return self.role == :super_admin.to_s\n end",
"def admin_or_curator?\n self.admin? || self.curator?\n end",
"def originator\n self.user ? self.user.name : NOT_SET\n end",
"def admin?\n super_user?\n end",
"def super_admin?\n self.role.role_name == \"super_admin\"\n end",
"def super_admin?\n admin\n end",
"def run\n super\n end",
"def run\n super\n end",
"def supermodel\n if superclass.respond_to?(:register_submodel)\n superclass\n end\n end",
"def begin_of_association_chain\n self.action_name != 'index' ? current_user : super\n end",
"def set_super\n @super = Super.find(params[:id])\n end",
"def name\n @_name ||= (@config[:supervisor_name_override] || \"#{@config[:root_name]}-#{`hostname`.chomp}\").gsub(/[^a-zA-Z0-9\\-\\_]/, ' ').gsub(/\\s+/, '-').downcase\n end",
"def current_user\n UserDecorator.decorate(super) unless super.nil?\n end",
"def current_user\n UserDecorator.decorate(super) unless super.nil?\n end",
"def senior\n # * pickup any exiting from mem_... attribute\n # * fetch using the role, when above fails\n # * insitantiate a new if all above failed\n # * Assign the final instance to mem... attribute, for next time\n # \n # Sat Jan 29 00:32:43 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4119\n # * pick up the most recent one (sort b <> a) if multiple halousers exist for some reason\n # * FIXME: we should never have multiple halousers for a user intake\n self.mem_senior ||= ( halouser || User.new.clone_with_profile)\n end",
"def supermodel\n if superclass.respond_to?(:register_submodel)\n superclass\n end\n end",
"def check_process\n super\n end"
] |
[
"0.6595611",
"0.62592715",
"0.61004466",
"0.6097345",
"0.60226864",
"0.5968137",
"0.59517866",
"0.5927085",
"0.58840185",
"0.5869165",
"0.58434784",
"0.5828282",
"0.5814401",
"0.57701194",
"0.5764326",
"0.5743865",
"0.57429636",
"0.5742461",
"0.5727721",
"0.5727489",
"0.57018965",
"0.56964684",
"0.56964684",
"0.56964684",
"0.56630015",
"0.56444365",
"0.56341463",
"0.5623118",
"0.5623118",
"0.5568823",
"0.55650014",
"0.55650014",
"0.555763",
"0.55508286",
"0.5550744",
"0.55254906",
"0.552206",
"0.5498411",
"0.5495863",
"0.548447",
"0.5475716",
"0.5475716",
"0.5468523",
"0.5465418",
"0.5432201",
"0.542113",
"0.542113",
"0.5401596",
"0.5400356",
"0.5392951",
"0.5390764",
"0.5388863",
"0.5369533",
"0.535097",
"0.53437567",
"0.5332057",
"0.5320501",
"0.53144866",
"0.53137696",
"0.531036",
"0.5309857",
"0.5302635",
"0.5289938",
"0.52776194",
"0.52769387",
"0.52730703",
"0.52611655",
"0.52520823",
"0.52505845",
"0.52409035",
"0.523966",
"0.5237416",
"0.5205272",
"0.52030754",
"0.5191536",
"0.5190131",
"0.51766646",
"0.5175386",
"0.51749545",
"0.51749545",
"0.5174417",
"0.51653624",
"0.51524615",
"0.5145646",
"0.5145023",
"0.5137756",
"0.5130544",
"0.5124493",
"0.51222026",
"0.5118158",
"0.51134604",
"0.51134604",
"0.5109198",
"0.51048666",
"0.51034516",
"0.51031286",
"0.50975096",
"0.50975096",
"0.50973094",
"0.50909925",
"0.50897485"
] |
0.0
|
-1
|
get a reporting tree starting from this person's boss, down to all leaf subordinates.
|
def get_tree(person)
h = build_adjacency_list
n = h[get_tree_top_id(person)] # start creating the tree at this person's supervisor, if there is one
nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)
nodes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_tree(employee)\n\n h = Employee.build_adjacency_list\n\n n = h[get_tree_top_id(employee)] # start creating the tree at this employee's supervisor, if there is one\n\n nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)\n\n nodes\n end",
"def cb_rpts_build_tree\n TreeBuilderChargebackReports.new(\"cb_reports_tree\", @sb)\n end",
"def x_get_tree_roots\n u = User.current_user\n user_groups = u.report_admin_user? ? nil : u.miq_groups\n having_report_results(user_groups).sort\n end",
"def boss\n @boss\n end",
"def tree\n @stack = @rpn.clone\n get_tree\n end",
"def root_level\n self.find\n end",
"def output_pedigree_name( indiv, depth, famc, fams, bitmap, prefix, child_marker, blank, suffix, max_depth )\n #Check to see if we reached the depth limit we set for this chart.\n if(max_depth > 0 && max_depth < depth)\n s = bars( bitmap, depth)\n if(depth)\n if(blank)\n s += lastspace\n else\n s += lastbar(depth)\n end\n end \n if html?\n s += \"<b>Maximum Depth Reached</b>\\n\"\n else\n s += \"Maximum Depth Reached\\n\"\n end\n return s\n end\n\n #ensure we actually have someone, and didn't just fall of the end of the world.\n #indiv == nil is our termination condition for recursion.\n if(indiv != nil)\n \n s = bars(bitmap, depth) #Add in leading bars, which form the visual links between individuals.\n if(depth > 0) #if we not on the first level, we need to add either a ' ' or a '|'.\n if(blank) #blank is passed in argument list.\n s += lastspace\n else\n s += lastbar(depth)\n end\n end\n\n if (name = indiv.primary_name) == ''\n name = '?'\n end\n \n #pull out the first TITL records from the Individual_record.individual_attribute_record array.\n #this will be an array of Individual_attribute records of type TITL records (probably only one element).\n if (title = indiv.title) != nil\n #For our display of this person in the chart, we want just on TITL. The GEDCOM standard says the most relevant one should be the first one.\n #This TITL record (title.first) has a value with the Title in it, stored in an array, so we need to take the first one.\n #A bit loopy, but consistent with records like PHON, where multiple phone number records are stored in the same array\n title_p = title.first.value.first \n else\n title_p = ''\n end\n\n if(html?)\n #indiv.individual_ref[1] is the XREF, indiv.individual_ref[0] being the index name :individual.\n s += \"<A NAME=\\\"#{indiv.individual_ref[1]}\\\"></A>\" #Put a HTML Anchor, so we can jump to this point with a URL.\n #these fams & famc URLs are currently peculiar to my gedcom server, so need to be culled or the base needs to be set dynamically.\n if(fams != nil) #passed in fams, so set up name to be a link to the family record.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{fams.family_ref[1]}.html\\\" >#{name}</A>\"\n elsif(famc != nil) #passed in famc, so set up name to be a link to the parent family record\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{famc.family_ref[1]}.html\\\" >#{name}</A>\"\n else #weren't passed in either fams or famc, so don't set up a link.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n else\n s += \"#{prefix}#{title_p}#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n \n \n if((birth = indiv.birth) != nil && (date = birth[0].date) != nil)\n #if we have a birth date, then we will add it to the output.\n s += html? ? \" <b>b.</b>#{date}\" : \" b.#{date}\" \n elsif((chr = indiv.christening) && (date = chr[0].date) != nil)\n #if we don't have a birth date, we might have a christening date.\n s += html? ? \" <b>c.</b>#{date}\" : \" c.#{date}\"\n end\n\n if((deat = indiv.death) != nil && (date = deat[0].date) != nil)\n s += html? ? \" <b>d.</b>#{date}\" : \" d.#{date}\"\n end\n \n s += \" #{suffix}\\n\" if suffix\n return s\n end\n \n return nil #allows test to break any recursion.\n end",
"def get_family\n family = [self]\n child = self\n (self.level-1).times do\n child = child.parent\n family.unshift child\n end\n family\n end",
"def tree\n @tree ||= build_tree\n end",
"def descendants\n tree.tap(&:shift)\n end",
"def get_hier_cell(pfx, name)\n return get_cell(name) if pfx.empty?\n cell = get_cell(pfx[0])\n ref = cell.ref\n npfx = pfx - pfx[0..0]\n ref.get_hier_cell(npfx, name)\n end",
"def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end",
"def all_in_tree\n accounts = Array.new\n accounts += ancestors\n accounts += sibling_accounts\n accounts += children\n accounts << self\n return accounts\n end",
"def get_tree_top_id(employee)\n if employee.supervisor_relationships.empty?\n employee.id\n else\n sup = employee.supervisor_relationships.reject{|sr| sr.dotted == true}.first\n sup.supervisor_id\n end\n end",
"def tree_root\n repo.tree\n end",
"def tree\r\n @rootNode\r\n end",
"def report_children(parent_id) \n\t\tReport.find(:all, :conditions => [\"parent_id=?\",parent_id])\t\t\t\n\tend",
"def grand_children\n []\n end",
"def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end",
"def to_ptree_enum\n # How to implement?\n # One visits the forest => beware of dependency\n # At each visited item create a corresponding tree node.\n # At end of visit & stack not empty\n # Re-generate another ptree\n end",
"def tree\n return [self] if @children.empty?\n\n @children.each_with_object([self]) do |child, tree|\n tree.concat(child.tree)\n end\n end",
"def tree\n\n h.updated_tree || h.original_tree\n end",
"def root\n # the BETWEEN clause is needed to ensure we get the right virtual root, if using those\n base_set_class.find(:first, :conditions => \"#{scope_condition} \\\n AND (#{parent_col_name} IS NULL OR #{parent_col_name} = 0) AND (#{self[left_col_name]} BETWEEN #{left_col_name} AND #{right_col_name})\")\n end",
"def parent_report_rows\n constituent_info.map do |druid, info_hash|\n info_hash[:parent_druids].map { |parent_druid| [druid, parent_druid] }.flatten\n end\n end",
"def page_tree\n @tree ||= [self.root_page.tree_hash_value]\n @tree\n end",
"def branches_report\n @branches_report ||= build_branches_report\n end",
"def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end",
"def tree\n return nil if messages.size == 0\n build_tree unless @tree\n @tree\n end",
"def rebalance\n order = self.level_order\n return build_tree(order)\n end",
"def root\n n = self\n while n.parent \n n = n.parent\n end\n n\n end",
"def build_hierarchy\n root = LetterNode.new(nil)\n\n # TODO: Limit word table to 50,000 highest ranking words\n\n words.each do |word|\n wl = root\n word.spelling.each_char do |letter|\n wl = wl.add(letter, word.count)\n end\n wl.word!(word.count)\n end\n\n root\n end",
"def get_results(with_root = false)\n ret = []\n\n # Iterate over all occupied descendants and create chain data\n @occupied_descendants.each do |node|\n ret << [node.data, node.get_chain(with_root)]\n end\n\n # Return\n ret\n end",
"def tree_children\n\n tree[2]\n end",
"def main\n entries = File.readlines('day7.txt')\n\n all_entries = entries.map { |e| Entry.new(e) }\n all_children = all_entries.map { |e| e.children }.flatten\n with_children = \n all_entries\n .select { |e| e.children.length > 0 }\n .map { |e| e.name }\n\n bottom = all_entries.select do |e| \n # not in all_children but in with_children }\n in_children = all_children.include?(e.name)\n has_children = with_children.include?(e.name)\n !in_children and has_children\n end.first\n\n return bottom\nend",
"def roots\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND (#{parent_col_name} IS NULL OR #{parent_col_name} = 0)\", :order => \"#{left_col_name}\")\n end",
"def find_leaf\n if first_question.descendants.length > 0\n leaves = first_question.descendants.select {|q| q.leaf?}\n\n raise StandardError, \"Multiple leaves found!\" if leaves.length > 1\n raise StandardError, \"No leaf found!\" if leaves.length == 0\n\n leaves.first\n else\n # Only one question!\n first_question\n end\n\n end",
"def export\n @tree\n end",
"def hierarchy\n nested_set_scope.where(\n \"#{self.class.table_name}.lft >= :lft AND #{self.class.table_name}.rgt <= :rgt\" +\n \" OR #{self.class.table_name}.lft < :lft AND #{self.class.table_name}.rgt > :rgt\",\n {:lft => lft, :rgt => rgt})\n end",
"def all\n root.branch\n end",
"def root\n if is_root?\n self\n else\n return Especie.none unless ancestry_ascendente_directo.present?\n ancestros = ancestry_ascendente_directo.split(',').map{|a| a.to_i if a.present?}.compact\n return Especie.none unless ancestros.any?\n\n Especie.find(ancestros.first)\n end\n end",
"def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def roots\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def children\n children = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n children << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n children\n end",
"def roots\n self.find(:all, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def leaves\n descendants.where(\"#{self.class.table_name}.rgt - #{self.class.table_name}.lft = ?\", 1)\n end",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def custom_tree\n\t\t#if they haven't made a shrink range/trunk yet, make one for them\n\t\tif $shrink_range.empty?\n\t\t\t$shrink_Range = (4..6).to_a\n\t\tend\n\t\tif $trunk.empty?\n\t\t\t$trunk = (175..250).to_a\n\t\tend\n\t\t\n\t\t@shrink = \"0.#{$shrink_range[0]}\".to_f\n\t\t#Height is 600, so y is in (0,600)\n\t\t$angle_of_separation = (@window.mouse_y / 10).to_i #this gives max of 60 degree angle, min of 0 (line)\n\t\t\n\t\t@branches = []\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[0]]] ]\n\t\t#Width is 800, so x is in (0,800)\n\t\t$num_splits = (((@window.mouse_x) / 100).to_i)+2 #this gives max of 8+2=10 splits, min of 2\n\t\t\n\t\tputs \"This output is from Custom Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\t\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\t\t\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t end",
"def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end",
"def root_entity\n root = self\n loop do\n break if root.parent_id.nil?\n root = root.parent\n end\n root\n end",
"def print_tree\n ''\n end",
"def leaf?; @leaf; end",
"def tree\n h.updated_tree || h.original_tree\n end",
"def boss_bars\n @boss_bars\n end",
"def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend",
"def report_parent(id) \n\t\tReport.find(id)\t\t\t\n\tend",
"def family\n self_and_children\n end",
"def to_recursive\n self\n end",
"def tree\n Tree.new(self)\n end",
"def root\n node = self\n node = node.parent while !node.parent.nil?\n node\n end",
"def family\n ([self] + self.children + self.parents + self.mergers + [self.merger]).compact\n end",
"def root\n self.find(:first, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\")\n end",
"def parent_hierarchy\n [\n parentADM4,\n parentADM3,\n parentADM2,\n parentADM1,\n parentCountry\n ].reject(&:empty?)\n end",
"def tree\n @roots = @cards.roots\n # TODO: remove jbuilder?\n render :tree, status: :ok\n end",
"def get_root()\n \n end",
"def children\n out_edges.each{|e| e.dest}\n end",
"def root\n root = self\n until (parent = root.parent).nil?\n root = parent\n end\n root\n end",
"def draw_tree\n result = ''\n max_cols = @n + 1\n calc_tree.each do |row|\n print = ' ' * ((max_cols - row.length) / 2) * max_cols\n print << row.join(' ')\n result << \"#{print}\\n\"\n end\n puts result\n end",
"def leaves\n descendants.where(arel_table[is_leaf_column_name].eq(true))\n end",
"def to_recursive\n self\n end",
"def children\n\n children_array = []\n @board.rows.each_index do |row_idx|\n @board.rows[row_idx].each_index do |col_idx|\n if @board[[row_idx, col_idx]].nil?\n dup_board = @board.dup\n dup_board[[row_idx, col_idx]] = @next_mover_mark\n next_next_mark = switch_mark\n children_array << TicTacToeNode.new(dup_board, next_next_mark, [row_idx, col_idx])\n end\n end\n end\n children_array\n end",
"def get_children()\n {}\n end",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def children\n children = []\n @board.rows.each_with_index do |row, r_idx|\n row.each_index do |c_idx|\n kid_board = @board.dup\n pos = [r_idx, c_idx]\n if kid_board.empty?(pos)\n kid_board[pos] = @next_mover_mark\n children << TicTacToeNode.new(kid_board, next_mark, pos)\n end\n end\n end\n children\n end",
"def calc_tree\n tree = []\n n = 1\n while n <= @n\n result = []\n result = [[0, 1]] if n == 1\n tree.each do |row|\n line1 = []\n line2 = []\n row.each_with_index do |elem, i|\n line1 << \"#{elem}0\" if i.positive?\n line2 << \"#{elem}0\" if i.zero?\n line2 << \"#{elem}1\"\n end\n result << line1 unless row.count == 1\n result << line2\n end\n tree = result\n n += 1\n end\n tree\n end",
"def goals_to_goals\n @higher_goal = Goal.find_by(title: @row['Higher_goal_title'])\n @higher_goal.children << @current_goal_in_row\n end",
"def build_tree(unit, node, level = 0)\r\n return nil if level > @max_depth\r\n \t\r\n unit.next_move(node.current_case).each do |next_case|\r\n next if next_case[0] < 0 || next_case[0] > 7 ||\r\n next_case[1] < 0 || next_case[1] > 7 \r\n \r\n next_node = Node.new(next_case, node)\r\n node.children << next_node\r\n\r\n build_tree(unit, next_node, level + 1)\r\n end \r\n end",
"def effective_root\n if empty? and children.size == 1\n children.first.effective_root\n else\n self\n end\n end",
"def root\n ltree_scope.where(\"#{self.class.table_name}.#{ltree_path_column} = SUBPATH(?, 0, 1)\", ltree_path).first\n end",
"def root\n object = self\n while (object.parent) do object = object.parent; end\n object || self\n end",
"def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend",
"def root\n node = self\n node = node.parent while node.parent\n node\n end",
"def to_string_tree\n if ((@children).nil? || (@children.size).equal?(0))\n return self.to_s\n end\n buf = StringBuffer.new\n if (!is_nil)\n buf.append(\"(\")\n buf.append(self.to_s)\n buf.append(Character.new(?\\s.ord))\n end\n i = 0\n while !(@children).nil? && i < @children.size\n t = @children.get(i)\n if (i > 0)\n buf.append(Character.new(?\\s.ord))\n end\n buf.append(t.to_string_tree)\n i += 1\n end\n if (!is_nil)\n buf.append(\")\")\n end\n return buf.to_s\n end",
"def to_array\n parents = []\n\n top_array = [self]\n c_arr = top_array\n\n self.class.base_class.each_with_level(descendants.includes(:link => :linkable)) do |menu, level|\n case level <=> parents.count\n when 0 # same level\n # set current array as new sibling array containing menu\n c_arr = [menu] \n\n # and push current array (the new sibling array) to current parent\n parents.last[1] << c_arr \n\n when 1 # descend\n # push a child array if the current level does no thave one\n c_arr << [] if c_arr.length == 1\n \n # and push the sibling array into that array\n c_arr[1] << [menu]\n\n # push the current array to be the current parent\n parents << c_arr\n\n # and reset the current as the new child array\n c_arr = c_arr[1].last\n\n when -1 # ascend\n # pop parents up to the parent of the new menu\n parents.pop while parents.count > level\n\n # and proceed to add new sibling as though level had been 0\n c_arr = [menu]\n parents.last[1] << c_arr\n end\n end\n\n top_array\n end",
"def full_hierarchy\n hierarchy = []\n current_location = self\n hierarchy << current_location.name\n while(1)\n if (current_location.location)\n location = current_location.location\n hierarchy << location.name\n current_location = location\n else\n break\n end\n end\n hierarchy.reverse.map {|h| h}.join(\", \")\n end",
"def root\n nested_set_class.find_with_nested_set_scope(:first, :conditions => \"(#{nested_set_parent} IS NULL)\")\n end",
"def leaves\n descendants.filter(self.class.qualified_right_column - self.class.qualified_left_column => 1)\n end",
"def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend",
"def roots(scope = {})\n find_in_nested_set(:all, { :conditions => \"(#{prefixed_parent_col_name} IS NULL OR #{prefixed_parent_col_name} = 0)\", :order => \"#{prefixed_left_col_name}\" }, scope)\n end",
"def root\n ancestors.first || self\n end",
"def roots\n nested_set_class.find_with_nested_set_scope(:all, :conditions => \"(#{nested_set_parent} IS NULL)\", :order => \"#{nested_set_left}\")\n end",
"def root\n self_and_ancestors.first\n end",
"def bins\n Set.new @tree.values\n end",
"def to_text\n self_and_descendants.map do |node|\n if block_given?\n inspect = yield(node)\n else\n inspect = node.class.inspect\n end\n \"#{'*'*(node.level+1)} #{inspect} (#{node.parent_id.inspect}, #{node.left}, #{node.right})\"\n end.join(\"\\n\")\n end",
"def children\n children_nodes = Array.new\n i = 0\n while i < self.board.rows.length\n j = 0\n while j < self.board.rows.length\n if self.board.empty?([i,j])\n duped_board = self.board.dup\n duped_board.[]=([i,j],self.next_mover_mark) \n duped_node = self.class.new(duped_board,self.alternate_mark,[i,j])\n children_nodes << duped_node\n end\n j += 1\n end\n i += 1\n end\n return children_nodes\n end",
"def children; []; end",
"def root\n cursor = self\n cursor = cursor.up until cursor.root?\n cursor\n end",
"def create_tree(start_tile)\n queue = [start_tile]\n visited.add(start_tile.pos)\n\n while !queue.empty?\n cur_tile = queue.shift\n tiles = adjacent_tiles(cur_tile.pos)\n\n tiles.each do |tile_pos|\n tile = self[tile_pos]\n tile.parent = cur_tile\n queue.push(tile)\n visited.add(tile.pos)\n end\n end\n start_tile\n end",
"def findChildren (parent, structure)\n #search for items in structure where item.manager = parent\n children = []\n \n #puts parent\n \n structure.each do |employee|\n \n #puts '> ' + employee.join(', ')\n \n if employee[2].eql? parent\n \n #puts 'got it!'\n \n children << employee\n end\n end\n \n return children\n\nend",
"def root(scope = {})\n # the BETWEEN clause is needed to ensure we get the right virtual root, if using those\n self.class.find_in_nested_set(:first, { :conditions => \"#{scope_condition} \\\n AND (#{prefixed_parent_col_name} IS NULL OR #{prefixed_parent_col_name} = 0) AND (#{self[left_col_name]} BETWEEN #{prefixed_left_col_name} AND #{prefixed_right_col_name})\" }, scope)\n end"
] |
[
"0.6351754",
"0.5512419",
"0.53303957",
"0.5296398",
"0.5267981",
"0.51744694",
"0.5152476",
"0.5144239",
"0.51137257",
"0.510391",
"0.50371367",
"0.5028946",
"0.5019304",
"0.4998947",
"0.49921027",
"0.49740613",
"0.4971543",
"0.49511394",
"0.49429905",
"0.4942447",
"0.49252063",
"0.49173367",
"0.49029073",
"0.48828188",
"0.4882802",
"0.48749995",
"0.48728114",
"0.4867832",
"0.4858196",
"0.4854943",
"0.48505238",
"0.484746",
"0.48458236",
"0.48429698",
"0.48347807",
"0.48328283",
"0.48319003",
"0.48295763",
"0.4811233",
"0.48107067",
"0.48075646",
"0.48069245",
"0.4800524",
"0.48002598",
"0.4799387",
"0.47913298",
"0.47860914",
"0.47819784",
"0.47615033",
"0.4759939",
"0.47335386",
"0.47268188",
"0.47161832",
"0.4715294",
"0.47145185",
"0.4709632",
"0.46794546",
"0.46739957",
"0.4668732",
"0.46686688",
"0.46628076",
"0.4654609",
"0.46448535",
"0.46412516",
"0.46344692",
"0.46337485",
"0.46285853",
"0.4622376",
"0.46221",
"0.46178615",
"0.46170014",
"0.4616416",
"0.4616416",
"0.46164098",
"0.46146163",
"0.46084207",
"0.46005398",
"0.45998794",
"0.45977685",
"0.45967507",
"0.45964643",
"0.45855835",
"0.45822734",
"0.45812836",
"0.45767292",
"0.45741782",
"0.4567727",
"0.45669568",
"0.45668992",
"0.4566122",
"0.45620492",
"0.45619145",
"0.4561818",
"0.45604423",
"0.45602417",
"0.45559198",
"0.45530304",
"0.455186",
"0.45441225",
"0.45427674"
] |
0.57526386
|
1
|
starting at a top person node, recurse through all subordinate relationships to create a nested reporting structure tree
|
def to_node(h, n, i=0)
i = i + 1
{
"id" => n[:id],
"name" => n[:name],
"size" => 1,
"children" => n[:children].empty? ? "" : n[:children].map { |c|
c[:children] = get_children(h, c)
to_node h, c, i
}
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_tree(person)\n\n h = build_adjacency_list\n\n n = h[get_tree_top_id(person)] # start creating the tree at this person's supervisor, if there is one\n\n nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)\n\n nodes\n end",
"def traverse(person)\n loop = false\n queue = []\n queue << tree\n\n until loop || queue.size <= 0\n current = queue.pop()\n found = current.generation.compact.map(&:name).include?(person)\n\n if found\n loop = true\n return current unless block_given?\n\n yield(current)\n else\n children = current.children\n (children || []).each do |child|\n queue << child\n end\n end\n end\n end",
"def build_adjacency_list\n\n r = join_people_by_relationship_type\n\n h = {}\n r.each {|rr|\n id = rr[0]\n h[id] = {:id => id, :name => rr[1], :children => []} if h[id].nil? # if there's no hash entry for this person, make one.\n h[id][:children] << {:id => rr[2], :name => rr[3], :children => []} # enter the person's subordinates as children into the hash. (source / sink)\n }\n h\n end",
"def _tree_navigate_through_child\n @ontology_class = OntologyClass.find_by_id(params[:id])\n \n @object_relationship = ObjectRelationship.find(params[:parent_relationship]) if !params[:parent_relationship].blank?\n @object_relationship == 'root' if !@object_relationship \n \n # close 1 1; open 0 1; open false (close); true (open) \n render :update do |page|\n page.replace \"level_#{@ontology_class.id}\", :partial => 'ontology/tree/tree_recurser', :locals => {\n :level => (params[:close] ? 1 : 0),\n :max_depth => 1,\n :parent_node => @ontology_class,\n :open => (params[:close] ? false : true),\n :relationship => @object_relationship,\n :relationship_type => params[:relationship_type] }\n end and return \n end",
"def depth(person)\n count = 0\n \n until person.ancestor == nil do\n person = person.ancestor\n count += 1\n end\n\n count\n end",
"def get_tree(employee)\n\n h = Employee.build_adjacency_list\n\n n = h[get_tree_top_id(employee)] # start creating the tree at this employee's supervisor, if there is one\n\n nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)\n\n nodes\n end",
"def select_father_summary(person_id)\n add_parents!\n couple = parents[0] || ParentsReference.new\n couple.select_parent(person_id,'Male')\n parents[0] = couple \n end",
"def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end",
"def output_pedigree_name( indiv, depth, famc, fams, bitmap, prefix, child_marker, blank, suffix, max_depth )\n #Check to see if we reached the depth limit we set for this chart.\n if(max_depth > 0 && max_depth < depth)\n s = bars( bitmap, depth)\n if(depth)\n if(blank)\n s += lastspace\n else\n s += lastbar(depth)\n end\n end \n if html?\n s += \"<b>Maximum Depth Reached</b>\\n\"\n else\n s += \"Maximum Depth Reached\\n\"\n end\n return s\n end\n\n #ensure we actually have someone, and didn't just fall of the end of the world.\n #indiv == nil is our termination condition for recursion.\n if(indiv != nil)\n \n s = bars(bitmap, depth) #Add in leading bars, which form the visual links between individuals.\n if(depth > 0) #if we not on the first level, we need to add either a ' ' or a '|'.\n if(blank) #blank is passed in argument list.\n s += lastspace\n else\n s += lastbar(depth)\n end\n end\n\n if (name = indiv.primary_name) == ''\n name = '?'\n end\n \n #pull out the first TITL records from the Individual_record.individual_attribute_record array.\n #this will be an array of Individual_attribute records of type TITL records (probably only one element).\n if (title = indiv.title) != nil\n #For our display of this person in the chart, we want just on TITL. The GEDCOM standard says the most relevant one should be the first one.\n #This TITL record (title.first) has a value with the Title in it, stored in an array, so we need to take the first one.\n #A bit loopy, but consistent with records like PHON, where multiple phone number records are stored in the same array\n title_p = title.first.value.first \n else\n title_p = ''\n end\n\n if(html?)\n #indiv.individual_ref[1] is the XREF, indiv.individual_ref[0] being the index name :individual.\n s += \"<A NAME=\\\"#{indiv.individual_ref[1]}\\\"></A>\" #Put a HTML Anchor, so we can jump to this point with a URL.\n #these fams & famc URLs are currently peculiar to my gedcom server, so need to be culled or the base needs to be set dynamically.\n if(fams != nil) #passed in fams, so set up name to be a link to the family record.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{fams.family_ref[1]}.html\\\" >#{name}</A>\"\n elsif(famc != nil) #passed in famc, so set up name to be a link to the parent family record\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{famc.family_ref[1]}.html\\\" >#{name}</A>\"\n else #weren't passed in either fams or famc, so don't set up a link.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n else\n s += \"#{prefix}#{title_p}#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n \n \n if((birth = indiv.birth) != nil && (date = birth[0].date) != nil)\n #if we have a birth date, then we will add it to the output.\n s += html? ? \" <b>b.</b>#{date}\" : \" b.#{date}\" \n elsif((chr = indiv.christening) && (date = chr[0].date) != nil)\n #if we don't have a birth date, we might have a christening date.\n s += html? ? \" <b>c.</b>#{date}\" : \" c.#{date}\"\n end\n\n if((deat = indiv.death) != nil && (date = deat[0].date) != nil)\n s += html? ? \" <b>d.</b>#{date}\" : \" d.#{date}\"\n end\n \n s += \" #{suffix}\\n\" if suffix\n return s\n end\n \n return nil #allows test to break any recursion.\n end",
"def get_missing_offspring \n puts \"in missing_offspring\"\n # get all of the parent relationships and add them to the hash\n # then get all of the child relationships and check that the ones in the parent exist there\n parent_relationships = Relationship.find_all_by_relationship_type(\"parent\")\n check_parent = Hash.new\n parent_relationships.each do |relationship|\n pid = relationship.person_id\n raise \"Parent id is null \" if pid.nil?\n rid = relationship.relation_id\n raise \"Child id is null \" if rid.nil?\n\n if check_parent[pid].nil? then\n check_parent[pid] = Hash.new\n end\n check_parent[pid][rid] = relationship.name\n end\n\n\n child_relationships = Relationship.find_all_by_relationship_type(\"child\")\n check_child = Hash.new\n child_relationships.each do |relationship|\n pid = relationship.person_id\n raise \"Parent id is null \" if pid.nil?\n rid = relationship.relation_id\n raise \"Child id is null \" if rid.nil?\n\n if check_child[pid].nil? then\n check_child[pid] = Hash.new\n end\n check_child[pid][rid] = relationship.name\n end\n\n add = Hash.new\n\n check_parent.each do |person, children|\n puts \"person #{person} #{check_parent[person]}\"\n children.each do |child, name|\n puts \"child #{child} #{check_parent[child]} name #{name}\"\n if check_child[child].nil? then\n\t puts \"making child entry #{child}\"\n\t add[child] = Hash.new\n\t add[child][person] = 'child'\n\t else \n if check_parent[person][child] and check_child[child][person] then\n\t puts \"found reciprocal relationships for #{person} and #{child}\"\n \t elsif check_parent[person][child] and check_child[child][person].nil? then\n puts \"missing child relationship between #{child} and #{person}\"\n\t puts \"add child #{add[child]}\"\n\t if add[child].nil? then\n\t add[child] = Hash.new\n\t end\n\t add[child][person] = 'child'\n\t elsif check_parent[person][child].nil? and check_child[child][person] then\n puts \"missing parent relationship between #{person} and #{child}\"\n if add[person].nil? then\n\t add[person] = Hash.new\n\t end\n\t add[person][child] = 'parent'\n\t end\n\t end # end if check_child[child].nil?\n\t puts \"****************\"\n end #end children each\n puts \"##################################\"\n end # end check_parent each\n\n return add\n end",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend",
"def recurse_nodes(parent_names, source_tmp_geo_area)\n if parent_names.count > 1\n parents = parent_names.dup # Tricky! \n name = parents.shift\n puts \"building internal node: #{name} : #{parents} \"\n add_item(\n name: name,\n parent_names: parents,\n source_table: source_tmp_geo_area.source_table,\n source_table_gid: source_tmp_geo_area.source_table_gid,\n is_internal_node: true\n )\n recurse_nodes(parents, source_tmp_geo_area)\n end\n end",
"def get_social_reach(person)\n person\n\n .loop do |p|\n p.in_e(:FOLLOWS).out_v(type: 'person').uniq\n end\n\n .while do |p, depth|\n if depth == 0\n :loop\n else depth <= 6\n :loop_and_emit\n else\n false\n end\n end",
"def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"def traverse_tree(idea=self, depth=1, &blk)\n if idea.has_citations?\n blk.call(idea, depth)\n depth += 1\n idea.citations.each { |citation| traverse_tree(citation, depth, &blk) }\n else\n blk.call(idea, depth)\n end\n end",
"def my_squirrels\n # which one knows about BOTH the trees and the nests?\n my_nests.map do |nest|\n nest.squirrel.name\n end\n end",
"def expand_depth(node) #:nodoc:\n relations_for(node).each do |rel|\n yield_node(rel)\n\n expand_node(rel) unless @description.prune_node?(rel)\n end\n end",
"def make_sub_goals (parent, depth)\n #make up to 4 sub goals\n [*(2..6)].sample.times do\n g = new_goal(parent)\n\n #max depth...\n if(depth < 2)\n puts \" #{depth} id: #{g.id} name: #{g.name} parent: #{parent.name if parent.present?}\"\n make_sub_goals(g,depth+1)\n end\n end\n end",
"def init_simple_tree\n @root_org = Org.create(name: 'root')\n @lv1_child_org = Org.create(name: 'lv1')\n @lv1_child_org2 = Org.create(name: 'lv1-2')\n @lv2_child_org = Org.create(name: 'lv2')\n @lv2_child_org2 = Org.create(name: 'lv2-2')\n @lv2_child_org3 = Org.create(name: 'lv2-3')\n @lv2_child_org4 = Org.create(name: 'lv2-4')\n @lv3_child_org = Org.create(name: 'lv3')\n @lv3_child_org2 = Org.create(name: 'lv3-2')\n @lv4_child_org = Org.create(name: 'lv4')\n @lv4_child_org2 = Org.create(name: 'lv4-2')\n @lv5_child_org = Org.create(name: 'lv5')\n @lv5_child_org2 = Org.create(name: 'lv5-2')\n\n current_time = Time.now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @root_org.id,\n distance: 0,\n start_time: 10.minutes.ago(current_time),\n end_time: 1000.years.from_now,\n scope_name: 'default'\n )\n\n # 10 minutes ago\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 2,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: 10.minutes.ago(current_time),\n end_time: current_time,\n scope_name: 'default'\n )\n\n # now\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv1_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv2_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org3.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org3.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv2_child_org4.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org2.id,\n child_id: @lv2_child_org4.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv3_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv4_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org.id,\n child_id: @lv5_child_org.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv3_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv3_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv3_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv4_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv4_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv4_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @root_org.id,\n child_id: @lv5_child_org2.id,\n distance: 5,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv1_child_org.id,\n child_id: @lv5_child_org2.id,\n distance: 4,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv2_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 3,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv3_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 2,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\n\n @root_org.elements_under_default_root.create(\n parent_id: @lv4_child_org2.id,\n child_id: @lv5_child_org2.id,\n distance: 1,\n start_time: current_time,\n end_time: 1000.years.since(current_time),\n scope_name: 'default'\n )\nend",
"def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend",
"def select_mother_summary(person_id)\n add_parents!\n couple = parents[0] || ParentsReference.new\n couple.select_parent(person_id,'Female')\n parents[0] = couple \n end",
"def to_madeline(pedigree, people)\n results = Array.new\n familyID = pedigree.tag\n\n conditions = pedigree.conditions\n phenotypes = pedigree.people.map { |p| p.phenotypes.where(:madeline_display => 1) }.flatten.uniq\n\n twin_letter = 'A'\n twin_count = 0\n people.each do |person|\n\t\t# this doesn't work for triplets?!?\n #blah = twin_count % 2 \n #if (((twin_count % 2) == 0) and twin_count > 0) then\n # in order for the letter to not be the same, we need to create a new object.\n # tl = twin_letter.dup\n # tl.next!\n # twin_letter = tl\n # twin_count = 0\n #end\n cp, twin_count = create_row(person, familyID, conditions, phenotypes, twin_letter, twin_count)\n results.push(cp)\n end # end people.each\n\n logger.debug(\"results before childless marriages #{results.inspect}\")\n childless_marriages = pedigree.find_childless_marriages # hash of person_id = person_id\n childless_marriages.each do |father_id, mother_id|\n father_ident = Person.find(father_id).madeline_identifier\n mother_ident = Person.find(mother_id).madeline_identifier\n fake_child = Person.new\n fake_child.collaborator_id = \"^\"+(0...8).map{65.+(rand(25)).chr}.join\n cp = create_fake(fake_child, familyID, conditions, phenotypes, father_ident, mother_ident) \n\n results.push(cp)\n end\n\n logger.debug(\"to_madeline results #{results.inspect}\")\n return results\n\nend",
"def each_root_relation\n\t for rel in relations\n\t\tyield(rel) unless rel.parent\n\t end\n\tend",
"def ascendants(result = nil, depth = 0)\n \n if (result.nil?)\n result = Hash.new\n end\n \n parents.each do |par|\n node = Array.new\n node[0] = par\n par_spice = par.spice\n if (!par_spice.nil? && par_spice.length > 0)\n # TBD: I know there is a Ruby way to copy an array but can't look it up on the plane - just copy myself for now\n spouse_list = Array.new\n par_spice.each do |s|\n spouse_list << s\n end\n node[1] = spouse_list\n end\n result[node] = depth\n par.ascendants(result, depth + 1)\n end \n \n return result\n \n end",
"def nesting() end",
"def test_perfind_flatten1\r\n pi = @mymodel.node_list.add_node(3, 'perfind3', PERFIND) \r\n\r\n assert_equal( { \"name\"=>\"perfind3\", \"ident\"=>3, \"type\"=>\"perfind\",\r\n \"commentary\"=>\"\", \"description\"=>\"\", \"evidence\"=>\"undefined\",\r\n \"value_function\"=>nil },\r\n pi.flatten_data)\r\n end",
"def get_tree_top_id(person)\n person.direct_supervisors.empty? ? person.id : person.direct_supervisors.first.id\n end",
"def generate_hierarchy(node, id = nil)\n loc = {}\n $navigation_html += '<ul><li>'\n node.each_element do |element|\n if element.name == 'node_name' && !id.nil?\n loc[:id] = id\n loc[:location] = element.text\n loc[:sub_loc] = []\n $navigation_html += \"<a href='#{loc[:location]}.html'>#{loc[:location]}</a>\"\n else\n loc[:sub_loc] << generate_hierarchy(element, element.attributes['atlas_node_id'])\n end\n end\n $navigation_html += '</li></ul>'\n return loc\nend",
"def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end",
"def relationship_ancestry(*args)\n stringify_options = args.extract_options!\n options = stringify_options.slice!(:field_delimiter, :record_delimiter, :exclude_class, :field_method, :include_self)\n\n include_self = stringify_options.delete(:include_self)\n field_method = stringify_options[:field_method] || :id\n\n meth = include_self ? :path : :ancestors\n meth = :\"#{meth.to_s.singularize}_ids\" if field_method == :id\n rels = send(meth, options)\n\n rels_meth = :\"stringify_#{field_method == :id ? \"resource_pairs\" : \"rels\"}\"\n Relationship.send(rels_meth, rels, stringify_options)\n end",
"def tree\n @treetop = @proj.default_ontology_class\n @proj.ontology_classes.first if !@treetop\n redirect_to :action => :new, :controller => :ontology_classes and return if !@treetop\n @colored_object_relationships = @proj.object_relationships.with_color_set\n @all_object_relationships = @proj.object_relationships \n render :action => 'ontology/tree/index'\n end",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def traversal_2a\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n doc_num = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project\n end\n projects.each do |project|\n doc_index = 0\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n doc_num += 1\n if doc_index == 0\n type = doc.doc_type\n name = doc.doc_name\n doc.doc_type = name\n doc.doc_name = type\n Perpetuity[Document].save doc\n end\n doc_index +=1\n end\n end\n end\n return doc_num\nend",
"def gen_relationships\n @parser.relationships.each do |rel|\n through_str = ''\n lines = []\n if rel[:has_relationship]\n has_relationship = rel[:has_relationship].gsub(':', '..')\n case has_relationship\n when '1'\n rel_str = 'belongs_to'\n when 'n'\n rel_str = \"has n,\"\n else\n rel_str = \"has #{has_relationship},\"\n if rel[:through]\n through_str = \", :through => :#{rel[:through]}\"\n else\n through_str = \", :through => Resource\"\n end\n end\n \n if rel[:through]\n lines << \" has n, :#{rel[:through]}\"\n end\n line = \" #{rel_str} :#{rel[:variable]}#{through_str}\"\n line += \" # #{rel[:comment]}\" unless rel[:comment].empty?\n lines << line\n elsif rel[:relationship]\n lines << ' ' + rel[:relationship]\n end\n editor = ModelEditor.new(rel[:filename].snake_case)\n editor.insert(AFTER_PROPERTIES, lines)\n end\n end",
"def each_with_level(objects)\n path = [nil]\n objects.sort_by(&left_column_name.to_sym).each do |o|\n if o._parent_id != path.last\n # we are on a new level, did we decent or ascent?\n if path.include?(o._parent_id)\n # remove wrong wrong tailing paths elements\n path.pop while path.last != o._parent_id\n else\n path << o._parent_id\n end\n end\n yield(o, path.length - 1)\n end\n end",
"def logical_relatives(options = {}) # :yields: {OntologyClass => implied_redundant_relationships ? true : false}\n return [] if !ObjectRelationship.find_by_interaction_and_proj_id('is_a', self.proj_id) || !ObjectRelationship.find_by_interaction_and_proj_id('part_of', self.proj_id)\n\n rel1 = Proj.find(self.proj_id).object_relationships.by_interaction('is_a').first.id\n rel2 = Proj.find(self.proj_id).object_relationships.by_interaction('part_of').first.id\n return [] if !rel1 || !rel2\n\n opt = {\n :direction => :children, # [:parents | :children]\n :rel1 => rel1,\n :rel2 => rel2\n }.merge!(options.symbolize_keys)\n\n return nil if ![:parents, :children].include?(opt[:direction])\n\n first_result = [] # all the part_of\n second_result = [] # part_of through is_a\n\n result = {}\n\n # Find/recurse the isa/part_of tree, this gets us a unique array of pertinent OntologyRelationships\n # that reflect OntologyClass relationships that are related by one of rel1 or rel2 at each inspection.\n rels = self.related_ontology_relationships(opt.merge(:relationship_type => [opt[:rel1], opt[:rel2]]))\n\n return {} if rels == nil\n\n # get all the part_of resuls, anything below and with a part_of, is part_of (since all others are is_a)\n to_nuke = [] # index of rels to delete before next itteration\n rels.each do |r|\n nuke = false # boolean check for delete\n if r.object_relationship_id == opt[:rel2]\n nuke = true\n if opt[:direction] == :parents\n first_result.push(r.ontology_class2)\n else\n first_result.push(r.ontology_class1)\n end\n end\n to_nuke.push(r) if nuke\n end\n\n # !! don't do uniq on first result\n\n # try to invoke some loop speedup by deleting values we don't need to loop through\n rels.delete_if{|r| to_nuke.include?(r)}\n rels.delete_if{|r| !r.object_relationship_id == opt[:rel1]} # we only need to deal with isas of rel1 now\n\n # for all of the part_of results also get the is_a children (or whatever rel2 -> rel1 relationship is)\n\n rels.each do |rel|\n first_result.uniq.each_with_index do |r,i|\n if opt[:direction] == :parents\n second_result.insert(-1, rel.ontology_class2) if (rel.ontology_class1 == r)\n else\n second_result.insert(-1, rel.ontology_class1) if (rel.ontology_class2 == r)\n end\n end\n end\n\n second_result.uniq! # don't imply redundancies from hitting an is_a twice (is this right?! - gives \"correct\" result AFAIKT)\n\n (first_result + second_result).each do |r|\n result.merge!(r => (!result.keys.include?(r) ? false : true))\n end\n\n result\n end",
"def property_tree\n properties = Hash[self.explore.properties.map {|p| [p.id, p]}]\n properties.keys.each do |key|\n prop = properties[key]\n prop.parents.each {|par| properties[par].children << prop if properties[par]}\n end\n roots = properties.values.select {|p| p.parents.empty?}\n root = LinkedData::Client::Models::Property.new\n root.children = roots\n root\n end",
"def recurseDerivedRequirements(requirement, treeNode)\n # $logger.log(treeNode.name)\n derivedReqs = []\n if StereotypesHelper.hasStereotype(requirement, $requirementStereotype)\n #for relation in requirement.get_relationshipOfRelatedElement()\n for relation in requirement.get_directedRelationshipOfTarget()\n if StereotypesHelper.hasStereotype(relation, $derivedRelationshipStereotype)\n # derivedReqs.push(ModelHelper.getClientElement(relation))\n derivedReqs.push(relation.getSource().get(0))\n # $logger.log(\"H: \" + derivedReqs[-1].getName())\n end\n end\n end\n unless derivedReqs.empty?\n # $logger.log(\"DR: \" + derivedReqs.size.to_s)\n # for dr in derivedReqs\n # $logger.log(dr.name)\n # end\n for derivedReq in derivedReqs\n # $logger.log(\"D: \" + derivedReq.getName())\n requirementId = StereotypesHelper.getStereotypePropertyFirst(derivedReq, $requirementStereotype, \"Id\").to_s\n # requirementId = \"\"\n childNode = Tree::TreeNode.new(requirementId + \" \" + derivedReq.getName())\n recurseDerivedRequirements(derivedReq, childNode)\n begin\n treeNode.add(childNode)\n rescue RuntimeError\n $logger.log(\"Duplicate entry: \" + childNode.name)\n $logger.log(treeNode.name)\n end\n end\n end\n return\nend",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def traversal_6\n\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n docs = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project unless projects.include?(projtm.project)\n end\n projects.each do |project|\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n docs += 1\n end\n end\n end\n return docs\nend",
"def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend",
"def populate_inheritance_heirarchy\n apps_and_templates = appTemplates + templates\n apps_and_templates.each do |temp| \n temp.attributes[:parent].to_s != '' ? app_or_temp = temp.attributes[:parent] :\n temp.attributes[:template].to_s != '' ? app_or_temp = temp.attributes[:template]:\n next\n next if app_or_temp == \"what the fuck?\"\n # if temp.attributes[:parent].is_a? String or temp.attributes[:template].is_a? String\n if not app_or_temp.empty?\n parent_template = self.templates.find { |template| template.name.downcase == app_or_temp.downcase }\n temp.child_of << parent_template\n parent_template.parent_of << temp\n end\n end \n end",
"def update\n\t\t @tree = current_user.trees.find(params[:tree_id])\n\n\t if @tree.nil?\n\t \trender json: { errors: [\"No such tree found\"], success: false }, status: :bad_request\n\t end\n\n\t @person = @tree.people.find(params[:id])\n\n \tif @person.nil?\n \t\trender json: { errors: [\"No such person found\"], success: false }, status: :bad_request\n \tend\n\n \tparams.delete :_id\n\n\t relations = {}\n\t\t \tmodified_people = []\n\n\t\t \tif params[:person][:spouses]\n\t\t \t\trelations[:spouses] = params[:person][:spouses]\n\t\t \t\tparams[:person].delete :spouses\n\t\t \tend\n\n\t\t \tif params[:person][:children]\n\t\t \t\trelations[:children] = params[:person][:children]\n\t\t \t\tparams[:person].delete :children\n\t\t \tend\n\n\t\t \tif params[:person][:parents]\n\t\t \t\trelations[:parents] = params[:person][:parents]\n\t\t \t\tparams[:person].delete :parents\n\t\t \tend\n\n \tif @person.update_attributes(params[:person])\n \t\tmodified_people << @person\n\n \t\trelations.each do |k,v|\n\t\t \t\tv.each do |p|\n\t\t \t\t\tputs \"RELATIONS\", relations\n\t\t \t\t\tputs \"HERE\", k, v, p\n\t\t \t\t\trelative = @tree.people.find(p)\n\t\t \t\t\tputs \"THERE\", relative[k], relative.to_json\n\t\t \t\t\trelative.send(k) << @person\n\t\t \t\t\trelative.save\n\t\t \t\t\tmodified_people << relative\n\t\t \t\tend\n\t\t \tend\n\n \trender json: { person: @person, people: modified_people }, status: :accepted\n \telse\n \trender json: { errors: @person.errors, success: false }, status: :unprocessable_entity\n \tend\n\t\t end",
"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 show\n @person = Person.find(params[:id])\n @address = @person.addresses.take\n @identifiers = @person.identifiers\n @parent = @person.company\n end",
"def each_ancestor # :nodoc:\n end",
"def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend",
"def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend",
"def generate!(website_obj)\n # Produce new children and add them to the tree, if necessary.\n end",
"def ancestors() end",
"def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend",
"def descendants(person_id)\n\t\t# initialize descendant with person as the first element\n\t\tdescendants_list = [] << [@people[person_id]]\n\t\tparent_gen_idx = 0\n\t\tbegin \n\t\t\tnext_gen = []\n\t\t\t# for each person in this generation, find their children\n\t\t\tdescendants_list[parent_gen_idx].each do | parent |\n\t\t\t\tparent.children_ids.map { | id | next_gen << @people[id] }\n\t\t\tend\n\t\t\t# add new generation as another element to the descendants\n\t\t\tdescendants_list << next_gen\n\t\t\tparent_gen_idx += 1\n\t\tend until next_gen.size == 0 # loop as long as another generation is returned\n\t\tdescendants_list\n\tend",
"def fulltree_rels_arranged(*args)\n options = args.extract_options!\n root_id = relationship.try(:root_id)\n return {relationship_for_isolated_root => {}} if root_id.nil?\n Relationship.filter_by_resource_type(Relationship.subtree_of(root_id), options).arrange\n end",
"def generate_all_connections!\n organisation_level_connections = []\n\n self.has_members.each do |member_uri|\n member = Person.find(member_uri)\n organisation_level_connections << member.get_connections!\n end\n\n organisation_level_connections.flatten\n end",
"def linkDescendants(id, child, childMap, done)\n childMap[child].each { |child2|\n if !done.include?([id, child2])\n #puts \"linkDescendants: id=#{id} child2=#{child2}\"\n UnitHier.create(\n :ancestor_unit => id,\n :unit_id => child2,\n :ordering => nil,\n :is_direct => false\n )\n done << [id, child2]\n end\n if childMap.include?(child2)\n linkDescendants(id, child2, childMap, done)\n end\n }\nend",
"def each_normal_group_record(top, safe_references = true, wide_deep = :deep, level=0, limit = :all)\n # wide_deep = :wide is not implemented yet\n # safe_references = false not implemented\n # limit not implemented\n level += 1\n indent = \" \"*(level-1)\n\n case # For case syntax, see http://ilikestuffblog.com/2008/04/15/how-to-write-case-switch-statements-in-ruby/\n when top.name == \"Web Browser.html\", # Web Browser.html is a hack in DevonThink, not a regular file\n top.kind == \"Smart Group\", # Since content in smart groups are also in other places, I avoid them\n top.uuid == @db.trashGroup.uuid, # Don't look in the Trash\n top.uuid == @db.syncGroup.uuid # Don't know what this group really does, so I avoid it for the time being\n @walker_log.debug indent + \"SKIPPED: '#{top.name}'\"\n else\n top = top.get # I'm using a lot of .get, to avoid mysterious bugs (at the cost of a slower application)\n @walker_log.debug indent + \"'#{top.name}' (#{top.kind})\"\n yield(top)\n # TODO Daycare\n top.children.each do |child|\n each_normal_group_record(child, safe_references, wide_deep, level){|newtop| yield(newtop)}\n end\n end\n end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def parents; end",
"def hierarchy\n p = self\n h = []\n while(p.parent != nil)\n h = [p] + h\n p = p.parent\n end\n h = [p] + h\n \n h\n end",
"def find_paternal_aunt(person)\n parent = find_parent(person)\n \n parentObject = find_person(parent)\n if parentObject.female?\n parent = find_spouse(parent)&.name\n end\n\n find_sibling_sisters(parent)\n .reject { |sibling| sibling == parent }\n end",
"def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end",
"def householdRelation()\n p_prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.person_id).take.contact_id\n h_prev = CIVICRM::VineContactPrevId.where(alf_id: self.household).take\n return if h_prev.nil?\n h_prev_id = h_prev.contact_id\n\n person = CIVICRM::Contact.find(p_prev_id)\n house = CIVICRM::Contact.find(h_prev_id)\n\n household_type = ALF::HouseholdPosition.findId(self.household_position)\n\n # Get relationships\n # head - a household - b\n head_household = CIVICRM::RelationshipType.where(id: 6).take\n # child - a parent - b\n child_parent = CIVICRM::RelationshipType.where(id: 1).take\n # spouse - a/b\n spouse_rel = CIVICRM::RelationshipType.where(id: 2).take\n # sibling - a/b\n sibling = CIVICRM::RelationshipType.where(id: 3).take\n # individual - a household - b\n member_household = CIVICRM::RelationshipType.where(id: 7).take\n\n if household_type.present? && household_type.household_position_name == \"Head\"\n rel = CIVICRM::Relationship.new(\n contact_id_a: person.id,\n contact_id_b: house.id,\n relationship_type_id: head_household.id\n )\n elsif household_type.present? && household_type.household_position_name == \"Spouse\"\n rel = CIVICRM::Relationship.new(\n contact_id_a: person.id,\n contact_id_b: house.id,\n relationship_type_id: member_household.id\n )\n\n head = CIVICRM::Relationship.where(contact_id_b: house.id, relationship_type_id: head_household.id).take\n if head.present?\n # Create spouse relationship\n sp = CIVICRM::Relationship.new(\n contact_id_a: head.contact_id_a,\n contact_id_b: person.id,\n relationship_type_id: spouse_rel.id\n )\n\n sp.save\n else\n rel = CIVICRM::Relationship.new(\n contact_id_a: person.id,\n contact_id_b: house.id,\n relationship_type_id: member_household.id\n )\n end\n rel.save\n end\n end",
"def ancestors(person_id)\n\t\t#intialize ancestors with person as the first element\n\t\tancestors_list = [] << [@people[person_id]]\n\t\tchild_gen_idx = 0\n\t\tbegin\n\t\t\tnext_gen = []\n\t\t\t#for each person in this generation, add their parents\n\t\t\tancestors_list[child_gen_idx].each do | child |\n\t\t\t\tnext_gen << @people[child.father_id] if child.father_id\n\t\t\t\tnext_gen << @people[child.mother_id] if child.mother_id\n\t\t\tend\n\t\t\tancestors_list << next_gen\n\t\t\tchild_gen_idx += 1\n\t\tend until next_gen.size == 0\n\t\tancestors_list\n\tend",
"def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end",
"def to_graph(indent=nil)\n out = \"Parents:\\n\"\n self.parents.each { |parent| out << \" #{parent}\" }\n out << \"\\nObject: #{self.to_s}\\n\"\n out << \"Children:\\n\"\n self.children.each { |child| out << \" #{child}\" }\n out\n end",
"def each_relation_edge(rg)\n rg.nodes.each { |node|\n [:src,:dst].each { |rg_level|\n next unless node.get_block(rg_level)\n node.successors(rg_level).each { |node2|\n if node2.type == :exit || node2.get_block(rg_level)\n yield IPETEdge.new(node,node2,pml_level(rg_level))\n end\n }\n }\n }\n end",
"def recursive_traverse(node, current_state)\n Log.debug \"visiting #{node.name}\"\n current_state.timelines.first << node.name\n if node.downstream.empty?\n Log.debug \"#{node.name} has no downstream nodes. Reached end of timeline\"\n return current_state\n elsif node.downstream.size == 1\n Log.debug \"#{node.name} only one downstream node. Moving to it now.\"\n return recursive_traverse node.downstream.first, current_state\n else\n Log.debug \"#{node.name} has #{node.downstream.size} downstream nodes. Investigating merge options.\"\n\n timeline_forks = node.downstream.collect { |down|\n downstream_fork_states = recursive_traverse(down, TimelineState.new).timelines\n raise \"Downstream partial merge detected. This type of merge is not yet supported\" unless downstream_fork_states.size == 1\n downstream_fork_states.first\n }\n common_elems = timeline_forks.inject { |sum, nex| sum & nex }\n\n common_elem = common_elems.first\n base_forks = timeline_forks.select { |f| f.first.equal? common_elem }\n if common_elem.nil?\n current_state.state = 'No merge is possible'\n\n timelines = timeline_forks.collect { |f|\n (current_state.timelines + f).flatten\n }\n\n current_state.timelines = timelines\n\n elsif base_forks.empty?\n current_state.state = 'Partial merge is possible'\n\n common_elem_index = timeline_forks.first.find_index common_elem\n agreed_tail_arry = timeline_forks.first.slice(common_elem_index, timeline_forks.first.size - 1)\n\n disputed_events_array = timeline_forks.collect { |f|\n term = f.find_index common_elem\n f.slice(0, term)\n }\n\n # could iterate over permuations of parallel events here to list all possible timelines, but outside of problem description\n possible_timelines = disputed_events_array.collect { |p|\n (current_state.timelines + p + agreed_tail_arry).flatten\n }\n\n current_state.timelines = possible_timelines\n\n elsif base_forks.size == 1\n current_state.state = 'Merge is possible'\n Log.debug 'Full merge possible'\n\n longest_merge_array = timeline_forks.sort_by(&:size).last\n current_state.timelines = [(current_state.timelines + longest_merge_array).flatten]\n else\n raise 'Only one base fork should be found!'\n end\n\n end\n current_state\n end",
"def get_family\n family = [self]\n child = self\n (self.level-1).times do\n child = child.parent\n family.unshift child\n end\n family\n end",
"def generate_passage_recursive(connector)\n #chamber_strategy = :wait # immediate: generate from chamber when it appears. \n # # wait: Generate from chambers after passages are complete\n map = connector.map_object.map\n from_map_object = connector.map_object\n to_map_object = connector.connecting_map_object\n if to_map_object and to_map_object.drawn?\n log \"Map object #{to_map_object.name} is already connected and drawn, skipping generation step from #{from_map_object.name}\"\n return\n end\n if to_map_object.nil?\n if connector.kind_of? Door\n log \"Generating new map object beyond door from #{from_map_object.name}\"\n passage_data = random_yaml_element(\"beyond_door\")\n else\n log \"Generating new map object from #{from_map_object.name}\"\n passage_data = random_yaml_element(\"passages\")\n passage_data[\"type\"] = \"passage\" if passage_data[\"type\"].nil?\n end\n else\n log \"Found existing connected map object: #{to_map_object.name}\"\n passage_data = {\"type\" => to_map_object.type}\n if to_map_object.type != \"passage\"\n raise \"Existing map objects other than passages are not supported in generate_passage_recursive\"\n end\n end\n debug \"Data: #{passage_data.to_s}\"\n case passage_data[\"type\"]\n when \"chamber\"\n log \"Type: Chamber\"\n chamber_data = random_yaml_element(\"chambers\")\n width = chamber_data[\"width\"]\n length = chamber_data[\"length\"]\n chamber = map.add_chamber(connector: connector, width: width, length: length)\n unless chamber.nil?\n chamber.add_exits()\n chamber.connectors.each { |c|\n generate_passage_recursive(c)\n }\n chamber.doors.each { |d|\n generate_passage_recursive(d)\n }\n end\n when \"stairs\"\n log \"Type: Stairs\"\n stairs = map.add_stairs(connector: connector)\n else\n log \"Type: Passage\"\n if to_map_object.nil?\n passage = map.add_passage(connector: connector, instructions: passage_data[\"passage\"])\n else\n debug \"#{connector.connecting_map_object.name} already exists\"\n unless to_map_object.kind_of? Passage\n log_important \"#{to_map_object.name} is not a passage but got assumed to be such in the generator! This should never happen.\"\n return\n end\n passage = map.add_passage(connector: connector, passage: to_map_object)\n return unless passage and passage.has_incomplete_connectors?\n end\n unless passage.nil?\n passage.all_connectors.each {|c|\n generate_passage_recursive(c)\n }\n end\n end\n end",
"def get_children_recursion(node)\n\tif node.class == SOCIAL_NETWORK[0].class\n\t\tnode.children.each do |child|\n\t\t\tget_children_recursion(delegate_word(child))\n\t\tend\n\tend\nend",
"def traversal_3\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n doc_num = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project\n end\n projects.each do |project|\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n doc_num+=1\n day = doc.revision_date.mday\n if day.odd?\n doc.revision_date += 24*60*60\n elsif day.even?\n doc.revision_date -= 24*60*60\n end\n Perpetuity[Document].save doc\n end\n end\n end\n return doc_num\nend",
"def printlewis(node)\r\n\tputs node.to_s + \" =\"\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\tputs n\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\t\tputs n\r\n\t\t\telse\r\n\t\t\t\tputs n\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tputs \"========\"\r\n\t\t\t\tprintlewis(n)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend",
"def produce_tree(ary); end",
"def nested_graph\n @nested_graph ||= ModelConverter.new(resource: Valkyrie::Types::Anything[value.value], adapter: value.adapter, subject_uri: subject_uri).convert.graph\n end",
"def build_parents(data)\n data.inject({}) do |h, d|\n (1...d.length).each { |i| h[d[i]] = d[0] }; h\n end\nend",
"def iterate root_child_itr\t\t\t#to iterate over the nodes\t\t\n\t \n\t ## Collect root_child_itr.children in a variable since it being used twice\n\t ## Can you try using some other conditional construct other than loop and break?\n\t\twhile true\n\t\t ###### Use an intuitive variable name\n\t\t\tchild = root_child_itr.children\n\t\t\t\n\t\t\t##### if temp.children[0]\n\t\t\tif child.children[0] == nil\t\t\t#checking if the node is innermost as innermost node will not be having any childnode\n\t\t\t\t@@arr.push child\n break\n\t\t\telse\n\t\t\t\tscan root_child_itr\t\t# iterate over the childnodes if it is not the parent of the innermost node\n break\n\t\t\tend\t\t\n\t\tend\n\tend",
"def disp_node(node, depth)\n# mon_string = ''\n# depth.times {mon_string+=' '}\n# mon_string += \"- #{node.name}\"\n# `echo \"#{mon_string}\" >> toto.txt`\n\n # depth.times {print ' '}\n # puts \"- #{node.name}\"\n self.graph.each_adjacent node do |adj_node|\n disp_node adj_node, depth+1\n end\n end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def ancestors; end",
"def parent_hierarchy\n [\n parentADM4,\n parentADM3,\n parentADM2,\n parentADM1,\n parentCountry\n ].reject(&:empty?)\n end",
"def descendants\n tree.tap(&:shift)\n end",
"def get_or_create_relationship(conn, node_start, node_end, type)\n data = <<\"EOS\"\n{\n \"to\" : \"#{node_end}\",\n \"max_depth\" : 1,\n \"relationships\" : {\n \"type\" : \"#{type}\",\n \"direction\" : \"out\"\n },\n \"algorithm\" : \"shortestPath\"\n}\nEOS\n r = conn.post(\"#{node_start}/paths\", data, HEADER)\n length = (JSON.parse(r.body).first || {})['length'] if r.status == 200\n if length != 1\n conn.post(\"#{node_start}/relationships\", JSON.unparse({ :to => node_end, :type => type }), HEADER)\n $load_r += 1\n else\n $skip_r += 1\n end\nend",
"def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end",
"def add_three_deep_levels(group_organization)\n\t\t service = group_organization.organizations.where(org_type: \"Service\").first\n\t\t first_dealer = create_child_dealer(group_organization, service)\n\t\t p \"Adding 1 child dealer #{first_dealer.id} for Group org : #{group_organization.id}\"\n\t\t create_two_subchild_dealers(group_organization, first_dealer)\n\t\tend",
"def wiki_format etym, parent = nil, tree = nil, use_html = false # FIX: \"use_html\" is kludgy\n\t\t# On first run-through, assert we're at the top level and define the 'tree' variable as etym's ancestor hash with etym removed.\n unless tree\n top_level = true\n\t\t\ttree = etym.try(:ancestor_map)\n end\n \n # Different actions based on what we're working with.\n # On initial run etym should only be an Etymology.\n # On subsequent runs, etym will be a Hash if there is no next_etymon; otherwise it will be an Array.\n case etym\n # If the tree to recurse does not have a next_etymon\n # e.g. { parent_etym => { grandparent_etym => {}}}\n # or { parent_etym => [{ grandparent_etym => {}}, { next_grandparent_etym => {}}]\n # Then get the wiki_format of the parent_etym, keeping the value of parent, and using the value of parent_etym as the tree.\n # We should get \", from [etymology of parent_etym]\"\n when Hash\n each_tree = etym.collect do |key, value|\n wiki_format key, parent, value, use_html\n end\n \n # pre_note = \", from \" if parent\n # pre_note = (pre_note || \"\") << each_tree.to_sentence\n ancestors = each_tree.to_sentence(locale: @dictionary.try(:definition_language) || I18n.locale)\n pre_note = parent ? t('helpers.etymology.from_ancestors', ancestors: ancestors) : ancestors\n # If the tree to recurse has a next_etymon\n # e.g. [ {{} => { parent_etym => { grandparent_etym => {} } }}, { next_etym => {} } ]\n # or [ {{} => { parent_etym => { grandparent_etym => {} } }}, [{ next_etym => {} }, { third_etym => {} }] ]\n # or [ {{} => { parent_etym => [ {grandparent_etym => {} }}, {next_grandparent_etym => {} }], [{ next_etym => {}}, {third_etym => {} }]]\n # or [ {{} => { parent_etym => {} }}, [{ next_etym => {} }, { third_etym => {} ]] \n # etc.\n when Array\n parent_ancestor = etym.shift\n orig_parent = parent_ancestor.keys[0]\n orig_ancestor = parent_ancestor.values[0]\n parent_ancestor = parent_ancestor.keys[0]\n pre_note = \"\"\n add_from = true if parent\n \t\t\t# pre_note = (pre_note || \"\") << \", from \" if add_from #DEBUG\n #pre_note << wiki_format(parent_ancestor, parent, \"\", use_html)\n format_ancestor = wiki_format(parent_ancestor, parent, \"\", use_html)\n pre_note = add_from ? t('helpers.etymology.from_ancestors', ancestors: format_ancestor) : format_ancestor\n\n parent_ancestor = wiki_format parent_ancestor.keys[0], parent, parent_ancestor.values[0], use_html unless (parent_ancestor.blank? || parent_ancestor.is_a?(Etymology))\n parent = orig_parent\n\n etym.flatten!\n peers = etym.collect do |peer_hash|\n wiki_format peer_hash.keys[0], parent, \"\", use_html\n end\n\n peers.each do |peer|\n pre_note = t('helpers.etymology.peerX_plus_peerY', peerX: pre_note, peerY: peer, default: \"%{peerX} + %{peerY}\")\n# pre_note << \" + #{peer}\"\n end\n \n appended_ancestor = false\n unless parent_ancestor.blank?\n short_parent = if use_html \n language = content_tag :span, :class => \"lexform-source-language\" do\n html_escape orig_parent.original_language.name\n end if orig_parent && orig_parent.original_language \n\n etymon = content_tag :span, :class => \"lexform-etymon\" do\n wh orig_parent.etymon\n end\n \n #[language, etymon].compact.join(\" \")\n if language && etymon then\n t('helpers.etymology.language_etymon', language: language, etymon: etymon, default: \"#{language} #{etymon}\")\n else\n language || etymon\n end\n else\n orig_parent.to_s\n end\n orig_ancestry = wiki_format(orig_ancestor.keys[0], parent, orig_ancestor.values[0], use_html) if orig_ancestor.values[0]\n # pre_note << \"; where #{short_parent} is from #{orig_ancestry}\" if orig_ancestry\n pre_note = t('helpers.etymology.etym_where_word_is_from_ancestors', etyms: pre_note, word: short_parent, ancestors: orig_ancestry) if orig_ancestry\n appended_ancestor = true if orig_ancestry\n end\n etym.each do |peer_hash|\n peer = peer_hash.keys[0]\n ancestor = peer_hash.values[0]\n unless ancestor.blank?\n short_peer = if use_html \n language = content_tag :span, :class => \"lexform-source-language\" do\n html_escape peer.original_language.name\n end if peer.original_language \n\n etymon = content_tag :span, :class => \"lexform-etymon\" do\n wh peer.etymon\n end\n\n #[language, etymon].compact.join(\" \")\n if language && etymon then\n t('helpers.etymology.language_etymon', language: language, etymon: etymon, default: \"#{language} #{etymon}\")\n else\n language || etymon\n end\n else\n peer.to_s\n end\n\n case ancestor\n when Hash\n# pre_note = \", from \" + pre_note if add_from\n ancestry = wiki_format ancestor.keys[0], peer, ancestor.values[0], use_html\n when Array\n ancestry = wiki_format ancestor, peer, (ancestor.size == 1 ? nil : ancestor[1..-1]), use_html\n end\n #pre_note << (appended_ancestor ? \", and \" : \"; \") << \"where #{short_peer} is from #{ancestry}\"\n pre_note = appended_ancestor ? \n t('helpers.etymology.etym_and_where_word_is_from_ancestors', etyms: pre_note, word: short_peer, ancestors: ancestry) :\n t('helpers.etymology.etym_where_word_is_from_ancestors', etyms: pre_note, word: short_peer, ancestors: ancestry)\n end\n end\n # When 'etym' is an etymology set pre_note to 'Language etymon \"gloss\"' and recurse, \n # using 'tree' as both the etymon and the tree, and using the etymon as the parent.\n when Etymology\n initial_etymon_same_language = Language.lang_for(Lexeme.with_etymology(etym)) == etym.original_language unless parent\n\n if use_html\n language = content_tag :span, :class => \"lexform-source-language\" do\n html_escape etym.original_language.name\n end if etym.original_language unless\n (parent && parent.original_language == etym.original_language) || initial_etymon_same_language \n etymon = content_tag :span, :class => \"lexform-etymon\" do\n wh etym.etymon\n end\n\n gloss = content_tag :span, :class => \"lexform-etymon-gloss\" do\n html_escape etym.gloss\n end unless etym.gloss.blank?\n else\n language = html_escape(etym.original_language.name) if \n etym.original_language unless\n (parent && parent.original_language == etym.original_language) || initial_etymon_same_language\n\n etymon = sanitize etym.etymon\n\n # gloss = html_escape('\"' << etym.gloss << '\"') if etym.gloss.present?\n gloss = html_escape(t('helpers.etymology.quoted_gloss', gloss: etym.gloss, default: \"\\\"#{etym.gloss}\\\"\")) if etym.gloss.present?\n end unless top_level\n\n # pre_note = [language, etymon, gloss].compact.join(\" \") \n etym_hash = {language: language, etymon: etymon, gloss: gloss}.select{|k,v| !v.nil? }\n pre_note = if etym_hash.length > 1 then\n t(\"helpers.etymology.#{etym_hash.keys.join(\"_\")}\", language: language, etymon: etymon, gloss: gloss, default: etym_hash.values.join(\" \"))\n else\n language || etymon || gloss\n end\n\n unless tree.blank?\n tree_note = wiki_format tree, (etym unless top_level), tree, use_html\n # pre_note = pre_note + tree_note\n pre_note = t('helpers.etymology.etym_predicate', etyms: pre_note, predicate: tree_note, default: \"#{pre_note}#{tree_note}\")\n end\n end\n \n #pre_note = (pre_note || \"\") << \".\" if top_level\n pre_note ||= \"\"\n pre_note = t('helpers.etymology.etym_fullstop', etyms: pre_note, default: \"#{pre_note}.\") if top_level\n pre_note \n end",
"def get_tree_top_id(employee)\n if employee.supervisor_relationships.empty?\n employee.id\n else\n sup = employee.supervisor_relationships.reject{|sr| sr.dotted == true}.first\n sup.supervisor_id\n end\n end",
"def org_tree_node(o = nil)\n orgs = {}\n @org_ids ||= {}\n (o ? o.children : Organization.find(Organization.find(organization_id).parent).children).order('name').each do |org|\n # collect roles associated with each org\n @org_ids[org.id] ||= {}\n orgs[org.id] = org_tree_node(org)\n end\n orgs\n end",
"def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"def deepest(cause); end",
"def combine_to_tree\n @dependencies.dependencies.each do |dependency|\n matches = /(.*?)\\((.*?)-([0-9]+)'*, (.*?)-([0-9]+)'*\\)/.match(dependency) # cop(disorder-4, is-2) # ROOT! NSUBJ\n if matches.nil?\n p dependency\n end\n dependency_name,word1,number1,word2,number2 = matches[1],matches[2],matches[3],matches[4],matches[5]\n node1=dependency_to_node(number1.to_i)\n node2=dependency_to_node(number2.to_i)\n node1.add_dependency_to(dependency_name, node2)\n node2.add_dependency_from(dependency_name, node1)\n end\n end",
"def pretty_print(pp) # :nodoc:\n if !node_models.empty?\n pp.text \" Node Models\"\n pp.nest(4) do\n pp.breakable\n pp.seplist(node_models.values.sort_by(&:name)) do |t|\n t.pretty_print(pp)\n end\n end\n end\n end",
"def record_with_ancestor_chain(record)\n TraverseAncestors[record]\n end",
"def find_parent(person)\n cohort = traverse(person)\n raise Family::Tree::PersonNotFoundError if cohort.nil?\n\n cohort&.\n generation&.\n find { |elem| elem&.name == person }&.\n parent\n end",
"def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend",
"def append_new_invitation \n parent_node =nil\n forest_operations.forest_tree_roots_arr.each{|node|\n node_present=ForestOperations.is_element_present_in_node?(\n node, \n line_content[:sent_or_accepted_by]\n )\n if node_present\n ForestOperations.link_parent_child_nodes_return_parent(\n parent_node = ForestOperations.select_node( \n node,\n line_content[:sent_or_accepted_by]\n ),\n ForestOperations.create_node(\n line_content[:recived_by]\n )\n )\n break\n end\n }\n parent_node\n end",
"def get_parents( 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 \ton 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 subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end",
"def format_person(person_id)\n\t\tperson_names = PersonName.where(person_id: person_id).first \n\t\tp = Person.where(person_id: person_id).first\n\n\t\tmother = PersonRelationship.where(person_a: person_id, person_relationship_type_id: 5).first\n\t\tmother_id = mother.person_b rescue nil\n\t\tmother_names = PersonName.where(person_id: mother_id).first\n\n\t\tfather = PersonRelationship.where(person_a: person_id, person_relationship_type_id: 1).first\n\t\tfather_id = father.person_b rescue nil\n\t\tfather_names = PersonName.where(person_id: father_id).first\n\n\t\taddress = PersonAddress.where(person_id: mother_id).first\n\t\tfather_address = PersonAddress.where(person_id: father_id).first\n\n\t\tdetail = PersonBirthDetail.where(person_id: person_id).first\n\n\t\tperson = {}\n\t\tperson[\"id\"] = person_id\n\t\tperson[\"first_name\"]= person_names.first_name rescue ''\n\t\tperson[\"last_name\"] = person_names.last_name rescue ''\n\t\tperson[\"middle_name\"] = person_names.middle_name rescue ''\n\t\tperson[\"gender\"] = p.gender rescue ''\n\t\tperson[\"birthdate\"]= p.birthdate rescue ''\n\t\tperson[\"birthdate_estimated\"] = 0\n\t\tperson[\"nationality\"]= mother_nationality rescue ''\n\t\tperson[\"place_of_birth\"] = Location.find(detail.place_of_birth).name rescue '' \n\t\tperson[\"district\"] = Location.find(detail.district_of_birth).name rescue ''\n\t\tperson[\"mother_first_name\"]= mother_names.first_name rescue ''\n\t\tperson[\"mother_last_name\"] = mother_names.last_name rescue ''\n\t\tperson[\"mother_middle_name\"] = mother_names.middle_name rescue ''\n\n\t\tperson[\"mother_home_district\"] = Location.find(address.home_district).name rescue ''\n\t\tperson[\"mother_home_ta\"] = Location.find(address.home_ta).name rescue ''\n\t\tperson[\"mother_home_village\"] = Location.find(address.home_village).name rescue ''\n\n\t\tperson[\"mother_current_district\"] = ''\n\t\tperson[\"mother_current_ta\"] = ''\n\t\tperson[\"mother_current_village\"] = ''\n\n\t\tperson[\"father_first_name\"]= father_names.first_name rescue ''\n\t\tperson[\"father_last_name\"] = father_names.last_name rescue ''\n\t\tperson[\"father_middle_name\"] = father_names.middle_name rescue ''\n\n\t\tperson[\"father_home_district\"] = Location.find(father_address.home_district).name rescue ''\n\t\tperson[\"father_home_ta\"] = Location.find(father_address.home_ta).name rescue ''\n\t\tperson[\"father_home_village\"] = Location.find(father_address.home_village).name rescue ''\n\n\t\tperson[\"father_current_district\"] = ''\n\t\tperson[\"father_current_ta\"] = ''\n\t\tperson[\"father_current_village\"] = ''\n\t\tperson\n\tend",
"def recurse_trade(node, route, items, visited={})\n \tif node == route[0]\n \t\troute << node\n \t\treturn route\n \telsif visited[node]\n \t\treturn\n \telse\n \t\tvisited[node] = true\n \t\troute << node\n \t\titems_children(node, items).each do |child|\n if child.new_owner\n next\n end\n \t\t\tresult = recurse_trade(child, route, items, visited)\n if result and result.count > 1\n # puts \"RESULT is #{result.count}\"\n # puts \"Result first is #{result.first}\"\n # puts \"Result last is #{result.last}\"\n return result\n else\n end\n \t\t\t# return result if result\n \t\tend\n \tend\t\t\n end"
] |
[
"0.63254434",
"0.5934211",
"0.5894449",
"0.56490564",
"0.5612903",
"0.56119716",
"0.5555985",
"0.5541716",
"0.5534209",
"0.5475243",
"0.5440395",
"0.54028016",
"0.5384216",
"0.5324889",
"0.5319483",
"0.5314651",
"0.5312348",
"0.52994525",
"0.5292738",
"0.5286284",
"0.52822423",
"0.52663493",
"0.5253552",
"0.5252907",
"0.5245737",
"0.52306813",
"0.5206904",
"0.51907444",
"0.51785904",
"0.5175533",
"0.51720804",
"0.5162197",
"0.5159325",
"0.51533365",
"0.51484245",
"0.5147523",
"0.5138863",
"0.5128661",
"0.5122735",
"0.509805",
"0.5091891",
"0.508986",
"0.5088945",
"0.5087528",
"0.5081414",
"0.508059",
"0.5063481",
"0.5029973",
"0.5024188",
"0.50185704",
"0.50162405",
"0.501287",
"0.49926043",
"0.4992016",
"0.49794272",
"0.49707758",
"0.49675786",
"0.49637914",
"0.4961637",
"0.49522966",
"0.4943126",
"0.49426022",
"0.49388474",
"0.49379086",
"0.49341235",
"0.49336895",
"0.49316236",
"0.49292344",
"0.49258444",
"0.492398",
"0.49166322",
"0.49150175",
"0.48994738",
"0.48982337",
"0.4874465",
"0.48739815",
"0.48733482",
"0.48703623",
"0.48597857",
"0.48597857",
"0.48597857",
"0.48597857",
"0.4858782",
"0.4856067",
"0.48509327",
"0.48485035",
"0.48432702",
"0.48367813",
"0.48354962",
"0.48343346",
"0.48338872",
"0.48277822",
"0.48243347",
"0.48239064",
"0.48238438",
"0.48225304",
"0.48196858",
"0.4806432",
"0.48060867",
"0.4805521",
"0.4805365"
] |
0.0
|
-1
|
get children from the hash in memory based on supervisor id
|
def get_children(h, n)
rr = h[n[:id]]
if !rr.nil?
rr[:children]
else
[]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def children\n SideJob.redis.hgetall(\"#{redis_key}:children\").each_with_object({}) {|child, hash| hash[child[0]] = SideJob.find(child[1])}\n end",
"def get_children_pids(pid)\n pid = pid.to_i\n unless process_tree.key? pid\n log \"No such pid: #{pid}\"\n return []\n end\n process_tree[pid][:children].inject([pid]) do |all_children_pids, child_pid|\n all_children_pids + get_children_pids(child_pid)\n end\n end",
"def get_child_pids(parent_pid)\n descendants = Hash.new{ |ht,k| ht[k] = [k] }\n Hash[*`ps -eo pid,ppid`.scan(/\\d+/).map{ |x| x.to_i }].each{ |pid, ppid|\n descendants[ppid] << descendants[pid]\n }\n descendants[parent_pid].flatten - [parent_pid]\n end",
"def child_hash\n if !@child_hash\n @child_hash = {}\n self.children.each do |i|\n @child_hash[i.name] = i\n end\n end\n\n @child_hash\n end",
"def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end",
"def child_pids(pid)\n\tkids = []\n\tDir.foreach('/proc') do |entry|\n\t\tnext unless entry =~ /^\\d+$/\n\t\tnext if parent_pid(entry) != pid\n\t\tkids << entry.to_i\n\tend\n\tkids\nend",
"def get_children_process(pid)\n\t`ps --ppid #{pid} | grep -v PID | awk '{print $1}'`.split(\"\\n\")\n\t#Could not find a Ruby way to do this\nend",
"def get_children(name, options)\n children = hash[name]\n children = children.is_a?(Hash) ? children : {}\n\n create_hash_children(children, options)\n end",
"def hash\n @children.hash\n end",
"def find_by_pid(pid)\n @proc_table = Array.new\n ProcFetch.get_process(:processid => pid).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\n end",
"def pull_out(parent_hash)\n return parent_hash[\"data\"][\"children\"]\n rescue\n return []\n end",
"def children\n @children ||= {}.with_indifferent_access\n end",
"def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end",
"def get_children_from(tree_hash)\n child_nodes = []\n if tree_hash != nil then \n tree_hash.each do |k, v| \n if v != nil then child_nodes.push(Tree.new({k => v})) end \n end\n end\n return child_nodes\n end",
"def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end",
"def get_node_children(parent,parent_id)\n @kids = []\n children = parent.get_elements(\"children\")\n children.each do |child|\n ps = construct_node(child,parent_id)\n if ps != nil\n @kids << ps\n end\n end\n if !@kids.empty?\n @kids = @kids.sort_by { |k| k.name.downcase }\n end\n @kids\n end",
"def child(name)\n SideJob.find(SideJob.redis.hget(\"#{redis_key}:children\", name))\n end",
"def reap\n out = []\n @children.each do |key,child|\n pid = child.waitpid\n out << child.info\n\n # dead or missing processes, forget about them\n if pid == -1 or pid == child.pid\n @children.delete(key)\n end\n end\n out\n end",
"def children\n @@devices.find {|i, v| i == @id }\n end",
"def children_get()\n @children\n end",
"def child_keys() []; end",
"def children\n @children ||= []\n end",
"def get_child_pids(parent_pid)\n processes = Sys::ProcTable.ps.select{ |pe| pe.ppid == parent_pid }\n processes.map {|process| [process.pid, process.ppid]}.flatten - [parent_pid]\n end",
"def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end",
"def children \n\t\t_c = Children.joins(:families).where(:families => {:parent_id => id} )\n\t\tif _c.present?\n\t\t\t_c\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end",
"def children\n entries\n end",
"def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end",
"def children\n children_tree.values\n end",
"def children\n children_tree.values\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def pids\n @pids ||= {}\n end",
"def children(res)\n # delete() returns nil when nothing was removed. so use delete_if instead.\n @graph.children(Resource.id(res).hash).delete_if{|i| i == 0}.collect { |hashid| id2obj(hashid) }\n end",
"def get_children(name, args)\n children_hash = {}\n\n blue_prints.send(name).each do |child_key, child_blue_prints|\n child_location = location + \"[#{child_key}]\"\n\n children_hash[child_key] = args.fetch(:interface).new(driver,\n child_blue_prints,\n child_key, self, child_location)\n end\n\n children_hash\n end",
"def find_selected_childentries(userid)\n @entries = Entry.find(:all, :conditions => [\"user_id=? and parent_id = ? \", userid, self.id])\n \n \n return @entries\n end",
"def grab_children(father)\n local_list = []\n father.each_pair do |key, value| \n local_list.push(key)\n local_list.push(grab_children(value))\n end\n return local_list\nend",
"def get_children(pi)\n response = Net::HTTP.get_response URI.parse(URI.escape(SERVICE_DCMDB + \"work/\" + pi + \"/children\"))\n children = Array.new\n case response\n when Net::HTTPSuccess\n doc = Document.new(response.body)\n XPath.each(doc, \"//workpid\") { |el|\n children.push(el.text)\n } \n end\n\n return children\n\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def children_names; @children.keys; end",
"def _children\n @children\n end",
"def get_children()\n {}\n end",
"def children(path)\n # r = nil\n # zk_call do\n # r = @zk.get_children(path: path)\n # end\n # debug \"ZK: Children '#{path}' => '#{r}'\"\n # raise NonExistingPathException.new(path) unless r[:stat].exists?\n # r[:children]\n end",
"def children\n @sandboxes.keys\n end",
"def children\n _children\n end",
"def children_ids\n \t children_ids = []\n self.children.each { |child| children_ids << child.id if child.permitted? } unless self.children.empty?\n children_ids\n end",
"def _children\n @children\n end",
"def [](key)\n @children[key]\n end",
"def process_tree\n return @process_tree if @process_tree\n @process_tree = {}\n ps.split(\"\\n\").each do |p|\n f = p.split\n pid = f.shift.to_i\n ppid = f.shift.to_i\n cmd = f.join ' '\n\n # create entry for this pid if not present\n @process_tree[pid] = {\n :children => []\n } unless @process_tree.key? pid\n\n # fill this entry\n @process_tree[pid][:ppid] = ppid\n @process_tree[pid][:pid] = pid\n @process_tree[pid][:cmd] = cmd\n\n # create entry for parent process if not present\n @process_tree[ppid] = {\n :children => []\n } unless @process_tree.key? ppid\n\n # fill parent's children\n @process_tree[ppid][:children] << pid\n end\n @process_tree\n end",
"def get_children\n \t@children\n end",
"def child_ids\n ids = [self.id]\n self.children.each do |child|\n ids += child.child_ids\n end\n ids\n end",
"def children\n self.class.where('? = ANY(parent_ids)', id.to_s)\n end",
"def children\n @children ||= {}\n child_definitions.keys.each{|p| @children[p] ||= cell(p)} unless child_definitions.nil?\n @children\n end",
"def get_children\n return children\n end",
"def get_children(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :watcher, :watcher_context, :callback, :context])\n assert_required_keys(args, [:path])\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(StringsCallback)\n #puts \"\\n---------- calling zoo_awget_children -------\"\n #puts \"@zk_handle is #{@zk_handle.inspect}\"\n #puts \"args[:path] is #{args[:path].inspect}\"\n #puts \"args[:watcher] is #{args[:watcher].inspect}\"\n #puts \"args[:watcher_context] is #{args[:watcher_context].inspect}\"\n #puts \"args[:callback] is #{args[:callback].inspect}\"\n #puts \"args[:callback].proc is #{args[:callback].proc.inspect}\"\n #puts \"args[:context] is #{args[:context].inspect}\"\n #puts \"----------\"\n return zoo_awget_children(@zk_handle, args[:path], args[:watcher], YAML.dump(args[:watcher_context]), args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n str_v = StringVector.new(FFI::MemoryPointer.new(StringVector))\n rc = zoo_wget_children(@zk_handle, args[:path], args[:watcher], YAML.dump(args[:watcher_context]), str_v)\n children = str_v[:data].read_array_of_pointer(str_v[:count]).map do |s|\n s.read_string\n end\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return children\n end",
"def get_children\n return @children\n end",
"def child_object_ids(valkyrie: false)\n child_objects(valkyrie: valkyrie).map(&:id)\n end",
"def get_ids_of_all_child_jobs_old\r\n ids_of_child_jobs = []\r\n if parent_job_id.blank?\r\n child_jobs = Job.where(\"jobs.parent_job_id = #{id}\").all\r\n child_jobs.each do |child_job|\r\n ids_of_child_jobs << child_job.id\r\n end\r\n end\r\n \r\n ids_of_child_jobs\r\n end",
"def get_children\n @children\n end",
"def state_children(path)\n @state_provider.children(path)\n end",
"def children\n @children\n end",
"def children\n @children\n end",
"def find_children_by_trail(trail)\n fetch_or_cache_by_key(\"CHILDREN_BY_TRAIL::\" + trail.to_s) do\n pages = Backpack.interface.list_pages['pages'].first['page']\n children = pages.select { |p| p['title'].squish.match(/^#{trail.squish}\\s*>\\s*[^>]+$/i) }\n children.map { |c| Page.find(c['id'].to_i) } \n end \n end",
"def values\n @children\n end",
"def get_all_child_collections_ids()\r\n ids = @db_interface.get_all_hash_values(@certain_coll_key)\r\n ids ||= []\r\n return ids\r\n end",
"def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end",
"def hash\n [self.class.name, children.map { |el| el.hash }].hash\n end",
"def children\n properties \n end",
"def children\n Array.new\n end",
"def hgetall(key); end",
"def hgetall(key); end",
"def child_hash(branch)\n raise ArgumentError unless branch >= 0 &&\n branch < 16\n hashes[branch]\n end",
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def nodes(hsh={})\n results = describe_instances(:status=>'running').select_with_hash({:keypair_name => keypair.basename})\n results.select_with_hash(hsh)\n end",
"def children\n []\n end",
"def children\n []\n end",
"def children\n []\n end",
"def children_params\n klass_id = self.class.name.split('::').last.downcase + '_id'\n route_params.merge(klass_id.to_sym => id).reject { |k, v| k == :id }\n end",
"def all_children\n find_all_children_with_dotted_ids\n end",
"def pid\n @child_pid\n end",
"def hgetall(hash)\n redis_token.hgetall(hash)\n end",
"def descendent_keyinfo\n \t self_and_descendents.map{ |f|\n\t\t{ id: f.id, name: f.name, parent: f.parent, level: f.level}\n\t\t}.flatten\n end",
"def find_by_name(name)\n @proc_table = Array.new\n ProcFetch.get_process({:name => name}).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\n end",
"def children\n []\n end",
"def children\n []\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 keys\n @children.map(&:title)\n end",
"def tree_hash\n serializable_hash.merge(children: children.map(&:serializable_hash))\n end",
"def tree_hash\n serializable_hash.merge(children: children.map(&:serializable_hash))\n end",
"def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n @children << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n end",
"def children\n attributes.fetch(:children)\n end",
"def children\n []\n end",
"def direct_children_by_id(*args)\n scope = args.last.is_a?(Hash) ? args.pop : {}\n ids = args.flatten.compact.uniq\n self.class.find_in_nested_set(:all, { \n :conditions => [\"#{scope_condition} AND #{prefixed_parent_col_name} = #{self.id} AND #{self.class.table_name}.#{self.class.primary_key} IN (?)\", ids]\n }, scope) \n end",
"def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end",
"def get_self_and_children_ids\n ids = [self.id]\n ids += get_children_ids_recursive\n return ids\n\t\tend",
"def children; end",
"def children; end"
] |
[
"0.7118726",
"0.6415582",
"0.6358646",
"0.62417567",
"0.6232998",
"0.62155116",
"0.6109614",
"0.6088668",
"0.6017252",
"0.5987482",
"0.5952522",
"0.5938795",
"0.5869971",
"0.5749495",
"0.57375175",
"0.5722531",
"0.5708195",
"0.570273",
"0.5698061",
"0.5686462",
"0.564385",
"0.5643444",
"0.56134367",
"0.5584312",
"0.55796474",
"0.5564877",
"0.5550782",
"0.5530658",
"0.55256784",
"0.55256784",
"0.55210024",
"0.55094165",
"0.5502265",
"0.54861206",
"0.54781556",
"0.5467961",
"0.54212195",
"0.5414144",
"0.5414144",
"0.5414144",
"0.5414144",
"0.5407294",
"0.5401964",
"0.5399298",
"0.53946453",
"0.5391246",
"0.53886986",
"0.5381112",
"0.53809613",
"0.5379666",
"0.536075",
"0.5354443",
"0.5349108",
"0.53346395",
"0.5322107",
"0.53194106",
"0.53144395",
"0.5313498",
"0.5310039",
"0.5303777",
"0.5293386",
"0.5290397",
"0.52888507",
"0.52888507",
"0.52839994",
"0.52721685",
"0.5239246",
"0.5237034",
"0.5215976",
"0.5208718",
"0.5202829",
"0.51969504",
"0.51969504",
"0.5193361",
"0.51931477",
"0.51918215",
"0.51777",
"0.51777",
"0.51777",
"0.5167182",
"0.5166107",
"0.5162837",
"0.5162131",
"0.5159163",
"0.5156237",
"0.5150786",
"0.5150786",
"0.51501316",
"0.514891",
"0.5148632",
"0.5148632",
"0.5143957",
"0.5134954",
"0.5132501",
"0.51309174",
"0.5127898",
"0.5125461",
"0.5124402",
"0.5124402"
] |
0.65943426
|
2
|
select the direct reporting relationships and all associated person information needed to construct tree
|
def join_people_by_relationship_type
sql = <<EOF
select supers.id, supers.name, subs.id, subs.name
from person_associations pa
inner join people as supers
on supers.id = pa.source_id
inner join people as subs
on subs.id = pa.sink_id
and association_type = 'direct_reporting'
order by supers.id
EOF
r = ActiveRecord::Base.connection.execute(sql)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def select_father_summary(person_id)\n add_parents!\n couple = parents[0] || ParentsReference.new\n couple.select_parent(person_id,'Male')\n parents[0] = couple \n end",
"def build_adjacency_list\n\n r = join_people_by_relationship_type\n\n h = {}\n r.each {|rr|\n id = rr[0]\n h[id] = {:id => id, :name => rr[1], :children => []} if h[id].nil? # if there's no hash entry for this person, make one.\n h[id][:children] << {:id => rr[2], :name => rr[3], :children => []} # enter the person's subordinates as children into the hash. (source / sink)\n }\n h\n end",
"def relations \n @roots = Category.roots \n @categories = Category.has_children \n @expense_types = ExpenseType.all\n @payment_methods = PaymentMethod.all\n end",
"def tree\n @treetop = @proj.default_ontology_class\n @proj.ontology_classes.first if !@treetop\n redirect_to :action => :new, :controller => :ontology_classes and return if !@treetop\n @colored_object_relationships = @proj.object_relationships.with_color_set\n @all_object_relationships = @proj.object_relationships \n render :action => 'ontology/tree/index'\n end",
"def show\n @person = Person.find(params[:id])\n @address = @person.addresses.take\n @identifiers = @person.identifiers\n @parent = @person.company\n end",
"def logical_relatives(options = {}) # :yields: {OntologyClass => implied_redundant_relationships ? true : false}\n return [] if !ObjectRelationship.find_by_interaction_and_proj_id('is_a', self.proj_id) || !ObjectRelationship.find_by_interaction_and_proj_id('part_of', self.proj_id)\n\n rel1 = Proj.find(self.proj_id).object_relationships.by_interaction('is_a').first.id\n rel2 = Proj.find(self.proj_id).object_relationships.by_interaction('part_of').first.id\n return [] if !rel1 || !rel2\n\n opt = {\n :direction => :children, # [:parents | :children]\n :rel1 => rel1,\n :rel2 => rel2\n }.merge!(options.symbolize_keys)\n\n return nil if ![:parents, :children].include?(opt[:direction])\n\n first_result = [] # all the part_of\n second_result = [] # part_of through is_a\n\n result = {}\n\n # Find/recurse the isa/part_of tree, this gets us a unique array of pertinent OntologyRelationships\n # that reflect OntologyClass relationships that are related by one of rel1 or rel2 at each inspection.\n rels = self.related_ontology_relationships(opt.merge(:relationship_type => [opt[:rel1], opt[:rel2]]))\n\n return {} if rels == nil\n\n # get all the part_of resuls, anything below and with a part_of, is part_of (since all others are is_a)\n to_nuke = [] # index of rels to delete before next itteration\n rels.each do |r|\n nuke = false # boolean check for delete\n if r.object_relationship_id == opt[:rel2]\n nuke = true\n if opt[:direction] == :parents\n first_result.push(r.ontology_class2)\n else\n first_result.push(r.ontology_class1)\n end\n end\n to_nuke.push(r) if nuke\n end\n\n # !! don't do uniq on first result\n\n # try to invoke some loop speedup by deleting values we don't need to loop through\n rels.delete_if{|r| to_nuke.include?(r)}\n rels.delete_if{|r| !r.object_relationship_id == opt[:rel1]} # we only need to deal with isas of rel1 now\n\n # for all of the part_of results also get the is_a children (or whatever rel2 -> rel1 relationship is)\n\n rels.each do |rel|\n first_result.uniq.each_with_index do |r,i|\n if opt[:direction] == :parents\n second_result.insert(-1, rel.ontology_class2) if (rel.ontology_class1 == r)\n else\n second_result.insert(-1, rel.ontology_class1) if (rel.ontology_class2 == r)\n end\n end\n end\n\n second_result.uniq! # don't imply redundancies from hitting an is_a twice (is this right?! - gives \"correct\" result AFAIKT)\n\n (first_result + second_result).each do |r|\n result.merge!(r => (!result.keys.include?(r) ? false : true))\n end\n\n result\n end",
"def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end",
"def directors\n directors = []\n self.children.each { |m|\n m.directors.slice(0,1).each { |d| directors.push(d) }\n }\n directors.uniq\n end",
"def get_tree(person)\n\n h = build_adjacency_list\n\n n = h[get_tree_top_id(person)] # start creating the tree at this person's supervisor, if there is one\n\n nodes = to_node(h, n) # recurse through the SQL results to construct a tree (nested hashes)\n\n nodes\n end",
"def select_mother_summary(person_id)\n add_parents!\n couple = parents[0] || ParentsReference.new\n couple.select_parent(person_id,'Female')\n parents[0] = couple \n end",
"def child_relation; end",
"def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end",
"def get_demographics(patient, doc, patient_id_xpath)\n patientActorID = doc.at_xpath(\"//ccr:ContinuityOfCareRecord/ccr:Patient/ccr:ActorID\").content\n patientActor = doc.at_xpath(\"//ccr:ContinuityOfCareRecord/ccr:Actors/ccr:Actor[ccr:ActorObjectID = \\\"#{patientActorID}\\\"]\")\n patientID = patientActor.at_xpath(patient_id_xpath).try(:content)\n patientID ||= patientActorID\n \n name_element = patientActor.at_xpath('./ccr:Person/ccr:Name')\n \n if name_element\n if name_element.at_xpath(\"./ccr:CurrentName\")\n patient['first'] = name_element.at_xpath('./ccr:CurrentName/ccr:Given').try(:content)\n patient['last'] = name_element.at_xpath('./ccr:CurrentName/ccr:Family').try(:content)\n elsif name_element.at_xpath(\"./ccr:DisplayName\")\n # this will not work in all cases, but we're using it as a last resort if no CurrentName is found\n first, last = name_element.at_xpath(\"./ccr:DisplayName\").content.split(\" \")\n patient['first'] = first.strip\n patient['last'] = last.strip\n end\n end\n \n \n birthdate = patientActor.at_xpath('./ccr:Person//ccr:DateOfBirth/ccr:ExactDateTime | ./ccr:Person//ccr:DateOfBirth/ccr:ApproximateDateTime')\n patient['birthdate'] = Time.parse(birthdate.content).to_i if birthdate\n \n gender_string = patientActor.at_xpath('./ccr:Person/ccr:Gender/ccr:Text').content.downcase\n patient['gender'] = Gender[gender_string.downcase]\n #race_node = doc.at_xpath('/ccr:placeholder') #how do you find this?\n race = doc.at_xpath('//ccr:SocialHistory/ccr:SocialHistoryElement[./ccr:Type/ccr:Text = \"Race\"]/ccr:Description/ccr:Code[./ccr:CodingSystem = \"CDC-RE\"]/ccr:Value')\n ethnicity = doc.at_xpath('//ccr:SocialHistory/ccr:SocialHistoryElement[./ccr:Type/ccr:Text = \"Ethnicity\"]/ccr:Description/ccr:Code[./ccr:CodingSystem = \"CDC-RE\"]/ccr:Value')\n \n if ethnicity\n patient[:ethnicity] = {\"code\" => ethnicity.text, \"codeSystem\" => 'CDC-RE'}\n end\n \n \n if race\n patient[:race] = {\"code\" => race.text, \"codeSystem\" => 'CDC-RE'}\n end\n\n \n \n #ethnicity_node = doc.at_xpath()\n \n\n # languages = doc.at_xpath()\n patient['languages'] = nil\n \n patient['medical_record_number'] = patientID\n end",
"def output_pedigree_name( indiv, depth, famc, fams, bitmap, prefix, child_marker, blank, suffix, max_depth )\n #Check to see if we reached the depth limit we set for this chart.\n if(max_depth > 0 && max_depth < depth)\n s = bars( bitmap, depth)\n if(depth)\n if(blank)\n s += lastspace\n else\n s += lastbar(depth)\n end\n end \n if html?\n s += \"<b>Maximum Depth Reached</b>\\n\"\n else\n s += \"Maximum Depth Reached\\n\"\n end\n return s\n end\n\n #ensure we actually have someone, and didn't just fall of the end of the world.\n #indiv == nil is our termination condition for recursion.\n if(indiv != nil)\n \n s = bars(bitmap, depth) #Add in leading bars, which form the visual links between individuals.\n if(depth > 0) #if we not on the first level, we need to add either a ' ' or a '|'.\n if(blank) #blank is passed in argument list.\n s += lastspace\n else\n s += lastbar(depth)\n end\n end\n\n if (name = indiv.primary_name) == ''\n name = '?'\n end\n \n #pull out the first TITL records from the Individual_record.individual_attribute_record array.\n #this will be an array of Individual_attribute records of type TITL records (probably only one element).\n if (title = indiv.title) != nil\n #For our display of this person in the chart, we want just on TITL. The GEDCOM standard says the most relevant one should be the first one.\n #This TITL record (title.first) has a value with the Title in it, stored in an array, so we need to take the first one.\n #A bit loopy, but consistent with records like PHON, where multiple phone number records are stored in the same array\n title_p = title.first.value.first \n else\n title_p = ''\n end\n\n if(html?)\n #indiv.individual_ref[1] is the XREF, indiv.individual_ref[0] being the index name :individual.\n s += \"<A NAME=\\\"#{indiv.individual_ref[1]}\\\"></A>\" #Put a HTML Anchor, so we can jump to this point with a URL.\n #these fams & famc URLs are currently peculiar to my gedcom server, so need to be culled or the base needs to be set dynamically.\n if(fams != nil) #passed in fams, so set up name to be a link to the family record.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{fams.family_ref[1]}.html\\\" >#{name}</A>\"\n elsif(famc != nil) #passed in famc, so set up name to be a link to the parent family record\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}<A HREF=\\\"#{url_base}#{famc.family_ref[1]}.html\\\" >#{name}</A>\"\n else #weren't passed in either fams or famc, so don't set up a link.\n s += \"#{prefix}<b>#{title_p}</b>#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n else\n s += \"#{prefix}#{title_p}#{(title_p == '' ? \"\" : \" \")}#{name}\"\n end\n \n \n if((birth = indiv.birth) != nil && (date = birth[0].date) != nil)\n #if we have a birth date, then we will add it to the output.\n s += html? ? \" <b>b.</b>#{date}\" : \" b.#{date}\" \n elsif((chr = indiv.christening) && (date = chr[0].date) != nil)\n #if we don't have a birth date, we might have a christening date.\n s += html? ? \" <b>c.</b>#{date}\" : \" c.#{date}\"\n end\n\n if((deat = indiv.death) != nil && (date = deat[0].date) != nil)\n s += html? ? \" <b>d.</b>#{date}\" : \" d.#{date}\"\n end\n \n s += \" #{suffix}\\n\" if suffix\n return s\n end\n \n return nil #allows test to break any recursion.\n end",
"def export_personal_information\n return unless persisted?\n\n descendants = ApplicationRecord.descendants.select(&:has_personal_information?)\n {}.tap do |result|\n descendants.each do |descendant|\n result[descendant.name] = descendant.export_personal_information(id)\n end\n end.to_json\n end",
"def show\n @dossier = Dossier.find(params[:id])\n @acteurs = @dossier.acteurs\n @contact_acteurs = []\n tree = []\n @acteurs.each do |acteur|\n content = {:expanded => true, :cls => \"folder\", :id => acteur.id, :text => acteur.description, :qualite_procedurale => '', :institution=>'', :email => '', :telephone => ''}\n contact_acteurs = []\n acteur.contact_acteurs.each do |conact|\n @contact_acteurs.push(conact)\n if conact.contact\n contact_content = {:id => conact.id, :text => conact.contact.full_name_inc_civilite, :qualite_procedurale => conact.qualite_procedurale.try(:description), :institution=>conact.contact.institution.try(:nom), :email => conact.contact.try(:email), :telephone => conact.contact.try(:telephone), :leaf => true}\n contact_acteurs.push(contact_content)\n end\n end\n content[:children] = contact_acteurs\n tree.push(content)\n end\n \n\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dossier }\n format.json { render :json => {:dossier => @dossier.attributes.merge(:institution_nom => @dossier.institution.try(:nom), :type_etat_dossier_description => @dossier.type_etat_dossier.try(:description), :juge_mission_id => @dossier.juge_mission.try(:contact_id), :juge_controlleur_id => @dossier.juge_controlleur.try(:contact_id)), :activites => @dossier.activites, :expenses => @dossier.expenses.map {|p| p.attributes.merge(:total_ht => p.total, :total_ttc => p.total_ttc, :activite_name => p.activite.try(:description))}, :reminders => @dossier.reminders, :documents => @dossier.documents.map {|p| p.attributes.merge(:short_link => p.generate_link,:long_link => p.generate_long_link )}, :acteurs =>@acteurs, :communications => @dossier.communications, :contact_acteurs=>@contact_acteurs, :tree => tree, :consignations => @dossier.consignations}}\n format.pdf {\n html = render_to_string( :action => \"show\")\n kit = PDFKit.new(html, :page_size => 'A4')\n kit = kit.to_pdf\n send_data(kit, :filename => \"labels.pdf\", :type => 'application/pdf', :disposition => 'inline')\n return\n }\n end\n end",
"def set_tree\n @organism = Tree.with_all.find(params[:id])\n end",
"def show\n puts '* database name, @dbname = ' + @dbname\n puts '* which belongs to database set name, @dsname = ' + @ds.dsname\n puts '* Now calling all entity sets to display themselves.....'\n if @hes\n @hes.each_value{|x| x.show}\n else\n puts 'No entity set to show'\n end # if\n \n if @hrs.size > 0\n puts '***** Now calling all relationship sets to display themselves.....'\n @hrs.each_value{|y| y.show}\n else\n puts 'RELATIONSHIP SETS? No relationship set exists in this database.'\n end # if\n end",
"def parent_report_rows\n constituent_info.map do |druid, info_hash|\n info_hash[:parent_druids].map { |parent_druid| [druid, parent_druid] }.flatten\n end\n end",
"def print_relationships\n result = []\n self.relationships.each do |elt|\n result << elt.name\n end\n result.sort.join(', ')\n end",
"def report_children(parent_id) \n\t\tReport.find(:all, :conditions => [\"parent_id=?\",parent_id])\t\t\t\n\tend",
"def children_table; end",
"def generate_all_connections!\n organisation_level_connections = []\n\n self.has_members.each do |member_uri|\n member = Person.find(member_uri)\n organisation_level_connections << member.get_connections!\n end\n\n organisation_level_connections.flatten\n end",
"def pseud_associations(pseuds)\n puts \" collecting pseud associations\"\n x = []\n pseuds.each do |p|\n print \".\"; STDOUT.flush\n x << p\n x << p.user\n x << p.user.preference\n end\n x\nend",
"def directors\n parse_crew('Directed by')\n end",
"def gen_relationships\n @parser.relationships.each do |rel|\n through_str = ''\n lines = []\n if rel[:has_relationship]\n has_relationship = rel[:has_relationship].gsub(':', '..')\n case has_relationship\n when '1'\n rel_str = 'belongs_to'\n when 'n'\n rel_str = \"has n,\"\n else\n rel_str = \"has #{has_relationship},\"\n if rel[:through]\n through_str = \", :through => :#{rel[:through]}\"\n else\n through_str = \", :through => Resource\"\n end\n end\n \n if rel[:through]\n lines << \" has n, :#{rel[:through]}\"\n end\n line = \" #{rel_str} :#{rel[:variable]}#{through_str}\"\n line += \" # #{rel[:comment]}\" unless rel[:comment].empty?\n lines << line\n elsif rel[:relationship]\n lines << ' ' + rel[:relationship]\n end\n editor = ModelEditor.new(rel[:filename].snake_case)\n editor.insert(AFTER_PROPERTIES, lines)\n end\n end",
"def getORULandingPageData(id)\n # addPage()\n children = $hierByAncestor[id]\n\n return {\n :series => children ? children.select { |u| u.unit.type == 'series' }.map { |u| seriesPreview(u) } : [],\n :journals => children ? children.select { |u| u.unit.type == 'journal' }.map { |u| {unit_id: u.unit_id, name: u.unit.name} } : [],\n :related_orus => children ? children.select { |u| u.unit.type != 'series' && u.unit.type != 'journal' }.map { |u| {unit_id: u.unit_id, name: u.unit.name} } : []\n }\nend",
"def build_up_frbr_tree(int_digital_edition_id, bln_primary)\n \t@arr_frbr_tree = Array.new\n \t\n \t\n \t@items = ItemsHasDigitalEditions.where(\"digital_edition_id = ?\", int_digital_edition_id).order(\"item_has_digital_edition_primary ASC\")\n \t@items.each do |items_item|\n \t\tint_assoc_man = 0\n \t\t@item = Item.where(\"id = ?\", items_item.item_id)\n \t\t@item.each do |item_item|\n \t\t\t\tint_item_id = item_item.id\n\t\t\t\tstr_item_name = \"I_\" + item_item.id + \": \" + item_item.item_siglum\n\t\t\t\tint_assoc_man = item_item.manifestation_id\n \t\tend\n \t\t@arr_manifestation_master = Array.new\n \t\t@manifestations = Manifestation.where(\"id = ?\", int_assoc_man).order(\"manifestation_name ASC\")\n \t\t@manifestations.each do |man_item|\n \t\t\t@arr_expressions_master = Array.new\n \t\t\t@exp_man_joins = ExpressionsHasManifestations.where(\"manifestation_id = ?\", man_item.id)\n \t\t\t@exp_man_joins.each do |exp_join_item|\n \t\t\t\n \t\t\t\t# here is where I have to put in the logic whether to display all expressions and works\n \t\t\t\t# or just the primary ones\n \t\t\t\tif (bln_primary)\n \t\t\t\t\t@expressions = Expression.joins(:works).where(\"expressions.id = ?\", exp_join_item.expression_id).order(\"expression_name ASC\")\n \t\t\t\telse\n \t\t\t\t\t@expressions = Expression.where(\"id = ?\", exp_join_item.expression_id).order(\"expression_siglum ASC\")\n \t\t\t\tend\n \t\t\t\t@expressions.each do |expression_item|\n \t\t\t\t\n \t\t\t\t\n \t\t\t\t\t@arr_works_master = Array.new\n \t\t\t\t\tif (bln_primary)\n \t\t\t\t\t\t@works = Work.where(\"work_frbr = 1 AND id = ?\", expression_item.work_id).order(\"work_name ASC\")\n \t\t\t\t\telse\n \t\t\t\t\t\t@works = Work.where(\"id = ?\", expression_item.work_id).order(\"work_siglum ASC\")\n \t\t\t\t\tend\n \t\t\t\t\t@works.each do |work_item|\n \t\t\t\t\t\t@arr_work_item = Array.new\n \t\t\t\t\t\tif bln_primary\n \t\t\t\t\t\t\tstr_work_item = \"W_\" + work_item.id.to_s + \": \" + work_item.work_name + \" (\" + work_item.work_siglum + \")\"\n \t\t\t\t\t\telse\n \t\t\t\t\t\t\tstr_work_item = \"(\" + work_item.work_siglum + \") \" + work_item.work_name + \": W_\" + work_item.id.to_s\n \t\t\t\t\t\tend\n \t\t\t\t\t\t@arr_work_item.push(work_item.id)\n \t\t\t\t\t\t@arr_work_item.push(str_work_item)\n \t\t\t\t\t\t@arr_works_master.push(@arr_work_item)\n \t\t\t\t\tend\n\n \t\t\t\t\t@arr_expression_item = Array.new\n \t\t\t\t\tstr_expression_item = \"E_\" + expression_item.id.to_s + \": \" + expression_item.expression_name + \" (\" + expression_item.expression_siglum + \")\"\n \t\t\t\t\t@arr_expression_item.push(expression_item.id)\n \t\t\t\t\t@arr_expression_item.push(str_expression_item)\n \t\t\t\t\t@arr_expression_item.push(@arr_works_master)\n \t\t\t\t\t@arr_expressions_master.push(@arr_expression_item)\n \t\t\t\t\t\n \t\t\t\tend\n\n \t\t\tend\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t\n \t\t\t@arr_manifestation_item = Array.new\n \t\t\tstr_manifestation_name = \"M_\" + man_item.id.to_s + \": \" + man_item.manifestation_name + \" (\" + man_item.manifestation_siglum + \")\"\n \t\t\t@arr_manifestation_item.push(man_item.id)\n \t\t\t@arr_manifestation_item.push(str_manifestation_name)\n \t\t\t@arr_manifestation_item.push(@arr_expressions_master)\n\n \t\tend\n\n \t\t#fill the items array and push to tree master\n\t\tif (items_item.item_has_digital_edition_primary)\n\t\t\tint_item_primary = 1\n\t\telse\n\t\t\tint_item_primary = 0\n\t\tend\n\t\tstr_item_name = \"I_\" + item_item.id.to_s + \": \" + item_item.item_siglum\n\t\t@arr_item_item = Array.new\n\t\t@arr_item_item.push(int_item_id)\n\t\t@arr_item_item.push(str_item_name)\n\t\t@arr_item_item.push(int_item_primary)\n\t\t@arr_item_item.push(@arr_manifestation_master)\n \t\tarr_frbr_tree.push(@arr_item_item)\n \tend\n \t\n \treturn @arr_frbr_tree\n end",
"def child_ontology_relationships(options = {}) # :yields: Array of OntologyRelationships\n opt = {\n :relationship_type => 'all' # or a ObjectRelationships#id\n }.merge!(options.symbolize_keys)\n\n # TODO: modify to sort by first(top) label\n if opt[:relationship_type] == 'all'\n OntologyRelationship.find(:all, :include => [:ontology_class1, :object_relationship, :ontology_class2], :conditions => ['ontology_class2_id = ?', self.id]) # .sort{|x,y| x.ontology_class1.preferred_label.name <=> y.ontology_class1.preferred_label.name}\n else\n OntologyRelationship.find(:all, :include => [:ontology_class1, :object_relationship, :ontology_class2], :conditions => ['ontology_class2_id = ? AND object_relationship_id = ?', self.id, opt[:relationship_type]]) # .sort{|x,y| x.ontology_class1.preferred_label.name <=> y.ontology_class1.preferred_label.name}\n end\n end",
"def to_relation\n scope.where(tree.columns.id => id)\n end",
"def initialize(dataset)\n opts = dataset.opts\n eager_graph = opts[:eager_graph]\n @master = eager_graph[:master]\n requirements = eager_graph[:requirements]\n reflection_map = @reflection_map = eager_graph[:reflections]\n reciprocal_map = @reciprocal_map = eager_graph[:reciprocals]\n limit_map = @limit_map = eager_graph[:limits]\n @unique = eager_graph[:cartesian_product_number] > 1\n \n alias_map = @alias_map = {}\n type_map = @type_map = {}\n after_load_map = @after_load_map = {}\n reflection_map.each do |k, v|\n alias_map[k] = v[:name]\n after_load_map[k] = v[:after_load] unless v[:after_load].empty?\n type_map[k] = if v.returns_array?\n true\n elsif (limit_and_offset = limit_map[k]) && !limit_and_offset.last.nil?\n :offset\n end\n end\n\n # Make dependency map hash out of requirements array for each association.\n # This builds a tree of dependencies that will be used for recursion\n # to ensure that all parts of the object graph are loaded into the\n # appropriate subordinate association.\n @dependency_map = {}\n # Sort the associations by requirements length, so that\n # requirements are added to the dependency hash before their\n # dependencies.\n requirements.sort_by{|a| a[1].length}.each do |ta, deps|\n if deps.empty?\n dependency_map[ta] = {}\n else\n deps = deps.dup\n hash = dependency_map[deps.shift]\n deps.each do |dep|\n hash = hash[dep]\n end\n hash[ta] = {}\n end\n end\n \n # This mapping is used to make sure that duplicate entries in the\n # result set are mapped to a single record. For example, using a\n # single one_to_many association with 10 associated records,\n # the main object column values appear in the object graph 10 times.\n # We map by primary key, if available, or by the object's entire values,\n # if not. The mapping must be per table, so create sub maps for each table\n # alias.\n records_map = {@master=>{}}\n alias_map.keys.each{|ta| records_map[ta] = {}}\n @records_map = records_map\n\n datasets = opts[:graph][:table_aliases].to_a.reject{|ta,ds| ds.nil?}\n column_aliases = opts[:graph_aliases] || opts[:graph][:column_aliases] # SEQUEL5: Remove :graph_aliases support\n primary_keys = {}\n column_maps = {}\n models = {}\n row_procs = {}\n datasets.each do |ta, ds|\n models[ta] = ds.model\n primary_keys[ta] = []\n column_maps[ta] = {}\n row_procs[ta] = ds.row_proc\n end\n column_aliases.each do |col_alias, tc|\n ta, column = tc\n column_maps[ta][col_alias] = column\n end\n column_maps.each do |ta, h|\n pk = models[ta].primary_key\n if pk.is_a?(Array)\n primary_keys[ta] = []\n h.select{|ca, c| primary_keys[ta] << ca if pk.include?(c)}\n else\n h.select{|ca, c| primary_keys[ta] = ca if pk == c}\n end\n end\n @column_maps = column_maps\n @primary_keys = primary_keys\n @row_procs = row_procs\n\n # For performance, create two special maps for the master table,\n # so you can skip a hash lookup.\n @master_column_map = column_maps[master]\n @master_primary_keys = primary_keys[master]\n\n # Add a special hash mapping table alias symbols to 5 element arrays that just\n # contain the data in other data structures for that table alias. This is\n # used for performance, to get all values in one hash lookup instead of\n # separate hash lookups for each data structure.\n ta_map = {}\n alias_map.keys.each do |ta|\n ta_map[ta] = [records_map[ta], row_procs[ta], alias_map[ta], type_map[ta], reciprocal_map[ta]]\n end\n @ta_map = ta_map\n end",
"def show_tree\n\tend",
"def tree attributes: false\n self.document.__tree attributes: attributes\n end",
"def show\n # v1 based on each person's first level relationship\n # @targethash=@donor.relationships.map{|a| a.slice(:target)}\n # @targetidvalues=@targethash.map{|x| x[:target]}\n # @nodeid=@targetidvalues.push(@donor.id)\n\n # @donors=Donor.where(id: @nodeid)\n # # @relationshiphash1=@donor.relationships.as_json.map{|a| a.slice('donor_id', 'target','link_description')}\n # @relationship_hash_array= @donor.relationships.collect{|relationship| {from: relationship.donor_id, to: relationship.target,label: relationship.link_description, arrows:'to'}}.to_json\n # # @donor_hash_array= @donors.collect{|donor| {id: donor.id, label: donor.name, shape: 'circularImage'}}.to_json\n # @donor_hash_array= @donors.collect{|donor| {id: donor.id, label: donor.name, shape: 'circularImage', image: donor.image.url(:thumb)}}.to_json\n \n #v2 everyone's show page have the whole picture \n\n @donors=Donor.all\n @donor_hash_array= [ \"id\": @donor.id,\"label\": @donor.name, shape: 'circularImage', \"image\":@donor.image.url(:thumb)].to_json\n @donors_hash_array= @donors.collect{|donor| {id: donor.id, label: donor.name, shape: 'circularImage', image: donor.image.url(:thumb)}}.to_json\n @relationships=Relationship.all\n @relationship_hash_array= @relationships.collect{|relationship| {from: relationship.donor_id, to: relationship.target,label: relationship.link_description, arrows:'to'}}.to_json\n \n end",
"def for_subjects(subjects)\n result = Hash[subjects.map {|node| [node, false]}]\n subjects_by_id = Hash[subjects.map {|subject| [subject.id, subject]}]\n subject_rlshp_sources = Hash.new { |h, k| h[k] = [] }\n [:subject, :subject_agent_subrecord, :subject_agent_subrecord_place].each do |t|\n Subject.relationship_dependencies[t].each { |d| subject_rlshp_sources[d] << t }\n end\n\n subject_rlshp_sources.each do |model, sources|\n sources.each do |source|\n # i.e. one or more: subject_rlshp, subject_agent_subrecord_rlshp, subject_agent_subrecord_place_rlshp\n link_relationship = model.find_relationship(source)\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(Subject).each do |subject_link_column|\n # Join subject_rlshp to (e.g.) accession\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, subject_link_column) => subjects_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, subject_link_column),\n :subject_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n elsif model.to_s =~ /^Agent/\n for_agents_linked_to_subject(linked_records.all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[subjects_by_id.fetch(linked_record[:subject_id])] = true\n end\n end\n end\n end\n end\n end\n\n result\n end",
"def find_daughters(person)\n find_children(person)\n .map(&:female_child)\n .compact\n .map(&:name)\n end",
"def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end",
"def eager_graph_build_associations(rows)\n objects = super\n\n if eager_data = @opts[:eager_graph_eager]\n eager_data.each do |deps, assocs|\n current = objects\n\n last_class, *deps = deps\n deps.each do |dep, is_multiple|\n current_assocs = current.map(&:associations)\n\n if is_multiple\n current = current_assocs.flat_map{|a| a[dep]}\n else\n current = current_assocs.map{|a| a[dep]}\n current.compact!\n end\n\n current.uniq!(&:object_id)\n end\n\n last_class.dataset.send(:eager_load, current, assocs)\n end\n end\n\n objects\n end",
"def inspect\n if empty?\n \"No matching routes\"\n elsif hemogenous?\n klass = nodes_by_id[selected_node_ids.first].class\n klass.table(selected_nodes).to_s\n else\n inspect_tree\n end\n end",
"def get_report\n @FROM_CONNECT_RELATION = report(\"#{@FROM_REPORT}\")\n @TO_CONNECT_RELATION = report(\"#{@TO_REPORT}\")\n end",
"def export\n @tree\n end",
"def site_tree_select\n pages.order(:names_depth_cache).map { |c| [\"--\" * c.depth + c.menu_name, c.id] }\n end",
"def relations\n Relations::RelationTraverser.new(@internal_node)\n end",
"def get_p3_personas\n # Thanks to http://ruby.bastardsbook.com/chapters/html-parsing/\n\n page = Nokogiri::HTML(open(get_persona_list_uri))\n arcanas = page.css('.mw-headline a').map {|arcana| arcana.text} # Duplicated code - but avoids making 2 requests to the same page\n grouped_personas = Hash.new { |hash, key| hash[key] = Array.new }\n\n page.css('table.table.p3').each_with_index do |table, index|\n arcana = arcanas[index]\n # Skip the first row (1-indexed, not 0-indexed, hence +2), loop through both th's (base level indicators) and\n # td's (persona names)\n table.css('tr:nth-child(n+2) th, tr:nth-child(n+2) td').each do |cell|\n if cell.name == 'th'\n data = {level: cell.text.to_i}\n if cell.child.name == 'abbr'\n data[:other] = cell.child[:title]\n end\n grouped_personas[arcana] << data\n elsif cell.name == 'td'\n data = grouped_personas[arcana].last\n data[:name] = cell.text.chomp #Some names have a trailing \\n, chomp discards it\n data[:source] = WikiParser::BASE_URL + cell.child[:href]\n else\n raise \"Unknown element: #{cell}\"\n end\n end\n end\n\n grouped_personas.each_value do |arcana|\n arcana.each do |persona|\n uri = get_persona_uri(persona)\n puts \"Analyzing #{persona[:name]} from #{uri} ...\"\n persona.merge!(get_detailed_info open(uri))\n end\n end\n\n grouped_personas\n end",
"def family\n ([self] + self.children + self.parents + self.mergers + [self.merger]).compact\n end",
"def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end",
"def relationship_options(patient, options={})\n options_array = []\n if options[:names] # show names of guardians as options\n rels = patient.relationships.all\n # filter out voided relationship target\n rels.each do |rel|\n unless rel.relation.blank?\n options_array << [rel.relation.name + \" (#{rel.type.b_is_to_a})\",\n rel.relation.name]\n end\n end\n options_array << ['None', 'None']\n else\n options_array << ['Yes', 'Yes']\n options_array << ['No', 'No']\n end\n options_array << ['Unknown', 'Unknown']\n options_for_select(options_array) \n end",
"def relationship_options(patient, options={})\n options_array = []\n if options[:names] # show names of guardians as options\n rels = patient.relationships.all\n # filter out voided relationship target\n rels.each do |rel|\n unless rel.relation.blank?\n options_array << [rel.relation.name + \" (#{rel.type.b_is_to_a})\",\n rel.relation.name]\n end\n end\n options_array << ['None', 'None']\n else\n options_array << ['Yes', 'Yes']\n options_array << ['No', 'No']\n end\n options_array << ['Unknown', 'Unknown']\n options_for_select(options_array) \n end",
"def relationship_options(patient, options={})\n options_array = []\n if options[:names] # show names of guardians as options\n rels = patient.relationships.all\n # filter out voided relationship target\n rels.each do |rel|\n unless rel.relation.blank?\n options_array << [rel.relation.name + \" (#{rel.type.b_is_to_a})\",\n rel.relation.name]\n end\n end\n options_array << ['None', 'None']\n else\n options_array << ['Yes', 'Yes']\n options_array << ['No', 'No']\n end\n options_array << ['Unknown', 'Unknown']\n options_for_select(options_array) \n end",
"def tree_results(word_data)\n #get the data ready for d3 view\n tree_data = {\"name\"=> (@topic.name), \"info\" => \"tst\", \"children\" => []}\n \n word_data.each do |text, v|\n tree_data[\"children\"].push({\"name\" => text.to_s, \"children\" => []})\n end\n \n tree_data[\"children\"][0][\"children\"] << Hash[\"name\", word_data[:word]]\n \n word_data[:definitions].each do |text|\n tree_data[\"children\"][1][\"children\"] << Hash[\"name\", text[\"text\"]]\n end\n \n word_data[:word_associations].each do |text|\n tree_data[\"children\"][2][\"children\"] << Hash[\"name\", text[\"relationshipType\"], \"children\", []]\n end \n if word_data[:reverse_definitions][\"results\"].nil? \n tree_data[\"children\"][3][\"children\"] << nil\n else\n word_data[:reverse_definitions][\"results\"].each do |result| \n tree_data[\"children\"][3][\"children\"] << Hash[\"name\", result[\"text\"]]\n end\n end\n i = 0\n word_data[:word_associations].each do |text|\n text[\"words\"].each do |word|\n tree_data[\"children\"][2][\"children\"][i][\"children\"] << Hash[\"name\", word]\n end\n i+=1\n end\n #reduce duplicates in word_association hash\n tree_data[\"children\"][3][\"children\"].uniq!\n tree_data[\"children\"][2][\"children\"].uniq!\n return tree_data\n end",
"def taxpayer_more_data(taxpayer)\n return { 'ins1:Individual': taxpayer_individual_details(taxpayer) } if taxpayer.org_name.blank?\n\n { 'ins1:OrganisationContact': taxpayer_org_details(taxpayer) }\n end",
"def traversal_6\n\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n docs = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project unless projects.include?(projtm.project)\n end\n projects.each do |project|\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n docs += 1\n end\n end\n end\n return docs\nend",
"def daughters \n\t\t_d = Daughter.joins(:families).where(:families => {:parent_id => id},:gender => 0 )\n\t\tif _d.present?\n\t\t\t_d\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def family\n self_and_children\n end",
"def traversal_2a\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n doc_num = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project\n end\n projects.each do |project|\n doc_index = 0\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n doc_num += 1\n if doc_index == 0\n type = doc.doc_type\n name = doc.doc_name\n doc.doc_type = name\n doc.doc_name = type\n Perpetuity[Document].save doc\n end\n doc_index +=1\n end\n end\n end\n return doc_num\nend",
"def get_projected_accounts\n\t\t #@projected_accounts_info = Hash[ACCOUNT_INFO.dup.find_all{|k,v| v[:discretionary]}]\n\t\t #@projected_accounts_info = accounts_with_projections(@projected_accounts_info)\n\t\t #@projected_accounts_info = @accounts.find_all{|acc| info = ACCOUNT_INFO[acc.name] and info[:discretionary]} \n projected_accounts = @accounts.find_all{|acc| acc.info and acc.info[:discretionary]}\n @projected_accounts_info = accounts_with_projections(projected_accounts)\n\tend",
"def to_madeline(pedigree, people)\n results = Array.new\n familyID = pedigree.tag\n\n conditions = pedigree.conditions\n phenotypes = pedigree.people.map { |p| p.phenotypes.where(:madeline_display => 1) }.flatten.uniq\n\n twin_letter = 'A'\n twin_count = 0\n people.each do |person|\n\t\t# this doesn't work for triplets?!?\n #blah = twin_count % 2 \n #if (((twin_count % 2) == 0) and twin_count > 0) then\n # in order for the letter to not be the same, we need to create a new object.\n # tl = twin_letter.dup\n # tl.next!\n # twin_letter = tl\n # twin_count = 0\n #end\n cp, twin_count = create_row(person, familyID, conditions, phenotypes, twin_letter, twin_count)\n results.push(cp)\n end # end people.each\n\n logger.debug(\"results before childless marriages #{results.inspect}\")\n childless_marriages = pedigree.find_childless_marriages # hash of person_id = person_id\n childless_marriages.each do |father_id, mother_id|\n father_ident = Person.find(father_id).madeline_identifier\n mother_ident = Person.find(mother_id).madeline_identifier\n fake_child = Person.new\n fake_child.collaborator_id = \"^\"+(0...8).map{65.+(rand(25)).chr}.join\n cp = create_fake(fake_child, familyID, conditions, phenotypes, father_ident, mother_ident) \n\n results.push(cp)\n end\n\n logger.debug(\"to_madeline results #{results.inspect}\")\n return results\n\nend",
"def collect_tree_up_from (foliage,\n parents,\n except_homepage,\n except_page,\n except_with_children)\n ancestry_string = parents.collect {|x| x.id.to_s }.join(\"/\")\n name_prefix = parents.collect {|x| x.title }.join(\" / \")\n name_prefix += \" / \" if name_prefix.present?\n\n our_mans_indexes = []\n foliage.each_index do |indx|\n if foliage[indx].ancestry.to_s == ancestry_string\n our_mans_indexes << indx\n end\n end\n\n leaves = []\n\n our_mans_indexes.reverse!\n our_mans_indexes.each do |indx|\n leaves << foliage.delete_at(indx)\n end\n\n leaves.sort! {|a,b| (a.prior == b.prior) ? a.id <=> b.id : a.prior <=> b.prior }\n result = []\n\n leaves.each do |leaf|\n do_writing = true\n if (except_page && leaf == except_page) || (except_homepage && leaf.home?)\n do_writing = false\n end\n result << [ name_prefix + leaf.title, leaf.id ] if do_writing\n unless do_writing == false && except_with_children\n result += collect_tree_up_from foliage,\n (parents + [ leaf ]),\n except_homepage,\n except_page,\n except_with_children\n end\n end\n\n result\n end",
"def house_directors\n\t\tPerson.find(:all, \n\t\t\t\t\t\t\t\t:conditions => \"people.position = 'House Director' AND house_id = #{self.id}\", \n\t\t\t\t\t\t\t\t:joins => :houses, \n\t\t\t\t\t\t\t\t:order => \"last_name, first_name ASC\")\n\tend",
"def relationships\n @relationships ||= {}\n end",
"def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"def show_all_children_info\n descendants.map(&:to_s)\n end",
"def show\n\n @tree = @person.get_tree\n\n @mother = Person.find(@person.parent_mother_id) rescue nil\n @father = Person.find(@person.parent_father_id) rescue nil\n @spouse = Person.find(@person.marriage) rescue nil\n\n month_diff = Date.current.month - @person.dob.month\n date_diff = Date.current.day - @person.dob.day\n @current_age = (Date.current.year - @person.dob.year) + (month_diff < 0 || (month_diff == 0 && date_diff < 0) ? -1 : 0)\n end",
"def dump_has_and_belongs_to_many_replicant(dumper, reflection)\n dumper.dump Habtm.new(self, reflection)\n end",
"def generate\n instance_eval(&callbacks[:setup])\n if options.only_recursion_depth.present?\n depth = options.only_recursion_depth.to_s.to_i\n options[:only].dup.each do |class_name|\n options[:only]+= recurse_into_relationships(@domain.entity_by_name(class_name), depth)\n end\n options[:only].uniq!\n end\n\n filtered_entities.each do |entity|\n instance_exec entity, filtered_attributes(entity), &callbacks[:each_entity]\n end\n\n filtered_specializations.each do |specialization|\n instance_exec specialization, &callbacks[:each_specialization]\n end\n\n filtered_relationships.each do |relationship|\n instance_exec relationship, &callbacks[:each_relationship]\n end\n end",
"def my_squirrels\n # which one knows about BOTH the trees and the nests?\n my_nests.map do |nest|\n nest.squirrel.name\n end\n end",
"def find_all_parents\n end",
"def parents; end",
"def relationships\n return [] if empty?\n\n map { |pivot_table| Relationship.new(pivot_table, PIVOT_TABLE_R, \"../#{pivot_table.pn}\") }\n end",
"def asst_div_directors\n\t\tPerson.find(:all, \n\t\t\t\t\t\t\t\t:conditions => \"people.position = 'Asst. Div. Director' AND house_id = #{self.id}\", \n\t\t\t\t\t\t\t\t:joins => :houses, \n\t\t\t\t\t\t\t\t:order => \"last_name, first_name ASC\")\n\tend",
"def printout_relations\n @relations.each do |shape, relations|\n relations.each do |relation|\n relation.each do |key, value|\n puts \"\\\"#{shape}\\\" #{value} \\\"#{key}\\\"\"\n end\n end\n end\n end",
"def plant_tree\n @category = Category.new\n subject = @category.subjects.build\n subject.resources.build\n @categories = Category.all\n @subjects = Subject.all\n render 'new'\n end",
"def page_tree_selector \n pages.order(:names_depth_cache).map { |page| [\n \"---\" * page.depth + \n (page.displayed ? \" \" : \" (invisible) \") +\n page.menu_name, \n page.id\n ] }\n end",
"def for_agents(agents)\n return {} if agents.empty?\n assert_same_type!(agents)\n\n agent_model = agents[0].class\n result = Hash[agents.map {|node| [node, false]}]\n agents_by_id = Hash[agents.map {|agent| [agent.id, agent]}]\n\n agent_model.relationship_dependencies[:linked_agents].each do |model|\n\n # Things like events aren't publishable and shouldn't count for these calculations\n next unless model.included_modules.include?(Publishable)\n\n link_relationship = model.find_relationship(:linked_agents)\n\n # agent_person_rlshp\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(agent_model).each do |agent_link_column|\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, agent_link_column) => agents_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, agent_link_column),\n :agent_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[agents_by_id.fetch(linked_record[:agent_id])] = true\n end\n end\n end\n end\n end\n\n result\n end",
"def show\n @page_structure = Page.find_by(parent_path: '', csv_id: @page.csv_id).subtree.arrange\n end",
"def test_perfind_flatten1\r\n pi = @mymodel.node_list.add_node(3, 'perfind3', PERFIND) \r\n\r\n assert_equal( { \"name\"=>\"perfind3\", \"ident\"=>3, \"type\"=>\"perfind\",\r\n \"commentary\"=>\"\", \"description\"=>\"\", \"evidence\"=>\"undefined\",\r\n \"value_function\"=>nil },\r\n pi.flatten_data)\r\n end",
"def choices4_all_as_tree(all=false)\n all ? DcManual.get_menu_all() : DcManual.get_menu(self)\nend",
"def relationship_options(patient, options={})\n options_array = []\n if options[:names] # show names of guardians as options\n rels = patient.relationships.all\n # filter out voided relationship target\n rels.each do |rel|\n unless rel.relation.blank?\n options_array << [rel.relation.name + \" (#{rel.type.b_is_to_a})\",\n rel.relation.name]\n end\n end\n options_array << ['None', 'None']\n else\n options_array << ['Yes', 'Yes']\n options_array << ['No', 'No']\n end\n options_array << ['Unknown', 'Unknown']\n options_for_select(options_array)\n end",
"def all_descendent_members\n raise TypeError.new(\"can only call on a persisted object\") unless persisted? && id.present?\n\n sql = <<~EOS\n id IN (WITH RECURSIVE tree AS (\n SELECT id, ARRAY[]::UUID[] AS ancestors\n FROM kithe_models WHERE id = '#{self.id}'\n\n UNION ALL\n\n SELECT kithe_models.id, tree.ancestors || kithe_models.parent_id\n FROM kithe_models, tree\n WHERE kithe_models.parent_id = tree.id\n ) SELECT id FROM tree WHERE id != '#{self.id}')\n EOS\n\n\n Kithe::Model.where(sql)\n end",
"def relationships\n model.relationships(repository.name)\n end",
"def roots\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND (#{parent_col_name} IS NULL OR #{parent_col_name} = 0)\", :order => \"#{left_col_name}\")\n end",
"def build_accordions_and_trees_only\n # Build the Explorer screen from scratch\n allowed_features = ApplicationController::Feature.allowed_features(features)\n @trees = allowed_features.collect { |feature| feature.build_tree(@sb) }\n @accords = allowed_features.map(&:accord_hash)\n\n allowed_features\n end",
"def model_relationships; end",
"def children#WORKING\n if self.adult == true\n self.related_users.select{|user| user.adult == false}\n else\n return []\n end\n end",
"def children\n # return students\n return offerings\n end",
"def select_relationship_ordinances(options)\n raise ArgumentError, \":id required\" if options[:id].nil?\n if self.relationships\n spouse_relationship = self.relationships.spouses.find{|s|s.id == options[:id]}\n if spouse_relationship && spouse_relationship.assertions && spouse_relationship.assertions.ordinances\n spouse_relationship.assertions.ordinances\n else\n []\n end\n end\n end",
"def related_organisms\n organisms = related_assays.collect{|a| a.organisms}.flatten.uniq.compact\n organisms = organisms | related_models.collect{|m| m.organism}.uniq.compact\n organisms\n end",
"def visible_relations \n\t\t\tif defined? @visible_relations \n\t\t\t\t@visible_relations\n\t\t\telse\n\t\t\t\tassociation_helper_models = []\n\t\t\t\t# find \n\t\t\t\tself.reflections.keys.each do |key|\n\t\t\t\t\tif self.reflections[key].class == ActiveRecord::Reflection::ThroughReflection\n\t\t\t\t\t\tassociation_helper_models.push self.reflections[key].options[:through]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tkeys = self.reflections.keys.map do |key| key.to_sym end\n keys - association_helper_models\n\t\t\tend\n\t\tend",
"def relationships(label = \"all\", status = true, created_by = \"any\")\n edges = self.edges.select do |edge|\n creation_condiction = true\n\n if created_by == \"self\"\n creation_condiction = edge.origin == self\n elsif created_by == \"other\"\n creation_condiction = edge.destiny == self\n end\n \n (edge.label == label or label == \"all\") and edge.active == status and creation_condiction\n end\n\n users = Set.new\n\n edges.each do |edge|\n users << (edge.origin != self ? edge.origin : edge.destiny)\n end\n\n return users\n end",
"def descendants(person_id)\n\t\t# initialize descendant with person as the first element\n\t\tdescendants_list = [] << [@people[person_id]]\n\t\tparent_gen_idx = 0\n\t\tbegin \n\t\t\tnext_gen = []\n\t\t\t# for each person in this generation, find their children\n\t\t\tdescendants_list[parent_gen_idx].each do | parent |\n\t\t\t\tparent.children_ids.map { | id | next_gen << @people[id] }\n\t\t\tend\n\t\t\t# add new generation as another element to the descendants\n\t\t\tdescendants_list << next_gen\n\t\t\tparent_gen_idx += 1\n\t\tend until next_gen.size == 0 # loop as long as another generation is returned\n\t\tdescendants_list\n\tend",
"def show\n @type_childs = Type.where(:parent => @type.id)\n @type_child_ids = [@type.id]\n @type_childs.each do |type_child|\n @type_child_ids.push(type_child.id)\n end\n @san_phams = SanPham.where(:type_id => @type_child_ids).order('type_id asc').paginate(:page => params[:page], :per_page => 11)\n \n end",
"def parsed_tree; end",
"def connected_people\n ids = connections.where(indirect_object_type: 'University::Person').pluck(:indirect_object_id)\n University::Person.where(id: ids)\n end",
"def show\n \n \n @people= Person.findByNameOrId(params[:id])\n \n if (@people.length == 1) \n @person = @people[0]\n else \n if(@people.length > 1)\n @name = params[:id].capitalize\n disambiguation\n return\n end\n end \n \n if(!@person)\n redirect_to '/search?q=' +params[:id].is_a?(Numeric) #+ params[:id].to_s + '&page=1'\n return\n end\n \n @max_depth = params[:family_tree_depth] || 3 \n @max_depth = @max_depth.to_i\n \n respond_to do |format|\n format.html { render :layout => \"main\" } # show.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def relation(user)\n traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| (path.end_node[:fbid] == user[:fbid]) ? :include_and_continue : :exclude_and_continue }\n # self.both(:bobfather).depth(:all).filter{|path| path.end_node.rel?(:recommend, :incoming)}.\n # each{|node| puts node[:name]}\n \n #traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| puts path.end_node ; puts path.end_node.id ; :include_and_continue }\n # traversal = self.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n # traversal = u1.both(:bobfather).depth(:all).unique(:node_path).eval_paths { |path| :include_and_continue }\n return traversal\n end",
"def associations; end",
"def display\n # tree-font is where we start with the fonts\n # min-tree-font is how far we go down... translates into\n # tree-depth, one depth increment corresponds to 2 font increments\n # absolute-min-tree-font is what you think it is\n init_session\n\t@level = 1\n @maxlevel = session[:'max-level']\t\n @font = session[:'tree-font']\n @individual = Individual.by_uid( params[:uid] ) \n\tif !@individual\n\t redirect_to root_path\n\telsif session[:display] == \"graph\"\n\t is_user = @current_user and @current_user.user?\n\t is_editor = @current_user and @current_user.user?\t \n\t @nodes = [] \n\t @edges = [] \n\t @nodes << @individual.graph_focus_node( is_user, (is_editor and session[:edit] == 'on') )\t\t \n\t @nodes, @edges = @individual.graph_up( \n\t 0, @maxlevel, @nodes, @edges, is_user, (is_editor and session[:edit] == 'on') )\t\t \n\t @nodes, @edges = @individual.graph_down( \n\t 0, @maxlevel, @nodes, @edges, is_user, (is_editor and session[:edit] == 'on') )\t \n\t render :graph\t\n\telse\n\t render\n\tend\n end",
"def get_aggregated_attributes\n\t\t self.attributes[:parents] = \"\"\n #self.attributes.each { |k,v| puts \"#{k} ====> #{v}\" }\n parent = self.attributes[:parent]\n #pp attributes\n\t\t return attributes if parent.empty?\n template = self.belongs_to.templates.find { |temp| temp.name.downcase == parent.downcase }\n \n\t\t while not parent.empty? do\n #puts \"template = #{template.name}\"\n #puts \"parent of #{template.name} = #{template.attributes[:parent]}\"\n\t\t template.attributes.each { |k,v| self.attributes[k] = v if self.attributes[k].empty? }\n\t\t\t\tparent = template.attributes[:parent] \n\t\t\t\t#puts \"parent = [#{parent.empty?}]\"\n\t\t\t\tbreak if parent.empty?\n\t\t\t\tself.attributes[:parents] += \", #{parent}\"\n\t\t\t\ttemplate = self.belongs_to.templates.find { |temp| temp.name.downcase == parent.downcase } \n\t\t\t\t\n\t\t\t\t\n\t\t end\n\t\t attributes\n end",
"def index\n @relatives = Relative.includes(:organizations, :representative)\n .group_by { |relative| relative.representative }\n end",
"def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end"
] |
[
"0.5809124",
"0.57667524",
"0.5698875",
"0.56147885",
"0.5610292",
"0.55432147",
"0.55208224",
"0.54995596",
"0.5482742",
"0.54484296",
"0.5434563",
"0.5381422",
"0.5362427",
"0.53606445",
"0.53301364",
"0.5306149",
"0.5303934",
"0.52873033",
"0.5279822",
"0.526612",
"0.5258828",
"0.5250544",
"0.5228252",
"0.52264255",
"0.5217262",
"0.5215287",
"0.52097416",
"0.5179522",
"0.5178085",
"0.5162982",
"0.5161898",
"0.5161126",
"0.5129951",
"0.5127897",
"0.5117572",
"0.51147807",
"0.5095174",
"0.5093635",
"0.5084652",
"0.5082721",
"0.5069479",
"0.50669575",
"0.50639373",
"0.5060489",
"0.5058424",
"0.5057589",
"0.5053774",
"0.5053774",
"0.5053774",
"0.5050525",
"0.5039076",
"0.5033276",
"0.50307083",
"0.5029861",
"0.502779",
"0.50187993",
"0.5015957",
"0.50116134",
"0.50058925",
"0.5005813",
"0.50015277",
"0.49987748",
"0.49965543",
"0.49962166",
"0.49904242",
"0.49850595",
"0.4981924",
"0.49805474",
"0.49804452",
"0.4979999",
"0.49789298",
"0.49776855",
"0.49738067",
"0.49730518",
"0.4970881",
"0.49698687",
"0.49632376",
"0.49572444",
"0.4952143",
"0.49493006",
"0.49408475",
"0.4940658",
"0.49390787",
"0.4933583",
"0.49319455",
"0.4918461",
"0.49160686",
"0.4915405",
"0.49115962",
"0.49106008",
"0.4907947",
"0.49069992",
"0.49062043",
"0.49034166",
"0.49020946",
"0.49003264",
"0.4899593",
"0.4898103",
"0.48979098",
"0.48901728"
] |
0.5244745
|
22
|
place SQL results into a hashkeyed off of supervisor ids, pointing to a list of subordinates for that supervisor
|
def build_adjacency_list
r = join_people_by_relationship_type
h = {}
r.each {|rr|
id = rr[0]
h[id] = {:id => id, :name => rr[1], :children => []} if h[id].nil? # if there's no hash entry for this person, make one.
h[id][:children] << {:id => rr[2], :name => rr[3], :children => []} # enter the person's subordinates as children into the hash. (source / sink)
}
h
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def iterator_heros\n results=[]\n other_results=[]\n Superhero.all.select do |hero| \n # binding.pry\n if self.user.superheros.include?(hero)\n results << {hero.name => hero.id}\n else \n other_results << {hero.name => hero.id}\n end\n end\n other_results\n end",
"def profiles_as_supervisor_ids\n self.areas.map(&:profiles).flatten.uniq.map(&:id)\n end",
"def admin_subordinates\n mypost=Login.current_login.staff.position\n post_name=mypost.name\n if post_name==\"Timbalan Pengarah (Pengurusan)\"\n adm_sub=mypost.descendants.map(&:staff_id)\n else\n adm_sub=[]\n end\n adm_sub\n end",
"def superfamily_ids\n superfamily_ids_set.to_a\n end",
"def fetch_member_orders_by_druid_and_constituent_parents\n @constituent_info = {}\n @member_orders_by_druid =\n ActiveRecord::Base.connection.execute(constituent_druid_sql).map do |row|\n parsed_constituent_druids = JSON.parse(row['constituent_druids'])\n parsed_constituent_druids.each do |constituent_druid|\n @constituent_info[constituent_druid] = { parent_druids: [] } unless @constituent_info.key?(constituent_druid)\n @constituent_info[constituent_druid][:parent_druids] << row['vobj_external_identifier']\n end\n [row['vobj_external_identifier'], parsed_constituent_druids, row['constituent_druids_count']]\n end\n end",
"def results\n Opinion.where(id: super.pluck(:id))\n end",
"def vertica_userids\n dd = dy2k() - 3 #let's be very conservatibe\n cmd = \"select distinct(sifi_uid) from cost_events where clicks > 0 and dd_id >= #{dd}\"\n puts cmd\n s = go_direct(cmd)\n xs = s.split(\"\\n\")\n vus = {} \n xs.each do |x|\n vus[x] = true\n end \n vus\nend",
"def supervisees_check?(user_id)\n db_params = {\n host: ENV['host'],\n port: ENV['port'],\n dbname: ENV['dbname'],\n user: ENV['user'],\n password: ENV['password']\n }\n db = PG::Connection.new(db_params)\n supervisees = db.exec(\"SELECT user_id FROM supervisor WHERE supervisor = '#{user_id}'\").values\n db.close\n supervisees.flatten\nend",
"def parent_report_rows\n constituent_info.map do |druid, info_hash|\n info_hash[:parent_druids].map { |parent_druid| [druid, parent_druid] }.flatten\n end\n end",
"def get_heroes_by_segment\n result = {}\n\n player_selections.each do |player_selection|\n result[player_selection.map_segment_id] ||= []\n result[player_selection.map_segment_id] << player_selection.hero_id\n end\n\n result\n end",
"def get_supervisor_ids(es_url)\n # TODO SCAL-770 there can be many ES instances - get all supervisors from them\n # TODO ES development (http)?\n supervisors = []\n\n if es_url.blank?\n Rails.logger.error('There are no Experiment Supervisors available')\n else\n begin\n Rails.logger.error('[supervisor_options] Using Experiment Supervisor:' + es_url)\n supervisors_resp = current_user.get_with_token(\"https://#{es_url}/supervisors\")\n supervisors = JSON.parse(supervisors_resp)\n rescue RestClient::Exception, StandardError => e\n Rails.logger.error \"Unable to connect with Supervisor: #{e.to_s}\"\n end\n end\n\n supervisors\n end",
"def subkeys\n return self.class.none unless primary?\n\n self.class.where(primary_key_grip: grip)\n end",
"def employees\n employee_array = []\n locations.each do |location|\n location.employees.each do |employee|\n employee_array << employee\n end\n end\n employee_array\n end",
"def supervisor\n @supervisors = Allocation.all.order(created_at: :desc).where(student_id: current_student.id)\n end",
"def sub_elders(options={})\n options = { update_elder_master: true,\n }.merge(options)\n\n @final_data.each_index do |i|\n record = @final_data[i]\n if @elder_sub.key?(record[:elder]) # found matching elder\n @final_data[i][:elder] = @elder_sub[record[:elder]] # modify elder in final database\n end\n end\n \n # optionally update elder master list\n if options[:update_elder_master]\n @elder_sub.each do |old_elder, new_elder|\n @elders.delete(old_elder)\n @elders << new_elder\n end \n end\n \nend",
"def sub_querier_keys()\n ret = @columnNames\n ret << :user_id\n ret << :milestone_id\n return ret\n end",
"def results=(list)\n @result_ids = list.map(&:id)\n @num_results = list.count\n @results = list.each_with_object({}) do |obj, map|\n map[obj.id] ||= obj\n end\n list\n end",
"def editable_location_ids\n return Location.all if is_super_admin?\n if self.region\n res = []\n region.locations.each do |lok|\n res += [lok.id.to_s] + lok.locations.map{|l| l.id.to_s}\n end\n res\n elsif self.location\n [location.id.to_s] + self.location.locations.map{|l|l.id.to_s}\n else\n []\n end\n end",
"def index\n @user = current_user\n @restaurants = @user.restaurants\n @branches = Array.new\n @tables = Array.new\n\n @restaurants.each do |r|\n r.branches.each do |b|\n @branches.push(b)\n end \n end\n\n @restaurants.each do |r|\n r.branches.each do |b|\n b.tables.each do |t|\n @tables.push(t)\n end \n end \n end\n\n end",
"def map_current_candidates\n\t\tobj = Candidate.all\n\t\tobj.map { |i| {i.id => i.name} }\n\tend",
"def result_input\n @employees = Employee.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"team\")\n @results = Result.find(:all,:conditions=>[\"company_id=?\",current_user.company_id],:order=>\"sort\").map {|r| [r.name, r.id]}\n end",
"def extra_users_data_look_up\n return if @results.empty?\n\n tickets = DataStore.instance.tickets\n @results.each do |user|\n ticket_names = tickets.select { |t| t['assignee_id'] == user['_id'] }.map { |t| t['subject'] }\n user['tickets'] = ticket_names\n end\n end",
"def populate_hits(session)\n id_hit_hash = Hash.new { |h, k| h[k] = {} }\n hits.each do |hit|\n id_hit_hash[hit.class_name][hit.primary_key] = hit\n end\n id_hit_hash.each_pair do |class_name, hits|\n hits_for_class = id_hit_hash[class_name]\n hits.each do |hit_pair|\n hit_pair[1].result = session[class_name].from_solr(hit_pair[1].stored_values)\n end\n end\n end",
"def supervisor_check?(user_id)\n db_params = {\n host: ENV['host'],\n port: ENV['port'],\n dbname: ENV['dbname'],\n user: ENV['user'],\n password: ENV['password']\n }\n db = PG::Connection.new(db_params)\n supervisors = db.exec(\"SELECT supervisor FROM supervisor\").values\n alt_supervisors = db.exec(\"SELECT alt_supervisor FROM supervisor\").values\n supervisor_list = supervisors.flatten\n alt_supervisor_list = alt_supervisors.flatten\n db.close\n if supervisor_list.include?(user_id) || alt_supervisor_list.include?(user_id)\n true\n else\n false\n end\nend",
"def manager_index \n # Get all departments\n @university = current_user.university\n @departments = @university.departments\n\n # Create a hash with key is department and value is all students object\n @department_students = Hash.new\n @departments.each do |department|\n @department_students[department] = Array.new\n department.users.each do |user|\n if user.role == 'Student'\n @department_students[department].push user\n end\n end\n end\n end",
"def index\n\t\t@super_users = SuperUser.all\n\tend",
"def list_of_politician_and_their_voters\nputs \"REPS and A List of their Voters.\"\n pol_votes = $db.execute(\"SELECT n.name, r.first_name, r.last_name) \n FROM congress_members n, voters r, votes v \n WHERE n.id = v.politician_id AND v.votes_id = r.id \n GROUP BY n.name\")\n \n pol_votes.each {|rep, fn, ln| puts \"#{rep}\"\n puts \"#{fn}\"\n puts \"#{ln}\"}\nend",
"def result_ids\n @ranks_and_ids ||= load_result_ids_from_cache\n end",
"def getSubpopGid(conn)\n\tsubpop = []\n conn.exec(\"select gid from geo.subpopulacoes order by gid;\").each do |row|\n subpop.push(row['gid'])\n end\nreturn subpop\nend",
"def remote_siblings; @remote_siblings ||= Hash[peer, id] end",
"def _insert_values\n identifier_hash(super)\n end",
"def company_employee_list(company_id)\n roles = Role.where(company_id: company_id)\n workers = []\n User.where(id: roles.pluck(:user_id).uniq).each do |w|\n workers.push(\n id: w.id,\n email: w.email,\n roles: roles.where(user_id: w.id).select(:id, :name)\n )\n end\n workers\n end",
"def initial_data\n @query_tracker.results.map.with_index do |data, index|\n data = data.dup\n data['_id'] = data['_id'].to_s\n [index, data]\n end\n end",
"def populate_hits #:nodoc:\n id_hit_hash = Hash.new { |h, k| h[k] = {} }\n hits.each do |hit|\n id_hit_hash[hit.class_name][hit.primary_key] = hit\n end\n id_hit_hash.each_pair do |class_name, hits|\n ids = hits.map { |id, hit| hit.primary_key }\n data_accessor = data_accessor_for(Util.full_const_get(class_name))\n hits_for_class = id_hit_hash[class_name]\n data_accessor.load_all(ids).each do |result|\n hit = hits_for_class.delete(Adapters::InstanceAdapter.adapt(result).id.to_s)\n hit.result = result\n end\n hits_for_class.values.each { |hit| hit.result = nil }\n end\n end",
"def upserted_ids\n @results[UPSERTED_IDS] || []\n end",
"def index\n if session[:isadmin]\n @sshkeys = Sshkey.all\n else\n #user_id = User.where(\"ldapowner LIKE ?\", \"%#{session[:nickname]}%\")\n #@sshkeys = Sshkey.where(\"user_id LIKE ?\", \"%#{session[:nickname]}%\")\n @something = Array.new\n @userids = ldap_owner_sshkeys(session[:nickname])\n\n @userids.each do |userid|\n @something = Sshkey.where(:user_id => userid).to_a\n if @something\n @sshkeys = @something\n else\n @sshkeys = []\n end\n\n end\n\n end\n\n\n end",
"def get_offices(lon, lat, distance)\n \n # divide distance in km by Radian of the earth in km (6371km)\n # this will speed up queries because we can calculate the min and max lon and lats with this data\n # now we don't have to perform the big formula bellow on all rows of the database but only on\n # the rows that are within the range of min and max lon and lat\n\n r = distance/6371\n\n latmin = lat - r \n latmax = lat + r\n\n # here it gets a little more complicated, but calculating longitudes min and max the same way we did latitude\n # is incorrect because distance gets shorter the further north or south you go from the equator\n # so the next formula was taken from a math book to get the correct min/max long distance\n\n latT = Math.asin(Math.sin(lat)/Math.cos(r))\n\n # @longT = Math.acos( ( Math.cos(r) - Math.sin(latT) * Math.sin(lat) ) / ( Math.cos(latT) * Math.cos(lat) ) )\n # formula above is long form of formula bellow\n\n lonT = Math.asin(Math.sin(r)/Math.cos(lat))\n\n lonmin = lon - lonT\n lonmax = lon + lonT\n\n ## First attempt at creating query, but this query doesn't use index of the table so if we had a large dataset, searches would be slow\n #\n # sql = \"select * from (\n # SELECT *,( 3959 * acos( cos( radians(#{lat}) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians(#{lon}) ) + sin( radians(#{lat}) # ) * sin( radians( lat ) ) ) ) AS distance \n # FROM offices\n # ) al\n # where distance < #{params['distance']}\n # ORDER BY distance;\"\n\n # This query uses indexes of the table and speeds up searches\n sql = \"select * from (\n SELECT *,( lat >= #{latmin} AND lat <= #{latmax}) AND (lon >= #{lonmin} AND lon <= #{lonmax}),\n ( 3959 * acos( cos( radians(#{lat}) ) * cos( radians( lat ) ) * cos( radians( lon ) - radians(#{lon}) ) + sin( radians(#{lat}) ) * sin( radians( lat ) ) ) ) AS distance\n FROM offices\n ) al\n where distance < #{distance/1.609344}\n ORDER BY distance;\"\n \n ActiveRecord::Base.connection.execute(sql)\n\n # I tested this method with Postgis/rgeo method and they both return almost identical values\n end",
"def supervisors\n (self.managers + self.trustees).uniq\n end",
"def map_to_hash_by_primary_key(result) \n hash = {}\n\n result.each do |record|\n hash[record[@primary_key]] = record\n end\n\n hash\n end",
"def locations()\n sql = \"SELECT dives.*\n FROM dives\n INNER JOIN schedules\n ON schedules.dive_id = dives.id\n WHERE schedules.id = $1\"\n values = [@schedule_id]\n result = SqlRunner.run(sql,values)\n dive = Dive.map_items(result)\n return dive\n end",
"def super_members\n self.members.find_all_by_role_id(MemberRole.super_role.id)\n end",
"def index\n\t\t@parent = parent_user\n\t\tgon.geo_parent = @parent\n\t\t@parents = Parent.all\n\t\t\t\t@hash = Gmaps4rails.build_markers(@parents) do |parent, marker|\n \t\t\t\t\tmarker.lat parent.latitude\n \t\t\t\t\tmarker.lng parent.longitude\n \t\tend\n\tend",
"def fetch_admins\n @admins = Admin.get_all_admins_from_memcache(@client_id)\n\n @admins.each do |admin|\n if admin.role == GlobalConstant::Admin.super_admin_role\n @super_admins[admin.id] = admin\n else\n @normal_admins[admin.id] = admin\n end\n end\n\n end",
"def index_query_results\n query = find_or_create_query(:Location, by: params[:by])\n show_selected_locations(query, id: params[:id].to_s, always_index: true)\n end",
"def roots(relation)\n\t @result_set = plan.query_roots(result_set, relation)\n\t self\n\tend",
"def resultset; end",
"def query_student(hQuery)\n result = []\n\n hQuery[:status] = :active unless hQuery.key?(:status)\n\n @data[:students].each do |hValue|\n elem = hValue\n hQuery.each do |query_key, query_value|\n elem = nil if not_in_query?(hQuery, hValue, query_key, query_value)\n end\n result << elem if elem\n end\n result\n end",
"def flattened_member_ids_with_collections(pids=nil, parent_collection=nil)\n # logger.info \"WithNestedMembers.flatten_pids_via_solr: querying for #{pids.inspect}\"\n\n # default to info from this collection\n if pids.nil?\n pids = member_ids\n end\n if parent_collection.nil?\n query = ActiveFedora::SolrService.construct_query_for_pids([pid])\n parent_collection = ActiveFedora::SolrService.query(query).first\n end\n\n # make sure pids aren't RDFLiterals\n pids = pids.map(&:to_s)\n\n # load many docs at once so we have fewer requests\n query = ActiveFedora::SolrService.construct_query_for_pids(pids)\n docs = ActiveFedora::SolrService.query(query, rows: pids.count).reduce({}) do |acc,doc|\n acc.merge!(doc['id'] => doc)\n end\n\n model_attr = ActiveFedora::SolrService.solr_name(\"has_model\", :symbol)\n pids.\n # don't do queries for all pids if we only need the first few\n lazy.\n # this is needed because member_ids sometimes returns deleted pids\n # see https://github.com/curationexperts/tufts_models/issues/8\n select{|pid| ActiveFedora::Base.exists?(pid)}.\n flat_map do |pid|\n doc = docs[pid]\n class_uri = doc[model_attr].first\n if [PersonalCollection, CourseCollection].map(&:to_class_uri).include? class_uri\n # this pid is a collection\n flattened_member_ids_with_collections(ActiveFedora::Base.find(pid).member_ids, doc)\n else\n # this pid is a non-collection\n [[pid, parent_collection]]\n end\n end\n end",
"def hash\n [searchable_id].hash\n end",
"def tracking_suggestions\n # temporarily removing solr for now - June 2012\n return [0, {}]\n \n facet_results_hsh = {:my_people_tracked_facet => [], :my_issues_tracked_facet => [], :my_bills_tracked_facet => []}\n my_trackers = 0\n\n begin\n users = User.find_by_solr('placeholder:placeholder', :facets => {:fields => [:my_people_tracked, :my_issues_tracked, :my_bills_tracked], :browse => [\"my_people_tracked:#{self.id}\"], :limit => 6, :zeros => false, :sort => true}, :limit => 1)\n rescue\n return [0, {}] unless Rails.env == 'production'\n raise\n end\n \n facets = users.facets\n facet_results_ff = facets['facet_fields']\n if facet_results_ff && facet_results_ff != []\n \n facet_results_ff.each do |fkey, fvalue|\n facet_results = facet_results_ff[fkey]\n \n #solr running through acts as returns as a Hash, or an array if running through tomcat...hence this stuffs\n facet_results_temp_hash = Hash[*facet_results] unless facet_results.class.to_s == \"Hash\"\n facet_results_temp_hash = facet_results if facet_results.class.to_s == \"Hash\"\n\n facet_results_temp_hash.each do |key,value|\n if key == self.id.to_s && fkey == \"my_people_tracked_facet\"\n my_trackers = value\n else\n unless facet_results_hsh[fkey.to_sym].length == 5\n object = Person.find_by_id(key) if fkey == \"my_people_tracked_facet\"\n object = Subject.find_by_id(key) if fkey == \"my_issues_tracked_facet\"\n object = Bill.find_by_ident(key) if fkey == \"my_bills_tracked_facet\"\n facet_results_hsh[fkey.to_sym] << {:object => object, :trackers => value}\n end\n end\n end\n end \n else\n return [my_trackers,{}]\n end\n \n unless facet_results_hsh.empty?\n #sort the hashes\n facet_results_hsh[:my_people_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n facet_results_hsh[:my_issues_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n facet_results_hsh[:my_bills_tracked_facet].sort!{|a,b| b[:trackers]<=>a[:trackers] }\n \n return [my_trackers, facet_results_hsh]\n else\n return [my_trackers,{}]\n end\n end",
"def staff_ids\n return @staff_ids\n end",
"def ancestor_ids\n read_attribute(self.base_class.structure_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end",
"def results_h\n empties = @ids.zip([nil]).to_h\n results.index_by(&:id).reverse_merge(empties)\n end",
"def trail_users_id_array\n # trail = Trail.find(:id)\n self.users.map do |x| \n x.id \n end \n end",
"def process_result\n if @result.present?\n @result.map do |admin_tag, url_hash|\n url_hash.map do |url, entity_list|\n entity_list.each do |entity|\n entity.symbolize_keys!\n save_and_relate_entity(entity[:name], entity[:url], [admin_tag], \"person\", ADMIN_SOURCE)\n end\n end\n end\n end\n end",
"def by_ssh_host\n by_ssh_host = {}\n self.class.list_map.each_pair do |role,list|\n self.send(list).each do |host_instance|\n if not by_ssh_host.has_key?(host_instance.ssh_host)\n by_ssh_host[host_instance.ssh_host] = []\n end\n by_ssh_host[host_instance.ssh_host] << host_instance\n end\n end\n by_ssh_host\n end",
"def get_self_and_children_ids\n ids = [self.id]\n ids += get_children_ids_recursive\n return ids\n\t\tend",
"def get_all_locations\n @locations = []\n results = Location.all\n results.each do |loc|\n @locations << loc.to_hash\n end\n end",
"def ministry_list\n root_ministry.descendants.pluck(:id)\n end",
"def allowSuperiorSubordinate()\n banner(\"Allow Superior/Subordinate\")\n @run.society.each_agent(true) do |agent|\n superior = agent.name\n debug \"superior = #{superior}\"\n subordinates = []\n directlyReportingAll(superior).each do |subordinate|\n if @allAgents.include?(subordinate) then\n subordinates.push(subordinate)\n end\n end\n debug \"subordinates = #{subordinates.join(',')}\"\n enclaves = [ agent.host.enclave ]\n subordinates.each do |subordinate|\n enclave = getEnclaveFromAgent(subordinate)\n if enclave == nil then\n next\n end\n if ! enclaves.include?(enclave) then\n enclaves.push(enclave)\n end\n end\n debug \"enclaves = [#{enclaves.join(\", \")}]\"\n if (! subordinates.empty?) then\n declareSet(namedAgent(superior), [superior])\n subordinatesName = \"SubordinatesOf#{superior}\"\n declareSet(subordinatesName, subordinates)\n permit(namedAgent(superior), subordinatesName,\n \"#{superior}TalksToSubordinates-I\",\n enclaves)\n permit(subordinatesName, namedAgent(superior),\n \"#{superior}TalksToSubordinates-II\",\n enclaves)\n end\n end\n end",
"def uids\n return [] unless valid?\n\n queries.search(name_query).merged_uids\n end",
"def build_centroids\n #sql = \"SELECT b.ogc_fid as id, ST_AsGeoJSON(ST_centroid(b.wkb_geometry)) as geo FROM buildings b\"\n sql = \"SELECT b.ogc_fid as id,\n st_x(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lng,\n st_y(st_transform(ST_Centroid(b.wkb_geometry),4326)) as lat\n FROM buildings b;\"\n result_set = ActiveRecord::Base.connection.execute(sql)\n results = {}\n\n result_set.each do |row|\n results[row['id']] = [row['lng'],row['lat']]\n end\n results\n end",
"def get_ids_of_all_jobs\r\n result = [id, parent_job_id].compact\r\n result << Job.where([\"parent_job_id in (?)\",result]).select(:id).collect(&:id)\r\n result.flatten.uniq\r\n end",
"def ancestor_ids\n read_attribute(self.base_class.ancestry_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = GetDistrictsByCoordinatesResultSet.new(resp)\n return results\n end",
"def all_employees\n ServiceProvider.all(:conditions => [\"user_id IN (?)\", self.users.map(&:id)])\n end",
"def search_site\n db = Site::Database::SiteOrm.all\n db_lat = db.reduce([]) { |box, record| box << record[:lat] }\n db_lng = db.reduce([]) { |box, record| box << record[:lng] }\n tmp = db_lat.zip(db_lng)\n result = @site.lat.zip(@site.lng)\n result << tmp\n result.uniq!\n end",
"def sites\n @list.map {|partition_name, partition| partition.sites.map {|site| {site => partition_name} }}.flatten(1)\n end",
"def sort\n self.location_hash = location_hash.sort_by { |hsh| hsh[\"user_id\"] }\n self\n end",
"def get_venue_ids\n @recommended_venues.each do |venue| \n @venue_ids << venue[\"id\"] \n end\n @venue_ids\n end",
"def searchlist\n\t\t@friendsHash = current_user.multi_friends\n\t\t# Get current user invited friends\n\t\tinviteFriends\n\t\t@alreadyinvitedusers = []\n\t\tif !@invitedFriends.blank?\n\t\t\t@invitedFriends = @invitedFriends.map(&:inspect).join(', ')\n\t\t\t@alreadyinvitedusers = User.where(\"id in (#{@invitedFriends})\").pluck(:uid)\n\t\tend\n\n\t\t# Get user Accepted friends UID\n\t\tacceptedFriends\n\t\t@alreadyAcceptedUsers = []\n\t\tif !@acceptedFriends.blank?\n\t\t\t@acceptedFriends = @acceptedFriends.map(&:inspect).join(', ')\n\t\t\t@alreadyAcceptedUsers = User.where(\"id in (#{@acceptedFriends})\").pluck(:uid)\n\t\tend\n\t\t\n\t\t@dt = {}\n current_user.multi_friends.each do |k,v| \n dist = dist(k)\n \tdist = (dist == 'No found') ? 99999 : dist\n @dt.merge!( k => dist)\n end\n\n @sortFriends = @dt.sort_by {|_k, val| val}\n\tend",
"def parents(result=nil)\n if result\n if @parents\n result |= @parents\n else\n\n upstreams.each do |upstream|\n if upstream.job == job\n upstream.parents(result)\n else\n result.add(upstream)\n end\n end\n\n result.to_a\n end\n else\n @parents ||= parents(Set.new)\n end\n end",
"def findSuperworks\n @results=Array.new\n \n #Grab the search term, in this case the work title, and store it - this is used for the popup\n @search_term = params[:query]\n session[:title_entered] = @search_term\n @search_term = FinderHelper.strip(params[:query]) +'*'\n if FinderHelper.strip(params[:query]).length < 3 then\n render :partial => 'frbr_objects/query_too_short'\n else\n # @matchingSuperworks=Superwork.find(:all,:conditions => [\"superwork_title like ? or superwork_title_alt like ?\", '%'+params[:query]+'%','%'+params[:query]+'%'] )\n # search_term = FinderHelper.strip(params[:query].downcase)+'*'\n \n #This took a bit of figuring out!\n fields = [\n {:name => 'superwork_title_for_solr_t', :boost => 4},\n {:name => 'superwork_title_alt_for_solr_t', :boost => 2.5}\n ]\n the_query = FinderHelper.build_query(Superwork, FinderHelper.strip(params[:query]), fields)\n @matchingSuperworks = solr_query(the_query)[0][:docs].map{|f|f.objectData}\n \n for superwork in @matchingSuperworks\n @results.push((FrbrObject.new(\"superwork\",superwork)))\n end\n # render :partial => 'result', :collection => @results\n render :partial => 'superworks_solr_search'\n end\n \n end",
"def admin_ids\n group_user_ids(admins_join_table)\n end",
"def entry_user_ids\n (entered_stories.map(&:user_id) + entered_notes_user_ids).flatten\n end",
"def find_selected_childentries(userid)\n @entries = Entry.find(:all, :conditions => [\"user_id=? and parent_id = ? \", userid, self.id])\n \n \n return @entries\n end",
"def get_ids\r\n case id\r\n when 1 then [1,2,3,4,5] # superadmin\r\n when 2 then [2] # data\r\n when 3 then [3,4,5] # centeradmin\r\n when 4 then [4,5] # teamadmin\r\n when 5 then [5] # behandler\r\n when 10 then [10,11,12,13,14,15] # login_bruger\r\n when 11 then [11] # parent\r\n when 12 then [12] # teacher\r\n when 13 then [13] # pedagogue\r\n when 14 then [14] # youth\r\n else []\r\n end\r\n end",
"def employees\n self.employee_examination_sessions.map(&:employee)\n end",
"def list_heros(superhero_conn)\n hero_names = superhero_conn.exec(\"SELECT name FROM super_heros;\").values\n count = 0\n hero_names.each do |name|\n count +=1\n puts \"#{count}.) Superhero: #{name}\"\n end\nend",
"def self_and_siblings_ids\n parent ? parent.children_ids : self.class.roots.map {|x| x.id}\n end",
"def find_passengers\n journeys = Journey.includes(\"stages\").where(stages: {route_id: self.id, accepted: true})\n passengers = []\n journeys.each do |journey|\n passengers << journey.user\n end\n passengers\n end",
"def find_locations\n parent = Location.find_by_id params[:id]\n @locations = parent.nil? ? [] : parent.children.order(:name)\n end",
"def exercise2\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n gr.name as group_name,\n u.name as user_name,\n sum(m.mapviews) as groups_count\n FROM (((users as u\n INNER JOIN groups_users as gu ON u.id=gu.user_id)\n INNER JOIN groups as gr ON gr.id = gu.group_id)\n INNER JOIN maps as m ON m.user_id = u.id)\n GROUP BY (gr.name, u.name)\n ORDER BY gr.name, groups_count DESC;\");\n\n @results2 = []\n\n index = 0\n @content.each do |r|\n @results2[index] = Result2.new r\n index = index + 1;\n end\n\n return @results2\n end",
"def work_id_list\n query = { params: { q: \"member_of_collection_ids_ssim:#{id} AND has_model_ssim:Work\", fl: \"id\", rows: \"100000\" } }\n results = solr.select(query)\n results['response']['docs'].flat_map(&:values)\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def locations\n unless defined?(@locations)\n @locations=[]\n for loc in Location.order(\"id ASC\").includes(:bottom_right_coordinate, :top_left_coordinate)\n @locations << loc if do_overlap_with?(loc.area)\n end \n end \n @locations\n end",
"def passenger_ids\n passenger_ids = []\n self.ridings.each {|riding| passenger_ids << riding.user_id}\n return passenger_ids\n end",
"def ids\n if Array === key\n Stal.solve(redis, key)\n else\n key.call(\"SMEMBERS\")\n end\n end",
"def hash\n [principals, relation].hash\n end",
"def prepare_identities_from_data; end",
"def ordered_ids\n Array(solr_document[\"member_ids_ssim\"])\n end",
"def data\n @data ||= begin\n event_users = Hash.new do |h, uuid|\n h[uuid] = Set.new\n end\n\n # IDEA: maybe there's a block form if this we can do that yields results as it loads them\n # to go slightly faster\n fetch_results.each do |row|\n event_users[row['name']] << row['user_id']\n end\n\n event_users\n end\n end",
"def to_hash\n call\n @hash[:inner_hits] = @inner_hits.to_hash if @inner_hits\n @hash\n end",
"def index\n @q = StaffWorker.eager_load(:subdivision => :company).ransack(params[:q])\n @staff_workers = @q.result(distinct: true)\n # @staff_workers = StaffWorker.all\n end",
"def map_in_included_relations!(result, query)\n dat = get_relation_data_as_hash(query)\n result.each do |res|\n dat.each do |name, lookup|\n res[name] = lookup[res[@relations[name][:this_key]]]\n if @relations[name][:type] == :has_one\n res[name] = res[name][0] unless res[name].nil?\n else \n res[name] = [] if res[name].nil?\n end\n end\n end\n end",
"def location_users_filter\n @location = Location.where(\"id = #{params[:location_id]}\").first\n @sub_locations = @location.locations\n full_tree_location_ids = @location.parent_location_full_child_tree\n logger.debug(\"**************** #{full_tree_location_ids}\")\n\n @users = User.where(\"location_id IN (#{full_tree_location_ids})\")\n \n respond_to do |format|\n format.js\n end\n end",
"def siblings\n others = user ? user.servers : Server.where(email: email, user_id: nil)\n others.where.not(id: id).to_a\n end",
"def assign_uuid_to_result(filtered_results)\n filtered_results.class.instance_eval('attr_accessor :uuid, :date_dimension, :latitude, :longitude')\n @listingsids.each do |id|\n filtered_results.each do |listing|\n if listing.send(:page_path).match(/#{id}/)\n listing.uuid = id\n end\n end\n end\n return filtered_results\n end",
"def users\n result_hash['usr']\n end",
"def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end",
"def household_users\n User.where(id: household_user_ids)\n end"
] |
[
"0.5744068",
"0.54649127",
"0.5417056",
"0.54154885",
"0.5393021",
"0.5191496",
"0.5142469",
"0.5062413",
"0.500996",
"0.50016695",
"0.4989448",
"0.4906232",
"0.49008897",
"0.48907262",
"0.4860441",
"0.48425025",
"0.4833781",
"0.4808018",
"0.47996476",
"0.47949952",
"0.4784699",
"0.47797897",
"0.47657013",
"0.47537777",
"0.47512892",
"0.47356617",
"0.47307575",
"0.47167087",
"0.47060707",
"0.47049555",
"0.4700631",
"0.4699448",
"0.46821123",
"0.4670707",
"0.46662384",
"0.46586797",
"0.46477348",
"0.46298987",
"0.46226907",
"0.46192637",
"0.46162385",
"0.45998487",
"0.4595651",
"0.45939475",
"0.45916352",
"0.45853016",
"0.4584011",
"0.45823634",
"0.45818725",
"0.45775136",
"0.45617586",
"0.4560446",
"0.45537487",
"0.4550913",
"0.4546547",
"0.4544662",
"0.45412338",
"0.4535282",
"0.4534878",
"0.45316714",
"0.4518021",
"0.4517052",
"0.45127928",
"0.45098838",
"0.45064712",
"0.44955486",
"0.4494851",
"0.4487757",
"0.44804728",
"0.44795215",
"0.44777557",
"0.4477648",
"0.44732347",
"0.44695023",
"0.4465416",
"0.44618705",
"0.44606733",
"0.4458818",
"0.4458324",
"0.4456372",
"0.44538194",
"0.44532624",
"0.44521892",
"0.4447138",
"0.4442797",
"0.4439247",
"0.4436412",
"0.44356453",
"0.4431313",
"0.44250843",
"0.44234723",
"0.44149742",
"0.44133076",
"0.43962565",
"0.43933088",
"0.43929946",
"0.43928775",
"0.43894342",
"0.43825796",
"0.43813127",
"0.43772197"
] |
0.0
|
-1
|
TODO Don't return all videos, just video for issue
|
def list
respond_to do |format|
format.html { render partial: 'videos/issues_video_container', locals: {videos: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per]), issue: Issue.where(id: params[:issue_id])} }
format.json { render json: Video.where(issue_id: params[:issue_id]).page(params[:page]).per(params[:per])}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def videos_test\n end",
"def video\n @streams.select { |stream| stream.is_a? VideoStream }\n end",
"def valid_videos\n self.videos.select{ |video|\n video.exist? && video.embed? && video.auto_play?\n }\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def video\n first_stream_of :video\n end",
"def video_tracks\n tracks.select { |t| t.video? }\n end",
"def video_tracks\n tracks.select { |t| t.video? }\n end",
"def video\n YouTubeApi.find_video(youtube_id)\n end",
"def videos\n video_ids = []\n @list_data['items'].each do |top_video|\n video_ids.push(top_video['id']['videoId']) unless top_video['id']['videoId'].nil?\n end\n\n # since we need to call youtube/api/videos to get the embed_link\n videos_data = @gateway.certain_id_videos_data(video_ids)\n @top_video_mapper.build_video_items(videos_data['items'])\n end",
"def recent_videos\n videos = self.videos\n\n return [] unless videos\n videos.first(6)\n end",
"def video_link\n if video_type? && !body.nil?\n vimeo_video(body) || youtube_video(body)\n end\n end",
"def video\n\t\tVideo.find(self.video_id)\n\tend",
"def public_videos\n Video.joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).where(:channel_id => self.channels.where(:private => false).collect(&:id))\n end",
"def get_datas\n tnurl=\"/images/no-image.jpg\"\n if self.source_url.match(/(youtube.com*)/)\n vid=self.source_url.match(/=([A-Za-z0-9]*)/) ? self.source_url.match(/=([A-Za-z0-9\\d_\\-]*)/)[0].gsub(/=/,'') : self.source_url\n unless vid.blank?\n \n client=YouTubeIt::Client.new(:dev_key => YOUTUBE_API_KEY)\n \n \n begin\n youtube_data=client.video_by(vid)\n rescue\n youtube_data=nil\n self.errors.add(:source_url, \"Invalid video url, removed from youtube\")\n self.source_url=nil\n end \n \n \n unless youtube_data.nil? \n self.title= self.title.blank? ? youtube_data.title : self.title\n self.description= self.description.blank? ? youtube_data.description : self.description\n tnurl=youtube_data.thumbnails[0].url\n self.media_content_url=youtube_data.media_content[0].url\n end\n end\n self.provider=\"youtube\"\n elsif self.source_url.match(/(vimeo.com*)/)\n tnurl='/images/video/vimeo.png' \n vid=self.source_url.match(/vimeo.com\\/([^&]+)/)[1]\n unless vid.blank?\n vimeo_data=Vimeo::Simple::Video.info(vid)\n if vimeo_data && vimeo_data.size>0\n tnurl=vimeo_data[0][\"thumbnail_medium\"]\n self.title= self.title.blank? ? vimeo_data[0][\"title\"] : self.title\n self.description= self.description.blank? ? vimeo_data[0][\"description\"] : self.description\n end\n end\n\n #self.media_content_url=\"/videos/#{self.id}\"\n\n\n self.media_content_url=\"http://www.vimeo.com/moogaloop.swf?clip_id=#{vid}&server=www.vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=\"\n self.provider=\"vimeo\"\n elsif self.source_url.match(/(dailymotion.com*)/)\n self.provider=\"dailymotion\" \n tnurl='/images/video/dailymotion.png' \n elsif self.source_url.match(/(myspace.com*)/)\n self.provider=\"myspace\" \n tnurl='/images/video/myspace.png' \n end\n\n self.thumbnail_url=tnurl\n\n\n end",
"def video_names \n\t\tvideos.map{|v| v.name}\n\tend",
"def show\n\n\n @video = Video.find(params[:id])\n \n @vid = params[:id]\n #@video = Video.where(:id=>@vid, :is_active=>'1').take\n #@video = Video.where(\"id = ? AND is_active = ?\", @vid, 1)\n \n @video_id = (/([\\w-]{11})/.match(@video.video_link)).to_s\n @embed_code = %Q{<iframe title=\"YouTube video player\" style=\" margin-top: 24px;\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/#{ @video_id}\" frameborder=\"0\" allowfullscreen></iframe>}\n \n \n @commentable = @video\n @comments = @commentable.comments\n @comment = Comment.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end",
"def show\n @video = Video.find_by_permalink(params[:id])\n \n previous_video = Video.previous(@video)\n if previous_video.empty?\n @previous = Video.last.permalink\n else\n @previous = previous_video.pop.permalink\n end\n \n next_video = Video.next(@video)\n if next_video.empty?\n @next = Video.first.permalink\n else\n @next = next_video.pop.permalink\n end\n # we may need some cant find permalink screen \n \n @text_size = @video.project.size < 35 ? \"textTitle\" : \"textTitleSmall\" \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def index\n @videos = Video.where(project_id: @project.id)\n end",
"def recent_videos\n videos.first(6)\n end",
"def all_videos\n Video.joins(:video_graph).where(:video_graphs => { :status => Video.statuses_to_show_to_current_user }).where(:channel_id => self.channels.collect(&:id))\n end",
"def video_by(video)\n vid = nil\n vid_regex = /(?:youtube.com|youtu.be).*(?:\\/|v=)([\\w-]+)/\n if video =~ vid_regex\n vid = $1\n else\n vid = video\n end\n video_id =\"http://gdata.youtube.com/feeds/api/videos/#{vid}?v=2#{@dev_key ? '&key='+@dev_key : ''}\"\n parser = YouTubeIt::Parser::VideoFeedParser.new(video_id)\n parser.parse\n end",
"def resources\n videos\n end",
"def video_by_status_url(status_url)\n parser = YouTubeG::Parser::VideoFeedParser.new(status_url)\n video = parser.parse \n return video \n end",
"def videos\n @hot_video_mapper.build_video_items(@list_data['items'])\n end",
"def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end",
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end",
"def index\n @videos = @item.videos\n end",
"def index\n @videos = @item.videos\n end",
"def next_video\n if episode?\n episode = content.next_ep\n unless episode.nil?\n return episode.video\n end\n end\n end",
"def video_title\n if video\n video.title\n end\n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def embed_video\r\n\tvid_host = self.video_url.sub(/^https?\\:\\/\\//, '').sub(/^www./,'').split('/')[0]\r\n\tif vid_host == 'youtube.com' or vid_host == 'youtu.be'\r\n\t\tyoutube_embed(self.video_url)\r\n\telsif vid_host == 'player.vimeo.com' or vid_host == 'vimeo.com'\r\n\t\tvimeo_embed(self.video_url)\r\n\tend\r\n end",
"def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end",
"def show\n @video = Video.new\n @competition_videos = Competition.find(params[:id]).videos\n #@competition_videos = Competition.find(params[:id]).videos.order(created_at: :desc).paginate(page: params[:page],per_page:50)\n end",
"def video\n \"#{self.video_file_name}\"\n end",
"def index\n @medio_videos = MedioVideo.all\n end",
"def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end",
"def show\n @video = Video.find(params[:id])\n @run = Run.find(@video.run_id)\n @videos = @run.visiblevideos\n @video.counter += 1\n @video.save\n \n @videocomments = Videocomment.find(:all, :conditions => {:video_id => @video.id})\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end",
"def current_video\n last_poll = Room.find(id).video_polls.second_to_last\n if last_poll\n if last_poll.played_video\n last_poll.played_video\n else\n last_poll.candidate_videos.first.video\n end\n else\n playlist.videos.first\n end\n end",
"def parse_video\n # standard\n unless /\\A\\s*(?<width>\\d+)x(?<height>\\d+)\\s+(?<url>.+)\\z/ =~ content\n env.warn 'can not parse \\video content, should be \"#{WIDTH}x#{HEIGHT} #{URL}\"'\n return\n end\n\n case url\n when /youtu\\.?be/\n # NOTE merging them into one regexp fails (because longest match?)\n unless id = url[/(?<=watch\\?v=)\\w+/] || url[/(?<=embed\\/)\\w+/] || url[/(?<=youtu\\.be\\/)\\w+/]\n env.warn 'can not parse youtube id'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://www.youtube-nocookie.com/embed/#{id}?rel=0\" frameborder=\"0\" allowfullscreen></iframe>|\n when /vimeo/\n unless id = url[/(?<=vimeo\\.com\\/)\\w+/]\n env.warn 'can not parse vimeo id, should use link like this \"http://vimeo.com/#{DIGITS}\"'\n return\n end\n %Q|<iframe width=\"#{width}\" height=\"#{height}\" src=\"https://player.vimeo.com/video/#{id}\" frameborder=\"0\" allowFullScreen></iframe>|\n when /sm/\n unless id = url[/\\bsm\\d+/]\n env.warn 'can not find \"sm#{DIGITS}\" from link'\n return\n end\n %Q|<script src=\"https://ext.nicovideo.jp/thumb_watch/#{id}?w=#{width}&h=#{height}\"></script>\"|\n else\n env.warn 'failed to parse video link, currently only youtube, vimeo and niconico are supported'\n return\n end\n end",
"def youtube_movie_embed\n str1 = \"http://www.youtube.com/v/\" \n str2 = movie_home_url.split('v=',2).last unless movie_home_url.nil?\n str3 = \"&hl=en_US&fs=1&\"\n return [str1,str2,str3].join \n end",
"def parse_activity_videos(entry)\n videos = []\n\n entry.css(\"link\").each do |link_tag|\n videos << YouTubeIt::Parser::VideoFeedParser.new(link_tag).parse if link_tag.at(\"entry\")\n end\n\n if videos.size <= 0\n videos = nil\n end\n\n return videos\n end",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end",
"def video_url\n \"http://video.ted.com/#{videoID}\"\n end",
"def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end",
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def index\n @game_videos = GameVideo.all\n end",
"def video_by(vid)\n video_id = vid =~ /^http/ ? vid : \"http://gdata.youtube.com/feeds/api/videos/#{vid}\"\n parser = YouTubeG::Parser::VideoFeedParser.new(video_id)\n parser.parse \n end",
"def fetch_video\n \t @video=UnvlogIt.new(url)\n \t self.embed_url=@video.embed_html(300, 169)\n \t self.thumb_url=@video.thumbnail\n end",
"def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end",
"def scenario_results_with_videos\n scenario_result_id_to_count = StepVideo\n .where.not(result_step_id: nil) # most likely aborted during uploaded\n .group(:scenario_result_id).count\n scenario_result_ids_with_videos = scenario_result_id_to_count.select { |key, value| value > 1 }\n ScenarioResult.where(id: scenario_result_ids_with_videos.keys)\n end",
"def download_all_videos_from_pl id,d_name\n\tmy_directory = \"#{@dir}#{d_name}\"\n\n\t videos_already_saved_array = get_all_titles_from_dir my_directory\n\n\t videos_already_saved_titles, videos_already_saved_paths = \n\t \t\t\t\t\tvideos_already_saved_array.map{|e| e[0]}, videos_already_saved_array.map{|e| e[2]}\n\n\t@current_playlist_video_titles.each do |v|\n\t\t\tsource = 'youtube'\n\t\t\tindex = @current_playlist_video_titles.index(v)\n\t\t\tp index\n\t\t\tvid = @current_playlist_video_ids[index]\n\t\t\tp vid\n\n\t\tif !videos_already_saved_titles.include?(v)\t\n\t\t\t\n\t\t\tvideo_string = \"http://www.youtube.com/watch?v=#{vid}\"\n\t\t\tdownload_video = \"viddl-rb #{video_string} -d 'aria2c' -s '#{my_directory}'\"\n\n\t\t\tcaptured_stdout = ''\n\t\t\tcaptured_stderr = ''\n\t\t\tstdin, stdout, stderr, wait_thr = Open3.popen3(\"#{download_video}\")\n\t\t\tpid = wait_thr.pid\n\t\t\tstdin.close\n\t\t\tcaptured_stdout = stdout.gets(nil)\n\t\t\taborted = captured_stdout.include? \"Download aborted\"\n \t\t\t# captured_stderr = stderr.read\n\t\t\twait_thr.value # Process::Status object returned\n\n\t# extract the info we need\n\t\t\tputs \"STDOUT: \" + captured_stdout\n\t\t\t# puts \"STDERR: \" + captured_stderr\n\n\t\t\t# go to Vimeo to download if it doesnt work\n\t\t\tif aborted\n\t\t\t\tartist_match_results = match_best v, @rule_artists\n\t\t\t\t@song_artist = artist_match_results[0]\n\t\t\t\tremaining_words = artist_match_results[1]\n\t\t\t\tsong_match_results = match_best remaining_words, @rule_titles\n\t\t\t\t@song_title = song_match_results[0]\n\n\t\t\t\tsource='vimeo'\n\t\t\t\tget_vimeo_manually @song_artist,@song_title,@mydir,\"vimeo\"\n\t\t\t\t# Process.kill(\"KILL\", stream.pid)\n\t\t\t\t# get_vimeo_manually v,my_directory,source \n\t\t\tend\n\n\t\t\tp \"already have it\" if videos_already_saved_titles.include?(v)\n\t\tend\n\n\n\tend\n\n\t\nend",
"def get_media_content\n begin\n video_sql = \"SELECT * FROM mediacontent\";\n video_sql += \" WHERE ContentTypeID = 1\";\n video_sql += \" AND ( iPodVideo IS NOT NULL AND iPodVideo != '') AND (iPodVideo LIKE '%mp4') ORDER BY RecordDate ASC\";\n message_video_content_data = Immutable.dbh.execute(video_sql);\n\n return message_video_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting message video content data from DB, Check migration log for more details');\n end\n end",
"def producer_public_videos(page_token = '')\n\n @producer_public_videos ||= begin\n result = []\n\n channels_response = get_channel_data\n uploads_list_id = channels_response.data.items.first['contentDetails']['relatedPlaylists']['uploads']\n\n public_uploads = get_public_uploads(uploads_list_id, page_token) \n playlist_items = public_uploads.items\n video_ids = playlist_items.map { |item| item[\"snippet\"][\"resourceId\"][\"videoId\"] }\n\n metadata_list = get_metadata(video_ids)\n duration_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"contentDetails\"][\"duration\"] }\n end.reduce(&:merge)\n\n view_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"statistics\"][\"viewCount\"] }\n end.reduce(&:merge)\n\n { \n :next_page_token => public_uploads.next_page_token, \n :items => serialize_playlist_items(playlist_items, duration_hash, view_hash)\n }\n end\n end",
"def mergeVideos()\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n vidList=\"#{pathToIntermediates}/vidList.txt\"\n # Create a txt file with the lists of all videos to concatenate\n system \"echo >#{vidList}\"\n (0...@objects.length).each do |e|\n system \"echo file \\'#{pathToIntermediates}/vid-#{e}.mp4\\' >> #{vidList}\" \n end\n # Concatenate videos from the txt file\n system \"ffmpeg -f concat -safe 0 -i #{vidList} -c copy #{pathToIntermediates}/output.mp4 -loglevel quiet\"\n end",
"def create_videos\n end",
"def show\n @yt_client = YouTubeIt::Client.new(:dev_key => \"AI39si6hkRNCL77mzzv1LycIohZtksVIi0L5S9lQMx6crqOfGdyKcB2U2M5WHeNBUT2VLgTVzjR9rxPa1RJZw-sZ6wqtnaZ7AA\")\n @video = Video.find(params[:id])\n\n @comments = @video.comments.all\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end",
"def contains_video?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_video?}\n result\n end",
"def get_all_videos\n # get the first set of results\n video_list = []\n start_index = 1\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n total_results = YouTubeApiCallsHelper.get_total_results(response.body)\n\n # if there are more results to fetch, loop till we have them all\n while video_list.length < total_results\n start_index += YouTubeApiCallsHelper::MAXRESULTS\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n end\n\n return video_list\n end",
"def get_player_rendered_videos(gamertag, page = 0)\n gamertag = gamertag.gsub(' ', '%20')\n uri = ENDPOINT + \"file/videos/#{key}/#{gamertag}/#{page}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end",
"def video_download_links(document, video_files)\n file = video_files.first\n video_links = []\n attachments_json = JSON.parse(file['attachments_ss'])\n %w(video_access_mp4 video_access_webm).each do |v_id|\n next unless attachments_json[v_id]\n\n video_links << file_download_link(file['id'],\n download_link_title(document, attachments_json),\n attachments_json,\n v_id,\n download_link_options)\n end\n video_links\n end",
"def getVideos\n\t\tvideos = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/videos/\"))\t\n\t\tret = []\n\n\t\tfor video in videos\n\t\t\tret.push(Video.new(video[\"hash\"], @testId))\n\n\t\tend\n\n\t\treturn ret\n\tend",
"def next_video_or_show\n ep = next_video\n if ep.nil?\n return content.show\n else\n return ep\n end\n end",
"def step_videos_without_uuid\n StepVideo.where(uuid: nil)\n end",
"def test_videos_by_tag_escape\n videos = @client.videos_by_tag('cindy & margolis')\n _test_video_list(videos)\n end",
"def streaming_video_url\n # TODO figure out how to remove the need for this stupid hack\n # paperclip adds the cache buster to the URL automatically, I need\n # it to go away, probably a really easy paperclip option, but not\n # finding it at the moment.\n unless streaming_video.nil?\n streaming_video.data.url.split(\"?\")[0]\n else\n nil\n end\n end",
"def played_videos\n Room.find(id).video_polls\n .select do |video_poll|\n video_poll.played_video_id &&\n (video_poll.created_at > last_playlist_completion_time)\n end\n .map do |video_poll|\n Video.find(video_poll.played_video_id)\n end\n end",
"def index\n @jeux_videos = JeuxVideo.all\n end",
"def wp_get_video_extensions()\n # Filters the list of supported video formats.\n apply_filters('wp_video_extensions', ['mp4', 'm4v', 'webm', 'ogv', 'flv'])\n end",
"def prev_video\n if episode?\n episode = content.prev_ep\n unless episode.nil?\n episode.video\n end\n end\n end",
"def index\n @help_videos = HelpVideo.all\n end",
"def has_video?\n false\n end",
"def show\n @videos = @board.videos.all\n end",
"def each_turns_next_video\n videos = user_rota.all.map{ |user| Video.next_for(user) }.compact\n if videos.any?\n videos\n else\n Video.pending\n end\n end",
"def show\n @videos = @video.responses\n @videos.unshift @video\n end",
"def video\n\t\tif params[:category_id]==\"all\"\n\t\t@search=OldFlashFile.all\n\t\t\t\tif !@search.empty?\n\t\t\t\t@status= @search.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\" ,:videotype=>f.video.content_type}}\n\t\t\t\telse\n\t\t\t\t@status=nil \n\t\t\t\tend\n\n\t\telse\n\t\targs={:search=>{:filter=>params[:filter],:category_id=>params[:category_id]}}\n\n\t\t@search = ContentSearch.new(args) \n\t\t@results = Kaminari.paginate_array( @search.results )\n\t\t@total = @search.total\n\n\t\t\tif !@results.empty?\n\t\t\t@status= @results.map{|f| {:title =>f.title, :imageUrl=>request.protocol+request.host_with_port+f.preview_image.url(:small), :videoUrl=>(f.video.content_type==\"video/x-flv\") ? \"#{request.protocol+request.host_with_port+f.video.url}\".gsub(\".flv\", \".mp4\") : \"#{request.protocol+request.host_with_port+f.video.url}\",:videotype=>f.video.content_type}}\n\n\t\t\telse\n\t\t\t@status=nil \n\t\t\tend\n\t\tend\n\n\t\trender :json =>@status.to_json\n\t\tend",
"def show\n gon.videos = []\n gon.videos_urls = []\n gon.tags = []\n @course.holes.each do |hole|\n gon.videos << hole.video if hole.video.present?\n gon.videos_urls << hole.video.video if hole.video.present?\n gon.tags << hole.video.tags if hole.video.present?\n end\n end",
"def index\n @videos = @palestrante.videos.mais_novos\n end",
"def show\n @video = Video.find(params[:id])\n\tif @video != nil\n\t\t@title = @video.alter_name\n\t\t@return_to = video_path(@video)\n\t\t@page_params = {:part_id => 5,:page_id => 1,:entity_id => @video.id}\n\t\t@path_array = [\n\t\t\t\t\t\t{:name => 'Видео', :link => videos_path},\n\t\t\t\t\t\t{:name => @video.category_name, :link => videos_path(:c => @video.category_path)},\n\t\t\t\t\t\t{:name => @video.alter_name, :link => '/'}\n\t\t\t\t\t ]\n\t\t@comments = @video.messages.where(:status_id => 1).order('created_at ASC')\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render :json => @video }\n\t\tend\n\tend\n end",
"def get_video_media_content_for_message(message_id)\n begin\n video_sql = \"SELECT * FROM mediacontent WHERE mediacontentid\";\n video_sql += \" IN (SELECT messagemediacontent.mediaid FROM messagemediacontent WHERE\";\n video_sql += \" messageid = #{message_id}) AND ( iPodVideo IS NOT NULL)\";\n video_sql += \" AND (ContentTypeID = 4 OR ContentTypeID = 1) AND (iPodVideo LIKE '%mp4')\";\n video_sql += \"AND iPodVideo!='' ORDER BY RecordDate ASC \";\n message_video_content_data = Immutable.dbh.execute(video_sql);\n\n return message_video_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting message video content data from DB, Check migration log for more details');\n end\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @videos = Video.all\n end",
"def index\n @congratulations_videos = CongratulationsVideo.all\n end"
] |
[
"0.7238571",
"0.7144692",
"0.7031928",
"0.68703896",
"0.67784584",
"0.6767138",
"0.6767138",
"0.67403907",
"0.66962653",
"0.6660596",
"0.6583289",
"0.65204346",
"0.6514951",
"0.6503534",
"0.6490964",
"0.6476618",
"0.64699405",
"0.64662665",
"0.64609516",
"0.6453069",
"0.64421237",
"0.64398706",
"0.6439418",
"0.6429557",
"0.6422634",
"0.6416066",
"0.6403401",
"0.6395822",
"0.6395822",
"0.63889056",
"0.63778466",
"0.6373639",
"0.6371559",
"0.6353927",
"0.6349229",
"0.6337412",
"0.6334783",
"0.63298887",
"0.6310379",
"0.6304456",
"0.6302199",
"0.6275613",
"0.6265794",
"0.62596613",
"0.62587917",
"0.6250402",
"0.62447435",
"0.62390614",
"0.6232487",
"0.6225553",
"0.62201756",
"0.6218495",
"0.6207524",
"0.61971444",
"0.61955446",
"0.6191805",
"0.6187106",
"0.6183156",
"0.61727095",
"0.6160583",
"0.61586726",
"0.61530364",
"0.6144378",
"0.6133721",
"0.6131293",
"0.61172277",
"0.6112081",
"0.6109792",
"0.6107717",
"0.61052006",
"0.6100818",
"0.6088249",
"0.6079561",
"0.607634",
"0.6074712",
"0.60723233",
"0.60702485",
"0.6068324",
"0.60656506",
"0.60654444",
"0.60641044",
"0.6059929",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60594326",
"0.60533077"
] |
0.699107
|
3
|
This might need a bit more complexity in the future, but for now, it works like a charm
|
def generate_around_site
return Video.order("RAND()").limit(4)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def schubert; end",
"def formation; end",
"def transformations; end",
"def transforms; end",
"def custom; end",
"def custom; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def anchored; end",
"def transform; end",
"def terpene; end",
"def escaper; end",
"def identify; end",
"def intensifier; end",
"def suivre; end",
"def original; end",
"def original_result; end",
"def weber; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def operations; end",
"def operations; end",
"def offences_by; end",
"def wrapper; end",
"def stderrs; end",
"def verdi; end",
"def trd; end",
"def berlioz; end",
"def isolated; end",
"def isolated; end",
"def villian; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def strategy; end",
"def post_process; end",
"def expanded; end",
"def transformation\n end",
"def sitemaps; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def internal; end",
"def starting_position; end",
"def reflector; end",
"def reflector; end",
"def zuruecksetzen()\n end",
"def celebration; end",
"def rest_positionals; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def user_os_complex\r\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def originalsourceform; end",
"def rassoc(p0) end",
"def prepareForReuse; end",
"def transform\n end",
"def mitch_hedberg; end",
"def preproc; end",
"def myletter\n \n end",
"def rekey_as_needed; end",
"def same; end",
"def extra; end",
"def overrides; end",
"def who_we_are\r\n end",
"def run_and_transform; end",
"def processor; end",
"def feruchemist; end",
"def bs; end",
"def tiny; end",
"def escaper=(_); end",
"def compilereturn\n\n end",
"def common\n \n end",
"def jack_handey; end",
"def required_positionals; end",
"def analyze_component_breakdown\n\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end"
] |
[
"0.6775992",
"0.58844966",
"0.57467264",
"0.5697172",
"0.5677934",
"0.5623939",
"0.5602447",
"0.5602447",
"0.5577124",
"0.5577124",
"0.5577124",
"0.5577124",
"0.55260164",
"0.552145",
"0.5502291",
"0.54278207",
"0.542326",
"0.5358239",
"0.53303516",
"0.53284883",
"0.53101146",
"0.5307686",
"0.530314",
"0.530314",
"0.5262148",
"0.52615374",
"0.52615374",
"0.52510095",
"0.5208827",
"0.5196907",
"0.51771593",
"0.5171351",
"0.5152369",
"0.5133712",
"0.5133712",
"0.5120929",
"0.51175386",
"0.51175386",
"0.5105515",
"0.50837463",
"0.50387925",
"0.50341934",
"0.5030536",
"0.5024825",
"0.5024825",
"0.5024825",
"0.50036776",
"0.50004065",
"0.4978329",
"0.4978329",
"0.4971408",
"0.49588498",
"0.49543512",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4951704",
"0.4941258",
"0.4941258",
"0.4941258",
"0.4941258",
"0.49187192",
"0.4906289",
"0.4906289",
"0.4906289",
"0.4906289",
"0.4904082",
"0.4904082",
"0.4904082",
"0.4904082",
"0.48964158",
"0.48918593",
"0.48882374",
"0.48813102",
"0.48800087",
"0.48782113",
"0.4860904",
"0.4859316",
"0.48524702",
"0.485115",
"0.48402902",
"0.4831622",
"0.48293304",
"0.48276103",
"0.48253772",
"0.48239875",
"0.48232654",
"0.4823035",
"0.4821476",
"0.48209202",
"0.48093015",
"0.48061633",
"0.48058382",
"0.47997293",
"0.47997293",
"0.47997293"
] |
0.0
|
-1
|
that's not the output we see. Why not?
|
def multiply_by_five(n)
n * 5
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def probers; end",
"def out; end",
"def private; end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def rassoc(p0) end",
"def writethis; end",
"def stderrs; end",
"def anchored; end",
"def r; end",
"def r; end",
"def original_result; end",
"def interpret\r\n return __________________ # <<2\r\n end",
"def berlioz; end",
"def p15\n\t\nend",
"def sld; end",
"def value_written=(_arg0); end",
"def offences_by; end",
"def terpene; end",
"def value_written; end",
"def bs; end",
"def probers=(_arg0); end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def inspect; end",
"def ibu; end",
"def output(o);printf o;end",
"def pass; end",
"def pass; end",
"def trd; end",
"def hiss; end",
"def internship_passed; end",
"def unboxed\n $stderr.puts \"I should never happen\"\n end",
"def herald; end",
"def same; end",
"def verdi; end",
"def final; end",
"def isolated; end",
"def isolated; end",
"def schubert; end",
"def g; end",
"def g; end",
"def stdouts; end",
"def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"def malts; end",
"def gounod; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end"
] |
[
"0.6346111",
"0.623553",
"0.60634243",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5997114",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5989041",
"0.5951523",
"0.5950198",
"0.5883429",
"0.58706427",
"0.5845493",
"0.5845493",
"0.575334",
"0.57481706",
"0.57400656",
"0.5722583",
"0.56809986",
"0.5677086",
"0.56445926",
"0.56351864",
"0.563233",
"0.56280786",
"0.56166345",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.559515",
"0.5594907",
"0.55930567",
"0.5588525",
"0.5588525",
"0.5587227",
"0.55864066",
"0.5568044",
"0.5567045",
"0.5564744",
"0.5543971",
"0.55437225",
"0.5536659",
"0.5536394",
"0.5536394",
"0.55281526",
"0.55107105",
"0.55107105",
"0.551005",
"0.5509711",
"0.5505537",
"0.5501873",
"0.54911864",
"0.54911864",
"0.54911864",
"0.54911864"
] |
0.0
|
-1
|
We will consider a, e, i, o, and u as vowels for this Kata. The input string will only consist of lower case letters and/or spaces.
|
def getCount(inputStr)
return inputStr.count("aeiou")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vowels (string)\r\n if string.class == String\r\n vowels(string.split(\"\").concat([ [] ]))\r\n else \r\n if string[0].class == String \r\n case string[0]\r\n when \"A\",\"a\",\"E\",\"e\",\"I\",\"i\",\"O\",\"o\",\"U\",\"u\"\r\n vowels(string.slice(1..-2).concat( [string[-1].concat([string[0]])] ))\r\n else\r\n vowels(string.drop(1)) \r\n end \r\n else\r\n return string[0]\r\n end\r\n end\r\nend",
"def vowels_6(words)\n words.downcase.match(/a|e|i|o|u/).to_s\nend",
"def vowels (string)\n # Your code here\nend",
"def vowels(string)\r\n new_string = []\r\n string.split(\"\").each do |letter|\r\n if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\" ||letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\"\r\n new_string.push(letter)\r\n end\r\n end\r\n return new_string\r\nend",
"def vowel_adv(str)\r\n str = secret_name(str)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend",
"def vowel_recognition input\n\tinput, count = input.split(\"\").map! {|x| x =~ /[a,e,i,o,u,A,E,I,O,U]/ ? x = 1 : x = 0 }, 0\n\tinput.each_with_index { |x, ind| x == 0 ? 0 : count += ((ind + 1) * (input.length - ind)) } \n\tp count\nend",
"def vowels_with_case(letter)\n case letter\n when \"a\",\"e\",\"i\",\"o\",\"u\"\n return true\n else\n return false\n end\nend",
"def vowels (string)\r\n vowels = []\r\n string.chomp.split(//).each do |letter|\r\n if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\" || letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\"\r\n vowels.push(letter)\r\n end\r\n end\r\n return vowels\r\nend",
"def is_vowel char\n vowels = \"aeiou\".split(\"\")\n vowels.each do |vowel|\n if vowel == char.downcase\n true\n else\n false\n end\n end\nend",
"def disemvowel(string)\n \n i = 0\n while i < string.length\n if string[i] == \"a\" || string[i] == \"e\" || (string[i] == \"i\") || (string[i] == \"o\") || (string[i] == \"u\")\n string[i] = \"\"\n else \n i += 1\n end\n \n end \n \n return string\nend",
"def next_vowel(name)\n name = name.split('')\n name.each do |indivLetter| \n if indivLetter == \"a\"\n indivLetter.replace(\"e\")\n elsif indivLetter == \"e\"\n indivLetter.replace(\"i\")\n elsif indivLetter == \"i\"\n indivLetter.replace(\"o\")\n elsif indivLetter == \"o\"\n indivLetter.replace(\"u\")\n elsif indivLetter == \"u\"\n indivLetter.replace(\"a\")\n end\n end\nend",
"def is_vowel?(letter)\n case letter\n when \"a\", \"e\", \"i\", \"o\", \"u\"\n return true\n else\n return false\n end\nend",
"def vowel(letter)\n if (letter==\"a\" || letter==\"e\" || letter==\"i\" || letter==\"o\"|| letter==\"u\")\n true\n elsif (letter==\"A\" || letter==\"E\" || letter==\"I\" || letter==\"O\"|| letter==\"U\")\n true\n else\n false\n end\n end",
"def vowels (string)\r\n #Initialising empty vowels array\r\n vowels = []\r\n\r\n letters = string.split(\"\")\r\n letters.each do |vow|\r\n if vow == \"a\" || vow == \"e\" || vow == \"i\" || vow == \"o\" || vow == \"u\" || vow == \"A\" || vow == \"E\" || vow == \"I\" || vow == \"O\" || vow == \"U\"\r\n vowels.push(vow)\r\n end\r\n end\r\n return vowels\r\nend",
"def vowels_2(letter)\n case letter.downcase\n when \"a\" then true\n when \"e\" then true\n when \"i\" then true\n when \"o\" then true\n when \"u\" then true\n else false\n end\nend",
"def vowels_5(letter)\n letter.downcase.match(/a|e|i|o|u/) != nil\nend",
"def vowels(string)\r\n # Your code here\r\n text = string.split(//)\r\n temp = []\r\n VOWELS.each do |v|\r\n text.each do |c|\r\n if v == c \r\n temp << c \r\n end\r\n end\r\n end\r\n temp \r\nend",
"def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=>\"o\",\n \"o\"=>\"u\",\n \"u\"=>\"a\"\n }\n vowels = \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else\n char\n end\n end\n\n return new_arr.join(\"\")\nend",
"def ordered_vowel_word?(word)\nend",
"def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend",
"def only_vowels?(str)\n vowels = \"aeiou\"\n new_str = \"\"\n words = str.split(\"\")\n words.each do |char|\n if vowels.include?(char)\n new_str << char\n end\n end\n new_str\nend",
"def is_alt(s)\n vowels = %w(a e i o u)\n test = s.chars.map { |letter| vowels.include?(letter) ? 1 : 0 }\n test.each_with_index { |char, index| return false if char == test[index+1] }\n true\nend",
"def vowels_4(letter)\n letter = letter.downcase\n letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\nend",
"def disemvowel(string)\n\nend",
"def disemvowel str\n\n\tstr.gsub(/[aeiou]/,'')\n\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n \n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n \n return new_chars.join(\"\")\nend",
"def vowels(arr)\n arr.each do |item|\n if item.tr!(\"aeiou\",\"\")\n end\n end\nend",
"def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=> \"o\",\n \"o\" => \"u\",\n \"u\"=> \"a\"\n }\n\n vowels= \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else \n char \n end \n end \n return new_arr.join(\"\")\nend",
"def next_vowel(str)\n\t\tvowels = ['a', 'e', 'i', 'o', 'u']\n\t\tstr = str.split('')\n\t\tnew_str = str.map do |char|\n\t\t\tif vowels.include?(char)\n\t\t\t\tvowels.rotate(1)[vowels.index(char)]\n\t\t\telse\n\t\t\t\tchar\n\n\t\t\tend\n\t\tend\n\tend",
"def vowel_adv(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n str = str.split('')\n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n else\n char\n end\n end\n str_new.join\nend",
"def vowel_cipher(string)\n \n vowels = \"aeiou\"\n new = \"\"\n\n string.each_char do |char|\n if vowels.include?(char)\n #mode = vowels.index(char)\n new << vowels[vowels.index(char) - 4]\n else \n new << char\n end \n end \n\n return new \nend",
"def vowel_recognition(s)\n (0...s.size).map {|i| s[i] =~ /[aeiou]/i ? (s.size - i) * (i + 1) : 0}.sum\nend",
"def vowel_swapper(string)\n next_vowel_characters = ''\n characters = string.split('')\n vowels = 'aeiou'\n vowel_conversions = {'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a'}\n # Iterate through vowels and push it into vowels_characters\n characters.each do |character|\n if vowels.include?(character)\n next_vowel_characters += vowel_conversions[character]\n else\n next_vowel_characters += character\n end\n end\n next_vowel_characters\nend",
"def only_vowels?(str)\n arrString = str.split('')\n arrString.each do |char|\n if ['a', 'e', 'i', 'o', 'u'].include?(char) == false\n return false\n else\n next\n end\n end\n return true\nend",
"def is_vowel?(letter)\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(letter)\n return true \n else \n return false \n end \nend",
"def ordered_vowel_words(string)\n output_string = []\n string.scan(/\\w+/).each {|word| output_string << word if word_valid?(word) }\n output_string\n (string.split.size == 1 && word_valid?(string) == false) ? \"\" : output_string.join(' '))\nend",
"def is_vowel?(letter)\n \"aeiou\".include?(letter)\n end",
"def str_vowel_replace(input)\n vowels = ['a', 'e', 'i', 'o', 'u']\n # convert string to array\n str_ary = input.split('')\n # iterate over string\n str_ary.each do |i|\n puts i\n # check for vowel\n puts i if vowels.include? i\n\n end\nend",
"def next_vowel (str)\r\n\tvowels = ['a', 'e', 'i', 'o', 'u']\r\n\tstr = str.chars\r\n\tstr.map do |char|\r\n\t\tif vowels.include?(char)\r\n\t\t\tvowels.rotate(1)[vowels.index(char)]\r\n\t\telse\r\n\t\t\tchar\r\n\t\tend\r\n\tend\r\n\tstr = str.strip!\r\nend",
"def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend",
"def vowels (string)\n vowel_list = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n result = []\n string.split(\"\").each do |letter|\n if vowel_list.include? letter.downcase\n result.push letter\n end\n end\n return result\nend",
"def vowel_cipher(string)\n\tvowels = \"aeiou\"\n \tstr = \"\"\n \tstring.each_char do |c|\n if vowels.include?(c)\n idx = vowels.index(c)\n idx += 1\n if idx > 4\n idx = (idx % 5)\n end\n str += vowels[idx]\n else\n str += c\n end\n end\n \treturn str\nend",
"def disemvowel(str)\n lookup = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n characters = str.split('')\n characters.each_with_index do |value, index|\n lookup.each_with_index do |v, i|\n characters[index] = characters[index].include?(v) ? '' : characters[index]\n end\n end\n characters.join('') \nend",
"def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end",
"def disemvowel(str)\n string = ''\n str.each_char do |x|\n if /[^aeiou]/i.match(x)\n string << x\n end\n end\n print string\nend",
"def starts_with_vowel?(str)\n @str= str.capitalize\n (@str[0] == 'A' or @str[0] == 'E' or @str[0] == 'I' or @str[0] == 'O' or @str[0] == 'U') ? true : false\nend",
"def has_vowel?(word)\n word.each_char do |letter|\n if is_vowel?(letter)\n return true\n end\n end\n return false\nend",
"def vowel_cipher(string)\n\tvowels = \"aeiou\"\n \tcipher = \"\"\n \n \tstring.each_char do |char|\n \tif vowels.include?(char)\n \tidx = vowels.index(char)\n \tchar = vowels[(idx + 1) % 5]\n end\n \tcipher += char\n end\n \n \treturn cipher\nend",
"def devowel(str)\n new_str = \"\"\n vowels = \"aeiou\"\n\n str.downcase.each_char do |char|\n if !vowels.include?(char)\n new_str += char\n end\n end\n return new_str\nend",
"def has_vowels?(word)\nend",
"def vowel_cipher(string)\n\tvowels = \"aeiou\"\n\n new_vowel = string.split(\"\").map do |char|\n if vowels.include?(char)\n prev_idx = vowels.index(char)\n new_idx = (prev_idx + 1) % vowels.length\n vowels[new_idx]\n else\n char\n end\n end\n return new_char.join(\"\")\nend",
"def vowel? (char)\n 'aeiou'.include? (char) \nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n string.each_char do |char|\n if char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\"\n new_char = vowels.index(char)\n new_string += vowels[(new_char + 1) % 5]\n else\n new_string += char\n end\n end\n\n return new_string\nend",
"def vowels_3(letter)\n letter = letter.downcase\n return true if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\n false\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \nend",
"def vowel_converter(string)\r\n\tname_array = string.split('')\r\n vowel = ['a', 'e', 'i', 'o', 'u']\r\n counter = 0\r\n vowel_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of vowels, compares them with name, and changes vowels in name\r\n \twhile vowel_counter < vowel.length\r\n \t\tif name_array[counter] == vowel[vowel_counter]\r\n if name_array[counter] == 'u'\r\n \tname_array[counter] = 'a'\r\n break\r\n else\t\r\n \t\t name_array[counter] = vowel[vowel_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n vowel_counter += 1\r\n end\r\n counter += 1\r\n vowel_counter = 0\r\n end \r\n return name_array\r\nend",
"def vowel_cipher(string)\r\n vowels = 'aeiou'\r\n newString = ''\r\n string.each_char do |char|\r\n if vowels.include?(char)\r\n newString += vowels[(vowels.index(char) + 1) % 5]\r\n else\r\n newString += char\r\n end\r\n end\r\nreturn newString\r\nend",
"def disemvowel(str)\n # str.gsub(\"aeiou\", \"\")\n # str.split - ['a'],['e'],['i'],['o'],['u'].join(' ')\n # str.tr('aeiou', '').join(' ')\n\n str.tr('aeiouAEIOU', '')\nend",
"def vowels(str)\n arr_of_vowels = []\n vowels = \"aeiou\"\n str.each_char do |char|\n if vowels.include?(char)\n arr_of_vowels << char\n end\n end\n arr_of_vowels\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n\n return new_chars.join(\"\")\nend",
"def vowel_cipher(string)\n \n vowels = \"aeiou\"\n\n new = \"\"\n\n string.each_char do |char|\n if vowels.include?(char)\n # print vowels.index(char)\n mode = vowels.index(char)\n new << vowels[mode - 4]\n else \n new << char\n end \n \n end \n\n return new \nend",
"def count_vowels(string)\ni = 0\nvowels = 0\n while i<string.length do\n if string[i] == \"a\" || string[i] == \"e\" || string[i] == \"i\" || string[i] == \"o\" || string[i] == \"u\"\n vowels += 1\n end\n i += 1\n end\nputs vowels\nend",
"def nearby_az(string)\r\n idx = 0\r\n vowel_a = \"\"\r\n while idx < string.length\r\n if string[idx]!=\"a\"\r\n idx = idx + 1\r\n end\r\n if string[idx]==\"a\"\r\n if string[idx+1]==\"z\"\r\n return true\r\n elsif string[idx+2]==\"z\"\r\n return true\r\n elsif string[idx+3]==\"z\"\r\n return true\r\n else\r\n return false\r\n end\r\n else\r\n return false\r\n end\r\n idx = idx + 1\r\n end\r\nend",
"def is_vowel letter\n return false if letter.class != String || letter.length != 1\n vowels = \"aeiouAEIOU\"\n vowels.include? letter\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \n return new_chars.join(\"\")\nend",
"def is_vowel(word, pos)\n# \"u\" is not considered a vowel in pig latin\n vowels = [\"a\", \"e\", \"i\", \"o\"]\n is_vowel = false\n vowels.each do |vowel|\n if(word[pos] == vowel)\n is_vowel = true\n end\n end\n return is_vowel\nend",
"def devowel(str)\r\n # your code goes here\r\n vowels = ['a','A','e','E','i','I','o','O','u','U']\r\n temp = \"\"\r\n\r\n i = 0\r\n while i < str.length\r\n if vowels.include?(str[i]) == false\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n\r\n temp\r\nend",
"def make_vowel_change(first)\n\tnew_first = first.split(\"\") \n\ti = 0\n\tfake_firstname = \"\"\n\tlengthfirst = first.length\n\twhile i < lengthfirst\n\tif new_first[i] == \"a\"\n\t\tfake_firstname += \"e\"\n\telsif new_first[i] == \"e\"\n\t\tfake_firstname += \"i\"\n\telsif new_first[i] == \"i\"\n\t\tfake_firstname += \"o\"\n\telsif new_first[i] == \"o\"\n\t\tfake_firstname += \"u\"\n\telsif new_first[i] == \"u\"\n\t\tfake_firstname == \"a\"\n\telsif (new_first[i] != \"a\" || new_first[i] !=\"e\" || new_first[i] != \"i\" || new_first[i] != \"o\" || new_first[i] != \"u\")\n\t\tfake_firstname += new_first[i]\n\tend\n\ti+=1 \n\tend \n\tfake_firstname\nend",
"def devowel(str)\n vowels = \"aeiou\"\n devoweled_string = \"\"\n str.each_char do |ch|\n unless vowels.include?(ch.downcase)\n devoweled_string << ch\n end\n end\n devoweled_string\nend",
"def devowel(str)\n vowels = 'aeiou'\n result = ''\n str.downcase.each_char do |char|\n result += char unless vowels.include?(char)\n end\n result\nend",
"def is_vowel(letter)\n \"aeiou\".include?(letter.downcase)\nend",
"def is_a_vowel(letter, space = false)\r\r\n letter.upcase\r\r\n return letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\" || (letter == \"X\" && space == true)\r\r\n end",
"def vowels2(string)\r\n vowels_array = []\r\n string.scan(/[aeiouAEIOU]/) { |letter| vowels_array.push(letter)}\r\n return vowels_array\r\nend",
"def next_vowel(letter)\n\tif letter == (\"a\")\n\t\tletter = \"e\"\n\telsif letter == (\"e\")\n\t\tletter = \"i\"\n\telsif letter == (\"i\")\n\t\tletter = \"o\"\n\telsif letter == (\"o\")\n\t\tletter = \"u\"\n\telse\n\t\tletter = \"a\"\n\tend\nend",
"def vowel string\n # string = string.split(\"\")\n # string = string.downcase\n string = string.delete 'AaEeIiOoUu'\n # string = string.capitalize\n\nend",
"def disemvowel string\n\tstring.chars.map {|char| \"aeiouAEIOU\".include?(char) ? nil : char }.join\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n # string.each_char do |ch|\n # if vowels.include?(ch)\n # old_idx = vowels.index(ch)\n # new_idx = (old_idx + 1) % 5\n # new_vowel = vowels[new_idx]\n # new_string << new_vowel\n # else\n # new_string << ch\n # end\n # end\n\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n new_string = new_chars.join(\"\")\n\n return new_string\nend",
"def vowels (string)\r\n # Your code here\r\n vowels = ['a','e','i','o','u']\r\n find = []\r\n for letter in string.chars\r\n find << letter if \r\n vowels.include?(letter.downcase)\r\nend\r\nreturn find\r\nend",
"def devowel(str)\n # your code goes here\n no_vowel_str = ''\n vowels = 'aeiou'\n str.downcase.each_char do |ch|\n if !vowels.include?(ch)\n no_vowel_str << ch\n end\n end\n no_vowel_str\nend",
"def count_vowels(str)\n vowels = 0\n str.split('').each do |char|\n vowels += 1 if ['a', 'e', 'i', 'o', 'u'].include? char\n end\n vowels\nend",
"def elim_vowels(string)\r\n string.downcase.delete(\"aeiou\")\r\nend",
"def reverberate(sentence)\n vowels = \"aeiou\"\n words = sentence.split(\" \")\n converted_sentence = []\n\n words.each do |word|\n if word.length < 3\n converted_sentence << word\n elsif vowels.include?(word[-1].downcase)\n converted_sentence << word + word[0].downcase + word[1..-1]\n else\n uppercase = word[0] == word[0].upcase ? true : false\n count = word.length - 1\n\n while count > 0\n if vowels.include?(word[count])\n new_word = word + word[count..-1]\n converted_sentence << new_word\n break\n end\n count -= 1\n end\n end\n end\n\n converted_sentence.join(\" \")\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n cipher = \"\"\n string.each_char do |char|\n if vowels.include?(char)\n idx = vowels.index(char)\n char = vowels[(idx + 1) % 5]\n end\n cipher += char\n end\n return cipher\nend",
"def no_vowels str\n # delete the vowels in the str if str has vowels a, e, i, o, u\n str.delete 'aeiouAEIOU'\nend",
"def vowel_cipher(string)\n vowels = 'aeiou'\n string.each_char.with_index do |char, i|\n if vowels.include?(char)\n vowel_index = vowels.index(char)\n string[i] = vowels[(vowel_index + 1) % vowels.length]\n end\n end\n string\nend",
"def vowel_censor(string)\n vowels=[\"a\",\"e\",\"i\",\"o\",\"u\"]\n new_string=\"\"\n string.each_char do |char|\n if vowels.include? char\n new_string << \"X\"\n else\n new_string << char\n end\n\n # while i<=string.length\n # if char==string[i]\n # new_string+=\"X\"\n # added = true\n # else\n # new_string+=char\n # end\n # i+=1\n # end\n end\n puts new_string\n return new_string\nend",
"def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend",
"def pig_latin_word(word)\n vowels = \"aeiou\" # vowel string to reference to contain all vowels\n \n # abcdefghijklmnopqrstuvwxyz\n\n # check if the word starts with a vowel, then add yay\n if vowels.include?(word[0]) # word is a string and check if starts with first position if its a vowel - check this character\n return word + \"yay\" # return + add string yay\n end \n\n # iterate through every letter of each word\n word.each_char.with_index do |char, idx| # iterate and grab every character\n if vowels.include?(char) # we know the behavior of each char is to iterate from left to right\n before_vowel = word[0...idx] # up to but not including vowel -- gives you `tr`\n after_vowel = word[idx..-1] # very last position, inclusive -- gives you `ash`\n return after_vowel + before_vowel + \"ay\"\n end\n end\n\nend",
"def vocales str\n puts !!(str =~ /[aeiou]/)\nend",
"def vowel_swap (secret_name)\n\t#first separate string into an array of characters\n\t#the loop through looking for vowels\n\t#use each do loop to then go through each character\n\t#check to see if it is a vowel using gsub and replace with the next vowel\n\t#have to replace with an uppercase vowel, so when a becomes 'e' and then I check for 'e's, those 'a's don't become 'i's and etc\n\tsecret_name = secret_name.split('')\n\tsecret_name.each do |letters|\n\t\tletters.gsub!(/[a]/, \"E\")\n\t\tletters.gsub!(/[e]/, \"I\")\n\t\tletters.gsub!(/[i]/, \"O\")\n\t\tletters.gsub!(/[o]/, \"U\")\n\t\tletters.gsub!(/[u]/, \"A\")\n\tend\n\t#then downcase eveything\n\tsecret_name.map!{|letter| letter.downcase}\n\t\nend",
"def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end",
"def is_vowel(char)\n # takes in a string of one character\n # determines whether the character is a vowel\n # ignores case\n # handles weird inputs gracefully\n\n if char.class != String || char.length != 1\n return false\n else\n vowels = \"aeiou\"\n vowels.include? char.downcase\n end\nend",
"def ordered_vowel_words(str)\n final_array = []\n word_array = str.split\n word_array.map do |word|\n if ordered_vowel_word?(word) == true\n final_array.push(word)\n else\n end\n end\n final_array.join(\" \")\nend",
"def vowel_cipher(str)\n new_str = ''\n vowel = 'aeiou'\n\n str.each_char do |char|\n if vowel.include?(char)\n old_idx = vowel.index(char)\n new_idx = (old_idx + 1) % vowel.length\n new_str += vowel[new_idx]\n else\n new_str += char\n end\n end\n\n return new_str\nend",
"def only_vowels?(str)\n vowels = \"aeiou\"\n str.split(\"\").all? do |char| #splits string into seperate array (aaoeee) -> [a,a,o,e,e,e]\n vowels.include?(char) #checks if the whole array includes any vowels [iou] -> true [cat] -> false\n end\nend",
"def vowel_cipher(string)\n vowels = \"aeiou\"\n new_arr = []\n string.each_char do |char|\n if vowels.include?(char)\n old_index = vowels.index(char)\n new_index = (old_index + 1)%5\n new_arr << vowels[new_index]\n else\n new_arr << char\n end\n \n end\n new_arr.join(\"\")\nend",
"def num_vowels(str)\n # your code goes here\n new_str = str.downcase\n vowels ='aeiou'\n count = 0\n new_str.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n\n count\nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend",
"def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend",
"def reverse_vowels(s)\n letters = s.chars \n vowels = letters.select { |letter| letter.downcase == 'a' || letter.downcase == 'e' \n letter.downcase == 'i' || letter.downcase == 'o'\n letter.downcase == 'u'}\n \nend",
"def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend"
] |
[
"0.7775484",
"0.7441667",
"0.7415979",
"0.7412654",
"0.7409381",
"0.7366463",
"0.73115844",
"0.73064893",
"0.7305904",
"0.7298773",
"0.72894734",
"0.72798187",
"0.7273071",
"0.7244948",
"0.7210117",
"0.7205979",
"0.71921057",
"0.7153378",
"0.7142784",
"0.7084901",
"0.7077123",
"0.706939",
"0.70685923",
"0.70604837",
"0.70458925",
"0.70446634",
"0.7041622",
"0.7039801",
"0.7016863",
"0.70165086",
"0.7015367",
"0.7010449",
"0.7007018",
"0.70029694",
"0.69918567",
"0.69891554",
"0.6971554",
"0.69655615",
"0.6947747",
"0.69456416",
"0.6941914",
"0.69411755",
"0.6939213",
"0.6935649",
"0.69320196",
"0.69269985",
"0.6921182",
"0.69177216",
"0.69109917",
"0.69103175",
"0.68993115",
"0.6897966",
"0.68972",
"0.6892999",
"0.68907064",
"0.68894833",
"0.6886642",
"0.6882599",
"0.68810004",
"0.68702835",
"0.6869574",
"0.68686867",
"0.68684477",
"0.6867717",
"0.6866639",
"0.68646896",
"0.68588763",
"0.68538266",
"0.6850803",
"0.68485",
"0.6847907",
"0.6842978",
"0.6838247",
"0.6837739",
"0.6837495",
"0.6828091",
"0.6823541",
"0.68225646",
"0.68117225",
"0.6809924",
"0.68065",
"0.68061554",
"0.68033093",
"0.6801934",
"0.68014354",
"0.6801367",
"0.6799364",
"0.67934746",
"0.679047",
"0.6780124",
"0.6773488",
"0.6764007",
"0.6763837",
"0.676382",
"0.6757891",
"0.6755",
"0.6753346",
"0.6751749",
"0.67514884",
"0.67439216",
"0.6742594"
] |
0.0
|
-1
|
Binomial, a simple sum of Bernoulli samples.
|
def rbinomial(mean, prob)
((1..mean).map { rbernoulli(prob) }).sum
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def binomial(n,k)\n return 1 if n-k <= 0\n return 1 if k <= 0\n fact(n) / ( fact(k) * fact( n - k ) )\n end",
"def binomial_coefficient(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min\n permutations(n,k).quo(factorial(k))\n # The factorial way is\n # factorial(n).quo(factorial(k)*(factorial(n-k)))\n # The multiplicative way is\n # (1..k).inject(1) {|ac, i| (ac*(n-k+i).quo(i))}\n end",
"def binomial_coefficient(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min\n binding.pry\n permutations(n,k).quo(factorial(k))\n # The factorial way is\n # factorial(n).quo(factorial(k)*(factorial(n-k)))\n # The multiplicative way is\n # (1..k).inject(1) {|ac, i| (ac*(n-k+i).quo(i))}\n end",
"def binom(n, k)\n return 1 if k.zero? || (n - k).zero?\n return n if k == 1 || n - k == 1\n\n factorial(n) / (factorial(k) * factorial(n - k))\n end",
"def binom(trials, successes, results = {})\n return 1 if k == 0\n return 0 if n == 0\n \n return results[[n,k]] if results.key?([n,k])\n \n (binom(n - 1, k) + binom(n - 1, k - 1)).tap do |res|\n d[[n, k]] = res\n end\n end",
"def exact_regularized_beta(x,a,b)\n return 1 if x==1\n m=a.to_i\n n=(b+a-1).to_i\n (m..n).inject(0) {|sum,j|\n sum+(binomial_coefficient(n,j)* x**j * (1-x)**(n-j))\n }\n\n end",
"def binomial_coefficient_multiplicative(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min\n (1..k).inject(1) {|ac, i| (ac*(n-k+i).quo(i))}\n end",
"def binomial_coefficient(n, k)\n return 1 if n == k || k == 0\n return n if k == 1\n return -1 if n < k\n\n # calculate factorials\n fact_n = (2..n).inject(1) { |carry, i| carry * i }\n fact_k = (2..k).inject(1) { |carry, i| carry * i }\n fact_n_sub_k = (2..(n - k)).inject(1) { |carry, i| carry * i }\n\n fact_n / (fact_k * fact_n_sub_k)\n end",
"def binary(digits: 4)\n bin = ''\n digits.times { bin += rand(2).to_s(2) }\n bin\n end",
"def r_binom_CI(x= 0, n= 0,temp_r_dir = File.dirname($0))\n temp_r_result = temp_r_dir + \"/temp_r_result\"\n print `Rscript -e 'binom.test(#{x},#{n})$conf.int[1];binom.test(#{x},#{n})$conf.int[2]' >#{temp_r_result}`\n lines = File.readlines(temp_r_result)\n low = lines[0].chomp[4..-1].to_f\n high = lines[1].chomp[4..-1].to_f\n File.unlink(temp_r_result)\n return [low.round(5), high.round(5)]\nend",
"def randbinary(problem)\n s = \"\"; 1500.times{|i| s << rand(2).to_s }; s\n end",
"def n_to_binary number\n bin_array = []\n until number == 0\n if number % 2 == 0\n bin_array << 0\n else \n bin_array << 1\n end\n number = number / 2\n end\n bin_array.join\nend",
"def altern(boul, prob, n)\n som = 0\n u = rand\n (1..n).to_a.each do |i|\n som += prob[i]\n # puts \"som is #{som}\"\n # puts \"u is #{u}\"\n # another typo, the paper says u >= som which will always return either\n # boul[1] or boul[10]\n if som >= u\n return boul[i]\n end\n end\n return boul[n]\n end",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 2 + bunny(n - 1) unless n.zero?\n return 0 if n.zero?\nend",
"def bin_decision(threshold)\n tmp = rand(1..100)\n if(tmp <= threshold)\n bin = 1\n else\n bin = rand(2..10)\n end\n return bin\n end",
"def bunny(n)\n\treturn 0 if n == 0\n\n\treturn 2 + bunny(n - 1)\nend",
"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 bunny(n)\n return 0 if n == 0\n return n + bunny(n / 2.0 )\n # This passes the tests, though technically it never hits 0 (just approaches 0)\n # An alternate solution is to return 1 + bunny(n - 0.5) but that would have a slower time complexity O(n)\nend",
"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 probability\n rand(1..100)\n end",
"def <<(input_bit)\n @buffer << (@pseudorandom_number_generator.generate_bit ^ input_bit)\n end",
"def binary(num)\n if num < 0\n positiveNumBinary = calculate_binary(num.abs, 'negative')\n else\n return calculate_binary(num, 'positive')\n end\n\nend",
"def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n if n == 0\n return 0\n else\n return 2 + bunny(n - 1)\n end\nend",
"def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend",
"def toBinary(n)\n\ttop = Math.log2(n).to_int\n\tlist = []\n\twhile top >= 0\n\t\tn >= 2 ** top ? (list << 1 and n -= 2 ** top) : (list << 0)\n\t\ttop -= 1\n\tend\n\tlist.join\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny( n - 1 )\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def wonky_coins(n)\n return 1 if n == 0\n\n coins = []\n coins << n/2 << n/2 << n/4 if n != 0\n\n coin_total = 0\n\n coins.each do |coin|\n \tcoin_total += wonky_coins(coin) if coin > 0\n \tcoin_total += 1 if coin == 0\n end\n\n return coin_total\nend",
"def binomial_coefficient_gamma(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min \n # First, we try direct gamma calculation for max precission\n\n val=gamma(n + 1).quo(gamma(k+1)*gamma(n-k+1))\n # Ups. Outside float point range. We try with logs\n if (val.nan?)\n #puts \"nan\"\n lg=loggamma( n + 1 ) - (loggamma(k+1)+ loggamma(n-k+1))\n val=Math.exp(lg)\n # Crash again! We require BigDecimals\n if val.infinite?\n #puts \"infinite\"\n val=BigMath.exp(BigDecimal(lg.to_s),16)\n end\n end\n val\n end",
"def binary(num)\n result = []\n\n until num == 0\n result.unshift(num % 2)\n num /= 2\n end\n\n result.empty? ? \"0\" : result.join\nend",
"def bunny(n) \n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def random_binary(n_bytes)\n #(Array.new(n_bytes) { rand(0x100) }).pack('c*')\n SecureRandom.random_bytes(64)\n end",
"def random_binary(n_bytes)\n #(Array.new(n_bytes) { rand(0x100) }).pack('c*')\n SecureRandom.random_bytes(64)\n end",
"def bunny(n)\n if n === 0\n return 0\n end\n\n return 2 + bunny(n-1)\nend",
"def logistic(alpha, beta)\n ( -beta - Math.log(1/random - 1) ) / alpha\n end",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def add_binary(a,b)\r\n sum = a + b\r\n arr = []\r\n if sum == 1\r\n p \"1\"\r\n else #if sum != 1\r\n arr.push(sum % 2) \r\n while sum / 2 != 0\r\n sum = sum / 2\r\n arr.push(sum % 2)\r\n end\r\n p arr.reverse.join\r\n end\r\nend",
"def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 0 if n == 0\n return 2 + bunny(n - 1)\n\nend",
"def bunny(n)\n return 0 if n == 0\n\n return (2 + (2 * (n - 1)))\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2)) / current_power_of_2).to_s\n \n break if num < current_power_of_2 * 2\n current_power_of_2 *= 2\n end\n \n num_bin.to_i\n end",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n - 1) if n >= 1\nend",
"def bunny(n)\n return 0 if n == 0\n\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n if n < 1\n return 0\n else \n return 2 + bunny(n-1)\n end\nend",
"def binaries\n value = 1 # initialize\n lambda { value += value } # the lambda is returned to the caller\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 if n == 1\n return bunny(n - 1) + bunny(1)\n\nend",
"def suma_pares(x)\n\tsum = 0\n\t(1..x).each do |i|\n\t\tif i.even?\n\t\t\tsum = sum + i\n\t\tend\n\tend\n\treturn sum\nend",
"def test_powers_of_two\n 100.times do |p|\n n = 2 << p\n\n assert_equal n, n.to_ber.read_ber\n end\n end",
"def bunny(n)\n return 0 if n == 0\n return 2 if n == 1\n return 2 + bunny(n - 1)\nend",
"def bunny(n)\n if n == 0\n return 0\n else\n return 2 + bunny(n - 1)\n end\nend",
"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 random_number( bits )\n m = (1..bits-2).map{ rand() > 0.5 ? '1' : '0' }.join\n s = \"1\" + m + \"1\"\n s.to_i( 2 )\n end",
"def bunny(n)\n if n == 0\n return 0\n elsif n == 1\n return 2 \n else\n 2 + bunny(n - 1)\n end \nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def stringy(num, bit = 1)\n bin_arr = []\n num.times { |n| n.even? ? bin_arr << (0 + bit) : bin_arr << (1 - bit) }\n bin_arr.join\nend",
"def bunny(n)\n if n <= 0\n return 0\n else\n return 2 + bunny(n-1)\n end\nend",
"def binary(integer)\n\nend",
"def binary(integer)\n\nend",
"def bi(i)\n string = []\n i.times do |n|\n if n.even?\n string << \"1\"\n else\n string << \"0\"\n end\n end\n string.join\nend",
"def random_bitstring(num_bits)\n return (0...num_bits).inject(\"\"){|s,i| s<<((rand<0.5) ? \"1\" : \"0\")}\nend",
"def add_binary(a,b)\n #your code here\n sum = a + b\n return sum.to_s(2)\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 bunny(n)\n if n % 2 == 0\n return 0\n else\n return n + bunny(2-1)\n end\nend",
"def add_binary(a,b)\n sum = (a+b).to_s(2)\nend",
"def bunny(n)\n if n == 0\n return 0\n else\n return 2 + bunny(n-1)\n end \nend",
"def bunny(n)\n return n if n == 0\n return 2 + bunny(n-1)\n end",
"def add_binary(a,b)\n total = a+b\n total.to_s(2)\nend",
"def power(b, n)\n\n\t# b^n.to_i\n\n\tb ** n\n\nend",
"def gen_binomial_tree_prices\n u = udp[:u]\n d = udp[:d]\n tree = [[initial_per_share]]\n t = 0\n while t < duration - 1e-6\n t += dt\n this_arr = tree.last.collect { |s| s * d }\n this_arr << tree.last.last * u\n tree << this_arr\n end\n tree\n end",
"def logb(x, b = 2)\n Math.log(x) / Math.log(b)\n end",
"def bunny(n)\n return 0 if n <= 0\n return 2 if n == 1\n return 2 + bunny(n-1)\nend",
"def to_bin(separator='')\n Array.new(factorbase.size){|i| (factors[factorbase[i]] || 0) % 2 }.join(separator)\n end",
"def generate_fake_binary_sequence\n s = \"\"\n 1500.times{|i| s << kernel.rand(1) }\n s\n end",
"def test_exercise_1127\n @rec_calls = 0\n binomial(10, 4, 0.25)\n predicate = Proc.new { |actual|\n Math.log10(actual).truncate == Math.log10(@rec_calls).truncate\n }\n\n params = [10, 4]\n verify_method :exercise_1127,\n :with => [{params: params, predicate: predicate}]\n end",
"def onemax(vector)\n return vector.inject(0.0){ |sum,v| sum + ((v==\"1\") ? 1 : 0)}\nend",
"def sum_of_power(p)\n result = []\n powers = 0.upto(10).map {|n| n**p}\n 2.upto(p.get_max_num) do |i|\n num = i.get_base_array(10).map {|n| powers[n]}\n if i == num.inject(0) {|t,n| t + n}\n result << i\n end\n end\n return result\nend",
"def xor_b\n end",
"def bunny(n)\n return 0 if n == 0\n return 2 if n == 1\n return 2 + bunny(n-1)\nend",
"def primordial; end",
"def add_binary(a, b)\n (a + b).to_s(2)\nend",
"def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend",
"def calculate_weighted_sum(base, weight_factors); end",
"def isbn(base: T.unsafe(nil)); end",
"def y()\n val = @b;\n @n.times {|i|\n val += @wn[i] * @xn[i];\n }\n return val;\n end",
"def biased_random_number(prob_arr)\n # http://stackoverflow.com/questions/479236/how-do-i-simulate-biased-die-in-python\n rand_roll = rand()\n sum = 0 \n result = 0\n prob_arr.each do |i|\n sum += i\n if rand_roll < sum\n return result\n end\n result += 1\n end\n # puts \"prob_arry:\" + prob_arr.to_s\n # puts \"rand_roll: \" + rand_roll.to_s\n # puts prob_arr.join(\" \")\n return result - 1\n end",
"def to_bin(number)\n number = Integer(number);\n if(number == 0)\n return 0;\n end\n ret_bin = \"\";\n ## Untill val is zero, convert it into binary format\n while(number != 0)\n ret_bin = String(number % 2) + ret_bin;\n number = number / 2;\n end\n return ret_bin;\n end",
"def activate\n @output = (1.0 / (1.0 + Math.exp(-1 * self.weightedsum - @bias)))\n @output\n end",
"def count_bits(n)\r\n # TODO: Program me\r\n binary_array = []\r\n while n >= 2\r\n reminder = n % 2\r\n binary_array.unshift(reminder)\r\n n = n / 2\r\n end\r\n binary_array.unshift(n)\r\n \r\n sum = 0\r\n binary_array.each do |num|\r\n if num == 1\r\n sum += 1\r\n end\r\n end\r\n\r\n return sum\r\nend",
"def initialize(bits_per_symbol: , p_0: 0.5, p_1: 0.5 )\r\n raise ArgumentError.new(\"Probabilities of bits must add up to 1\") if p_0 + p_1 != 1\r\n @bits_per_symbol, @p_0, @p_1, @random_generator = bits_per_symbol, p_0, p_1, Random.new\r\n end",
"def activation(dendrites, nueron_number)\n\tweights=Array.new\n\ttotal_value=0\n\tfor i in 0...dendrites.size\n\t\tvalue=dendrites[i].print_value \n\t\tweights=dendrites[i].print_weight\n\t\ttotal_value=total_value + (weights[nueron_number-1]*value)\n\tend\n\treturn total_value\nend",
"def jacobi(a, n)\n if a == 0\n n == 1 ? 1 : 0\n elsif a.odd?\n negpow((a-1)*(n-1)/4) * jacobi(n%a, a)\n else\n negpow((a**2-1)/8) * jacobi(a/2, n)\n end\nend",
"def bunny(n)\n if n == 0\n return n\n else\n return 2 + bunny(n - 1)\n end\nend",
"def comb(m,n)\n num,denum=m,1;\n (2..n).each{|i| num*=(m-i+1); denum*=i}\n num/denum\nend"
] |
[
"0.649787",
"0.6391014",
"0.6376122",
"0.62458915",
"0.6124563",
"0.5773585",
"0.5683067",
"0.561799",
"0.54564595",
"0.5418322",
"0.5331472",
"0.5313237",
"0.52160627",
"0.5199694",
"0.5179689",
"0.51397675",
"0.51350796",
"0.5093536",
"0.50844187",
"0.5055865",
"0.5054107",
"0.50210345",
"0.5013586",
"0.49773058",
"0.49698684",
"0.49488562",
"0.49398297",
"0.4938441",
"0.49378142",
"0.4934588",
"0.4929513",
"0.4922229",
"0.49185994",
"0.49185994",
"0.490609",
"0.49060625",
"0.48936257",
"0.48894846",
"0.48716217",
"0.4857065",
"0.485255",
"0.48512033",
"0.48512033",
"0.48373568",
"0.48359224",
"0.48359224",
"0.48343685",
"0.48330042",
"0.48251027",
"0.48213664",
"0.48160294",
"0.4810926",
"0.48089373",
"0.4808858",
"0.48062792",
"0.480537",
"0.48053253",
"0.48042405",
"0.48037314",
"0.48037314",
"0.48037314",
"0.47971302",
"0.47944087",
"0.4789495",
"0.4789495",
"0.47814125",
"0.4771784",
"0.47710624",
"0.47708067",
"0.4770338",
"0.47633797",
"0.4763312",
"0.47625113",
"0.4760563",
"0.47581717",
"0.47507453",
"0.47479704",
"0.47367197",
"0.47364485",
"0.47338614",
"0.4725109",
"0.47192287",
"0.47134304",
"0.4711206",
"0.47105908",
"0.4710472",
"0.4709882",
"0.470234",
"0.46987712",
"0.46962512",
"0.46920636",
"0.46873054",
"0.46823144",
"0.4678878",
"0.4677983",
"0.4668456",
"0.46673286",
"0.4659781",
"0.46593755",
"0.46567747"
] |
0.76020145
|
0
|
N(0,1) sampling from the BoxMuller theorem, in two flavours. Note: Feel free to exchange the cos by sin.
|
def rnormal(mean, sd)
mean + (Math.sqrt(-2 * Math.log(rand)) * Math.cos(2 * Math::PI * rand)) * sd
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def box_muller\n θ = 2 * Math::PI * rand\n ρ = Math.sqrt(-2 * Math.log(1 - rand))\n scale = σ * ρ\n μ + scale * Math.cos(θ)\n end",
"def box_mueller( mean = 0.0, stddev = 1.0 )\n x1 = 0.0, x2 = 0.0, w = 0.0\n\n until w > 0.0 && w < 1.0\n x1 = 2.0 * rand - 1.0\n x2 = 2.0 * rand - 1.0\n w = ( x1 * x2 ) + ( x2 * x2 )\n end\n\n w = Math.sqrt( -2.0 * Math.log( w ) / w )\n r = x1 * w\n\n mean + r * stddev\nend",
"def standard_normal_sample\n rho = Math.sqrt(-2.0 * Math.log(rand.rand))\n theta = 2 * Math::PI * rand.rand\n tfn = rand.rand > 0.5 ? :cos : :sin\n rho * Math.send(tfn, theta)\n end",
"def randomn\n size = self.size\n case type = self.typecode\n when COMPLEX; type=FLOAT\n when SCOMPLEX; type=SFLOAT\n when FLOAT\n when SFLOAT\n else\n raise TypeError, \"NArray type must be (S)FLOAT or (S)COMPLEX.\"\n end\n rr = NArray.new(type,size)\n xx = NArray.new(type,size)\n i = 0\n while i < size\n n = size-i\n m = ((n+Math::sqrt(n))*1.27).to_i\n x = NArray.new(type,m).random!(1) * 2 - 1\n y = NArray.new(type,m).random!(1) * 2 - 1\n r = x**2 + y**2\n idx = (r<1).where\n idx = idx[0...n] if idx.size > n\n if idx.size>0\n\trr[i] = r[idx]\n\txx[i] = x[idx]\n\ti += idx.size\n end\n end\n # Box-Muller transform\n rr = ( xx * NMath::sqrt( -2 * NMath::log(rr) / rr ) )\n # finish\n rr.reshape!(*self.shape) if self.rank > 1\n rr = rr.to_type(self.typecode) if type!=self.typecode\n if RUBY_VERSION < \"1.8.0\"\n self.type.refer(rr)\n else\n self.class.refer(rr)\n end\n end",
"def volume_of_cube(n)\n return n * n * n\nend",
"def generate_sample(n=1)\n if self.respond_to? :inv_cdf\n (1..n).map{ inv_cdf(rand) }\n else\n (1..n).map{ generate_number }\n end\n end",
"def sample_variance\n @mutex.synchronize do\n @M_2 / (@items - 1)\n end\n end",
"def volume_of_a_cube(n)\n return n**3\nend",
"def sample_variance\n return 0 if length <= 1\n sum_of_squares / (length - 1)\n end",
"def create_norm_distancer(n)\n lambda do |b1, b2|\n ((b1.x - b2.x).abs**n + (b1.y - b2.y).abs**n) ** (1.0/n)\n end\nend",
"def skewness\n return 0.0 if n == 1\n cubed_dev = x.inject(0.0) { |sum, i| sum + (i - mean) ** 3 }\n cubed_dev / ((n - 1) * (sd ** 3))\n end",
"def shuffle_function1(game, index)\n r = Math.tan(game.seed + index / game.seed - index) - Math.sin(game.seed / index) + 336 * Math.sin(8 * index)\n n = r - r.floor\n (10 * n).floor\nend",
"def fvan(i, n, pmt)\n return pmt * (((1 + i) ** n) - 1) / i \n end",
"def sample(n=nil)\n if n\n choice = []\n _n = n.to_f\n each_with_index do |x,i|\n if rand < (_n/(i+1))\n if choice.size < n\n choice << x\n else\n choice[rand(n)] = x\n end\n end\n end\n choice\n else\n choice = nil\n each_with_index do |x,i|\n choice = x if rand(i+1) == 0\n end\n choice\n end\n end",
"def generateHull()\n # two dot ellipsis is inclusive\n return (rand(3.0..6.0))\nend",
"def sample_variance\n mean = self.mean\n sum = self.inject(0) do |accum, index|\n accum + (index - mean) ** 2\n end\n sum/(self.length - 1).to_f\n end",
"def volume_of_cube(side)\n return ( side ** 3 )\nend",
"def volume_of_cube(dimension)\n return dimension**3\nend",
"def kernel(samples, koef, v_n_1, v_n_2)\r\n samples.each { |x|\r\n v_n_1, v_n_2 = koef*v_n_1 - v_n_2 + x, v_n_1\r\n }\r\n return v_n_1, v_n_2\r\n end",
"def phi_norm(n)\n primes = n.prime_division.map(&:first)\n primes.map { |p| 1.0 - 1.0 / p }.inject(:*)\nend",
"def l(x); rand(x*@n); end",
"def multiply_by_1_5(n)\n n = n.to_i\n is_one_third = rand(3) == 0\n result = (n * 1.5).floor\n result += 1 if is_one_third && n.odd?\n result -= 1 if is_one_third && n.even?\n result\n end",
"def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(WIDTH), rand(40) - 50)\n shape = CP::Shape::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << Box.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end",
"def squared_nos_sigma(limit)\n i=0\n sum=0\n n = limit\n while i<=n do\n sum = sum + i*i\n i+=1\n end \n return sum\nend",
"def volume_of_cube(length_of_side)\n return length_of_side ** 3\nend",
"def build_distribution\n dist = Array.new(NUM_DICE * SIDES + 1, 0)\n (1..SIDES).each do |i|\n (1..SIDES).each do |j|\n dist[i+j] += 1\n end\n end\n\n # normalize to a probability\n (NUM_DICE..NUM_DICE * SIDES).each do |k|\n dist[k] = dist[k].to_f / 36.to_f\n end\n dist\nend",
"def volume_of_cube(s)\n return (s ** 3)\nend",
"def volume_of_cube(length)\n return length**3\nend",
"def volume_of_cube(length)\n return length**3\nend",
"def volume_of_cube(length)\n return length ** 3\nend",
"def rng\n box_muller\n end",
"def volume_of_cube(length)\n return length **3\nend",
"def volume_of_cube(length_of_the_side)\nreturn length_of_the_side.to_i**3\nend",
"def unit\n [\"teaspoon\", \"cup\", \"pinch\"].sample\nend",
"def initialize_single_even(n)\n # Build an odd magic square and fill the new one based on it\n # according to the LUX method\n square = MagicSquare.new(n/2)\n m = (n+2)/4\n for x in 0...(n/2)\n for y in 0...(n/2)\n if(x < m)\n shape = (x == m-1 and x == y) ? :U : :L\n fill(x, y, square[x,y], shape)\n elsif ( x == m )\n shape = (x == y+1) ? :L : :U\n fill(x, y, square[x,y], shape)\n else\n fill(x, y, square[x,y], :X)\n end\n end\n end\n end",
"def volume_of_cube(side_length)\n return (side_length ** 3)\nend",
"def pi(n)\n t = 0\n start_i = 0\n\n while start_i < n\n r = rand\n p = (1 - (r * r)) ** 0.5\n t += p\n start_i += 1\n end\n\n 4 * t / n\nend",
"def sample(count=MaglevUndefined, options=MaglevUndefined)\n return at Kernel.rand(size)\n end",
"def nostalgia; return rand end",
"def sarle_bimodality\n (skewness**2 + 1) /\n (kurtosis + (3 * ((n - 1)**2)) / ((n - 2) * (n - 3)))\n end",
"def sample_variance\n avg = mean\n sum = inject(0){|acc,i|acc +(i-avg)**2}\n sum.to_f/size\n end",
"def get_public(phi)\n (2...phi).find_all {|e| e.gcd(phi) == 1}.sample\nend",
"def normal(mean: 1, standard_deviation: 1)\n theta = 2 * Math::PI * rand\n rho = Math.sqrt(-2 * Math.log(1 - rand))\n scale = standard_deviation * rho\n mean + scale * Math.cos(theta)\n end",
"def e(x)\n rand(x**@n)\n end",
"def volume_of_cube(side_length)\n return side_length ** 3\nend",
"def body_part\n [\"heart\", \"eye\", \"stomach\", \"neck\", \"leg\", \"shoulder\", \"chest\"].sample\nend",
"def generate_feature_vector probs\n (0..7).map do |i|\n ::DistSampler.new({ true => probs[i], false => (1 - probs[i]) }).sample\n end\n end",
"def sample_variance\n avg = self.average\n sum = self.inject(0) { |acc, i| acc + (i - avg) ** 2 }\n 1 / self.length.to_f * sum\n end",
"def volume_of_cube(length, width, height)\nreturn length * width * height\n #add test code here\nend",
"def gaussian_rand\n u1 = u2 = w = g1 = g2 = 0 # declare\n begin\n u1 = 2 * rand - 1\n u2 = 2 * rand - 1\n w = u1 * u1 + u2 * u2\n end while w >= 1\n\n w = Math::sqrt( ( -2 * Math::log(w)) / w )\n g2 = u1 * w;\n g1 = u2 * w;\n # g1 is returned\nend",
"def rnd_permu(list)\n rnd_select(list, list.length)\nend",
"def random_spread(spread)\n spread.nonzero? ? (random(spread) - spread / 2.0) : 0.0\nend",
"def standard_normal_samples\n NMatrix.build([popsize,ndims], dtype: :float64) {standard_normal_sample}\n end",
"def sptriplet(n)\n divisors_of_500 = []\n1.upto(500) {|n| divisors_of_500 << n if 500 % n == 0}\ndivisors_of_500.inspect\n\n solutions = []\n for x in divisors_of_500\n for z in divisors_of_500\n if (x < z && z < 2*x) && n%(x*z) == 0\n y = z - x\n k = ((n/2) / x) / z\n\n a = k*(x*x-y*y)\n b = 2*k*x*y\n c = k*(x*x+y*y)\n\n solutions << [a,b,c]\n end\n end\n end\n\n product = 1\n solutions.map! {|arr| arr.sort}\n solutions.uniq!\n solutions[0].each {|num|product *= num}\n product\n\nend",
"def random_x args\n (args.grid.w.randomize :ratio) * -1\nend",
"def random_x args\n (args.grid.w.randomize :ratio) * -1\nend",
"def create_boxes(num)\n box_vertices = polygon_vertices(NUM_SIDES, EDGE_SIZE)\n box_image = polygon_image(box_vertices)\n boxes = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_poly(1.0, box_vertices, 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::Poly.new(body, box_vertices, CP::Vec2.new(0, 0))\n shape.e = 0.0\n shape.u = 0.4\n boxes << AObject.new(box_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return boxes\n end",
"def sample_variance\n avg = self.average\n sum = self.inject(0) { |acc, i| acc + (i - avg)**2 }\n return(1 / self.length.to_f*sum)\n end",
"def fitn(crate, box)\n \n permutations_array = box.permutation.to_a\n\n def get_fit(crate, rotated_box)\n fit = 1\n crate.each_index do |i|\n fit_on_side = crate[i] / rotated_box[i]\n fit *= fit_on_side\n end\n return fit\n end\n\n fit = 0\n permutations_array.each do |rotated_box|\n boxes = get_fit(crate, rotated_box)\n if boxes > fit\n fit = boxes\n end\n end\n\n puts fit\n\nend",
"def findgen(n)\n NVector.seq(n, :float32)\n end",
"def fator n\n\n\treturn [-1, 1] if n<0\n\treturn [0, 1] if n==0\n\treturn [1, 1] if n==1\n\treturn [2, 1] if n==2\n\treturn [n>>1,2] if ((n%2)==0)\n\n\ti, j, k = n, 0, 0\n\n\ti += j and k = (i**(0.5)).to_i and j += ((j==0)?1:2) while (i-k*k>0)\n\n\tk += (j-1)>>1;\n\tn /= k;\n\n\treturn [n,k] if n>=k\n\treturn [k,n] if n<k\n\nend",
"def sample n=1\n @rng.fill(n)\n end",
"def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend",
"def new_cube(n)\r\n return n*n*n,70;\r\nend",
"def perfects (n)\n return (1..n).select {| x | factors(x).uniq.sum / 2 == x}\nend",
"def random_figures(x=0)\n x + Kernel.rand\n end",
"def sample_size\n @n\n end",
"def volume_of_sphere(r)\nreturn 4/3 * 3.141592653 * ( r ** 3 )\nend",
"def volume_of_cube(side_length)\n volume = side_length **3\n #return volume\nend",
"def sample(value)\n (@bins[value] || 0).to_f / @n.to_f\n end",
"def ftks\n limit = 50\n result = 0\n # these are the correct right angles\n result += limit * limit * 3\n # these are the ones on their side\n (1..limit).each do |i|\n result += i / 2 * 2\n end\n # there are some on their little angles\n (2..limit).each do |long|\n (1..(long - 1)).each do |tall|\n gcd = intGCDInts long, tall\n longd, talld = long / gcd, tall / gcd\n maxn = ((limit - long) / talld > tall / longd ? tall / longd : (limit - long) / talld)\n minn = (long / talld > (limit - tall) / longd ? (limit - tall) / longd : long / talld)\n # p \"(#{long}, #{tall}) => (#{longd}, #{talld}) : #{maxn} + #{minn}\"\n result += (maxn + minn) * 2\n end\n end\n result\nend",
"def divisors(n)\n (1.upto(n ** 0.5).select { |d| (n % d).zero? }.size * 2) - 1\nend",
"def volumeOfSphere( r )\n return (4.0/3.0) * Math::PI * (r**3)\nend",
"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 rawtransforms(nsamples)\n size = 1.0\n nsplit = nsamples - 1\n rsize = size - nsplit * @mindiff\n if rsize < 0.0\n raise(\"RandomFilter rawtransforms error: nsamples #{nsamples} mindiff #{@mindiff} are incompatible\")\n end\n \n mindiffs = Array.new( nsplit, @mindiff )\n \n # compute now nsplit values whose sum is <= to rsize\n randarray = [0.0]\n subarray = (0.0..rsize).rand( nsplit-1 )\n if not subarray.is_a? Array\n subarray = [subarray]\n end\n randarray += subarray\n randarray.push( rsize )\n randarray.sort!\n\n rsizes = Array.new\n randarray.each_cons(2) { |min, max| rsizes.push( (0.0..max-min).rand ) }\n\n rsum = rsizes.sum\n root = (0.0..(rsize-rsum)).rand\n\n # Trace(\"mindiffs #{mindiffs.inspect} rsizes #{rsizes.inspect} rsize #{rsize} rsum #{rsum} root #{root}\")\n\n preresult = []\n mindiffs.zip( rsizes ) {|mindiff, rsize| preresult.push( mindiff + rsize )}\n\n result = [root]\n preresult.each {|v| newv = result[-1] + v; result << newv }\n\n return result\n end",
"def fudge(stat)\n stat * rand(0.8..1.2)\n end",
"def pile_of_cubes(m)\n n = 1\n n^3\n n^3 + (n+1)^3\n n^3 + (n+1)^3 + (n+2)^3\n\n\n # check m against 1^3\n # check m against 1^3 + 2^3\n # check m against 1^3 + 2^3 + 3^3...\n\n\nend",
"def factor_for type, sample\n case type\n when :const\n sample.to_f\n when :logn\n sample.to_f/Math.log10(@sample_size)\n\n when :n\n sample.to_f/@sample_size\n\n when :nlogn\n sample.to_f/(@sample_size * Math.log10(@sample_size))\n\n when :n_sq\n sample.to_f/(@sample_size * @sample_size)\n end\n end",
"def roulette(questions, user, n)\n probs = questions.map { |q| [1 - q.correct_ratio_user(user), 0.1].max }\n\n selected = []\n\n n.times do\n break if probs.empty?\n r, inc = rand * probs.max, 0\n questions.each_index do |i|\n if r < (inc += probs[i])\n selected << questions[i]\n # make selection not pick sample twice\n questions.delete_at i\n probs.delete_at i\n break\n end\n end\n end\n return selected\n end",
"def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend",
"def s2(n)\n n*(n+1)*(2*n+1)/6\nend",
"def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc + (i-avg)**2}\n return(1/self.length.to_f*sum)\n end",
"def secure_sample(n=:single, o={})\n o, n = n, :single if n.is_a?(Hash)\n raise ArgumentError, 'wrong number of arguments (2 for 1)' unless o.is_a?(Hash)\n if random = o[:random]\n args = [{random: random}]\n args.unshift(n) unless n == :single\n sample(*args)\n else\n if n == :single\n self[SecureRandom.random_number(size)]\n else\n raise ArgumentError, 'negative sample number' if n < 0\n res = []\n old = dup\n n = size if n > size\n [*(size-n+1)..size].reverse_each.with_object([]){ |i, res|\n res << old.delete_at(SecureRandom.random_number(i))\n }\n end\n end\n end",
"def smooth_vector(s1, s2, s3)\n mills = millis * 0.00003 ## Lazydogs factor\n # mills = millis * 0.0000001 ## worked for me a bit slower!!\n x = 0.5 * Math.sin(mills * s1) + 0.5\n y = 0.5 * Math.sin(mills * s2) + 0.5\n z = 0.5 * Math.sin(mills * s3) + 0.5\n Vec3D.new(x, y, z)\nend",
"def factorize\n x = self\n o = []\n loop do\n break unless (c = (2..x).find { |i| x % i == 0 })\n x /= c\n o << c\n end\n o\n end",
"def samp_vs_norm(obj_a, obj_b)\n return if norm_vs_norm(obj_a, obj_b)\n\n s = 1 / (obj_a.multisample + 1)\n t = s\n obj_a.multisample.times do\n obj_a.samp.set_to(\n obj_a.prev.x + t * (obj_a.curr.x - obj_a.prev.x),\n obj_a.prev.y + t * (obj_a.curr.y - obj_a.prev.y)\n )\n if test_types(obj_a, obj_b)\n CollisionResolver.resolve(@cpa, @cpb, @coll_normal, @coll_depth)\n return\n end\n t += s\n end\n end",
"def volume_factor(stock)\n 1.01 + (rand() * 0.0001 * stock.price) + (rand() * 0.0005)\n end",
"def propose(x)\n y = x.clone\n two_pi_r = 2*GSL::M_PI*rand\n sqrt_n2_ln_phi = Math.sqrt(-2*log(rand))\n z1 = cos(two_pi_r) * sqrt_n2_ln_phi\n z2 = sin(two_pi_r) * sqrt_n2_ln_phi\n c1 = sqrt(1.0+@correlation)/2.0\n c2 = sqrt(1.0-@correlation)/2.0\n y[@indices[0]] = x[@indices[0]] + @stdev1*(c1*z1+c2*z2)\n y[@indices[1]] = x[@indices[1]] + @stdev2*(c1*z1-c2*z2)\n y\n end",
"def generate_perlin(window,seed)\n borders(window)\n w_y = []\n w_x = []\n Ncurses.getmaxyx(window,w_x,w_y)\n random_seed = seed\n n3d = Perlin::Noise.new 3, :interval => 100, :seed => random_seed\n contrast = Perlin::Curve.contrast(Perlin::Curve::CUBIC, 3)\n Ncurses.init_pair(1, 8, 15)\n Ncurses.wattron(window,Ncurses.COLOR_PAIR(1))\n 1.step(w_x[0] - 2, 1.0) do |x| # x == whole integer, which will always give .5\n 1.step(w_y[0] - 2, 1.0) do |y|\n \n i = (x / w_x[0]) * 10 # (0.01..1.00) * 10 == (.1..9.9)\n j = (y / w_y[0]) * 10 # (0.01..1.00) * 10 == (.1..9.9)\n\n n = n3d[i,j,0.8]\n #n = contrast.call n\n if n > 0.4 and n < 0.7\n Ncurses.mvwaddstr(window, x, y, \"~\")\n else\n Ncurses.mvwaddstr(window, x, y, \"#\")\n end\n end\n end\n Ncurses.wattroff(window,Ncurses.COLOR_PAIR(1))\nend",
"def eratosthenes(limit)\n nlist = [nil, nil, *2..limit]\n (2..Math.sqrt(limit)).each do |x|\n (x ** 2..limit).step(x) { |y| nlist[y] = nil } if nlist[x]\n end\n nlist.compact!\nend",
"def gen_128_16_std_breqd_instance(n, seed)\n c = 128*n\n wmax = c\n pmax = 16*wmax\n gen_std_breqd_instance(n, c, wmax, pmax, seed)\nend",
"def crunch_stats(value, n)\n\tmean = value.inject(:+)/n.to_f\n\tvariance = 0\t# <= technically, this is actually variance*n\n\tfeed_presence = 0\t\n\tvalue.each do |item|\n\t\tvariance += (item - mean)**2\n\t\tfeed_presence += 1 if item > 0\n\tend\n\tfeed_presence = feed_presence/n.to_f\n\tsd = Math.sqrt(variance/n)\n\treturn [mean,sd,feed_presence]\nend",
"def simpson(t1, t2, n, &f)\n n += 1 unless n % 2 == 0\n d=(t2-t1) / n.to_f \n out= (d / 3.0)*(f[t1.to_f].to_f+\n ((1..(n-1)).inject(0) {|ac,i|\n ac+((i%2==0) ? 2 : 4)*f[t1+d*i] \n })+f[t2.to_f].to_f)\n out\n end",
"def vitamin\n vitamins = [\"Vitamin C\", \"Vitamin K\", \"Vitamin B12\", \"CoQ10\", \"Zinc\", \"Magnesium\", \"Fish Oil\", \"Activated Charcoal\", \"Iron\", \"Potassium\", \"Calcium\", \"Vitamin A\", \"Niacin\", \"Flintstones Gummies\"].sample\nend",
"def samples; end",
"def samples; end",
"def dft(inv,array)\r\n elem = Array.new\r\n array.each{|e| elem.push( Complex.new(e,0) ) }\r\n ret=Array.new\r\n n=elem.size\r\n a=Math::PI*2.0/n\r\n a=-a if inv \r\n n.times{|i|\r\n ret[i]=Complex.new(0,0)\r\n n.times{|j|\r\n ret[i] = ret[i] + ( elem[j] * Complex.new(Math.cos(a*i*j),-Math.sin(a*i*j)) )\r\n }\r\n ret[i] = ret[i] * (1.0/n) if inv\r\n }\r\n return ret\r\nend",
"def treasure\n [\"ring\", \"necklace\", \"dagger\", \"amulet\", \"ruby\", \"sapphire\", \"piece of jade\", \"human skull\", \"tarask skull\"].sample\nend",
"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 em(x, min=nil)\n min ||= x * @n / 5\n rand(x**@n) + min*@n\n end",
"def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end"
] |
[
"0.667646",
"0.6259642",
"0.59863317",
"0.5897662",
"0.586521",
"0.56459343",
"0.5633882",
"0.56110126",
"0.54187095",
"0.5298697",
"0.52863425",
"0.5280851",
"0.5259248",
"0.5241511",
"0.5206297",
"0.51865214",
"0.51795936",
"0.51728475",
"0.51563483",
"0.51393306",
"0.5129376",
"0.51293707",
"0.51246893",
"0.5116782",
"0.510946",
"0.51028126",
"0.50852954",
"0.50749606",
"0.50749606",
"0.5072253",
"0.50686026",
"0.50678825",
"0.50661606",
"0.5057597",
"0.505745",
"0.5055894",
"0.5054169",
"0.505159",
"0.5039064",
"0.5029168",
"0.50242317",
"0.5010842",
"0.5007152",
"0.50032765",
"0.49966908",
"0.4989587",
"0.49747774",
"0.4973379",
"0.49573886",
"0.4946331",
"0.49211645",
"0.49166593",
"0.49102426",
"0.4907767",
"0.48985538",
"0.48985538",
"0.48983994",
"0.48867655",
"0.48792365",
"0.48698482",
"0.48608723",
"0.4854598",
"0.48507717",
"0.48294142",
"0.48275784",
"0.48273626",
"0.48184568",
"0.4816775",
"0.48157614",
"0.4815605",
"0.48091942",
"0.48040727",
"0.4803304",
"0.4800225",
"0.4798172",
"0.47962305",
"0.4791094",
"0.47671726",
"0.47627515",
"0.47597307",
"0.47500604",
"0.4748571",
"0.47470835",
"0.4746965",
"0.47367916",
"0.47306457",
"0.47304574",
"0.47250307",
"0.47231337",
"0.47219285",
"0.4719795",
"0.47158304",
"0.47113854",
"0.47110835",
"0.4710276",
"0.4710276",
"0.47026035",
"0.47016528",
"0.46952465",
"0.46950075",
"0.46922243"
] |
0.0
|
-1
|
Beta. NOTE: NOT WORKING!
|
def rbeta(alpha, beta)
alpha = alpha.to_f
beta = beta.to_f
log10 = Math.log(10)
a = alpha + beta
if [alpha, beta].min <= 1
b = [1 / alpha, 1 / beta].max
else
b = Math.sqrt((a - 2) / (2 * alpha * beta - a))
end
c = alpha + 1/b
begin
u1, u2 = rand, rand
v = b * Math.log(u1 / (1 - u1))/logbase
w = alpha * Math.exp(v)
end while a * Math.log(a / (beta + w))/logbase + c * v - Math.log(4)/logbase < Math.log(u1*u1*u2)/logbase
w / (beta + w)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def berlioz; end",
"def blg; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def verdi; end",
"def villian; end",
"def terpene; end",
"def bs; end",
"def refutal()\n end",
"def weber; end",
"def gounod; end",
"def bellini; end",
"def stderrs; end",
"def anchored; end",
"def ibu; end",
"def formation; end",
"def suivre; end",
"def custom; end",
"def custom; end",
"def jack_handey; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def internship_passed; end",
"def intensifier; end",
"def trd; end",
"def implementation; end",
"def implementation; end",
"def spec; end",
"def spec; end",
"def mitch_hedberg; end",
"def internal; end",
"def ext; end",
"def ext; end",
"def dh; end",
"def r; end",
"def r; end",
"def isolated; end",
"def isolated; end",
"def diff2; end",
"def leeway; end",
"def leeway; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def operations; end",
"def operations; end",
"def tld; end",
"def tld; end",
"def herald; end",
"def malts; end",
"def diff1; end",
"def standalone; end",
"def external; end",
"def offences_by; end",
"def pass; end",
"def pass; end",
"def probers=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def alpha; end",
"def zuruecksetzen()\n end",
"def who_we_are\r\n end",
"def loc; end",
"def loc; end",
"def loc; end",
"def g; end",
"def g; end",
"def alt; end",
"def original; end",
"def schumann; end",
"def upc_e; end",
"def surge; end",
"def returns; end",
"def celebration; end",
"def standalone=(_arg0); end",
"def buzzword; end",
"def buzzword; end",
"def rossini; end",
"def bizet; end",
"def stage; end",
"def stage; end",
"def minor; end",
"def minor; end"
] |
[
"0.71760875",
"0.6703603",
"0.65820426",
"0.6547483",
"0.6372093",
"0.63479966",
"0.63479966",
"0.63479966",
"0.63479966",
"0.6304892",
"0.62530065",
"0.6179779",
"0.6164725",
"0.6116117",
"0.610676",
"0.5997255",
"0.5948738",
"0.5914281",
"0.5897416",
"0.589595",
"0.5884841",
"0.5863687",
"0.5860707",
"0.5860707",
"0.5838157",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.58325064",
"0.5812707",
"0.5800817",
"0.5767139",
"0.5746378",
"0.5746378",
"0.57217944",
"0.57217944",
"0.57147527",
"0.5705624",
"0.57028216",
"0.57028216",
"0.5683963",
"0.5677979",
"0.5677979",
"0.5676074",
"0.5676074",
"0.56728435",
"0.566773",
"0.566773",
"0.5663406",
"0.5663406",
"0.5663406",
"0.5663406",
"0.56605613",
"0.56605613",
"0.56605613",
"0.56605613",
"0.56544185",
"0.56544185",
"0.5652963",
"0.5652963",
"0.56245923",
"0.56206757",
"0.5615702",
"0.5609418",
"0.5604127",
"0.5599437",
"0.5598437",
"0.5598437",
"0.55982566",
"0.55719274",
"0.55719274",
"0.55719274",
"0.55710196",
"0.5565897",
"0.5564502",
"0.55637085",
"0.55637085",
"0.55637085",
"0.55535924",
"0.55535924",
"0.5549064",
"0.55446005",
"0.5538999",
"0.55351377",
"0.5534794",
"0.5531068",
"0.5529706",
"0.5523988",
"0.5522221",
"0.5522221",
"0.55206716",
"0.5517973",
"0.551782",
"0.551782",
"0.5512243",
"0.5512243"
] |
0.0
|
-1
|
Negative binomial. F. Weibull. NOTE: TEST.
|
def rweibull(alpha, beta)
beta.to_f * (- Math.log(rand))**(1 / alpha.to_f)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def opposite(x)\n x * -1\nend",
"def binary(num)\n if num < 0\n positiveNumBinary = calculate_binary(num.abs, 'negative')\n else\n return calculate_binary(num, 'positive')\n end\n\nend",
"def opposite(number)\r\n return number * (-1)\r\nend",
"def opposite(number)\n number*-1\nend",
"def bitnot(b)\n (~b)&1\nend",
"def opposite(number)\n return 0 - number\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 opposite num\n -num\n end",
"def binomial(n,k)\n return 1 if n-k <= 0\n return 1 if k <= 0\n fact(n) / ( fact(k) * fact( n - k ) )\n end",
"def find_nb(m)\n n = 0\n while m.positive?\n n += 1\n m -= n**3\n end\n m.zero? ? n : -1\nend",
"def binom(n, k)\n return 1 if k.zero? || (n - k).zero?\n return n if k == 1 || n - k == 1\n\n factorial(n) / (factorial(k) * factorial(n - k))\n end",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 2 + bunny(n - 1) unless n.zero?\n return 0 if n.zero?\nend",
"def negative(num)\n num *= -1 if num > 0\n num\nend",
"def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend",
"def opposite(x)\n puts -(x)\nend",
"def nuw_neg(arg, name = \"\")\n Instruction.from_ptr(C.build_nuw_neg(self, arg, name))\n end",
"def complement(bit)\n bit.succ % 2\n end",
"def xor_b\n end",
"def exact_regularized_beta(x,a,b)\n return 1 if x==1\n m=a.to_i\n n=(b+a-1).to_i\n (m..n).inject(0) {|sum,j|\n sum+(binomial_coefficient(n,j)* x**j * (1-x)**(n-j))\n }\n\n end",
"def power!(p0) end",
"def not\n ~@bits\n end",
"def find_complement(num)\n result = 0\n\n num_bits = num.to_s(2).chars.map(&:to_i) # Convert to binary (base 2) and map to integers\n\n num_bits.reverse.each_with_index do |n, idx|\n n = n == 0 ? 1 : 0\n result += 2 ** idx * (n) # Convert to base 10\n end\n\n result\nend",
"def negative(input)\n input.abs * -1\nend",
"def bunny(n)\n return 0 if n == 0\n\n return (2 + (2 * (n - 1)))\nend",
"def dec_b\n end",
"def bunny(n)\n if n < 0 \n raise ArgumentError, \"bunnies cannot be a negative number!\"\n elsif\n n == 0\n return n\n else\n return 2+ bunny(n-1)\n end\nend",
"def make_negative(n)\n -(n.abs)\nend",
"def r_binom_CI(x= 0, n= 0,temp_r_dir = File.dirname($0))\n temp_r_result = temp_r_dir + \"/temp_r_result\"\n print `Rscript -e 'binom.test(#{x},#{n})$conf.int[1];binom.test(#{x},#{n})$conf.int[2]' >#{temp_r_result}`\n lines = File.readlines(temp_r_result)\n low = lines[0].chomp[4..-1].to_f\n high = lines[1].chomp[4..-1].to_f\n File.unlink(temp_r_result)\n return [low.round(5), high.round(5)]\nend",
"def findNb(m)\n # n^3 + (n-1)^3 + (n-2)^3 + ... 1^3 = m\n # m - 1 - 8 - 27 - 64 - ... etc = 0\n base = 1\n loop do\n m -= (base ** 3)\n break if m <= 0\n base += 1\n end\n m < 0 ? -1 : base\nend",
"def probNull(bit)\n if bit == 1\n return @probNullVal\n else #bit == 0\n return @negProbNullVal\n end\nend",
"def neg_binom_dist()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::NegBinom_Dist::NegBinomDistRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def negative(num)\n num < 0 ? num : -1 * num\nend",
"def rbinomial(mean, prob)\n ((1..mean).map { rbernoulli(prob) }).sum\nend",
"def negative(num)\n\n if num <=0\n num\n else \n num * -1\n end\nend",
"def bce(n)\n return -n\n end",
"def execute_NEG(operand)\n\t\t# all flags affected\n\t\tset_auxiliary_carry_flag_from 0 - operand.value.lowest_4_bits\n\t\tperform_arithmetic_operation_storing_result(operand, operand, 0 - operand.value)\n\tend",
"def p_burglary\n flip(0.001, :B, :notB)\nend",
"def makeNegative(num)\r\n if num >= 0\r\n return num * (-1)\r\n else\r\n return num * 1\r\n end\r\n end",
"def power(b, n)\n\n\t# b^n.to_i\n\n\tb ** n\n\nend",
"def negative(n)\n return n if n <= 0\n -n\nend",
"def to_b\n !zero?\n end",
"def bitodec(bi)\n\tbistring = bi.to_s\n\tturnbi = bistring.chars.reverse.map{|i| i.to_i}\n\tfor index in (0...turnbi.length)\n\t\tturnbi[index] = turnbi[index]*(2**index)\n\tend\n\tdec = turnbi.sum\n\treturn dec\nend",
"def n_to_binary number\n bin_array = []\n until number == 0\n if number % 2 == 0\n bin_array << 0\n else \n bin_array << 1\n end\n number = number / 2\n end\n bin_array.join\nend",
"def negative(num)\n if num <= 0 \n return num\n else\n return num - (num * 2)\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def - b\n 2.plus self.plus(b)\n end",
"def negative(num)\n\treturn -num unless num <= 0\n\tnum\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def subtract(n1, n2)\n result = n1 - n2\n result = 0 if result < 0\nend",
"def bunny(n)\n return 0 if n == 0\n return n + bunny(n / 2.0 )\n # This passes the tests, though technically it never hits 0 (just approaches 0)\n # An alternate solution is to return 1 + bunny(n - 0.5) but that would have a slower time complexity O(n)\nend",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 0 if n == 0\n return 2 + bunny(n - 1)\n\nend",
"def bunny(n)\n if n % 2 == 0\n return 0\n else\n return n + bunny(2-1)\n end\nend",
"def bunny(n) \n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def negative(num)\r\n # your code goes here\r\n # abosulte value of any number is +ve\r\n\r\n num.abs*-1\r\nend",
"def altern(boul, prob, n)\n som = 0\n u = rand\n (1..n).to_a.each do |i|\n som += prob[i]\n # puts \"som is #{som}\"\n # puts \"u is #{u}\"\n # another typo, the paper says u >= som which will always return either\n # boul[1] or boul[10]\n if som >= u\n return boul[i]\n end\n end\n return boul[n]\n end",
"def negative(num)\n num.positive? ? -num : num\nend",
"def powers\n @powers.reject{ |u,p| p == 0 }\n end",
"def negative(num)\n return num<0\nend",
"def negative(number)\n number > 0 ? (number * -1) : number\nend",
"def inverse_of; end",
"def negative(number)\n number <= 0 ? number : number * -1\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n - 1)\nend",
"def invert(list)\n for i in 0..list.length-1\n list[i] *= -1 unless list[i] == 0\n end\n list\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def exponent(b, n)\n\nend",
"def negate!\n negate self\n end",
"def toBinary(n)\n\ttop = Math.log2(n).to_int\n\tlist = []\n\twhile top >= 0\n\t\tn >= 2 ** top ? (list << 1 and n -= 2 ** top) : (list << 0)\n\t\ttop -= 1\n\tend\n\tlist.join\nend",
"def negative(integer)\n return integer if integer.negative? || integer == 0\n integer * -1\nend",
"def powers_of_two(x)\n 0.upto(x) {|n| (2**n) if x >= (2**n)}.compact\nend",
"def binomial_coefficient(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min\n permutations(n,k).quo(factorial(k))\n # The factorial way is\n # factorial(n).quo(factorial(k)*(factorial(n-k)))\n # The multiplicative way is\n # (1..k).inject(1) {|ac, i| (ac*(n-k+i).quo(i))}\n end",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny( n - 1 )\nend",
"def test_powers_of_two\n 100.times do |p|\n n = 2 << p\n\n assert_equal n, n.to_ber.read_ber\n end\n end",
"def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end",
"def unsigned_not(int)\r\n bits = int.bit_length\r\n bits = (bits / 4.0).ceil.to_i * 4 # round to nearest half-byte\r\n mask = (1 << bits) - 1\r\n return mask - int\r\n end",
"def ~\n NumericExpression.new(:'B~', self)\n end",
"def IntegerComplement(n)\n\n complements = {\n '0' => '1', # => \"1\"\n '1' => '0' # => \"0\"\n } # => {\"0\"=>\"1\", \"1\"=>\"0\"}\n\n binary = n.to_s(2) # => \"110010\"\n\n #Solution 1: using Ruby's .to_i with base (2) method\n new_binary = '' # => \"\"\n binary.chars.each { |e| new_binary << complements[e] } # => [\"1\", \"1\", \"0\", \"0\", \"1\", \"0\"]\n new_binary # => \"001101\"\n new_decimal = new_binary.to_i(2) # => 13\n\n\n #Solution 2: Evaluating complement's decimal manually\n comp_binary = [] # => []\n binary.chars.each { |e| comp_binary << complements[e] } # => [\"1\", \"1\", \"0\", \"0\", \"1\", \"0\"]\n comp_binary # => [\"0\", \"0\", \"1\", \"1\", \"0\", \"1\"]\n\n comps = [] # => []\n comp_binary.reverse.each_with_index { |e, i| comps << (e.to_i) * (2**i) } # => [\"1\", \"0\", \"1\", \"1\", \"0\", \"0\"]\n comps # => [1, 0, 4, 8, 0, 0]\n decimal_complement = comps.reduce(:+) # => 13\n\n\n p new_decimal # => 13\n p decimal_complement # => 13\n\nend",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n if n == 0\n return 0\n else\n return 2 + bunny(n - 1)\n end\nend",
"def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend",
"def bunny(n)\n\treturn 0 if n == 0\n\n\treturn 2 + bunny(n - 1)\nend",
"def execute_NOT(operand)\n\t\t# no flags affected\n\t\toperand.value = ~operand.value\n\tend",
"def opposite n\n\t\tif n%2 == 0\n\t\t\treturn n+1\n\t\telse\n\t\t\treturn n-1\n\t\tend\n\tend",
"def makeNegative(num)\n num > 0 ? num * -1 : num\nend",
"def f(num)\n (1.upto(num).inject { |m,n| m + n**2 } - 1.upto(num).sum ** 2).abs\nend",
"def binomial_coefficient(n, k)\n return 1 if n == k || k == 0\n return n if k == 1\n return -1 if n < k\n\n # calculate factorials\n fact_n = (2..n).inject(1) { |carry, i| carry * i }\n fact_k = (2..k).inject(1) { |carry, i| carry * i }\n fact_n_sub_k = (2..(n - k)).inject(1) { |carry, i| carry * i }\n\n fact_n / (fact_k * fact_n_sub_k)\n end",
"def nozero(num)\n num > 0 ? -num : num \nend",
"def raise_to_power_brute(x, y)\n result = x\n\n while y > 1\n result *= x\n y -= 1\n end\n\n result\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def bunny(n)\n return 0 if n == 0\n return 2 + bunny(n-1)\nend",
"def nsw_neg(arg, name = \"\")\n Instruction.from_ptr(C.build_nsw_neg(self, arg, name))\n end",
"def bunny(n)\n if n === 0\n return 0\n end\n\n return 2 + bunny(n-1)\nend",
"def binomial_coefficient(n,k)\n return 1 if (k==0 or k==n)\n k=[k, n-k].min\n binding.pry\n permutations(n,k).quo(factorial(k))\n # The factorial way is\n # factorial(n).quo(factorial(k)*(factorial(n-k)))\n # The multiplicative way is\n # (1..k).inject(1) {|ac, i| (ac*(n-k+i).quo(i))}\n end",
"def convert_binary_to_signed_negative(address)\n twos_compliment = convert_to_signed_twos_complement address.to_i(2)\n HumanComputer::Processor.eight_bitify twos_compliment\n end",
"def subtract_product_and_sum(n)\r\n n=n.to_s.chars.map(&:to_i)\r\n if n[0] == 0\r\n n[1] = n[1]*-1 \r\n n = n[1..-1]\r\n end\r\n n.reduce(:*) - n.sum\r\nend",
"def power(nb1, nb2)\n return nb1 ** nb2\nend",
"def neg &blk\r\n build_piece Negative, blk\r\n end",
"def probability_exact\n\t\t str_format=\"%0#{nr}b\"\n\t\t combinations=2**nr\n\t\t #p str_format\n\t\t total_w=combinations.times.map do |i|\n comb=sprintf(str_format,i)\n w_local=comb.length.times.inject(0) do |ac,j|\n sgn=comb[j]==\"0\" ? -1 : 1\n\t\t\t\t ac+(j+1)*sgn\n end\n\t\t end.sort\n\n \t\t total_w.find_all do |v| \n if @tails==:both\n v<=-w.abs or v>=w.abs\n elsif @tails==:left\n v<=w\n elsif @tails==:right\n \t\t\t\t v>=w\n end\n \t\t end.count/(combinations.to_f)\n end"
] |
[
"0.6388879",
"0.62787855",
"0.61814743",
"0.6131015",
"0.60918397",
"0.6057517",
"0.590113",
"0.58922476",
"0.5885237",
"0.5847681",
"0.5780743",
"0.57715017",
"0.577008",
"0.57323104",
"0.57108706",
"0.57078445",
"0.57044077",
"0.5700991",
"0.57001585",
"0.56616527",
"0.5656508",
"0.5638773",
"0.56227094",
"0.5605925",
"0.5605049",
"0.5603553",
"0.5601183",
"0.56007797",
"0.55848306",
"0.55824685",
"0.5580675",
"0.55767417",
"0.55628055",
"0.5550569",
"0.5540262",
"0.5538568",
"0.5538519",
"0.5530385",
"0.55249625",
"0.5503353",
"0.5499717",
"0.54971033",
"0.5469677",
"0.5463061",
"0.5460186",
"0.5457375",
"0.5457375",
"0.5450076",
"0.54437006",
"0.5437033",
"0.54340583",
"0.54325706",
"0.54264903",
"0.54259527",
"0.542506",
"0.5423245",
"0.54203445",
"0.54127055",
"0.5412676",
"0.5411219",
"0.5408704",
"0.5406988",
"0.54029965",
"0.540124",
"0.5400899",
"0.53944933",
"0.53944933",
"0.53944933",
"0.53878415",
"0.5387203",
"0.53813785",
"0.5375659",
"0.53736836",
"0.5372917",
"0.53678554",
"0.5364478",
"0.53608507",
"0.53588486",
"0.5358117",
"0.5357265",
"0.5351236",
"0.5348131",
"0.53469217",
"0.5344518",
"0.53381705",
"0.53306466",
"0.532684",
"0.5326576",
"0.5321534",
"0.5309757",
"0.5309757",
"0.5309757",
"0.53089863",
"0.53082764",
"0.53061205",
"0.53028107",
"0.53000206",
"0.5299847",
"0.5299228",
"0.52985203"
] |
0.61543226
|
3
|
Hypergeometric. Geometric. Chisquared. Erlang. NOTE: TEST.
|
def rerlang(k, beta)
-(beta.to_f / k) * Math.log((k.times.collect { rand }).prod)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def power(g,h)\n return g**h\nend",
"def cosh\n math :cosh\n end",
"def rh_factor; end",
"def hyperbolic_cos\n Math.log(Math.tan(Math::PI * random / 2))\n end",
"def geometric(colors)\n colors.reduce(&:*)**(1.0 / colors.count)\n end",
"def gecos(*) end",
"def hypothenus(x, y)\n return Math.sqrt(x**2 + y**2)\nend",
"def compute_hypotenuse(a, b)\n Math.sqrt(a * a + b * b)\nend",
"def alg; end",
"def gethashespersec\n coind.gethashespersec\n end",
"def squared\n end",
"def hecto\n big_self * HECTO\n end",
"def hcf(i,j)\n \nend",
"def getExp ( x , y )\n\texp = x ** y\n\treturn exp\nend",
"def heptagonal?\n fcache[:heptagonal] ||= (Math.sqrt(40*self +9)+3)%10 == 0\n end",
"def test_groebner_basis_coeff_01\n x, y, z = @P.vars('xyz')\n\n f1 = x**2 + y**2 + z**2 - 1\n f2 = x**2 + z**2 - y\n f3 = x - z\n\n g = x**3 + y**3 + z**3\n q, r = g.divmod_s(f1, f2, f3)\n # p q\n # p r\n assert_equal(g, q.inner_product([f1, f2, f3]) + r)\n # if g == q.inner_product([f1, f2, f3]) + r\n # puts \"Success!\"\n # else\n # puts \"Fail.\"\n # end\n end",
"def g(x,y) x + y end",
"def power (x,y)\n return x**y \nend",
"def tanh\n math :tanh\n end",
"def erlang_c(m, u)\n d = power_fact(m, u)\n s = 1.0\n (1..(m - 1)).each do |k|\n s += power_fact(k, u)\n end\n d / (d + (1 - u / m) * s)\n end",
"def cdf(k, m, n, total) # :nodoc:\n GSL::Cdf::hypergeometric_P(k, m, total-m, n)\n end",
"def giga_funs(features='min', gas_type='regular', miles = 100000)\n fun = unit_horsepower\n base_cost = @specs[\"msrp_#{features}\"]\n gas_cost = total_gas_cost(gas_type, miles, 'city')\n return 0 if fun.nil? || base_cost.nil? || base_cost.to_i == 0 || base_cost == 'NULL'\n\n (fun.to_f * 1000000000 / (base_cost.to_f + gas_cost)).round(1)\n end",
"def power(x,y)\n x**y\nend",
"def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend",
"def math(b1,b2,goal)\r\n\r\n\t# link to math:\r\n\t# http://www.math.tamu.edu/~dallen/hollywood/diehard/diehard.htm\r\n\t# mp = nq = k\r\n\t# (x)(b1) + (y)(b2) = goal\r\n\r\n\tx = 0\r\n\ty = 0\r\n\tcurrent_total = 0\r\n\r\n\t#determine x and y mathematically\r\n\twhile (current_total != goal) do\r\n\r\n\t\tif current_total < goal\r\n\t\t\tx += 1\r\n\t\telsif current_total > goal\r\n\t\t\ty -= 1\r\n\t\tend\r\n\r\n\t\tcurrent_total = x*b1.size + y*b2.size\r\n\t\tputs \"X: #{x}, Y: #{y}, CT: #{current_total}\"\r\n\r\n\tend\r\n\r\nend",
"def cosh\n\t\tresult = Math.cosh(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend",
"def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend",
"def pow base, p\n base ** p\n end",
"def hypo(a,b)\n @side_a = a\n @side_b = b\n total = Math.hypot(@side_a,@side_b).round\n\n\n puts \"The Hypotenuse is #{total}\"\n end",
"def square(x)\n\tx ** 2\nend",
"def square(x)\n\tx ** 2\nend",
"def numerator() end",
"def acosh\n math :acosh\n end",
"def eq_of_equinox() \r\n cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) * Celes.nut06a(@ajd, 0)[ 0 ]\r\n end",
"def hipotenusa2cat(cat1,cat2)\n hipotenusa = Math.sqrt(cat1*cat1 + cat2*cat2)\nend",
"def gcd(p0) end",
"def geometric_factor\n hourly_beam_radiation_on_tilted_surface / hourly_beam_radiation_on_horizontal_surface\n end",
"def cos\n pass\nend",
"def square(term1)\n return term1.to_i ** 2\nend",
"def object_of_power; end",
"def oval(x, a, b, h, k)\n k + -b * Math.sqrt(1 - ((x-h)/a) ** 2)\n end",
"def square(siffra)\n return siffra**2\nend",
"def comman_fact(num1, num2)\n if num1 < num2\n small = num1\n else\n small = num2\n end\n\n for i in 2..small\n if (num1% i == 0 && num2 % i == 0)\n hcf = i\n #\n end\n end\n\n if hcf\n num1 = num1/hcf \n num2 = num2/hcf\n end\n \n if num1/2 == 0 && num2/2 == 0\n comman_fact(num1, num2)\n \n else\n return num1.to_s+\"/\"+num2.to_s\n end\n end",
"def pathagorean_theorem_hypotenuse (a,b)\n a_squared = a**2\n b_squared = b*b \n a_squared_plus_b_squared = a_squared+b_squared\n return Math.sqrt (a_squared_plus_b_squared)\nend",
"def cubed(orgnum)\n return orgnum * orgnum * orgnum\nend",
"def test_DiscriminantGeq0\n assert_equal( [-1, -1.5], Equation.solve_quadratic(2, 5, 3) )\n end",
"def power(base, power)\n base ** power\nend",
"def square(x)\n x ** 2\nend",
"def ArithGeo(arr)\n\n isGeo, isArith = true, true\n arith_diff, geo_diff=arr[1]-arr[0], arr[1].div(arr[0])\n \n arr.each_with_index{|x,index|\n break if index==arr.length-1\n isArith=false if arr[index] + arith_diff!=arr[index+1]\n isGeo=false if arr[index] * geo_diff!=arr[index+1]\n }\n \n \n return \"Arithmetic\" if isArith\n return \"Geometric\" if isGeo\n return -1\n \nend",
"def sinh\n math :sinh\n end",
"def GF_product_t_i(a, b)\n t = GF_tables()\n t[:exponential][(t[:logarithmic][a] + t[:logarithmic][b]) % 255]\nend",
"def cubertino(n) # n is the parameter \n puts n ** 3\nend",
"def squared(num1)\n\tnum1 ** 2\nend",
"def pchi2(n, y)\r\n if n == 1\r\n w = pnorm(1 - y/2) # = pnormal___x(y/2)\r\n w * w\r\n elsif n == 2\r\n # v = (1.0 / y - 1.0) / 33.0\r\n # newton_a(y, v) {|x| [q_chi2(n, x), -chi2dens(n, x)] }\r\n -2.0 * Math.log(y)\r\n else\r\n eps = 1.0e-5\r\n v = 0.0\r\n s = 10.0\r\n loop do\r\n v += s\r\n if s <= eps then break end\r\n if (qe = q_chi2(n, v) - y) == 0.0 then break end\r\n if qe < 0.0\r\n v -= s\r\n s /= 10.0 #/\r\n end\r\n end\r\n v\r\n end\r\n end",
"def cgamma(z)\n if z.real < 0.5\n PI / (CMath.sin(PI * z) * cgamma(1.0 - z))\n else\n z -= 1.0\n x = (1...QLEN).inject(Q[0]) { |s, i| s + Q[i] / (z + i) }\n t = z + QLEN_G + 0.5\n SQRT_2PI * (t**(z + 0.5)) * CMath.exp(-t) * x\n end\nend",
"def power(x,y)\n\treturn x**y\nend",
"def calculate_hyperballs\n while hyperball_once\n @ball_size += 1\n end\n\n print_centralities\n end",
"def imaginary_compass\n {\n 'W' => Complex(0, -1),\n 'E' => Complex(0, 1),\n 'N' => Complex(1, 0),\n 'S' => Complex(-1, 0)\n }\nend",
"def transmogrifier(num1,num2,square)\n\tresultOf = num1*num2\n\tnumberex = square * square\n\tresultpower = resultOf + numberex\nend",
"def getQuo ( x , y )\n\tq = x / y\n\treturn q\nend",
"def transmorgifier (num1,num2,num3)\n (num1*num2).pow(num3)\nend",
"def eccentricity_Earth()\r\n # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}\r\n eoe(@ta) \r\n end",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def square(cuadrado)\n 2**(cuadrado - 1)\n end",
"def diaphony_choriambize()\n symbranch(constrictive, ither)\n end",
"def cosine_to_Earth() \r\n cos( Celes.nut06a(@ajd, 0)[ 1 ] + Celes.obl06(@ajd, 0) ) \r\n end",
"def primordial; end",
"def _hensel_lift(g0, f0, _char, height, where)\n # self in MPolynomial/ZorZp\n # g0 in Polyomial/ZorZp, candidate of factor of f0\n # f0 in Polyomial/ZoZzp, one variable reduction of self\n\n ring = self.class\n ring_one = g0.class\n\n h0, r0 = f0.divmod g0\n raise 'each_product does not work well' unless r0.zero?\n\n # where = 0\n ary = [g0, h0]\n cofacts = mk_cofacts(ary)\n fk = ary.collect { |fx| fx.value_on_one(ring, where) } # MPolynomial\n\n height.times do |k|\n c = self - fk[0] * fk[1]\n h = c.annihilate_away_from(where, k + 1)\n h_alpha0 = h.collect_away_from(where, ring_one) # Hash: ind0=>Polynomial\n h_alpha = {}\n\n h_alpha0.each do |ind, ha|\n h_alpha[ind] = yield(ha, ary, cofacts)\n end\n\n hias = ary.collect { {} }\n h_alpha.each do |ind, ha_i|\n ha_i.each_with_index do |fx, i|\n next if fx.zero?\n hias[i][ind] = fx\n end\n end\n\n hi = hias.collect do |hia|\n e = ring.zero\n hia.each do |ind, fx|\n e += ring.monomial(ind) * fx.value_on_one(ring, where)\n end\n e\n end\n fk_new = []\n hi.each_with_index do |fx, i|\n fk_new.push fk[i] + fx\n end\n fk = fk_new\n end\n fk\n end",
"def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend",
"def square_float(x)\n return x ** 2\nend",
"def calc_k(n, g)\n H(n, n, g)\n end",
"def #power(a,b)\n\ta ** b\nend",
"def hypotenuse(values)\n @product = 1\n values.each do |a|\n values.each do |b|\n c = Math.hypot(a,b)\n if c%1 == 0 && a + b + c == 1000\n @product = a * b * c\n end\n end\n end\n return @product\nend",
"def cubertino(n)\n puts n ** 3\nend",
"def exponentiation(x, y)\n puts \"#{ x } ** #{ y } = #{ x ** y }\"\nend",
"def transmogrifier (a,b,c)\n (a*b)^c\n end",
"def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend",
"def how_high(energy)\n energy * energy\nend",
"def pchi2(n, y)\n if n == 1\n w = Distribution::Normal.p_value(1 - y/2) # = p1.0-Distribution::Normal.cdf(y/2)\n w * w\n elsif n == 2\n # v = (1.0 / y - 1.0) / 33.0\n # newton_a(y, v) {|x| [q_chi2(n, x), -chi2dens(n, x)] }\n -2.0 * Math.log(y)\n else\n eps = 1.0e-5\n v = 0.0\n s = 10.0\n loop do\n v += s\n if s <= eps then break end\n if (qe = q_chi2(n, v) - y) == 0.0 then break end\n if qe < 0.0\n v -= s\n s /= 10.0\n end\n end\n\n v\n end\n end",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def d(x)\n 2 * ( l(x) + h(x) ) - 1\n end",
"def centi\n big_self * CENTI\n end",
"def cannabinoid; end",
"def CalculatePentagonal (input)\n\treturn (input * (3*input - 1) / 2)\nend",
"def calc_k(n, g)\n H(n, n, g)\n end",
"def sisoku(a, b)\r\n puts a+b\r\n puts a-b\r\n puts a*b\r\n puts a/b\r\n end",
"def ftoc(fahrenheit)\n\n (fahrenheit - 32) * 5/9\n\nend",
"def power(input1, input2)\n input1 ** input2\nend",
"def calc_short (g, a, t, c)\n t = 4.0*(g+c)+2.0*(a+t)\n return t\nend",
"def gcd_euclides(a, b)\n while b != 0\n t = b\n b = a % b\n a = t\n end\n a\nend",
"def transmogrifier(a, b, c)\n p (a * b) ** c\nend",
"def pow(a, b, c)\n return false if c.negative?\n multi = 1\n (0...b).each do |i|\n multi = multi * a\n end\n result = multi % c\n result\nend",
"def gethashespersec\n request :gethashespersec\n end",
"def ctof (degres)\n return ((degres * 1.8) + 32)\nend",
"def power(base, power)\r\n base ** multiply(power, 1)\r\nend",
"def gcd_ex(x, y)\n s1 = t0 = 0\n s0 = t1 = 1\n until y.zero?\n x, (q, y) = y, divmod(x, y)\n s0, s1 = s1, s0 - q*s1\n t0, t1 = t1, t0 - q*t1\n # puts \"x=#{x} y=#{y} s0=#{s0} s1=#{s1} t0=#{t0} t1=#{t1} q=#{q}\"\n end\n return x, s0, t0, t1, s1\n end",
"def curve\n end",
"def curve\n end",
"def exponent; end",
"def transmogrifier (a, b, c)\n ((a * b) ** c)\nend",
"def calcpi()\n\n pi = 0.0\n rep = $PI_ITER\n \n while rep >= 0\n \n pi += 1.0 / pow(16.0, rep) * (4.0 / (8.0 * rep + 1.0) - 2.0 / (8.0 * rep + 4.0) - 1.0 / (8.0 * rep + 5.0) - 1 / (8.0 * rep + 6.0))\n rep -= 1\n\t\t\n end\n\t\n return pi\nend"
] |
[
"0.669272",
"0.6281804",
"0.61853135",
"0.6131464",
"0.6098486",
"0.60730606",
"0.5941944",
"0.5903776",
"0.5887678",
"0.5838002",
"0.5777422",
"0.5765179",
"0.5694909",
"0.5656472",
"0.56473446",
"0.56099916",
"0.56043214",
"0.55912673",
"0.5583138",
"0.5554771",
"0.5548989",
"0.5542232",
"0.55411816",
"0.5540156",
"0.5533092",
"0.5525543",
"0.5521326",
"0.5473623",
"0.5466333",
"0.5454826",
"0.5454826",
"0.54532653",
"0.54397476",
"0.54312974",
"0.54279065",
"0.54251564",
"0.5424057",
"0.5422017",
"0.54211897",
"0.54101676",
"0.54098314",
"0.5409037",
"0.54037607",
"0.54008764",
"0.54003656",
"0.53723025",
"0.53631663",
"0.53588873",
"0.53556174",
"0.53497463",
"0.53460634",
"0.53418744",
"0.53189814",
"0.5315834",
"0.53141356",
"0.5308986",
"0.530742",
"0.53063804",
"0.5303257",
"0.5301446",
"0.5293019",
"0.52900374",
"0.5289924",
"0.5289266",
"0.5280231",
"0.52784526",
"0.5275633",
"0.52753675",
"0.5274333",
"0.52736",
"0.52696365",
"0.5267297",
"0.52602893",
"0.52543235",
"0.5247815",
"0.5247421",
"0.5246496",
"0.52424705",
"0.5240069",
"0.5237967",
"0.5227171",
"0.522409",
"0.5223371",
"0.5221635",
"0.522071",
"0.5214553",
"0.5212358",
"0.5207518",
"0.5199034",
"0.51972246",
"0.51946294",
"0.5190177",
"0.5187303",
"0.51857114",
"0.5185001",
"0.518459",
"0.5183066",
"0.5183066",
"0.5182575",
"0.5181714",
"0.51810133"
] |
0.0
|
-1
|
GET /control_points GET /control_points.xml GET /user/:user_id/control_points GET /user/:user_id/control_points.xml GET /map/:map_id/control_points GET /map/:map_id/control_points.xml
|
def index
unless @parent.nil?
@control_points = @parent.control_points.order(:updated_at).page(params[:page]).per(10)
@all_control_points = @parent.control_points
else
@control_points = ControlPoint.order(:updated_at).page(params[:page]).per(10)
@all_control_points = ControlPoint.all
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @all_control_points }
format.json { render :json => @all_control_points }
format.rdf
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @map = Map.find(params[:map_id])\n @control_point = @map.control_points.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_point }\n end\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def show\n @control_point = ControlPoint.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_point }\n format.json { render :json => @control_point }\n format.rdf { render :rdf => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n format.ttl { render :ttl => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n format.nt { render :nt => @control_point, \n :httpURI => @base_uri,\n :host => @host}\n end\n end",
"def index\n # @checkpoints = Checkpoint.all\n @route = Route.find(params[:route_id])\n @checkpoints = @route.checkpoints\n # render json: {\n # checkpoints: @checkpoints.to_a\n # }\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def destroy\n @control_point = ControlPoint.find(params[:id])\n @map = @control_point.map\n \n if current_user == @control_point.user\n @control_point.destroy\n end\n \n\n respond_to do |format|\n format.html { redirect_to(map_url @map) }\n format.xml { head :ok }\n end\n end",
"def index\n @user_points = UserPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_points }\n end\n end",
"def index\n @allUsers = User.find(:all, :order => 'points DESC, last_request_at DESC')\n @users = @allUsers.paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end",
"def trackview\n username = params[:username]\n password = params[:password]\n @user = User.get_user(username) # User.first(:login => username)\n @results = []\n if @user\n points = Geo.all(:limit => 4999, :order => [ :created_at.desc ], :user => @user.id )\n points.each do |p|\n @results << [ p.lat, p.lon ]\n end\n else\n @results = [\n [ 37.4419, -122.1419],\n [ 47.4519, -102.1519],\n [ 57.4619, -132.1819]\n ]\n end\n @map.feature_line(@results)\n render\n end",
"def index\n @tourpoints = Tourpoint.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tourpoints }\n end\n end",
"def index\n @way_points = WayPoint.all\n end",
"def index\n @viewpoints = Viewpoint.all\n end",
"def show\n @user = User.find_by_id(params[:user_id])\n\n if @user == nil\n skip_authorization\n elsif @user != nil\n if @user.id == current_user.id\n skip_authorization\n else\n authorize @passive_data_points\n end\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @passive_data_point, status: 200 }\n end\n end",
"def index\n @page_title = \"Data Points\"\n @data_points = DataPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @data_points }\n end\n end",
"def index\r\n @way_points = WayPoint.all\r\n end",
"def index\n @routes_title = I18n.t(\"interface.routes.titles.default\")\n @order = params[:order] || 'updated_at'\n @page = params[:page] || '1'\n @asc = params[:asc] || 'desc'\n conditions = params[:user_id] ? {:user_id => params[:user_id].split('-').first} : {}\n\n #FIXME intentar cargar solo los waypoints para el static path\n #FIXME se debería hacer como un has_many a nivel de modelo o en named_scope\n @routes = Route.paginate :include => [:waypoints, :user, :comments, :favoriters],\n :conditions => conditions, :per_page => '10',\n :page => @page,\n :order => @order + \" \" + @asc\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @routes }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @clipping = Clipping.find(params[:id])\n @previous = @clipping.previous_clipping\n @next = @clipping.next_clipping\n\n @related = Clipping.find_related_to(@clipping)\n\n respond_to do |format|\n format.html # show.rhtml\n end\n end",
"def index\n @operation = request.request_parameters['operation'].blank? ? nil : request.request_parameters['operation']\n @resource_uri = request.request_parameters['resource_uri'].blank? ? nil : request.request_parameters['resource_uri']\n @access_token = request.request_parameters['access_token'].blank? ? nil : request.request_parameters['access_token']\n @aggregation_type = request.request_parameters['aggregation_type'].blank? ? nil : request.request_parameters['aggregation_type']\n @interval_start_time = convert_time(request.request_parameters['interval_start_time'])\n @interval_end_time = convert_time(request.request_parameters['interval_end_time'])\n\n begin\n if !resource_uri.to_s.blank?\n if 'download_data' == operation\n @usage_points = PVImpactGreenButton.download_data(@access_token, @resource_uri, @interval_start_time, @interval_end_time, @aggregation_type.to_i)\n else\n @usage_points = PVImpactGreenButton.retrieve_data(@resource_uri, @interval_start_time, @interval_end_time, @aggregation_type.to_i)\n end\n end\n rescue => e\n @error = e\n p e.backtrace\n end\n end",
"def index\n @member_points = MemberPoint.where(member_id: params[:member_id])\n end",
"def show\n @actions << { url: { action: :index, controller: :pins }, text: 'Pins', method: :get }\n\n respond_to do |format|\n format.html { render partial: 'show', locals: { record: @geo_viewer }, layout: 'admin/admin_show' }\n format.xml { render xml: @geo_viewer }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n format.kml # show.kml.erb\n end\n end",
"def show\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_point }\n end\n end",
"def points\n @usersPoints = User.where.not(id: 1)\n .order(points: :desc)\n .limit(30)\n .paginate(page: params[:points_page], per_page: 10)\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def update\n @control_point = ControlPoint.find(params[:id])\n respond_to do |format|\n if @control_point.update_attributes(params[:control_point])\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n authorize! :index, Por, :message => 'Acceso denegado.'\n @pors = @campus.pors.paginate(:per_page => 3, :page => params[:page])\n\t\t@points = @pors\n\t\t@point_name = \"por\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render \"points/index.json.erb\" } # index.json.erb\n end\n end",
"def index\n @point_services = PointService.all\n end",
"def index\n authorize :user\n if @localmap=Localmap.get(@user,params[:localID])\n @message=\"Found\"\n else\n @message=\"Not found\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @localmap,:template => 'localmaps/localmap.xml.builder' }\n end\n end",
"def create\n @control_point = ControlPoint.new(params[:control_point])\n @control_point.user = current_user\n @control_point.map = Map.find(params[:map_id])\n @map = @control_point.map # we have to do this so the form is correctly displayed on error\n respond_to do |format|\n if @control_point.save\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully created.') }\n format.xml { render :xml => @control_point, :status => :created, :location => @control_point }\n format.js { }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @routes = Route.all\n @alt=50\n @kml_name=\"WMATA Bus\"\n @kml_desc=\"WMATA Bus Routes\"\n respond_to do |format|\n format.html \n format.kml { render kml: @routes }\n format.json { render json: @routes }\n end\n end",
"def mini_map_index\n @mini_maps = MiniMap.find_all_by_houdd_user_id(params[:user_id])\n\n respond_to do |format|\n format.html # mini_map_index.html.erb\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def index\n @coordinates = @track.coordinates.for_user current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordinates }\n end\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end",
"def view_indicators_and_resources\n\t\t@competency = Competency.find(params[:competency_id])\n\t\t@indicators = Indicator.by_level(params[:level]).by_competency(@competency.name)\n\t\t@resources = Resource.all\n\tend",
"def index\n @controls = Control.all\n\n respond_with @controls\n end",
"def show\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end",
"def index\n p params[:tour_id]\n if params[:tour_id].nil?\n @points = Point.all\n render json: @points, include: :tour, status: :ok\n else\n @points = Point.where(tour_id: params[:tour_id])\n render json: @points, status: :ok\n end\n end",
"def index\n @needed_control = NeededControl.all\n end",
"def index\n ok_request current_user, %w(user, opinion_polls, opinion_polls.time_slots)\n end",
"def index\n @accesspoints = Accesspoint.all\n end",
"def show\n @point = Point.find(params[:id])\n @user = User.find(:first, :joins => \"inner join points on users.id = points.user_id\", :conditions => [ \"points.id = ?\",params[:id]])\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @point }\n# end\n#タイムラインへリダイレクト\n redirect_to_timelines\n end",
"def show\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def index\n # == show the source and destinations\n #OPTIMIZE\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @maps }\n end\n end",
"def index\n @points = Point.all\n end",
"def index\n @points = Point.all\n end",
"def point_list\n @user_point = UserPoint.find_by_user_id(current_user.id)\n end",
"def show\n route = Route.find(params[:id])\n imgs = []\n if !route.nil?\n route.rota_points.each do |rp|\n imgs.push(rp.rota_point_images)\n end\n render :json => {:success => \"true\", :route => route, :points => route.rota_points, :images => imgs}\n else\n render :json => {:success => \"false\"}\n end\n end",
"def index\n if params[:x1]\n @places = Place.by_bounds( params[:x1], params[:y1], params[:x2], params[:y2], params )\n end\n #@places = Place.without_nodes\n respond_with(@places)\n end",
"def new\n @point = Point.new\n @users = User.all\n @user = User.find(params[:user_id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def index\n @pclevels = Pclevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pclevels }\n end\n end",
"def index\n @trips = policy_scope(Trip).belonging_to(@user.id).includes(flights: [:airline, :depart_airport_info, :arrive_airport_info]).decorate.reverse\n @show_controls = current_user.present? && @user.id == current_user.id\n end",
"def available_credit_points\n @retval = Hash.new()\n unless params[:username].blank?\n @hmm_user = HmmUser.find(:first,:conditions=>{:v_user_name=>params[:username]},:select=>'id')\n if(@hmm_user)\n @credit = CreditPoint.find(:first,:conditions=>{:user_id=>@hmm_user.id})\n if @credit\n @retval['available_points'] = @credit.available_credits\n @retval['status'] = true\n else\n @retval['available_points'] = 0\n @retval['status'] = true\n end\n else\n @retval['message'] = 'user not found'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'username is required'\n @retval['status'] = false\n end\n render :xml => @retval.to_xml({:root=>'response',:dasherize =>false})\n end",
"def show\n add_breadcrumb :details\n @map_opt = {\n :zoom => 2,\n :auto_adjust => true,\n :auto_zoom => false,\n :detect_location => true\n }\n @user = User.find(params[:id], :include => [:positions => [:company]])\n if (current_user.id != @user.id)\n Visit.create! :ip => request.ip, :ua => request.env['HTTP_USER_AGENT'], :user_id => current_user.id, :visitor_id => @user.id\n end\n respond_to do |format|\n format.html do #show.html.erb\n @markers = @user.to_gmaps4rails do |user, marker|\n marker.infowindow render_to_string(:partial => \"marker_template\", :locals => {:usr => @user})\n marker.json({:id => user.id})\n end\n end\n format.xml { render :xml => {:user => @user} }\n format.json { render :json => {:user => @user} }\n end\n end",
"def show\n if current_user\n @user = User.find_by(uuid: params[:uuid])\n @user.update_points\n elsif (current_user)\n redirect_to users_path\n else\n redirect_to root_path\n end\n end",
"def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def index\n session[:ppage] = (params[:per_page].to_i rescue 25) if (params[:per_page] && (not params[:per_page.blank?] ) )\n @per_page = session[:ppage].to_s\n params[:ppage] = session[:ppage]\n\n if (params[:status].present? && CollectionPoint.collection_points_status.include?(params[:status].to_sym) )\n @active = params[:status].to_sym\n @collection_points = CollectionPoint.where(status: params[:status]).order(:name)\n else\n @collection_points = CollectionPoint.order(:name)\n @active = \"all\"\n end\n @collection_points = @collection_points.page(params[:page]).per(session[:ppage])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collection_points }\n end\n end",
"def index\n if current_user != nil\n redirect_to trip_plans_choose_path\n end\n end",
"def show\n @node = Node.find(params[:id])\n @json = Node.find(params[:id]).to_gmaps4rails\n # @json = Node.where(:user_id => current_user[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def index\n parent_id = BSON::ObjectId(params[:facility_id]) unless params[:facility_id].blank?\n house_id = BSON::ObjectId(params[:house_id]) unless params[:house_id].blank?\n opts = {\n status: params[:status],\n access_ip: params[:access_ip],\n user_facility_ids: parent_id || house_id\n }.delete_if {|key, value| value.blank?}\n\n @client_face_ips = paginate(FaceIp.includes(:user).where(opts))\n end",
"def index\n @conns = current_user.conns\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conns }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @user_accounts = @user.user_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_accounts }\n format.xml { render xml: @user_accounts }\n end\n end",
"def index\n # Get permissions in order to show/hide \"Edit\"/\"Destroy\" links on each\n # trip.\n if user_signed_in?\n @permissions = Permission.where(user_id: current_user.id)\n @admin_permission = Permission_type.find_by(permission: \"admin\").id\n end\n\n # Get public trips and the private trip the connected user has an access on.\n if user_signed_in?\n # Show all trips if the user is super-admin\n if current_user.super_admin\n @trips = Trip.all\n else\n sqlRequest = \"\n SELECT *\n FROM trips AS t\n WHERE public = 1\n OR id IN (SELECT p.trip_id FROM permissions AS p WHERE p.user_id = ? AND accepted = 1)\"\n @trips = Trip.find_by_sql [sqlRequest, current_user.id]\n end\n else\n @trips = Trip.where(public: 1)\n end\n end",
"def index\n if current_user.admin\n @access_list_to_ea_points = AccessListToEaPoint.all\n else \n redirect_to \"/ea_points\", notice: 'Page not available.'\n end\n end",
"def results\n @checkpoint_user = CheckpointUser.find(params[:id])\n @user = current_user\n\n # redirect users trying to access other checkpoints\n if (!current_user.is_admin? && !current_user.is_orgleader? && @checkpoint_user.user.id != current_user.id)\n puts \"ACCESS EXCEPTION: non-admin user #{current_user.id} is trying to access #{@checkpoint_user.user.id}'s checkpoint\"\n flash[:error] = \"You don't have permission to access this checkpoint's results.\"\n redirect_to checkpoints_path\n end\n \n # make sure checkpoint is complete\n if (!@checkpoint_user.is_complete?)\n flash[:error] = \"Sorry, this checkpoint hasn't been completed yet.\"\n redirect_to checkpoints_path\n end\n \n # view does the rest...\n \n end",
"def index\n if !params[:all].nil?\n @all_stops = true\n @stops = Stop.all\n else\n @all_stops = false\n @stops = Stop.enabled\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stops.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.js { render :json => @stops.to_json(\n :include => {\n :routes => {\n :only => [:name, :id]\n }\n }\n ) }\n format.kml\n end\n end",
"def show\n @groundwater_control = GroundwaterControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groundwater_control }\n end\n end",
"def index\n @levels_points = LevelsPoint.all\n end",
"def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"def show\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def index\n # user = User.find(params[:user_id]) if params[:user_id]\n # if user\n # @unit_planners = user.unit_planners\n # else\n @unit_planners = UnitPlanner.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @unit_planners }\n end\n end",
"def index\n @map_nodes = Map::Node.paginate(:page => params[:page], :per_page => 64)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @punch_clocks = current_user.account.punch_clocks\n end",
"def show\n authorize! :show, PointsEntryType\n load_points_entry_type\n load_points_entries\n end",
"def index\n @points = Array.new\n @profiles = Profile.where(:user_id => current_user.id)\n @user = User.find(current_user.id)\n @bounds = Hash.new\n\n lng_max=lat_max=-999999\n lng_min=lat_min=999999\n @anzahl = @user.profile.meeting_points.count\n @user.profile.meeting_points.each do |val|\n if val.lng.to_f > lng_max.to_f\n lng_max = val.lng\n end\n if val.lng.to_f < lng_min.to_f\n lng_min = val.lng\n end\n if val.lat.to_f > lat_max.to_f\n lat_max = val.lat\n end\n if val.lat.to_f < lat_min.to_f\n lat_min = val.lat\n end\n\n @points << [ val.lng.to_s, val.lat.to_s, val.description, val.id ]\n end\n @bounds={:lng_max => lng_max, :lng_min=>lng_min, :lat_max=>lat_max, :lat_min=>lat_min }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def users\n @map = Map.find_by_name('Stor-Oslo') \n @gmap = @map.to_gmap\n Users.find(:all).each { |u| @gmap.overlay_init(u.to_gmarker) }\n render :action => :index\n end",
"def requests_on_map\n params[:listing_type] = \"request\"\n @to_render = {:action => :index}\n @listings = Listing.open.order(\"created_at DESC\").find_with(params, @current_user, @current_community)\n @listing_style = \"map\"\n load\n end",
"def trips\n get '/gtfs/trips'\n end",
"def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def index\n\n asCoord = Coord.where(admin_id: params[:admin_id])\n @coords = asCoord.paginate(page: params[:page], per_page: 5).order(\"curso_id\")\n end",
"def index\n @user_prefs = UserPref.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_prefs }\n end\n end",
"def index\n @useraccountrights = Useraccountright.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @useraccountrights }\n end\n end",
"def index\n set_user\n @time_offs = TimeOff.all\n end",
"def index\n @current_user = current_user\n user_id = params[:user_id] || current_user.id\n @user = User.find( user_id )\n @json = @user.to_gmaps4rails\n if( params[:ad_id].present? )\n @ad = Ad.find( params[:ad_id]) # if you want to find users following ads\n @users = @ad.followers\n flash[:title] = \"Following\"\n respond_with( @ad, @users )\n elsif( params[ :product_id ] )\n @product = Product.find( params[ :product_id ] )\n @object = @product\n @users = @product.userfeed( params[ :show_users_by] )\n flash[:title] = params[ :show_users_by]\n respond_with( @product, @users )\n elsif( params[ :q ] )\n @users = User.where( User.search_query( params[:q] ) )\n respond_with( @users )\n else\n @users = @user.userfeed( params[:show_users_by] )\n flash[:title] = params[:show_users_by]\n respond_with( @users )\n end\n end",
"def index\n render plain: \"/api/races, offset=[#{params[:offset]}], limit=[#{params[:limit]}]\"\n end",
"def ajax_service_point\n sp_id = params['sp_id']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n sp = CUL::FOLIO::Edge.service_point(url, tenant, folio_token, sp_id)\n render json: sp\n end",
"def index # Essentially the main page of the application proper. This is the discover page.\n #@outlets = Outlet.where(inactive: false).order(:name).paginate(page: params[:page], per_page: 20)\n offset = params[:offset].to_i\n if offset == nil\n offset = 0\n end\n if current_user.trial == true\n puts \"current_user is trial user\"\n fetch_trial_outlets\n else\n fetch_outlets(offset)\n end\n render json: @outlets\n end",
"def show\n @key_point = KeyPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_point }\n end\n end",
"def index\n @compares = current_user.compares\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @compares }\n end\n end",
"def index\n\t\t@interval = 10\n\t\t@page = 0\n\t\t@users = User.all.order('points DESC')\n\tend",
"def clients\n @map = Map.find_by_name('Stor-Oslo') \n @gmap = @map.to_gmap\n Client.find(:all).each { |c| @gmap.overlay_init(c.to_gmarker) }\n render :action => :index\n end",
"def show\n @water_point = WaterPoint.visible.find(params[:id]) rescue (redirect_to water_points_path; return)\n @comments = @water_point.comments.visible\n @current_vote = current_user && Vote.find_by_user_id_and_water_point_id(@current_user.id, @water_point.id)\n @subscribed = current_user && Follower.find_by_user_id_and_water_point_id(@current_user.id, @water_point.id)\n\n make_map('detail')\n \n @page_ancestors = [{:name=>'Dripplets', :url=> water_points_path}]\n @bc_title = 'Dripplet'\n \n respond_to(:html,:iphone)\n\n end",
"def GET; end",
"def index\n @own_coupons = Coupon.where(user_id: current_user).paginate(:page => params[:page], :per_page => 30)\n @coupons = Coupon.all.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @coupons }\n end\n end",
"def index\n @time_controls = TimeControl.all\n end",
"def service_points(request)\n return restricted_service_point_options(request) if request.restricted_pickup_service_points.present?\n\n service_point_options(request)\n end"
] |
[
"0.6276032",
"0.62197244",
"0.60305244",
"0.58358794",
"0.5720946",
"0.56601816",
"0.56504554",
"0.55939615",
"0.55346173",
"0.5487293",
"0.54569525",
"0.54560316",
"0.54267526",
"0.5425114",
"0.54191685",
"0.5414706",
"0.5412523",
"0.54117185",
"0.5388194",
"0.5382972",
"0.5361237",
"0.53604263",
"0.5336245",
"0.5335952",
"0.5335906",
"0.5329836",
"0.5329746",
"0.53265774",
"0.5322467",
"0.53034824",
"0.5302292",
"0.5288703",
"0.52846044",
"0.52712524",
"0.5262387",
"0.52565396",
"0.5256456",
"0.52558124",
"0.52535516",
"0.5247659",
"0.5235843",
"0.5216474",
"0.5212561",
"0.5209273",
"0.51995486",
"0.5193794",
"0.5185149",
"0.5185149",
"0.5165882",
"0.51564944",
"0.51537895",
"0.5147745",
"0.5131671",
"0.5118117",
"0.51167184",
"0.5109963",
"0.5106769",
"0.5094879",
"0.5092579",
"0.508472",
"0.5084203",
"0.506966",
"0.5069212",
"0.50673693",
"0.50652367",
"0.5061673",
"0.5053175",
"0.5052812",
"0.50485224",
"0.5048374",
"0.50422764",
"0.5039732",
"0.5035981",
"0.50340956",
"0.50320435",
"0.503199",
"0.50287604",
"0.50273216",
"0.50232726",
"0.502307",
"0.5022271",
"0.5014708",
"0.50144774",
"0.50140536",
"0.5012862",
"0.50116813",
"0.5004885",
"0.5004624",
"0.50040376",
"0.500264",
"0.5001185",
"0.4992818",
"0.49919844",
"0.49859935",
"0.49852824",
"0.49832898",
"0.49792877",
"0.49776676",
"0.49773854",
"0.49735385"
] |
0.6369145
|
0
|
GET /control_points/1 GET /control_points/1.xml
|
def show
@control_point = ControlPoint.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @control_point }
format.json { render :json => @control_point }
format.rdf { render :rdf => @control_point,
:httpURI => @base_uri,
:host => @host}
format.ttl { render :ttl => @control_point,
:httpURI => @base_uri,
:host => @host}
format.nt { render :nt => @control_point,
:httpURI => @base_uri,
:host => @host}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n \n unless @parent.nil?\n @control_points = @parent.control_points.order(:updated_at).page(params[:page]).per(10)\n @all_control_points = @parent.control_points\n else\n @control_points = ControlPoint.order(:updated_at).page(params[:page]).per(10)\n @all_control_points = ControlPoint.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @all_control_points }\n format.json { render :json => @all_control_points }\n format.rdf\n end\n end",
"def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end",
"def index\n @page_title = \"Data Points\"\n @data_points = DataPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @data_points }\n end\n end",
"def show\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def new\n @map = Map.find(params[:map_id])\n @control_point = @map.control_points.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_point }\n end\n end",
"def show\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point }\n format.kml # show.kml.erb\n end\n end",
"def index\n @tourpoints = Tourpoint.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tourpoints }\n end\n end",
"def show\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def show\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @approximate_service }\n end\n end",
"def show\n @groundwater_control = GroundwaterControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groundwater_control }\n end\n end",
"def show\n @stop = Stop.where(:short_name => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stop.to_xml(\n :include => { \n :routes => {\n :only => [:name, :id] \n } \n }\n ) }\n format.kml\n end\n end",
"def show\n @history_point = HistoryPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @history_point }\n end\n end",
"def show\n @pclevel = Pclevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"def index\n @pclevels = Pclevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pclevels }\n end\n end",
"def show\n @credit_control = CreditControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @credit_control }\n end\n end",
"def show\n @point_type = PointType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def index\n # @checkpoints = Checkpoint.all\n @route = Route.find(params[:route_id])\n @checkpoints = @route.checkpoints\n # render json: {\n # checkpoints: @checkpoints.to_a\n # }\n end",
"def show\n @cybercontrol = Cybercontrol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cybercontrol }\n end\n end",
"def index\n @viewpoints = Viewpoint.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @tourpoint = Tourpoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def show\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end",
"def index\n @pppams_indicator_base_refs = PppamsIndicatorBaseRef.paginate(:all, :per_page => 20, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pppams_indicator_base_refs }\n>>>>>>> 7436653363ecf064fdcfcd2b30df919b5144a2b8\n end\n end",
"def show\n @key_point = KeyPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_point }\n end\n end",
"def show\n @countdown_ipp = CountdownIpp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown_ipp }\n end\n end",
"def show\n @calibration = Probe::Calibration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calibration }\n end\n end",
"def show\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @graph_point }\n format.json { render :json => @graph_point }\n end\n end",
"def new\n @checkpoint = Checkpoint.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def index\n @point_services = PointService.all\n end",
"def index\n @peeps = Peep.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @peeps }\n end\n end",
"def show\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @point_consumption }\n end\n end",
"def show\n @crop_pricing = CropPricing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crop_pricing }\n end\n end",
"def show\n @deposit_threshold = DepositThreshold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deposit_threshold }\n end\n end",
"def update\n @control_point = ControlPoint.find(params[:id])\n respond_to do |format|\n if @control_point.update_attributes(params[:control_point])\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @end_point }\n format.xml { render xml: @end_point }\n end\n end",
"def index\n @pricing_plans = PricingPlan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pricing_plans }\n end\n end",
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end",
"def new\n @page_title = \"Data Points\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def show\n @knob = Knob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @knob }\n end\n end",
"def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def show\n @node = Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.xml { render :xml => @node }\n format.kml { render :xml => @node }\n end\n end",
"def index\n @way_points = WayPoint.all\n end",
"def index\n @operation = request.request_parameters['operation'].blank? ? nil : request.request_parameters['operation']\n @resource_uri = request.request_parameters['resource_uri'].blank? ? nil : request.request_parameters['resource_uri']\n @access_token = request.request_parameters['access_token'].blank? ? nil : request.request_parameters['access_token']\n @aggregation_type = request.request_parameters['aggregation_type'].blank? ? nil : request.request_parameters['aggregation_type']\n @interval_start_time = convert_time(request.request_parameters['interval_start_time'])\n @interval_end_time = convert_time(request.request_parameters['interval_end_time'])\n\n begin\n if !resource_uri.to_s.blank?\n if 'download_data' == operation\n @usage_points = PVImpactGreenButton.download_data(@access_token, @resource_uri, @interval_start_time, @interval_end_time, @aggregation_type.to_i)\n else\n @usage_points = PVImpactGreenButton.retrieve_data(@resource_uri, @interval_start_time, @interval_end_time, @aggregation_type.to_i)\n end\n end\n rescue => e\n @error = e\n p e.backtrace\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def show\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def index\n @service_plans = ServicePlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_plans }\n end\n end",
"def index\n @checkpoint_removeds = CheckpointRemoved.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @checkpoint_removeds }\n end\n end",
"def vips\n request :get, '/vips'\n end",
"def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end",
"def show\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def show\n\n redirect_to :action => \"index\"\n # @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n\n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @deadlift_data_point }\n # end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def index\n @points = Point.all\n end",
"def index\n @points = Point.all\n end",
"def show\n @incentive = Incentive.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @incentive }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def show\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_panel }\n end\n end",
"def show\n @access_point = AccessPoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @access_point }\n end\n end",
"def index\n @controls = Control.all\n\n respond_with @controls\n end",
"def index\r\n @way_points = WayPoint.all\r\n end",
"def index\n @preferences = Preference.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @preferences }\n end\n end",
"def get; end",
"def show\n @kpi = Kpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kpi }\n end\n end",
"def ajax_service_point\n sp_id = params['sp_id']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n sp = CUL::FOLIO::Edge.service_point(url, tenant, folio_token, sp_id)\n render json: sp\n end",
"def index\n @point_of_interest_comments = @point_of_interest.point_of_interest_comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @point_of_interest_comments }\n end\n end",
"def index\n @kpis = Kpi.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kpis }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def index\n @checkpoints = Checkpoint.all_future_checkpoints\n @past_checkpoints = Checkpoint.all_past_checkpoints\n end",
"def show\n @point = Point.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @point }\n end\n end",
"def show\n @countdown = Countdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end",
"def index\n @accesspoints = Accesspoint.all\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def index\n @positioncoefficients = Positioncoefficient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positioncoefficients }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end",
"def index\n @controlpreats = Controlpreat.all\n end",
"def show\n @power = Power.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power }\n end\n end",
"def show\n @pricing_plan = PricingPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pricing_plan }\n end\n end",
"def show\n @peep = Peep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @peep }\n end\n end",
"def show\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actuator }\n end\n end",
"def show\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end",
"def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end",
"def show\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic }\n end\n end",
"def index\n @terminate_points = TerminatePoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @terminate_points }\n end\n end",
"def show\n @lista_precio = ListaPrecio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lista_precio }\n end\n end",
"def show\n @point_of_interest = PointOfInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @point_of_interest }\n format.json { render :json => @point_of_interest.as_json_single() }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def show\n @path = Path.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @path }\n format.kml # show.kml.erb\n end\n end",
"def index\n @available_offs=current_employee.available_offs\n if @available_offs\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @available_offs } \n end\n else\n render :text => \"Error\"\n end\n end",
"def index\n @ppos_prerequisites = PposPrerequisite.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ppos_prerequisites }\n end\n end",
"def show\n @prc = Prc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def show\n @exposure = Exposure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exposure }\n end\n end"
] |
[
"0.6437103",
"0.6291598",
"0.6111449",
"0.6101844",
"0.60807395",
"0.597764",
"0.5963573",
"0.5938321",
"0.5902689",
"0.59000844",
"0.57983583",
"0.5773126",
"0.57420653",
"0.5701334",
"0.5701086",
"0.56786627",
"0.5678122",
"0.5616808",
"0.5605142",
"0.5601392",
"0.55908585",
"0.5578262",
"0.5555607",
"0.55377835",
"0.5530962",
"0.5510355",
"0.54948694",
"0.54918104",
"0.5480692",
"0.54727566",
"0.5469367",
"0.5454816",
"0.5453241",
"0.5450978",
"0.5449324",
"0.54132885",
"0.5383256",
"0.53735703",
"0.53719336",
"0.53667444",
"0.5361124",
"0.53581727",
"0.5356738",
"0.5348953",
"0.53338426",
"0.5331697",
"0.53270036",
"0.53133196",
"0.53113335",
"0.5309209",
"0.5304972",
"0.53039986",
"0.5297025",
"0.5289261",
"0.52846134",
"0.52829295",
"0.52794856",
"0.52769315",
"0.52746695",
"0.52681744",
"0.52653134",
"0.52653134",
"0.5265159",
"0.5263933",
"0.52609855",
"0.52602255",
"0.5257045",
"0.5251564",
"0.5242045",
"0.5240463",
"0.52373",
"0.52341366",
"0.5227414",
"0.5225959",
"0.52249616",
"0.52240336",
"0.5221702",
"0.5221069",
"0.5216915",
"0.52147865",
"0.5214145",
"0.52097946",
"0.5205878",
"0.51999015",
"0.51971656",
"0.5195099",
"0.5194019",
"0.51879597",
"0.5177726",
"0.51712966",
"0.51705235",
"0.5165711",
"0.5165208",
"0.5165114",
"0.51648885",
"0.5162622",
"0.51603836",
"0.5160367",
"0.51596045",
"0.5158171"
] |
0.63807595
|
1
|
GET /control_points/new GET /control_points/new.xml GET /maps/:map_id/control_points/new
|
def new
@map = Map.find(params[:map_id])
@control_point = @map.control_points.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @control_point }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @control_point = ControlPoint.new(params[:control_point])\n @control_point.user = current_user\n @control_point.map = Map.find(params[:map_id])\n @map = @control_point.map # we have to do this so the form is correctly displayed on error\n respond_to do |format|\n if @control_point.save\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully created.') }\n format.xml { render :xml => @control_point, :status => :created, :location => @control_point }\n format.js { }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n #TODO\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def new\n @map = Map.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.name = \"Map Created #{Time.now.strftime('at %I:%M%p')}\" if @map.name.blank?\n @map.description = \"No Description Provided\" if @map.description.blank?\n if points = params['markers']\n points.each do |marker_identifier, point|\n @map.points.build(:lat => point['lat'].to_f,:lng => point['lng'].to_f,:description =>point['description'], :marker_identifier => marker_identifier)\n end\n end\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def new\n @map_layer = MapLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_layer }\n end\n end",
"def create\n #FIXME check\n @map = Map.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n format.xml { render :xml => @map, :status => :created, :location => @map }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @map = current_user.maps.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def new\n @point = Point.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @localmap = Localmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @localmap }\n end\n end",
"def new\n @map = Map.new\n\n puts @saved_locations\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def new\n @map = Map.new\n @map.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map }\n end\n end",
"def new\n @map = Map.find(params[:map_id])\n\n #@node = Node.new\n @node = @map.nodes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @map_node = Map::Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_node }\n end\n end",
"def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def new\n @waypoint = Waypoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @waypoint }\n end\n end",
"def new\n @map_marker = MapMarker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_marker }\n end\n end",
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render action: 'show', status: :created, location: @map }\n else\n format.html { render action: 'new' }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tinymap = Tinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def new\n @shiftmap = Shiftmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shiftmap }\n end\n end",
"def new\n @moretinymap = Moretinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @moretinymap }\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @map.mapable, notice: 'Map added!' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_map = current_my_map\n place = Place.find(params[:place_id])\n @way_point = @my_map.add_place(place.id)\n\n respond_to do |format|\n if @way_point.save\n format.html { redirect_to @way_point.my_map, notice: 'マイマップに追加しました。' }\n format.json { render action: 'show', status: :created, location: @way_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @way_point = WayPoint.new(way_point_params)\r\n respond_to do |format|\r\n if @way_point.save\r\n format.html { redirect_to my_maps_path, notice: 'Way point was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @way_point }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = current_user.maps.new(params[:map])\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n else\n format.html { redirect_to maps_url }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.user = current_user\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render json: @map, status: :created, location: @map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mini_map_road = MiniMapRoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def new\n do_new_resource\n get_project_if_exists\n do_set_attributes\n do_authorize_instance\n\n # initialize lat/lng to Brisbane-ish\n @site.longitude = 152\n @site.latitude = -27\n respond_to do |format|\n format.html\n format.json { respond_new }\n end\n end",
"def new\n @m_get_point = MGetPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @m_get_point }\n end\n end",
"def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @stop = Stop.new({:latitude => MAP_CENTER[:lat], :longitude => MAP_CENTER[:long]})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stop }\n end\n end",
"def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def new\n @collection_point = CollectionPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_point }\n end\n end",
"def new\n @map_image = MapImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_image }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end",
"def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @point }\n end\n end",
"def new\n @outdoor = Outdoor.new\n @json = Outdoor.new(params[:id]).to_gmaps4rails\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outdoor }\n end\n end",
"def new\n @map_area = MapArea.new\n @start = GeoLoc.new(:lat=>40.010492, :lng=> -105.276843)\n @zoom= 14\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_area }\n end\n end",
"def new\n @map_area = MapArea.new\n @start = GeoLoc.new(:lat=>40.010492, :lng=> -105.276843)\n @zoom= 14\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_area }\n end\n end",
"def new\n @admin_route = Admin::Route.new\n\t\t@admin_route.route_markers.build\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_route }\n end\n end",
"def new\n @location_point = LocationPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_point }\n end\n end",
"def new\n @access_point = AccessPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_point }\n end\n end",
"def new\n @pointcode = Pointcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pointcode }\n end\n end",
"def new\n @google_map = GoogleMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @google_map }\n end\n end",
"def new\n @gmap = Gmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gmap }\n end\n end",
"def new\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true,:map_type => true)\n @map.center_zoom_init([30.7645,120.7248],15)\n @map.event_init(@map, :click, \"function(marker, point) {\n if(marker == null)\n {\n map.clearOverlays();\n map.addOverlay( new GMarker(point,{title : ''}) );\n $('house_lng').value=point.y;\n $('house_lat').value=point.x;\n }\n }\")\n \n @house = House.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house }\n end\n end",
"def new\n @key_point = KeyPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key_point }\n end\n end",
"def new\n\n @trip_proxy = TripProxy.new()\n @trip_proxy.traveler = @traveler\n\n # set the flag so we know what to do when the user submits the form\n @trip_proxy.mode = MODE_NEW\n \n # Set the travel time/date to the default\n travel_date = default_trip_time\n\n @trip_proxy.trip_date = travel_date.strftime(TRIP_DATE_FORMAT_STRING)\n @trip_proxy.trip_time = travel_date.strftime(TRIP_TIME_FORMAT_STRING)\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_proxy }\n end\n end",
"def create\n @map = @kanzume.maps.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id), notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: kanzume_map_path(kanzume_id: @map.kanzume_id,id: @map.id) }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n authorize! :new_marker, ::Gameui::Map\n @marker = ::Gameui::Marker.new\n end",
"def create\n @map_layer = MapLayer.new(params[:map_layer])\n\n respond_to do |format|\n if @map_layer.save\n flash[:notice] = 'Map Layer was successfully created.'\n format.html { redirect_to(@map_layer) }\n format.xml { render :xml => @map_layer, :status => :created, :location => @map_layer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_layer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @openmapa = Openmapa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @openmapa }\n end\n end",
"def new\n @pclevel = Pclevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pclevel }\n end\n end",
"def new\n # if (params[:map_link])\n # check_slashes(params[:map_link])\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n @group_map = GroupMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_map }\n end\n end",
"def new\n @point_type = PointType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point_type }\n end\n end",
"def new\n @theme_map = ThemeMap.new\n @map_layers = MapLayer.order('name ASC')\n end",
"def new\n @cocktail_marker = CocktailMarker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cocktail_marker }\n end\n end",
"def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def new\n @requirement_map = RequirementMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @requirement_map }\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end",
"def create\n @moretinymap = Moretinymap.new(params[:moretinymap])\n\n respond_to do |format|\n if @moretinymap.save\n format.html { redirect_to @moretinymap, notice: 'Moretinymap was successfully created.' }\n format.json { render json: @moretinymap, status: :created, location: @moretinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moretinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @time_point = TimePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_point }\n end\n end",
"def create\n @route = Route.new(route_params)\n @route.save\n\n redirect_to '/routes/map/'+@route.map_id.to_s\n end",
"def create\n @category_map = CategoryMap.new(category_map_params)\n\n respond_to do |format|\n if @category_map.save\n format.html { redirect_to @category_map, notice: 'Category map was successfully created.' }\n format.json { render :show, status: :created, location: @category_map }\n else\n format.html { render :new }\n format.json { render json: @category_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @route_point = RoutePoint.new(params[:route_point])\n\n respond_to do |format|\n if @route_point.save\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully created.') }\n format.xml { render :xml => @route_point, :status => :created, :location => @route_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n \n if current_user\n @map = Map.create\n current_user.memberships.create(:map => @map, :level => 'owner')\n else\n self.unsaved_map = Map.create unless unsaved_map\n @map = unsaved_map\n end\n redirect_to [:edit, @map]\n end",
"def create\n @location_url_map = LocationUrlMap.new(params[:location_url_map])\n\n respond_to do |format|\n if @location_url_map.save\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully created.' }\n format.json { render json: @location_url_map, status: :created, location: @location_url_map }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @domain_map = current_user.domain_maps.new\n @server_ip = server_ip\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @domain_map }\n end\n end",
"def create\n @map = Map.new(map_params)\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n respond_to do |format|\n if @map.save\n format.html { redirect_to @map, notice: 'Map was successfully created.' }\n format.json { render :show, status: :created, location: @map }\n else\n format.html { render :new }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sasmap = Sasmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def new\n @page_title = \"Data Points\"\n @data_point = DataPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @data_point }\n end\n end",
"def create\n @roadmap = Roadmap.new(params[:roadmap])\n\t\t@roadmap.user_id = current_user.id\n\n respond_to do |format|\n if @roadmap.save\n flash[:notice] = 'Roteiro criado com sucesso.'\n format.html { redirect_to(@roadmap) }\n format.xml { render :xml => @roadmap, :status => :created, :location => @roadmap }\n else\n\t\t\t\n\t\t\t\t# Recarrega os estados e as cidades se possivel\n\t\t\t\tload_states_and_cities(@roadmap)\n\n format.html { render :action => \"new\" }\n format.xml { render :xml => @roadmap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @mosttinymap = Mosttinymap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mosttinymap }\n end\n end",
"def new\n @title = \"場所の登録\"\n @spot = Spot.new\n \n\n @lat = session[:new_map_center_lat] || 34\n @lng = session[:new_map_center_lng] || 150\n @zoom = session[:new_map_zoom] || 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spot }\n end\n end",
"def create\n @place.user = current_user\n\n @select_markers = return_markers\n\n puts params[:map_marker]\n\n\n respond_to do |format|\n if @place.save\n Log.logit!(:places, :notice, \"User created place \" + @place.name, {:user_id => @current_user.id, :place_id => @place.id})\n format.html { redirect_to @place, notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @map_state = MapState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @map_state }\n end\n end",
"def create\n @m_get_point = MGetPoint.new(params[:m_get_point])\n\n respond_to do |format|\n if @m_get_point.save\n format.html { redirect_to :controller => \"m_get_points\", :action => \"index\" }\n #format.html { redirect_to @m_get_point, notice: 'M get point was successfully created.' }\n format.json { render json: @m_get_point, status: :created, location: @m_get_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_get_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sessionmap = Sessionmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sessionmap }\n end\n end",
"def new\n @position_mapper = PositionMapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @position_mapper }\n end\n end",
"def new\n @overlay = Overlay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @overlay }\n end\n end",
"def new\n @select_markers = return_markers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end",
"def new\n # pc_map instance\n @pc_map = PcMap.new\n @pc_map.product_id = params[:product_product_id]\n end",
"def new\n @coff = Coff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coff }\n end\n end",
"def create\n @waypoint = Waypoint.new(params[:waypoint])\n\n respond_to do |format|\n if @waypoint.save\n flash[:notice] = 'Waypoint was successfully created.'\n format.html { redirect_to(@waypoint) }\n format.xml { render :xml => @waypoint, :status => :created, :location => @waypoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @waypoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @tourpoint = Tourpoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tourpoint }\n end\n end",
"def new\n @admin_hotspot = Admin::Hotspot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_hotspot }\n end\n end",
"def new\n @land_use_mapping = LandUseMapping.new\n @title = \"land use mapping\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @land_use_mapping }\n end\n end",
"def create\n @indication_generic_map = IndicationGenericMap.new(indication_generic_map_params)\n\n respond_to do |format|\n if @indication_generic_map.save\n format.html { redirect_to @indication_generic_map, notice: 'Indication generic map was successfully created.' }\n format.json { render :show, status: :created, location: @indication_generic_map }\n else\n format.html { render :new }\n format.json { render json: @indication_generic_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def new\n @trip = current_user.trips.build\n 5.times {@trip.places.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def create\n @map_node = Map::Node.new(params[:map_node])\n\n respond_to do |format|\n if @map_node.save\n format.html { redirect_to @map_node, notice: 'Node was successfully created.' }\n format.json { render json: @map_node, status: :created, location: @map_node }\n else\n format.html { render action: \"new\" }\n format.json { render json: @map_node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @zone = Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone }\n end\n end",
"def new\n @layer = Layer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @layer }\n end\n end"
] |
[
"0.7418747",
"0.69204503",
"0.6777111",
"0.66253453",
"0.6617716",
"0.6550849",
"0.6548895",
"0.65268975",
"0.6509584",
"0.6503684",
"0.64741904",
"0.6437832",
"0.63669163",
"0.63422155",
"0.6339899",
"0.6325702",
"0.62836325",
"0.6260058",
"0.62180346",
"0.6215675",
"0.6212604",
"0.6167483",
"0.6163088",
"0.6162806",
"0.6157705",
"0.6156001",
"0.6151653",
"0.61293733",
"0.6118248",
"0.6104478",
"0.6102722",
"0.6100414",
"0.60936826",
"0.6075074",
"0.60729206",
"0.6072809",
"0.6072222",
"0.60694546",
"0.60620034",
"0.6057779",
"0.60510415",
"0.60510415",
"0.6048492",
"0.60387087",
"0.60312116",
"0.60258436",
"0.6014249",
"0.6010598",
"0.6006724",
"0.59962386",
"0.5992671",
"0.5979043",
"0.5977193",
"0.5974535",
"0.59689945",
"0.59685254",
"0.5963263",
"0.59592116",
"0.59475493",
"0.5947294",
"0.5936899",
"0.593651",
"0.5924961",
"0.59167796",
"0.59119004",
"0.59113",
"0.58825403",
"0.5878296",
"0.58673966",
"0.58423275",
"0.58384335",
"0.5826431",
"0.58108157",
"0.580391",
"0.5802447",
"0.58020884",
"0.5801722",
"0.57999307",
"0.5799887",
"0.57971585",
"0.5795934",
"0.5788862",
"0.5781722",
"0.57739097",
"0.5766936",
"0.57645077",
"0.5763467",
"0.5744056",
"0.5742797",
"0.5733698",
"0.5729629",
"0.57219714",
"0.5720391",
"0.5715534",
"0.5715344",
"0.5708624",
"0.57077426",
"0.5704829",
"0.5697722",
"0.5693242"
] |
0.8813118
|
0
|
POST /control_points POST /control_points.xml
|
def create
@control_point = ControlPoint.new(params[:control_point])
@control_point.user = current_user
@control_point.map = Map.find(params[:map_id])
@map = @control_point.map # we have to do this so the form is correctly displayed on error
respond_to do |format|
if @control_point.save
format.html { redirect_to(@control_point, :notice => 'Control Point was successfully created.') }
format.xml { render :xml => @control_point, :status => :created, :location => @control_point }
format.js { }
else
format.html { render :action => "new" }
format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @map = Map.find(params[:map_id])\n @control_point = @map.control_points.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_point }\n end\n end",
"def update\n @control_point = ControlPoint.find(params[:id])\n respond_to do |format|\n if @control_point.update_attributes(params[:control_point])\n format.html { redirect_to(@control_point, :notice => 'Control Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @page_title = \"Data Points\"\n @data_point = DataPoint.new(params[:data_point])\n\n respond_to do |format|\n if @data_point.save\n flash[:notice] = 'DataPoint was successfully created.'\n format.html { redirect_to(@data_point) }\n format.xml { render :xml => @data_point, :status => :created, :location => @data_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @data_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @route_point = RoutePoint.new(params[:route_point])\n\n respond_to do |format|\n if @route_point.save\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully created.') }\n format.xml { render :xml => @route_point, :status => :created, :location => @route_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @deadlift_data_point = DeadliftDataPoint.new(params[:deadlift_data_point])\n\n respond_to do |format|\n if @deadlift_data_point.save\n format.html { redirect_to @deadlift_data_point, notice: 'Deadlift data point was successfully created.' }\n format.json { render json: @deadlift_data_point, status: :created, location: @deadlift_data_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @deadlift_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @key_point = KeyPoint.new(params[:key_point])\n\n respond_to do |format|\n if @key_point.save\n format.html { redirect_to :back, notice: 'Key point was successfully created.' }\n format.json { render json: @key_point, status: :created, location: @key_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outcome_timepoint = OutcomeTimepoint.new(params[:outcome_timepoint])\n\n respond_to do |format|\n if @outcome_timepoint.save\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully created.') }\n format.xml { render :xml => @outcome_timepoint, :status => :created, :location => @outcome_timepoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @access_point = AccessPoint.new(params[:access_point])\n\n respond_to do |format|\n if @access_point.save\n format.html { redirect_to @access_point, notice: 'Access point was successfully created.' }\n format.json { render json: @access_point, status: :created, location: @access_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @access_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @touchpoint = Touchpoint.new(params[:touchpoint])\n\n respond_to do |format|\n if @touchpoint.save\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully created.' }\n format.json { render json: @touchpoint, status: :created, location: @touchpoint }\n else\n format.html { render action: \"new\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spent_point = SpentPoint.new(params[:spent_point])\n\n respond_to do |format|\n if @spent_point.save\n format.html { redirect_to(@spent_point, :notice => 'SpentPoint was successfully created.') }\n format.xml { render :xml => @spent_point, :status => :created, :location => @spent_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spent_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @waypoint = Waypoint.new(params[:waypoint])\n\n respond_to do |format|\n if @waypoint.save\n flash[:notice] = 'Waypoint was successfully created.'\n format.html { redirect_to(@waypoint) }\n format.xml { render :xml => @waypoint, :status => :created, :location => @waypoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @waypoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @levels_point = LevelsPoint.new(levels_point_params)\n\n respond_to do |format|\n if @levels_point.save\n format.html { redirect_to @levels_point, notice: 'Levels point was successfully created.' }\n format.json { render :show, status: :created, location: @levels_point }\n else\n format.html { render :new }\n format.json { render json: @levels_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @checkpoint = Checkpoint.new(checkpoint_params)\n @checkpoint.activationCount = 0\n \n respond_to do |format|\n if @checkpoint.save\n format.html { redirect_to level_checkpoint_path(@checkpoint.level,@checkpoint) , notice: 'Checkpoint was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @base_point = BasePoint.new(base_point_params)\n if @base_point.save\n flash[:success] = \"拠点登録完了しました\"\n else\n flash[:danger] = \"拠点登録に失敗しました\"\n end\n redirect_to base_points_path\n end",
"def create\n @tourpoint = Tourpoint.new(params[:tourpoint])\n\n respond_to do |format|\n if @tourpoint.save\n flash[:notice] = 'Tourpoint was successfully created.'\n format.html { redirect_to(@tourpoint) }\n format.xml { render :xml => @tourpoint, :status => :created, :location => @tourpoint }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tourpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @accesspoint = Accesspoint.new(accesspoint_params)\n\n respond_to do |format|\n if @accesspoint.save\n format.html { redirect_to @accesspoint, notice: 'Accesspoint was successfully created.' }\n format.json { render :show, status: :created, location: @accesspoint }\n else\n format.html { render :new }\n format.json { render json: @accesspoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @point_type = PointType.new(params[:point_type])\n\n respond_to do |format|\n if @point_type.save\n format.html { redirect_to(admin_point_types_path, :notice => 'Point type was successfully created.') }\n format.xml { render :xml => @point_type, :status => :created, :location => @point_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @time_point = TimePoint.new(params[:time_point])\n\n respond_to do |format|\n if @time_point.save\n format.html { redirect_to @time_point, notice: 'Time point was successfully created.' }\n format.json { render json: @time_point, status: :created, location: @time_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_point\n validate(\n point: :security_json\n )\n\n custom_experiment = (@experiment.type == 'manual_points')\n raise ValidationError.\n new(:id, @experiment.id, 'Not a custom-points experiment') unless custom_experiment\n\n point_index = @experiment.add_point!(Utils::parse_json_if_string(params[:point]))\n\n respond_to do |format|\n format.json { render json: {status: 'ok', index: point_index}, status: :ok }\n end\n end",
"def create\n @collection_point = CollectionPoint.new(params[:collection_point])\n\n respond_to do |format|\n if @collection_point.save\n @collection_point.delay.create_collection_point_tag_on_contacts\n format.html { redirect_to @collection_point, notice: 'Collection point was successfully created.' }\n format.json { render json: @collection_point, status: :created, location: @collection_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @point_consumption = PointConsumption.new(params[:point_consumption])\n\n respond_to do |format|\n if @point_consumption.save\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully created.' }\n format.json { render :json => @point_consumption, :status => :created, :location => @point_consumption }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @point = Point.new(point_params)\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render :show, status: :created, location: @point }\n else\n format.html { render :new }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpltkt = Controlpltkt.new(controlpltkt_params)\n\n respond_to do |format|\n if @controlpltkt.save\n format.html { redirect_to @controlpltkt, notice: 'Controlpltkt was successfully created.' }\n format.json { render :show, status: :created, location: @controlpltkt }\n else\n format.html { render :new }\n format.json { render json: @controlpltkt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_point = UserPoint.new(params[:user_point])\n\n respond_to do |format|\n if @user_point.save\n format.html { redirect_to @user_point, :notice => 'User point was successfully created.' }\n format.json { render :json => @user_point, :status => :created, :location => @user_point }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @end_point = EndPoint.new(params[:end_point])\n\n respond_to do |format|\n if @end_point.save\n format.html { redirect_to @end_point, notice: 'End point was successfully created.' }\n format.json { render json: @end_point, status: :created, location: @end_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @end_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ecopoint = Ecopoint.new(ecopoint_params)\n\n respond_to do |format|\n if @ecopoint.save\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully created.' }\n format.json { render :show, status: :created, location: @ecopoint }\n else\n format.html { render :new }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def point_params\n params.require(:point).permit(:temperature, :pm25, :light, :analog, :digital, :group)\n end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render json: @point, status: :created, location: @point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @deposit_threshold = DepositThreshold.new(params[:deposit_threshold])\n\n respond_to do |format|\n if @deposit_threshold.save\n format.html { redirect_to(@deposit_threshold, :notice => 'DepositThreshold was successfully created.') }\n format.xml { render :xml => @deposit_threshold, :status => :created, :location => @deposit_threshold }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposit_threshold.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @checkpoint = Checkpoint.new(checkpoint_params)\n\n respond_to do |format|\n if @checkpoint.save\n format.html { redirect_to @checkpoint, notice: 'Checkpoint was successfully created.' }\n format.json { render :show, status: :created, location: @checkpoint }\n else\n format.html { render :new }\n format.json { render json: @checkpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n Member.all.each { |member|\n member.assign_points\n }\n\n flash[:notice] = 'Puntos asignados correctamente'\n redirect_to matches_path\n end",
"def create\n @credit_control = CreditControl.new(params[:credit_control])\n\n respond_to do |format|\n if @credit_control.save\n format.html { redirect_to(new_contact_credit_control_path, :notice => 'Credit control was successfully created.') }\n format.xml { render :xml => @credit_control, :status => :created, :location => @credit_control }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @credit_control.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @proxy_votes_collected = ProxyVotesCollected.new(proxy_votes_collected_params)\n\n respond_to do |format|\n if @proxy_votes_collected.save\n format.html { redirect_to @proxy_votes_collected, notice: 'Proxy votes collected was successfully created.' }\n format.json { render :show, status: :created, location: @proxy_votes_collected }\n else\n format.html { render :new }\n format.json { render json: @proxy_votes_collected.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @controlpreat = Controlpreat.new(controlpreat_params)\n\n respond_to do |format|\n if @controlpreat.save\n format.html { redirect_to @controlpreat, notice: 'Controlpreat was successfully created.' }\n format.json { render :show, status: :created, location: @controlpreat }\n else\n format.html { render :new }\n format.json { render json: @controlpreat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:data_point].nil?\n DataPoint.createFromMailgun(params)\n # always return 200\n render :text => \"\"\n else\n @user = current_user\n if params[:data_point][:id]\n @data_point = DataPoint.duplicate(params[:data_point][:id],params[:data_point][:uploaded_at] )\n else\n @data_point = DataPoint.new(params[:data_point])\n @data_point.user_id = @user.id\n @data_point.uploaded_at = @user.now()\n @data_point.noObserver = true\n puts \">>>>>>>>>>>>> created photo from form\"\n end\n\n if @data_point && @data_point.save\n puts \"data point after saved: #{@data_point.inspect}\"\n # publish to facebook\n if @user.canPublishOnFacebook?\n @user.fb_publish(@data_point)\n end\n\n # set content type even if it's json because f... IE doesn't recognized json and prompt\n # download window when returning json\n render :json => @data_point, :content_type => 'text/plain'\n else\n puts \"data point not saved, errors: #{@data_point.errors.inspect}\"\n render :json => @data_point.errors\n end\n end\n end",
"def create\n\t\t@domain=Domain.find(params[:domain_id])\n @terminate_point = TerminatePoint.new(params[:terminate_point])\n\t\t@terminate_point.domain = @domain\n\n respond_to do |format|\n if @terminate_point.save\n format.html { redirect_to terminate_points_path, notice: 'Terminate point was successfully created.' }\n format.json { render json: @terminate_point, status: :created, location: @terminate_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @terminate_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def create\n @point_type = PointType.new(point_type_params)\n\n respond_to do |format|\n if @point_type.save\n format.html { redirect_to @point_type, notice: 'Point type was successfully created.' }\n format.json { render :show, status: :created, location: @point_type }\n else\n format.html { render :new }\n format.json { render json: @point_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @checkpoint = Checkpoint.new(params[:checkpoint])\n nextSeq = Checkpoint.getNextSeq()\n @checkpoint.sequence = nextSeq\n respond_to do |format|\n if @checkpoint.save\n format.html { redirect_to(:action => :index) }\n format.xml { redirect_to(:action => :index) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @checkpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(data)\n response_data = []\n data.each do |xml|\n req = send_request(xml)\n\n if req[:code].to_i.between?(200, 201)\n response_data << req[:data]\n else\n if req[:code] == \"401\"\n raise ResponseError, \"Could not authenticate with the Pomegranate API. Ensure that your credentials are correct.\"\n elsif req[:code] == \"400\"\n raise ResponseError, \"Bad asset value formatting. Please reformat and try again.\"\n else\n raise StandardError, \"An unknown error has occured.\"\n end\n response_data = false\n break\n end\n end\n\n response_data\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @points_transaction = PointsTransaction.new(points_transaction_params)\n\n respond_to do |format|\n if @points_transaction.save\n format.html { redirect_to @points_transaction, notice: 'Points transaction was successfully created.' }\n format.json { render :show, status: :created, location: @points_transaction }\n else\n format.html { render :new }\n format.json { render json: @points_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @treatment_point_prescription = Treatment::PointPrescription.new(treatment_point_prescription_params)\n\n respond_to do |format|\n if @treatment_point_prescription.save\n format.html { redirect_to @treatment_point_prescription, notice: 'Point prescription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @treatment_point_prescription }\n else\n format.html { render action: 'new' }\n format.json { render json: @treatment_point_prescription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @m_get_point = MGetPoint.new(params[:m_get_point])\n\n respond_to do |format|\n if @m_get_point.save\n format.html { redirect_to :controller => \"m_get_points\", :action => \"index\" }\n #format.html { redirect_to @m_get_point, notice: 'M get point was successfully created.' }\n format.json { render json: @m_get_point, status: :created, location: @m_get_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_get_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def waypoint_params\n\t\t\tparams.require(:waypoint).permit(:title, :body, :x, :y, :date, :coverphoto)\n\t\tend",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n @bill_point = BillPoint.new(params[:bill_point])\n\n respond_to do |format|\n if @bill_point.save\n format.html { redirect_to @bill_point, notice: 'Bill point was successfully created.' }\n format.json { render json: @bill_point, status: :created, location: @bill_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def control_params\n params.require(:control).permit(:cid, :name, :type, :status, :installation_type, :usage_time, :activity_count)\n end",
"def create\n @cybercontrol = Cybercontrol.new(params[:cybercontrol])\n\n respond_to do |format|\n if @cybercontrol.save\n format.html { redirect_to(@cybercontrol, :notice => 'Cybercontrol was successfully created.') }\n format.xml { render :xml => @cybercontrol, :status => :created, :location => @cybercontrol }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cybercontrol.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_data; end",
"def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save_with_history!\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ajax_service_point\n sp_id = params['sp_id']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n sp = CUL::FOLIO::Edge.service_point(url, tenant, folio_token, sp_id)\n render json: sp\n end",
"def create\r\n @way_point = WayPoint.new(way_point_params)\r\n respond_to do |format|\r\n if @way_point.save\r\n format.html { redirect_to my_maps_path, notice: 'Way point was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @way_point }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @data_point = DataPoint.new data_point_params\n @data_point[:_type] = data_point_params[:type]\n\n if @data_point.save\n render json: @data_point, status: :created, location: @data_point\n else\n render json: @data_point.errors, status: :unprocessable_entity\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end",
"def control_params\n params.require(:control).permit(\n :id, :title, :desc, :impact, :refs, :refs_list,\n :code, :control_id, :profile_id,\n :tag_severity, :tag_gtitle, :tag_gid, :tag_rid, :tag_stig_id,\n :tag_cci, :tag_nist, :tag_nist_list,\n :tag_subsystems, :tag_subsystems_list, :tag_check, :tag_fix,\n :sl_ref, :sl_line\n )\n end",
"def approve\n registration = Registration.find(params[:id])\n if (params[:assigned_points].present? || registration.evidence.points)\n registration.update(assigned_points: params[:assigned_points])\n registration.update(approved: true)\n end\n redirect_to :registrations\n end",
"def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end",
"def controlpltkt_params\n params.require(:controlpltkt).permit(:n1, :n2, :siglas, :limite, :vendida)\n end",
"def create\n @control = @device.controls.new(control_params)\n\n respond_to do |format|\n if @control.save\n format.html { redirect_to [@device,@control], notice: 'Control was successfully created.' }\n format.json { render action: 'show', status: :created, location: @control }\n else\n format.html { render action: 'new' }\n format.json { render json: @control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def levels_point_params\n params.require(:levels_point).permit(:level, :learnable_id, :points)\n end",
"def create\n @debate = Debate.new\n @debate.title = params[:title]\n @debate.image = params[:image]\n @debate.content = params[:content]\n @debate.user_id = current_user.id\n\n respond_to do |format|\n if @debate.save\n if params[:points]\n params[:points].each do |p|\n Point.create(user_id: current_user.id, debate_id: @debate.id, title: p)\n end\n end\n format.html { redirect_to @debate, notice: 'Debate was successfully created.' }\n format.json { render :show, status: :created, location: @debate }\n else\n format.html { render :new }\n format.json { render json: @debate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n \n unless @parent.nil?\n @control_points = @parent.control_points.order(:updated_at).page(params[:page]).per(10)\n @all_control_points = @parent.control_points\n else\n @control_points = ControlPoint.order(:updated_at).page(params[:page]).per(10)\n @all_control_points = ControlPoint.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @all_control_points }\n format.json { render :json => @all_control_points }\n format.rdf\n end\n end",
"def create\n @point_exchange = PointExchange.new(point_exchange_params)\n\n @remain_point = Customer.find(point_exchange_params[:customer_id]).customer_point.point\n @customer_point = Customer.find(point_exchange_params[:customer_id]).customer_point\n @customer_point.point = @customer_point.point - point_exchange_params[:point].to_i\n\n respond_to do |format|\n if @point_exchange.save and @customer_point.save\n format.html { redirect_to @point_exchange, notice: 'Point exchange was successfully created.' }\n format.json { render action: 'show', status: :created, location: @point_exchange }\n else\n format.html { render action: 'new' }\n format.json { render json: @point_exchange.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def points_transaction_params\n params.require(:points_transaction).permit(:user_id, :transaction_type, :number_of_points, :value_of_points, :notes, :approval_required, :approval_received, :admin_id)\n end",
"def create\n @xpto = Xpto.new(params[:xpto])\n\n respond_to do |format|\n if @xpto.save\n format.html { redirect_to @xpto, notice: 'Xpto was successfully created.' }\n format.json { render json: @xpto, status: :created, location: @xpto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course_point = CoursePoint.new(params[:course_point])\n\n respond_to do |format|\n if @course_point.save\n format.html { redirect_to @course_point, notice: 'Course point was successfully created.' }\n format.json { render json: @course_point, status: :created, location: @course_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @graph_point = GraphPoint.new(params[:graph_point])\n\n respond_to do |format|\n if @graph_point.save\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully created.') }\n format.xml { render :xml => @graph_point, :status => :created, :location => @graph_point }\n format.json { render :json => @graph_point, :status => :created, :location => @graph_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def create\n @groundwater_control = GroundwaterControl.new(params[:groundwater_control])\n\n respond_to do |format|\n if @groundwater_control.save\n flash[:notice] = 'GroundwaterControl was successfully created.'\n format.html { redirect_to(@groundwater_control) }\n format.xml { render :xml => @groundwater_control, :status => :created, :location => @groundwater_control }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @groundwater_control.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @ppos_prerequisite = PposPrerequisite.new(params[:ppos_prerequisite])\n\n respond_to do |format|\n if @ppos_prerequisite.save\n flash[:notice] = 'PposPrerequisite was successfully created.'\n format.html { redirect_to(@ppos_prerequisite) }\n format.xml { render :xml => @ppos_prerequisite, :status => :created, :location => @ppos_prerequisite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ppos_prerequisite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @outcome_timepoint = OutcomeTimepoint.new(params[:outcome_timepoint])\n\t@outcome_timepoint.save\n end",
"def member_point_params\n params.permit(:date, :points, :event_id, :member_id, :activity_id)\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def create\n @studio_point = StudioPoint.new(studio_point_params)\n\n respond_to do |format|\n if @studio_point.save\n format.html { redirect_to @studio_point, notice: 'Studio point was successfully created.' }\n format.json { render :show, status: :created, location: @studio_point }\n else\n format.html { render :new }\n format.json { render json: @studio_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end",
"def create\n @access_list_to_ea_point = AccessListToEaPoint.new(access_list_to_ea_point_params)\n\n respond_to do |format|\n if @access_list_to_ea_point.save\n\n @access_list_to_ea_point.ea_pproof.url # => '/url/to/file.png'\n @access_list_to_ea_point.ea_pproof.current_path # => 'path/to/file.png'\n @access_list_to_ea_point.ea_pproof_identifier # => 'file.png'\n\n format.html { redirect_to \"/ea_points\", notice: 'Document has been uploaded.' }\n #format.html { redirect_to @access_list_to_ea_point, notice: 'Access list to ea point was successfully created.' }\n format.json { render :show, status: :created, location: @access_list_to_ea_point }\n else\n format.html { render :new }\n format.json { render json: @access_list_to_ea_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @member_point = MemberPoint.new(member_point_params)\n @member_id = params[:member_id]\n @member = Member.find(@member_id)\n @event_id = params[:event_id]\n @event = Event.find(@event_id)\n @activity = Activity.find(@event.activity_id)\n @new_points = @member.totalPoints + @activity.num_points\n\n respond_to do |format|\n if @member_point.save\n Member.update(@member_id, totalPoints: @new_points)\n format.html { redirect_to @event, notice: 'You have checked into this event.' }\n format.json { render :show, status: :created, location: @member_point }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @member_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\r\n end",
"def create_spending_control_using_post_with_http_info(spending_control, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SpendingControlApi.create_spending_control_using_post ...'\n end\n # verify the required parameter 'spending_control' is set\n if @api_client.config.client_side_validation && spending_control.nil?\n fail ArgumentError, \"Missing the required parameter 'spending_control' when calling SpendingControlApi.create_spending_control_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/spending_control'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(spending_control)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SpendingControl')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SpendingControlApi#create_spending_control_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @padiddle_point = PadiddlePoint.new(padiddle_point_params)\n @padiddles = 0.10\n\n respond_to do |format|\n if @padiddle_point.save\n format.html { redirect_to root_path, notice: 'Padiddle point was successfully created.' }\n format.json { render :show, status: :created, location: @padiddle_point }\n else\n format.html { render :new }\n format.json { render json: @padiddle_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pricing_plan = PricingPlan.new(params[:pricing_plan])\n\n respond_to do |format|\n if @pricing_plan.save\n flash[:notice] = 'PricingPlan was successfully created.'\n format.html { redirect_to(@pricing_plan) }\n format.xml { render :xml => @pricing_plan, :status => :created, :location => @pricing_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pricing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @checkpoint_removed = CheckpointRemoved.new(params[:checkpoint_removed])\n\n respond_to do |format|\n if @checkpoint_removed.save\n flash[:notice] = 'CheckpointRemoved was successfully created.'\n format.html { redirect_to(@checkpoint_removed) }\n format.xml { render :xml => @checkpoint_removed, :status => :created, :location => @checkpoint_removed }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @checkpoint_removed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @history_point = HistoryPoint.new(params[:history_point])\n\n respond_to do |format|\n if @history_point.save\n format.html { redirect_to(@history_point, :notice => 'HistoryPoint was successfully created.') }\n format.xml { render :xml => @history_point, :status => :created, :location => @history_point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @history_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user_smart_point = UserSmartPoint.new(user_smart_point_params)\n\n respond_to do |format|\n if @user_smart_point.save\n format.html { redirect_to @user_smart_point, notice: 'User smart point was successfully created.' }\n format.json { render :show, status: :created, location: @user_smart_point }\n else\n format.html { render :new }\n format.json { render json: @user_smart_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def touch\n @service.context.post(@control_path, :action => 'touch')\n self\n end",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def create\n @location_point = LocationPoint.new(params[:location_point])\n\n respond_to do |format|\n if @location_point.save\n format.html { redirect_to @location_point, notice: 'Location point was successfully created.' }\n format.json { render json: @location_point, status: :created, location: @location_point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @route_point = RoutePoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_point }\n end\n end",
"def poset_params\n params.require(:poset).permit(:name, :pass_threshold, :fail_threshold)\n end"
] |
[
"0.5788798",
"0.552815",
"0.54015684",
"0.53514504",
"0.53513753",
"0.5306971",
"0.5306015",
"0.52876735",
"0.52558243",
"0.52422506",
"0.52386504",
"0.5222931",
"0.5198525",
"0.5162963",
"0.5155648",
"0.51487064",
"0.5138782",
"0.5136373",
"0.51293296",
"0.5118681",
"0.5104979",
"0.50972456",
"0.50893",
"0.50867295",
"0.50718933",
"0.5051595",
"0.5048705",
"0.5029711",
"0.50282794",
"0.5027137",
"0.5026122",
"0.5026109",
"0.50209284",
"0.501647",
"0.5004545",
"0.4996228",
"0.49885157",
"0.49875733",
"0.49787462",
"0.49547443",
"0.49441642",
"0.49312365",
"0.49247652",
"0.49202955",
"0.49101865",
"0.48948073",
"0.4886327",
"0.48823038",
"0.48795018",
"0.48695186",
"0.48670295",
"0.48606414",
"0.48580438",
"0.48494914",
"0.48452112",
"0.4844462",
"0.48431408",
"0.48409206",
"0.48339337",
"0.4831431",
"0.48308066",
"0.48299986",
"0.4817621",
"0.48167023",
"0.48097947",
"0.4803917",
"0.48002216",
"0.47928327",
"0.47904265",
"0.4789557",
"0.47872892",
"0.4778635",
"0.47782177",
"0.4776448",
"0.47677916",
"0.4761579",
"0.47562262",
"0.4753687",
"0.47514305",
"0.47460622",
"0.4742446",
"0.47395173",
"0.4738512",
"0.47349566",
"0.4734073",
"0.47242627",
"0.4722884",
"0.47223386",
"0.472203",
"0.47206724",
"0.47114128",
"0.47095993",
"0.4707446",
"0.4704847",
"0.47013947",
"0.46992567",
"0.46969563",
"0.46939003",
"0.4688772",
"0.46855178"
] |
0.55718523
|
1
|
PUT /control_points/1 PUT /control_points/1.xml
|
def update
@control_point = ControlPoint.find(params[:id])
respond_to do |format|
if @control_point.update_attributes(params[:control_point])
format.html { redirect_to(@control_point, :notice => 'Control Point was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @control_point.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @point = Point.find(params[:id])\n \n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @route_point = RoutePoint.find(params[:id])\n\n respond_to do |format|\n if @route_point.update_attributes(params[:route_point])\n format.html { redirect_to(@route_point, :notice => 'Route point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n if @checkpoint.update_attributes(params[:checkpoint])\n ##format.html { redirect_to(@checkpoint, :notice => 'Checkpoint was successfully updated.') }\n ##format.xml { head :ok }\n format.html { redirect_to(:action => :index) }\n format.xml { redirect_to(:action => :index) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checkpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n if @data_point.update_attributes(params[:data_point])\n flash[:notice] = 'DataPoint was successfully updated.'\n format.html { redirect_to(@data_point) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @data_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @key_point = KeyPoint.find(params[:id])\n\n respond_to do |format|\n if @key_point.update_attributes(params[:key_point])\n format.html { redirect_to :back, notice: 'Key point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spent_point = SpentPoint.find(params[:id])\n\n respond_to do |format|\n if @spent_point.update_attributes(params[:spent_point])\n format.html { redirect_to(@spent_point, :notice => 'SpentPoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spent_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n if @point_consumption.update_attributes(params[:point_consumption])\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tourpoint = Tourpoint.find(params[:id])\n\n respond_to do |format|\n if @tourpoint.update_attributes(params[:tourpoint])\n flash[:notice] = 'Tourpoint was successfully updated.'\n format.html { redirect_to(@tourpoint) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tourpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @touchpoint = Touchpoint.find(params[:id])\n\n respond_to do |format|\n if @touchpoint.update_attributes(params[:touchpoint])\n format.html { redirect_to @touchpoint, notice: 'Touchpoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @touchpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\n respond_to do |format|\n if @outcome_timepoint.update_attributes(params[:outcome_timepoint])\n format.html { redirect_to(@outcome_timepoint, :notice => 'Outcome timepoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outcome_timepoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point = Point.find(params[:id])\n\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @waypoint = Waypoint.find(params[:id])\n\n respond_to do |format|\n if @waypoint.update_attributes(params[:waypoint])\n flash[:notice] = 'Waypoint was successfully updated.'\n format.html { redirect_to(@waypoint) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @waypoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @terminate_point = TerminatePoint.find(params[:id])\n\n respond_to do |format|\n if @terminate_point.update_attributes(params[:terminate_point])\n format.html { redirect_to terminate_points_path, notice: 'Terminate point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @terminate_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @control_point = args[:control_point] if args.key?(:control_point)\n end",
"def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @check_point.update(check_point_params)\n format.html { redirect_to @check_point, notice: 'Check point was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_point }\n else\n format.html { render :edit }\n format.json { render json: @check_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @point_type = PointType.find(params[:id])\n\n respond_to do |format|\n if @point_type.update_attributes(params[:point_type])\n format.html { redirect_to([:admin,@point_type], :notice => 'Point type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @access_point = AccessPoint.find(params[:id])\n\n respond_to do |format|\n if @access_point.update_attributes(params[:access_point])\n format.html { redirect_to @access_point, notice: 'Access point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_point.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 @knowledge_point = KnowledgePoint.find(params[:id])\n\n respond_to do |format|\n if @knowledge_point.update_attributes(params[:knowledge_point])\n format.html { redirect_to @knowledge_point, :notice => 'Knowledge point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @knowledge_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @history_point = HistoryPoint.find(params[:id])\n\n respond_to do |format|\n if @history_point.update_attributes(params[:history_point])\n format.html { redirect_to(@history_point, :notice => 'HistoryPoint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @history_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @old_point_tag = OldPointTag.find(params[:id])\n\n respond_to do |format|\n if @old_point_tag.update_attributes(params[:old_point_tag])\n format.html { redirect_to(@old_point_tag, :notice => 'Old point tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @old_point_tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n\n respond_to do |format|\n if @activity.update(ap)\n @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ecopoint.update(ecopoint_params)\n format.html { redirect_to @ecopoint, notice: 'Ecopoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @ecopoint }\n else\n format.html { render :edit }\n format.json { render json: @ecopoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n# @point = params[:point]\n# @date = date[:date]\n \n# render :text => 'hoge' \n\n @point = Point.find(params[:id])\n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :notice => 'Point was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put endpoint, data\n do_request :put, endpoint, data\n end",
"def update\n respond_to do |format|\n if @point.update(point_params)\n format.html { redirect_to @point, notice: 'Point was successfully updated.' }\n format.json { render :show, status: :ok, location: @point }\n else\n format.html { render :edit }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data_point = DataPoint.find(params[:id])\n\n respond_to do |format|\n if @data_point.update_attributes data_point_params\n format.html { redirect_to @data_point, notice: 'Data point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course_point = CoursePoint.find(params[:id])\n\n respond_to do |format|\n if @course_point.update_attributes(params[:course_point])\n format.html { redirect_to @course_point, notice: 'Course point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @graph_point = GraphPoint.find(params[:id])\n\n respond_to do |format|\n if @graph_point.update_attributes(params[:graph_point])\n format.html { redirect_to(@graph_point, :notice => 'Graph point was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @graph_point }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @graph_point.errors, :status => :unprocessable_entity }\n format.json { render :json => @graph_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n @user_point = UserPoint.find(params[:id])\n\n respond_to do |format|\n if @user_point.update_attributes(params[:user_point])\n format.html { redirect_to @user_point, :notice => 'User point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n put :update\n end",
"def update\n @approximate_service = ApproximateService.find(params[:id])\n\n respond_to do |format|\n if @approximate_service.update_attributes(params[:approximate_service])\n format.html { redirect_to(@approximate_service, :notice => 'ApproximateService was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @approximate_service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:event_id])\n @point_of_interest = PointOfInterest.find(params[:id])\n\n respond_to do |format|\n if @point_of_interest.update_attributes(params[:point_of_interest])\n format.html { redirect_to(event_point_of_interest_path, :notice => 'Point of interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point_of_interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @checkpoint.update(checkpoint_params)\n format.html { redirect_to level_checkpoints_path(@checkpoint.level), notice: 'Checkpoint was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @way_point.update(way_point_params)\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @xpto = Xpto.find(params[:id])\n\n respond_to do |format|\n if @xpto.update_attributes(params[:xpto])\n format.html { redirect_to @xpto, notice: 'Xpto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @end_point = EndPoint.find(params[:id])\n\n respond_to do |format|\n if @end_point.update_attributes(params[:end_point])\n format.html { redirect_to @end_point, notice: 'End point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @end_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @way_point.update(way_point_params)\r\n format.html { redirect_to @way_point, notice: 'Way point was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @way_point.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @checkpoint.update(checkpoint_params)\n format.html { redirect_to @checkpoint, notice: 'Checkpoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @checkpoint }\n else\n format.html { render :edit }\n format.json { render json: @checkpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n\n respond_to do |format|\n if @checkpoint_removed.update_attributes(params[:checkpoint_removed])\n flash[:notice] = 'CheckpointRemoved was successfully updated.'\n format.html { redirect_to(@checkpoint_removed) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checkpoint_removed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @location_point = LocationPoint.find(params[:id])\n\n respond_to do |format|\n if @location_point.update_attributes(params[:location_point])\n format.html { redirect_to @location_point, notice: 'Location point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\t@outcome_timepoint.update_attributes(params[:outcome_timepoint])\n end",
"def update\n respond_to do |format|\n if @accesspoint.update(accesspoint_params)\n format.html { redirect_to @accesspoint, notice: 'Accesspoint was successfully updated.' }\n format.json { render :show, status: :ok, location: @accesspoint }\n else\n format.html { render :edit }\n format.json { render json: @accesspoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_point.update(trip_point_params)\n format.html { redirect_to @trip_point, notice: 'Trip point was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_point }\n else\n format.html { render :edit }\n format.json { render json: @trip_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def update\n respond_to do |format|\n if @checkpoint.update(checkpoint_params)\n format.html { redirect_to @checkpoint, notice: \"Checkpoint was successfully updated.\" }\n format.json { render :show, status: :ok, location: @checkpoint }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @checkpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def touch\n @service.context.post(@control_path, :action => 'touch')\n self\n end",
"def update\n @m_get_point = MGetPoint.find(params[:id])\n\n respond_to do |format|\n if @m_get_point.update_attributes(params[:m_get_point])\n format.html { redirect_to :controller => \"m_get_points\", :action => \"index\" }\n #format.html { redirect_to @m_get_point, notice: 'M get point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_get_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n\n respond_to do |format|\n if @deadlift_data_point.update_attributes(params[:deadlift_data_point])\n format.html { redirect_to @deadlift_data_point, notice: 'Deadlift data point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @deadlift_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n load_points_entry_type\n authorize! :update, @points_entry_type\n build_points_entry_type\n save_points_entry_type or redirect_to :edit\n end",
"def update\n @knob = Knob.find(params[:id])\n\n respond_to do |format|\n if @knob.update_attributes(params[:knob])\n flash[:notice] = 'Knob was successfully updated.'\n format.html { redirect_to(@knob) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @knob.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n if @meeting_point.update_attributes(params[:meeting_point])\n format.html { redirect_to @meeting_point, notice: 'Meeting point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill_point = BillPoint.find(params[:id])\n\n respond_to do |format|\n if @bill_point.update_attributes(params[:bill_point])\n format.html { redirect_to @bill_point, notice: 'Bill point was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @base_point.update(base_point_params)\n flash[:success] = \"拠点情報編集完了しました\"\n else\n flash[:danger] = \"拠点情報編集失敗しました\"\n end\n redirect_to base_points_path\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def new\n @map = Map.find(params[:map_id])\n @control_point = @map.control_points.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_point }\n end\n end",
"def update\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n if @actuator.update_attributes(params[:actuator].each_value(&:strip!))\n format.html { redirect_to(@actuator, :notice => 'Actuator was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actuator.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @incentive = Incentive.find(params[:id])\n\n respond_to do |format|\n if @incentive.update_attributes(params[:incentive])\n format.html { redirect_to(@incentive, :notice => 'Incentive was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incentive.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @squat_data_point = SquatDataPoint.find(params[:id])\n\n respond_to do |format|\n if @squat_data_point.update_attributes(params[:squat_data_point])\n format.html { redirect_to @squat_data_point, notice: 'Squat data point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squat_data_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spot = Spot.find(params[:id])\n\n respond_to do |format|\n if @spot.update_attributes(params[:spot])\n flash[:notice] = 'Spot was successfully updated.'\n format.html { redirect_to(@spot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @name_has_access_point = NameHasAccessPoint.find(params[:id])\n\n respond_to do |format|\n if @name_has_access_point.update_attributes(params[:name_has_access_point])\n format.html { redirect_to @name_has_access_point, notice: 'Name has access point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @name_has_access_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member_point.update(member_point_params)\n format.html { redirect_to @event, notice: 'Member point was successfully updated.' }\n format.json { render :show, status: :ok, location: @member_point }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @member_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n respond_to do |format|\n if @xservice.update(xservice_params)\n format.html { redirect_to @xservice, notice: 'Xservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @xservice }\n else\n format.html { render :edit }\n format.json { render json: @xservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def put(*args)\n request(:put, *args)\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def create\n @checkpoint = Checkpoint.new(checkpoint_params)\n @checkpoint.activationCount = 0\n \n respond_to do |format|\n if @checkpoint.save\n format.html { redirect_to level_checkpoint_path(@checkpoint.level,@checkpoint) , notice: 'Checkpoint was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n params[:collection_point][:contact_ids] = params[:collection_point][:contact_ids].first.split(\",\") if params[:collection_point][:contact_ids].present?\n\n @collection_point = CollectionPoint.find(params[:id])\n\n respond_to do |format|\n if @collection_point.update_attributes(params[:collection_point])\n @collection_point.delay.create_collection_point_tag_on_contacts\n format.html { redirect_to @collection_point, notice: 'Collection point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def points_update\n command = Goal::GoalPointsUpdateCommand.new(params)\n run(command)\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def set_point_service\n @point_service = PointService.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @control.update(control_params)\n format.html { redirect_to [@device,@control], notice: 'Control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spouse = Spouse.find(params[:id])\n\n respond_to do |format|\n if @spouse.update_attributes(params[:spouse])\n flash[:notice] = 'Spouse was successfully updated.'\n format.html { redirect_to(@spouse) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spouse.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cybercontrol = Cybercontrol.find(params[:id])\n\n respond_to do |format|\n if @cybercontrol.update_attributes(params[:cybercontrol])\n format.html { redirect_to(@cybercontrol, :notice => 'Cybercontrol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cybercontrol.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def set_checkpoint\n @route = Route.find(params[:route_id])\n @checkpoint = Checkpoint.find(params[:id])\n end",
"def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_smart_point.update(user_smart_point_params)\n format.html { redirect_to @user_smart_point, notice: 'User smart point was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_smart_point }\n else\n format.html { render :edit }\n format.json { render json: @user_smart_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @point_type.update(point_type_params)\n format.html { redirect_to @point_type, notice: 'Point type was successfully updated.' }\n format.json { render :show, status: :ok, location: @point_type }\n else\n format.html { render :edit }\n format.json { render json: @point_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @socialize_plan = SocializePlan.find(params[:id])\n\n respond_to do |format|\n if @socialize_plan.update_attributes(params[:socialize_plan])\n format.html { redirect_to(@socialize_plan, :notice => 'Socialize plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @socialize_plan.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.60472596",
"0.6014395",
"0.60137856",
"0.60045904",
"0.597827",
"0.59353644",
"0.5787352",
"0.5768037",
"0.57469773",
"0.57033706",
"0.56777453",
"0.5672234",
"0.56524825",
"0.5642758",
"0.5631553",
"0.56256044",
"0.5625326",
"0.5603833",
"0.56034833",
"0.55759764",
"0.5556035",
"0.55345094",
"0.5526963",
"0.55183905",
"0.55031747",
"0.54945725",
"0.5483911",
"0.5476447",
"0.5467595",
"0.54613227",
"0.5455982",
"0.545171",
"0.54309034",
"0.5428731",
"0.54191655",
"0.5409855",
"0.5407151",
"0.53806114",
"0.5378376",
"0.5374386",
"0.53705305",
"0.5362395",
"0.53521234",
"0.5344432",
"0.53409034",
"0.5333962",
"0.5296907",
"0.52895623",
"0.5285312",
"0.52851105",
"0.52822125",
"0.5279783",
"0.52792954",
"0.52696776",
"0.52366054",
"0.52346444",
"0.5228851",
"0.5226309",
"0.5221872",
"0.5218742",
"0.52138007",
"0.5212666",
"0.52058154",
"0.52027047",
"0.5189297",
"0.51829535",
"0.516597",
"0.5161324",
"0.51521313",
"0.51497734",
"0.51408577",
"0.5134629",
"0.5119182",
"0.51127666",
"0.5111416",
"0.5109804",
"0.50957507",
"0.5094578",
"0.5094307",
"0.5089837",
"0.5077641",
"0.50742185",
"0.5068064",
"0.506662",
"0.50658244",
"0.5063144",
"0.50565565",
"0.5056183",
"0.50489",
"0.50416964",
"0.5034175",
"0.5029683",
"0.50112903",
"0.50112766",
"0.5009193",
"0.50043374",
"0.49943876",
"0.49938843",
"0.49916336",
"0.49890155"
] |
0.6983892
|
0
|
DELETE /control_points/1 DELETE /control_points/1.xml
|
def destroy
@control_point = ControlPoint.find(params[:id])
@map = @control_point.map
if current_user == @control_point.user
@control_point.destroy
end
respond_to do |format|
format.html { redirect_to(map_url @map) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @route_point = RoutePoint.find(params[:id])\n @route_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_points_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @waypoint = Waypoint.find(params[:id])\n @waypoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(waypoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @deposit_threshold = DepositThreshold.find(params[:id])\n @deposit_threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_thresholds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graph_point = GraphPoint.find(params[:id])\n @graph_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(graph_points_url) }\n format.xml { head :ok }\n format.json { render :nothing => true }\n end\n end",
"def destroy\n @point_of_interest = PointOfInterest.find(params[:id])\n @point_of_interest.destroy\n\n respond_to do |format|\n format.html { redirect_to(point_of_interests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cybercontrol = Cybercontrol.find(params[:id])\n @cybercontrol.destroy\n\n respond_to do |format|\n format.html { redirect_to(cybercontrols_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n @design_detail_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(design_detail_data_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @old_point_tag = OldPointTag.find(params[:id])\n @old_point_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(old_point_tags_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @access_point = AccessPoint.find(params[:id])\n @access_point.destroy\n\n respond_to do |format|\n format.html { redirect_to access_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @history_point = HistoryPoint.find(params[:id])\n @history_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(history_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @point_type = PointType.find(params[:id])\n @point_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_point_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @key_point = KeyPoint.find(params[:id])\n @key_point.destroy\n\n respond_to do |format|\n format.html { redirect_to key_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @approximate_service = ApproximateService.find(params[:id])\n @approximate_service.destroy\n\n respond_to do |format|\n format.html { redirect_to(approximate_services_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @tourpoint = Tourpoint.find(params[:id])\n @tourpoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(tourpoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n @ppos_prerequisite.destroy\n\n respond_to do |format|\n format.html { redirect_to(ppos_prerequisites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @deadlift_data_point = DeadliftDataPoint.find(params[:id])\n @deadlift_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to deadlift_data_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spent_point = SpentPoint.find(params[:id])\n @spent_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(spent_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @level = @checkpoint.level\n @checkpoint.destroy\n respond_to do |format|\n format.html { redirect_to level_checkpoints_path(@level, @level.checkpoints), notice: 'Checkpoint was successfully destroyed.' }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @point_consumption = PointConsumption.find(params[:id])\n @point_consumption.destroy\n\n respond_to do |format|\n format.html { redirect_to point_consumptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @groundwater_control = GroundwaterControl.find(params[:id])\n @groundwater_control.destroy\n\n respond_to do |format|\n format.html { redirect_to(groundwater_controls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enclavecontrol = Enclavecontrol.find(params[:id])\n @enclavecontrol.destroy\n\n respond_to do |format|\n format.html { redirect_to(enclavecontrols_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @accesspoint.destroy\n respond_to do |format|\n format.html { redirect_to accesspoints_url, notice: 'Accesspoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to data_points_url }\n format.json { head :no_content }\n end\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end",
"def deleteWaypoint _wp\n SQF.deleteWaypoint _wp\n end",
"def destroy\n @check_point.destroy\n respond_to do |format|\n format.html { redirect_to check_points_url, notice: 'Check point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @crop_pricing = CropPricing.find(params[:id])\n @crop_pricing.destroy\n\n respond_to do |format|\n format.html { redirect_to(crop_pricings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n @outcome_timepoint.destroy\n\n respond_to do |format|\n format.html { redirect_to(outcome_timepoints_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n checkins = Checkin.all\n checkouts = Checkout.all\n if((checkins.length == 0) and (checkouts.length ==0))\n @checkpoint = Checkpoint.find(params[:id])\n @checkpoint.destroy\n respond_to do |format|\n format.html { redirect_to(checkpoints_url) }\n format.xml { head :ok }\n end\n else\n flash[:notice] = \"Can not delete checkpoint when checkins or checkouts exist!\"\n redirect_to(checkpoints_url)\n end\n end",
"def destroy\n @colonoscopytest = Colonoscopytest.find(params[:id])\n @colonoscopytest.destroy\n\n respond_to do |format|\n format.html { redirect_to(colonoscopytests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xpto = Xpto.find(params[:id])\n @xpto.destroy\n\n respond_to do |format|\n format.html { redirect_to xptos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment = Segment.find(params[:id])\n @segment.destroy\n\n respond_to do |format|\n format.html { redirect_to(worldreach_segments_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n\t\t\tClient.delete @root\n\t\tend",
"def destroy\n @pageview = Pageview.find(params[:id])\n @pageview.destroy\n\n respond_to do |format|\n format.html { redirect_to(pageviews_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @collection_point = CollectionPoint.find(params[:id])\n @collection_point.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terminate_point = TerminatePoint.find(params[:id])\n\n if @terminate_point.vlans==[] and @terminate_point.vinos==[]\n @terminate_point.destroy\n redirect_to terminate_points_path, notice: 'Terminate point del succefull' \n else\n redirect_to terminate_points_path, notice: \"Can't remove Terminate point, pls del vlans and vinoses linked with this terminate point\"\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cadd = Cadd.find(params[:id])\n @cadd.destroy\n\n respond_to do |format|\n format.html { redirect_to(cadds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @data_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_sets_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def delete\n \n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n if @base_point.destroy\n flash[:success] = \"拠点情報削除しました\"\n else\n flash[:danger] = \"拠点情報削除に失敗しました\"\n end\n redirect_to base_points_path\n end",
"def destroy\n @pbx = Pbx.find(params[:id])\n @pbx.destroy\n\n respond_to do |format|\n format.html { redirect_to(pbxes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\n end",
"def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end",
"def destroy\n @knowledge_point = KnowledgePoint.find(params[:id])\n @knowledge_point.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledge_points_url }\n format.json { head :ok }\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 @water_point = WaterPoint.find_by_id(params[:id])\n @water_point.destroy\n\n respond_to do |format|\n format.any(:html,:iphone) { redirect_to(water_points_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_set = ImageSet.find(params[:id])\n @image_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @dcf = Dcf.find(params[:id])\r\n @dcf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(dcfs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto_option = AutoOption.find(params[:id])\n @auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto_options_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_points_url }\n format.json { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n @goods_auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_auto_options_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @decision = Decision.find(params[:id])\n @decision.destroy\n\n respond_to do |format|\n format.html { redirect_to(decisions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photo_set = PhotoSet.find(params[:id])\n @photo_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @raw_data_file = RawDataFile.find(params[:id])\n @raw_data_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_data_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @checkpoint.destroy\n respond_to do |format|\n format.html { redirect_to checkpoints_url, notice: 'Checkpoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end"
] |
[
"0.6578399",
"0.6508327",
"0.6505394",
"0.6465438",
"0.6465438",
"0.6465438",
"0.64558667",
"0.6416198",
"0.63274354",
"0.63111055",
"0.6264992",
"0.62335855",
"0.6198459",
"0.619169",
"0.61718273",
"0.61651474",
"0.61372656",
"0.61207384",
"0.61103076",
"0.61085796",
"0.6091299",
"0.6080467",
"0.6078881",
"0.6059354",
"0.6049249",
"0.6049057",
"0.60197705",
"0.6016222",
"0.60062975",
"0.60001516",
"0.5999154",
"0.59956145",
"0.59927297",
"0.5984811",
"0.59812874",
"0.59805626",
"0.59800917",
"0.5976174",
"0.5957901",
"0.59572494",
"0.59566456",
"0.5954435",
"0.59400904",
"0.59234077",
"0.5918845",
"0.5911473",
"0.5902978",
"0.5897705",
"0.5897049",
"0.58803374",
"0.587857",
"0.5876385",
"0.58730954",
"0.5864796",
"0.5857715",
"0.5853668",
"0.5850841",
"0.58484817",
"0.58474135",
"0.5844162",
"0.5841653",
"0.5837607",
"0.58313185",
"0.58258283",
"0.5822817",
"0.58220005",
"0.5821996",
"0.58207566",
"0.5818504",
"0.5815828",
"0.58100283",
"0.58097064",
"0.58008474",
"0.5800616",
"0.5794856",
"0.5782205",
"0.5780976",
"0.5780976",
"0.5780976",
"0.5780976",
"0.57808125",
"0.57805353",
"0.5777123",
"0.57762855",
"0.5772114",
"0.57716167",
"0.57705474",
"0.5769707",
"0.5766588",
"0.5764174",
"0.57641584",
"0.57587117",
"0.57573605",
"0.575593",
"0.575593",
"0.575593",
"0.575593",
"0.575593",
"0.575593",
"0.575593"
] |
0.62090063
|
12
|
GET /mini_blogs GET /mini_blogs.xml
|
def index
@mini_blogs = MiniBlog.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mini_blogs }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def new\n @mini_blog = MiniBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def show\n @mini_blog = MiniBlog.find(params[:id])\n @entradas = @mini_blog.entradas\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def blogs\n get(get_all_sites_uri)\n end",
"def index\n @moto_blogs = MotoBlog.all\n end",
"def index\n @blog_posts = BlogPost.where(:super_user_id => 1).order(\"created_at DESC\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_posts }\n end\n end",
"def feed\r\n\t\t@blogs = Blog.find(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\")\r\n\t\trender :action => :feed, :layout => false\r\n\tend",
"def index\n @blogs = Blog.all_project_blogs\n\n @blogs = @blogs.paginate :page => (params[:page] || 1), :per_page=> 15\n \n if params[:format] == \"rss\"\n render :action => \"all_blogs_rss\", :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end\n \n @selected_subnav_link = \"project_updates\"\n end",
"def index\n\t\t@blogs = Blog.as_created.paginate(page: (params[:page] || 1), per_page: 20)\n\tend",
"def index\r\n\t\tblog_show_params = params[:blog_show_params] || {}\r\n @blogs = Blog.paginate(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\", :page => blog_show_params[:page] || 1, :per_page => 15)\r\n\t\t#set_page_title(\"Relentless Simplicity - The Bonanzle Blog\")\r\n \r\n\t\trespond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @blogs }\r\n end\r\n end",
"def show\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.scoped.page(params[:page]).per(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @entradas = @mini_blog.entradas.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entradas }\n end\n end",
"def show\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # { render :xml => @blog }\n end\n end",
"def show\n @blog_post = @current_user.blogs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def index\n @my_blogs = MyBlog.all\n end",
"def index\n @myblogs = Myblog.all\n end",
"def blogs\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def show\n @blog_entry = BlogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def show\n @blogs = Blog.all\n end",
"def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end",
"def index\n @admin_blogs = Admin::Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_blogs }\n end\n end",
"def index\n @user_blogs = UserBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_blogs }\n end\n end",
"def index\n @blogs = Blog.all\n end",
"def index\n @blogs = Blog.all\n end",
"def index\n @news_blasts = NewsBlast.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_blasts }\n end\n end",
"def index\n #binding.pry\n #@blogs = Blog.new_first\n @blogs = Blog.new_first.page(params[:page]).per(5)\n #byebug\n #@blogs = Blog.featured_blogs\n #binding.pry\n @page_title = \"Blogs\"\n end",
"def index\n @pages = Page.find(:all, :order => 'updated_at DESC', :limit => 5)\n @blogs = Blog.all\n end",
"def show\n @personal_blog = PersonalBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal_blog }\n end\n end",
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def feed_url\n blog_index_url(format: :rss)\n end",
"def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end",
"def index\n @bs_blogs = BsBlog.all\n end",
"def index\n @blogs = Blog.where(visible:true).paginate(page: params[:page], per_page: 8)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def show\n @news_blast = NewsBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_blast }\n end\n end",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def index\n @blogs = Blog.all.page(params[:page]).per(5)\n \n end",
"def index\n @mini_urls = MiniUrl.all\n end",
"def show\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myblog }\n end\n end",
"def show\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myblog }\n end\n end",
"def index\r\n @blogposts = Blogpost.all\r\n #used for current day and date.\r\n #@WeatherRss = WeatherRSS.new()\r\n @weather_rss = WeatherRSS.weather_rss\r\n end",
"def index\n @news_updates = NewsUpdate.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_updates }\n end\n end",
"def index\n @siteblogs = Siteblog.all\n end",
"def index\n @page = params[:page] || '1'\n @forums = TogForum::Forum.find(:all, :order => 'id ASC').paginate({:page => @page})\n respond_to do |format|\n format.html\n format.rss { render :rss => @forums } \n end\n end",
"def show\n @entrada = @mini_blog.entradas.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entrada }\n end\n end",
"def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end",
"def index\n @blogs = Blog.find(:all)\n render :action => \"index\"\n end",
"def index\n @latestinfos = Latestinfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @latestinfos }\n end\n end",
"def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end",
"def index\n if @blog\n # @replies = @blog.replies.find_new(15)\n @replies = @blog.replies.recent\n else\n @replies=Reply.find_new(15)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def index\n @blogs = Blog.all(:order => \"created_at DESC\")\n @blogs_p = Blog.all(:order => \"rating DESC\")\n session[:user_id] = 0\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def show\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def index\n # カレントページはGETパラメーターとして受け取ってくる想定\n @page = params['page'].to_i\n # リスト初期化\n $alist = []\n @userBlogInfos = UserBlogInfo.all\n \n url = []\n @userBlogInfos.each do |userBlogInfo|\n if userBlogInfo.feedUrl.present?\n url.push(userBlogInfo.feedUrl)\n else\n puts \"no\"\n end\n end\n \n url.each do |item|\n perse(item)\n end\n\n #時系列順にソート -にすることで降順にする。\n @sorted = $alist.sort{|aa, bb|\n -(aa.published.to_i <=> bb.published.to_i)\n }\n #ページサイズ\n #ページネーション設定\n @rss_list = Kaminari.paginate_array(@sorted).page(params[:page]).per(10)\n end",
"def index\n @harsha_blogs = HarshaBlog.all\n end",
"def index\n @office_blogs = Office::Blog.all\n end",
"def index\n per_page = params[:per_page] ||= PER_PAGE\n @newsblogs = Newsblog.paginate :page => params[:page],\n :per_page => params[:per_page],\n :order=>'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @newsblogs} # index.xml.builder\n format.json {render :json => @newsblogs}\n end\n end",
"def index\n @watercolor_blogs = WatercolorBlog.all\n end",
"def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def show\r\n @blogs = Blog.find(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\")\r\n @blog = Blog.find(:first, :conditions => [\"id = ? OR url_identifier = ?\", params[:id], params[:id]])\r\n\r\n\t\tif !@blog || (!@blog.is_complete && !blog_writer?)\r\n\t\t\tflash[:error] = \"You do not have permission to see this blog.\"\r\n\t\t\treturn (redirect_to( :action => 'index' ))\r\n\t\telse\r\n\t\t\tset_page_title(@blog.title)\r\n\t\tend\r\n\t\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end",
"def index\n if params[:whose]\n @rblogs = Rblog.my_blogs(params[:whose])\n if params[:private]\n @rblogs = @rblogs.my_private_blogs(params[:whose])\n else\n @rblogs = @rblogs.my_shared_blogs(params[:whose])\n end\n else\n @rblogs = Rblog.shared\n end\n @rblogs = @rblogs.paginate(page: params[:page], per_page: 10)\n # if request.xhr?\n # sleep(1)\n # render :partial => @rblogs\n # end\n end",
"def index\n @blogs = @current_user.blogs\n end",
"def index\n @updates_pagy, @updates = pagy(Update.with_preloads.recent, items: 5)\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n format.rss { render 'index.xml.builder' }\n end\n end",
"def getBlogs(oStatsProxy, iMechanizeAgent, iConf)\n # TODO: Be able to get the list of blogs using MySpace only, without config\n # Parse each blog ID given from the conf.\n lLstBlogsRead = []\n iConf[:BlogsID].each do |iBlogID|\n # Get the blog page\n lBlogPage = iMechanizeAgent.get(\"http://www.myspace.com/#{iConf[:MySpaceName]}/blog/#{iBlogID}\")\n lBlogTitle = lBlogPage.root.css('h2.post-title').first.content\n lNbrLikes = 0\n lStrLikes = lBlogPage.root.css('span.like span.likeLabel').first.content\n if (!lStrLikes.empty?)\n lNbrLikes = Integer(lStrLikes.match(/\\((\\d*)\\)/)[1])\n end\n lNbrReads = 0\n lStrReads = lBlogPage.root.css('li.blogCommentCnt span').first.content\n if (!lStrReads.empty?)\n lNbrReads = Integer(lStrReads.match(/\\((\\d*)\\)/)[1])\n end\n oStatsProxy.add_stat(lBlogTitle, 'Blog likes', lNbrLikes)\n oStatsProxy.add_stat(lBlogTitle, 'Blog reads', lNbrReads)\n lLstBlogsRead << lBlogTitle\n end\n log_debug \"#{lLstBlogsRead.size} blogs read: #{lLstBlogsRead.join(', ')}\"\n end",
"def index\n @spree_blogs = Spree::Blog.all\n end",
"def show\n @blog = EntryFeed.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @blog }\n end\n end",
"def fetch_blogs (size = Globals::DEFAULT_BLOGS_FETCHED)\n @view_state[:blogs] = get_leaves_for_current('blog', 'page', size)\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def show\n @microsite = Microsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @microsite }\n end\n end",
"def feed\n @blog_articles = BlogArticle.all\n respond_to do |format|\n format.rss { render layout: false }\n end\n end",
"def index\n @running_blogs = RunningBlog.all\n end",
"def create\n @mini_blog = MiniBlog.new(params[:mini_blog])\n\n respond_to do |format|\n if @mini_blog.save\n flash[:notice] = \"Mini-Blog creado exitosamente\"\n format.html { redirect_to(@mini_blog) }\n format.xml { render :xml => @mini_blog, :status => :created, :location => @mini_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @user_blogs = UserBlog.all\n end",
"def home\n\n# find_all_blog_posts\n#\n# find_blog_post\n#\n# find_tags\n (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss? \n respond_with (@blog_posts) do |format|\n format.html\n format.rss\n end\n\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n end",
"def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end",
"def show\n @blog = Blog.find_by_url(params[:id])\n if @blog.nil?\n @blog = Blog.find_by_id(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog }\n end\n end",
"def index\n @blogs = Blog.published.paginate(:page => params[:page]).order('id DESC')\n end",
"def get_blog_feed\n # fetching a single feed\n @feed = []# Feedzirra::Feed.fetch_and_parse(\"http://norastable.wordpress.com/feed/\")\n end",
"def users_blog_index\n @blogs = current_user.blogs.page(params[:page]).per(5).most_recent # gets the current users blog posts in descending order and paginating the results to 5 per page\n end",
"def index\n @bulletins = Bulletin.paginate(:all, :order => 'created_at DESC', :per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bulletins }\n format.rss { render :layout => false }\n end\n end",
"def index\n @tag_blogs = TagBlog.all\n end",
"def index\n @blog_categories = BlogCategory.all\n @blog_category = BlogCategory.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_categories }\n end\n end",
"def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end",
"def index\n @second_blogs = SecondBlog.all\n end",
"def index\n @blogs = current_user.blogs\n end",
"def all_blogs\n\t\t@blogs = Blog.all.order(\"created_at DESC\")\n\tend",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @sites }\n end\n end",
"def index\n @homework_blogs = HomeworkBlog.all\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def index\n headers['Content-Type'] = 'application/xml'\n @routes = website_routes + @opportunity_routes\n @blog_sitemap_route = buttercms_blog_sitemap_url\n end",
"def blogfeed\n if params[:tag]\n @blogposts = current_user.blog_feed.tagged_with(params[:tag]).paginate(page: params[:page], :per_page => 10)\n else\n @blogposts = current_user.blog_feed.paginate(page: params[:page], :per_page => 10)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogposts }\n end\n end",
"def index\n @feed_entries = FeedEntry.all\n @title = \"Feeds List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def index\n @blogs = Blog.all\n\n if user_signed_in?\n visited = Visit.new(ip_address: request.remote_ip, :what => \"blogs\", :user_id => current_user.id)\n visited.save\n else\n visited = Visit.new(ip_address: request.remote_ip, :what => \"blogs\")\n visited.save\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end"
] |
[
"0.69056165",
"0.6716386",
"0.67085975",
"0.6704603",
"0.6383639",
"0.63157517",
"0.6286475",
"0.6262945",
"0.6251652",
"0.6238403",
"0.6230913",
"0.62203425",
"0.62203425",
"0.62168604",
"0.6158014",
"0.6157484",
"0.614848",
"0.6113",
"0.6108077",
"0.6101627",
"0.6083194",
"0.6068256",
"0.6065068",
"0.60352623",
"0.60302347",
"0.6028579",
"0.6010018",
"0.6010018",
"0.60085577",
"0.60042715",
"0.59851164",
"0.59804344",
"0.5973799",
"0.5950148",
"0.5939274",
"0.5937611",
"0.59325457",
"0.5916794",
"0.5913586",
"0.5910288",
"0.5907756",
"0.5903089",
"0.58931726",
"0.58931726",
"0.58872426",
"0.5886533",
"0.5878286",
"0.58729696",
"0.58716476",
"0.5864037",
"0.5862623",
"0.5853675",
"0.58387303",
"0.5830205",
"0.5825766",
"0.58218384",
"0.58162665",
"0.58145946",
"0.5808516",
"0.58001274",
"0.5797348",
"0.5797271",
"0.5791376",
"0.57904154",
"0.57832086",
"0.5779907",
"0.5774287",
"0.5771737",
"0.5771491",
"0.5754382",
"0.57505774",
"0.57472676",
"0.57372534",
"0.57279027",
"0.5727753",
"0.5727736",
"0.5722548",
"0.5721115",
"0.5719877",
"0.57144886",
"0.5713223",
"0.57089925",
"0.56996596",
"0.5682708",
"0.5681627",
"0.5666349",
"0.5656061",
"0.5653946",
"0.56416965",
"0.563693",
"0.563693",
"0.563693",
"0.563693",
"0.563693",
"0.56367755",
"0.56317914",
"0.56257886",
"0.56244713",
"0.5615543",
"0.5611308"
] |
0.7906309
|
0
|
GET /mini_blogs/1 GET /mini_blogs/1.xml
|
def show
@mini_blog = MiniBlog.find(params[:id])
@entradas = @mini_blog.entradas
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mini_blog }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @mini_blogs = MiniBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mini_blogs }\n end\n end",
"def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def new\n @mini_blog = MiniBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def blogs\n get(get_all_sites_uri)\n end",
"def show\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def index\n @blog_posts = BlogPost.where(:super_user_id => 1).order(\"created_at DESC\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_posts }\n end\n end",
"def show\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # { render :xml => @blog }\n end\n end",
"def feed\r\n\t\t@blogs = Blog.find(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\")\r\n\t\trender :action => :feed, :layout => false\r\n\tend",
"def show\n @blog_post = @current_user.blogs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def show\n @blog_entry = BlogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def index\r\n\t\tblog_show_params = params[:blog_show_params] || {}\r\n @blogs = Blog.paginate(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\", :page => blog_show_params[:page] || 1, :per_page => 15)\r\n\t\t#set_page_title(\"Relentless Simplicity - The Bonanzle Blog\")\r\n \r\n\t\trespond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @blogs }\r\n end\r\n end",
"def index\n @blogs = Blog.all_project_blogs\n\n @blogs = @blogs.paginate :page => (params[:page] || 1), :per_page=> 15\n \n if params[:format] == \"rss\"\n render :action => \"all_blogs_rss\", :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end\n \n @selected_subnav_link = \"project_updates\"\n end",
"def show\n @personal_blog = PersonalBlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @personal_blog }\n end\n end",
"def index\n\t\t@blogs = Blog.as_created.paginate(page: (params[:page] || 1), per_page: 20)\n\tend",
"def show\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def index\n @posts = Post.limit 50\n @title = \"Weblog - last posts\"\n @updated = @posts.first.created_at unless @posts.empty?\n respond_to do |format|\n format.rss do\n redirect_to feeds_path(format: :atom),\n status: :moved_permanently\n end\n format.atom\n end\n end",
"def index\n @moto_blogs = MotoBlog.all\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end",
"def index\n @news_blasts = NewsBlast.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_blasts }\n end\n end",
"def show\n @news_blast = NewsBlast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @news_blast }\n end\n end",
"def index\n @my_blogs = MyBlog.all\n end",
"def feed_url\n blog_index_url(format: :rss)\n end",
"def index\n @myblogs = Myblog.all\n end",
"def index\n\n\t\t# GET ALL THE BLOG POSTS\n @posts = Post.find(:all, :limit => 5)\n @downloads = Download.find(:all, :limit => 5, :conditions => {:parent_id => nil})\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end",
"def index\n @blogs = Blog.scoped.page(params[:page]).per(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n #binding.pry\n #@blogs = Blog.new_first\n @blogs = Blog.new_first.page(params[:page]).per(5)\n #byebug\n #@blogs = Blog.featured_blogs\n #binding.pry\n @page_title = \"Blogs\"\n end",
"def index\n @blogs = Blog.all\n end",
"def index\n @blogs = Blog.all\n end",
"def show\r\n @blogs = Blog.find(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\")\r\n @blog = Blog.find(:first, :conditions => [\"id = ? OR url_identifier = ?\", params[:id], params[:id]])\r\n\r\n\t\tif !@blog || (!@blog.is_complete && !blog_writer?)\r\n\t\t\tflash[:error] = \"You do not have permission to see this blog.\"\r\n\t\t\treturn (redirect_to( :action => 'index' ))\r\n\t\telse\r\n\t\t\tset_page_title(@blog.title)\r\n\t\tend\r\n\t\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end",
"def show\n @blogs = Blog.all\n end",
"def blogs\n @blogs = Blog.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def index\n @blogs = Blog.find(:all)\n render :action => \"index\"\n end",
"def index\n @entradas = @mini_blog.entradas.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entradas }\n end\n end",
"def index\n @admin_blogs = Admin::Blog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_blogs }\n end\n end",
"def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end",
"def index\n @bs_blogs = BsBlog.all\n end",
"def index\n @pages = Page.find(:all, :order => 'updated_at DESC', :limit => 5)\n @blogs = Blog.all\n end",
"def index\r\n @blogposts = Blogpost.all\r\n #used for current day and date.\r\n #@WeatherRss = WeatherRSS.new()\r\n @weather_rss = WeatherRSS.weather_rss\r\n end",
"def index\n @blog_categories = BlogCategory.all\n @blog_category = BlogCategory.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_categories }\n end\n end",
"def index\n @user_blogs = UserBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_blogs }\n end\n end",
"def show\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myblog }\n end\n end",
"def show\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myblog }\n end\n end",
"def index\n @latestinfos = Latestinfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @latestinfos }\n end\n end",
"def index\n @feeds = Feed.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @feeds.to_xml }\n end\n end",
"def new\n @blogger = Blogger.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blogger }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def index\n @blogs = Blog.all(:order => \"created_at DESC\")\n @blogs_p = Blog.all(:order => \"rating DESC\")\n session[:user_id] = 0\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def index\n @blogs = Blog.all.page(params[:page]).per(5)\n \n end",
"def show\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mush_crawler }\n end\n end",
"def index\n if @blog\n # @replies = @blog.replies.find_new(15)\n @replies = @blog.replies.recent\n else\n @replies=Reply.find_new(15)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @replies }\n end\n end",
"def index\n @news_updates = NewsUpdate.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @news_updates }\n end\n end",
"def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end",
"def index\n @siteblogs = Siteblog.all\n end",
"def rss\n @headers[\"Content-Type\"] = \"application/xml\"\n @articles = Article.find(:all, \n :order => 'created_at DESC',\n :conditions => [\"articles.approved = ?\", true],\n :limit => 10\n )\n render :layout => false\n end",
"def index\n per_page = params[:per_page] ||= PER_PAGE\n @newsblogs = Newsblog.paginate :page => params[:page],\n :per_page => params[:per_page],\n :order=>'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @newsblogs} # index.xml.builder\n format.json {render :json => @newsblogs}\n end\n end",
"def show\n @blog = EntryFeed.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @blog }\n end\n end",
"def index\n @blogs = Blog.where(visible:true).paginate(page: params[:page], per_page: 8)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def index\n @blogs = Blog.all\n render json: @blogs\n end",
"def index\n @running_blogs = RunningBlog.all\n end",
"def index\n @mush_crawlers = MushCrawler.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mush_crawlers }\n end\n end",
"def index\n @office_blogs = Office::Blog.all\n end",
"def rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end",
"def index\n @page = params[:page] || '1'\n @forums = TogForum::Forum.find(:all, :order => 'id ASC').paginate({:page => @page})\n respond_to do |format|\n format.html\n format.rss { render :rss => @forums } \n end\n end",
"def show\n @blog = Blog.find_by_url(params[:id])\n if @blog.nil?\n @blog = Blog.find_by_id(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blog }\n end\n end",
"def index\n @blog1s = Blog1.all\n end",
"def show\n @microsite = Microsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @microsite }\n end\n end",
"def show\n @entrada = @mini_blog.entradas.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entrada }\n end\n end",
"def index\n @blogs = Blog.published.paginate(:page => params[:page]).order('id DESC')\n end",
"def index\n @watercolor_blogs = WatercolorBlog.all\n end",
"def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end",
"def index\n @blogs = @current_user.blogs\n end",
"def index\n @blogs = Blog.all\n\n render json: @blogs\n end",
"def new\r\n @blog = Blog.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end",
"def new\n @blog_entry = BlogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def index\n @updates_pagy, @updates = pagy(Update.with_preloads.recent, items: 5)\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n format.rss { render 'index.xml.builder' }\n end\n end",
"def index\n @spree_blogs = Spree::Blog.all\n end",
"def index\n @feed_entries = FeedEntry.all\n @title = \"Feeds List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feed_entries }\n end\n end",
"def home\n\n# find_all_blog_posts\n#\n# find_blog_post\n#\n# find_tags\n (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss? \n respond_with (@blog_posts) do |format|\n format.html\n format.rss\n end\n\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n end",
"def getBlogs(oStatsProxy, iMechanizeAgent, iConf)\n # TODO: Be able to get the list of blogs using MySpace only, without config\n # Parse each blog ID given from the conf.\n lLstBlogsRead = []\n iConf[:BlogsID].each do |iBlogID|\n # Get the blog page\n lBlogPage = iMechanizeAgent.get(\"http://www.myspace.com/#{iConf[:MySpaceName]}/blog/#{iBlogID}\")\n lBlogTitle = lBlogPage.root.css('h2.post-title').first.content\n lNbrLikes = 0\n lStrLikes = lBlogPage.root.css('span.like span.likeLabel').first.content\n if (!lStrLikes.empty?)\n lNbrLikes = Integer(lStrLikes.match(/\\((\\d*)\\)/)[1])\n end\n lNbrReads = 0\n lStrReads = lBlogPage.root.css('li.blogCommentCnt span').first.content\n if (!lStrReads.empty?)\n lNbrReads = Integer(lStrReads.match(/\\((\\d*)\\)/)[1])\n end\n oStatsProxy.add_stat(lBlogTitle, 'Blog likes', lNbrLikes)\n oStatsProxy.add_stat(lBlogTitle, 'Blog reads', lNbrReads)\n lLstBlogsRead << lBlogTitle\n end\n log_debug \"#{lLstBlogsRead.size} blogs read: #{lLstBlogsRead.join(', ')}\"\n end",
"def index\n @second_blogs = SecondBlog.all\n end",
"def feed\n @blog_articles = BlogArticle.all\n respond_to do |format|\n format.rss { render layout: false }\n end\n end",
"def index\n all_blogs = Blog.all\n @recent_blogs = []\n i = 0\n if (all_blogs.length > 0) then\n i = all_blogs.last().id\n end\n\n while (@recent_blogs.length < 6 && i >= 1)\n if (Blog.exists?(i)) then\n @recent_blogs << Blog.find(i)\n end\n i -= 1\n end\n end",
"def index\n @page[:per_page] = params[:limit] || 5\n @blog_posts = BlogPost.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_posts, callback: params[:callback] }\n format.xml { render xml: @blog_posts }\n format.rss { render 'feed' }\n end\n end",
"def create\n @mini_blog = MiniBlog.new(params[:mini_blog])\n\n respond_to do |format|\n if @mini_blog.save\n flash[:notice] = \"Mini-Blog creado exitosamente\"\n format.html { redirect_to(@mini_blog) }\n format.xml { render :xml => @mini_blog, :status => :created, :location => @mini_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @posts = Post.all\n\n @title = \"Blog Management\"\n\n respond_to do |format| \n format.html { render :index }\n format.xml { render :xml => @posts.to_xml}\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end",
"def index\n @bulletins = Bulletin.paginate(:all, :order => 'created_at DESC', :per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bulletins }\n format.rss { render :layout => false }\n end\n end",
"def index\n @harsha_blogs = HarshaBlog.all\n end",
"def index\n @user_blogs = UserBlog.all\n end",
"def index\n # カレントページはGETパラメーターとして受け取ってくる想定\n @page = params['page'].to_i\n # リスト初期化\n $alist = []\n @userBlogInfos = UserBlogInfo.all\n \n url = []\n @userBlogInfos.each do |userBlogInfo|\n if userBlogInfo.feedUrl.present?\n url.push(userBlogInfo.feedUrl)\n else\n puts \"no\"\n end\n end\n \n url.each do |item|\n perse(item)\n end\n\n #時系列順にソート -にすることで降順にする。\n @sorted = $alist.sort{|aa, bb|\n -(aa.published.to_i <=> bb.published.to_i)\n }\n #ページサイズ\n #ページネーション設定\n @rss_list = Kaminari.paginate_array(@sorted).page(params[:page]).per(10)\n end",
"def index\n if params[:whose]\n @rblogs = Rblog.my_blogs(params[:whose])\n if params[:private]\n @rblogs = @rblogs.my_private_blogs(params[:whose])\n else\n @rblogs = @rblogs.my_shared_blogs(params[:whose])\n end\n else\n @rblogs = Rblog.shared\n end\n @rblogs = @rblogs.paginate(page: params[:page], per_page: 10)\n # if request.xhr?\n # sleep(1)\n # render :partial => @rblogs\n # end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @sites }\n end\n end",
"def show\n begin\n @blogger = current_blogger\n @blog_profile = BlogProfile.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @blog_profile }\n end\n rescue ActiveRecord::RecordNotFound =>e\n @blog_profile = BlogProfile.new\n respond_to do |format|\n format.html { render :action => \"new\" }\n end\n end\n \n end"
] |
[
"0.7785462",
"0.71288604",
"0.66795796",
"0.657555",
"0.6520972",
"0.6461359",
"0.6442262",
"0.63986194",
"0.63976383",
"0.63478094",
"0.63366735",
"0.63229644",
"0.6256309",
"0.6237625",
"0.6225953",
"0.61977714",
"0.61837614",
"0.61801314",
"0.61801314",
"0.6177376",
"0.61734563",
"0.6165482",
"0.61232305",
"0.61123604",
"0.6105673",
"0.6084085",
"0.60827005",
"0.60721815",
"0.6056518",
"0.6056518",
"0.6051964",
"0.6041705",
"0.60233927",
"0.60147625",
"0.6013408",
"0.6003362",
"0.5990058",
"0.5987748",
"0.5982313",
"0.5979607",
"0.59729356",
"0.59420216",
"0.5934091",
"0.5934091",
"0.593005",
"0.58958644",
"0.5884696",
"0.58822465",
"0.58822465",
"0.58822465",
"0.5879615",
"0.5868459",
"0.58664286",
"0.58655113",
"0.5865486",
"0.58578557",
"0.5849089",
"0.58452165",
"0.5839004",
"0.58343494",
"0.58297414",
"0.5827269",
"0.5814626",
"0.58145005",
"0.58140266",
"0.5813874",
"0.5812329",
"0.58064723",
"0.58039594",
"0.58026993",
"0.5795064",
"0.57935363",
"0.5789872",
"0.5787824",
"0.578338",
"0.57821167",
"0.57780784",
"0.57752055",
"0.5771585",
"0.57674015",
"0.5759884",
"0.5758047",
"0.57577455",
"0.57543486",
"0.57407326",
"0.5736966",
"0.573622",
"0.57295245",
"0.57275885",
"0.572466",
"0.572085",
"0.5719296",
"0.5718328",
"0.57120764",
"0.5705758",
"0.5705758",
"0.5705758",
"0.5705758",
"0.5705758",
"0.5698245"
] |
0.6453557
|
6
|
GET /mini_blogs/new GET /mini_blogs/new.xml
|
def new
@mini_blog = MiniBlog.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mini_blog }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blogger = Blogger.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blogger }\n end\n end",
"def new\r\n @blog = Blog.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end",
"def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def new\n @twitterfeed = Twitterfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitterfeed }\n end\n end",
"def new\n @blog_entry = BlogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @blog = Blog.find(params[:blog_id])\n @post = Post.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end",
"def index\n @mini_blogs = MiniBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mini_blogs }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @news }\n end\n end",
"def create\n @mini_blog = MiniBlog.new(params[:mini_blog])\n\n respond_to do |format|\n if @mini_blog.save\n flash[:notice] = \"Mini-Blog creado exitosamente\"\n format.html { redirect_to(@mini_blog) }\n format.xml { render :xml => @mini_blog, :status => :created, :location => @mini_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @news = News.new\n @title = \"New news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def new\n @blog_category = BlogCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_category }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @entrada = @mini_blog.entradas.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrada }\n end\n end",
"def new\n @news_link = NewsLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_link }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @site }\n end\n end",
"def new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @feed = Feed.new\n @page_title = 'Add Feed'\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @feed }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @live_news = LiveNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @live_news }\n end\n end",
"def new\n @blog_post = BlogPost.new\n @categories = BlogCategory.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def new\n @myblog = Myblog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @myblog }\n end\n end",
"def new\n @myblog = Myblog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @myblog }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tweet }\n end\n end",
"def new\n @news_category = NewsCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_category }\n end\n end",
"def new\n @news_article = NewsArticle.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_article }\n end\n end",
"def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"def new\n @datafeed = Datafeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datafeed }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @post10 = Post10.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post10 }\n end\n end",
"def new\n @blog_url = BlogUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog_url }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blog }\n end\n end",
"def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def new\n @populate_feed_info = PopulateFeedInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @populate_feed_info }\n end\n end",
"def index\n @blog_categories = BlogCategory.all\n @blog_category = BlogCategory.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_categories }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n @tiny_resource = TinyResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiny_resource }\n end\n end",
"def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitter_crawler_hash_tag }\n end\n end",
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\n @post101 = Post101.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post101 }\n end\n end",
"def new\n @website = Website.new params[:website]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @website }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\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 @blog_profile = BlogProfile.new\n @blogger = current_blogger\n @blog_profile.blogger_id = @blogger.id\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_profile }\n end\n end",
"def new\n @crawler_article = CrawlerArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawler_article }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end",
"def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/new\" }\n format.xml { render :xml => @site }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @page = Page.new\n\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 # @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @blog }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n \n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end",
"def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def new\n @crawl_result = Crawl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crawl_result }\n end\n end",
"def new\n @blogger = Blogger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blogger }\n end\n end",
"def new\n @search_tweet = SearchTweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @search_tweet }\n end\n end",
"def new\n @forum = TogForum::Forum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.rss { render :rss => @forum }\n end\n end",
"def new\n @site_link = SiteLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site_link }\n end\n end",
"def new\n @post50 = Post50.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post50 }\n end\n end",
"def new\n @page = Page.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 = Page.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 = Page.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 = Page.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 = Page.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 = Page.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 @post310 = Post310.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post310 }\n end\n end",
"def new\n @avatar_tweet = AvatarTweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @avatar_tweet }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @microsite = Microsite.new\n build_microsite(@microsite)\n @categories = Category.all\n @microsites = Microsite.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @microsite }\n end\n end",
"def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blog_post, callback: params[:callback] }\n format.xml { render xml: @blog_post }\n end\n end",
"def new\n @post58 = Post58.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post58 }\n end\n end",
"def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end"
] |
[
"0.72367585",
"0.72367585",
"0.72367585",
"0.71660256",
"0.71568733",
"0.6940847",
"0.6937096",
"0.69343245",
"0.69255906",
"0.6813487",
"0.6761975",
"0.6759992",
"0.6759992",
"0.6759992",
"0.67087287",
"0.67069954",
"0.6705693",
"0.67014277",
"0.67008513",
"0.6681612",
"0.6598839",
"0.6588611",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65767974",
"0.65690356",
"0.65666807",
"0.6562086",
"0.6551809",
"0.6533663",
"0.651575",
"0.651575",
"0.65096587",
"0.64954096",
"0.6495395",
"0.64823544",
"0.64589304",
"0.64541703",
"0.6444857",
"0.6444857",
"0.6444464",
"0.6443082",
"0.6404169",
"0.6404169",
"0.6403905",
"0.64025646",
"0.64025646",
"0.6397865",
"0.63818",
"0.6379186",
"0.6359915",
"0.6344529",
"0.633963",
"0.633963",
"0.6339623",
"0.633537",
"0.63297147",
"0.63272613",
"0.6315476",
"0.6306359",
"0.6306208",
"0.630245",
"0.628713",
"0.62807834",
"0.6277914",
"0.6269921",
"0.62647086",
"0.62615216",
"0.626139",
"0.6256874",
"0.6248797",
"0.6247915",
"0.6245226",
"0.6240905",
"0.62401617",
"0.623924",
"0.62367827",
"0.6233337",
"0.62324184",
"0.62317646",
"0.62305677",
"0.6230404",
"0.6230404",
"0.6230404",
"0.6230404",
"0.6230404",
"0.6230404",
"0.62245655",
"0.62217057",
"0.621828",
"0.621828",
"0.62157977",
"0.6213716",
"0.6212583",
"0.62112474"
] |
0.76912254
|
0
|
POST /mini_blogs POST /mini_blogs.xml
|
def create
@mini_blog = MiniBlog.new(params[:mini_blog])
respond_to do |format|
if @mini_blog.save
flash[:notice] = "Mini-Blog creado exitosamente"
format.html { redirect_to(@mini_blog) }
format.xml { render :xml => @mini_blog, :status => :created, :location => @mini_blog }
else
format.html { render :action => "new" }
format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @mini_blogs = MiniBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mini_blogs }\n end\n end",
"def new\n @mini_blog = MiniBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def create\n @personal_blog = PersonalBlog.new(params[:personal_blog])\n @personal_blog.feed = @personal_blog.feed.gsub(/^feed/, 'http')\n\n respond_to do |format|\n if @personal_blog.save\n format.html { redirect_to(@personal_blog) }\n format.xml { render :xml => @personal_blog, :status => :created, :location => @personal_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @personal_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @mini_blog = MiniBlog.find(params[:id])\n\n respond_to do |format|\n if @mini_blog.update_attributes(params[:mini_blog])\n flash[:notice] = 'Mini-Blog actualizado exitosamente'\n format.html { redirect_to(@mini_blog) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @blog_article = BlogArticle.new(blog_article_params)\n\n respond_to do |format|\n if @blog_article.save\n uri = URI.parse 'http://benjamin-watson-senior-seminar.superfeedr.com/'\n post_params = {\n 'hub.mode' => 'publish',\n 'hub.url' => 'https://benjamin-watson-push-src.herokuapp.com/feed.rss',\n }\n Net::HTTP.post_form uri, post_params\n\n format.html { redirect_to @blog_article, notice: 'Blog article was successfully created.' }\n format.json { render :show, status: :created, location: @blog_article }\n else\n format.html { render :new }\n format.json { render json: @blog_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def metaWeblog_newPost(args)\n new_post_params = Hash.from_xml(args.children[3].to_s)['param']['value']['struct']['member']\n # title = new_post_params[0]['value']['string']\n title =''\n body = new_post_params[1]['value']['string']\n categories = []\n # categories = (new_post_params[2]['value']['array']['data']['value'].class == Array ? new_post_params[2]['value']['array']['data']['value'].map { |e| e['string'] } : [new_post_params[2]['value']['array']['data']['value']['string']] )\n tags = (new_post_params[3]['value']['array']['data']['value'].class == Array ? new_post_params[3]['value']['array']['data']['value'].map { |e| e['string'] } : [new_post_params[3]['value']['array']['data']['value']['string']] )\n ifttt_new_post(title, body, categories, tags)\n rpc_response(\"xml.value 'nothing'\")\n end",
"def create\n @blog = Blog.new(params[:blog])\n\n respond_to do |format|\n if @blog.save\n flash[:success] = 'Blog was successfully created.'\n format.html { redirect_to blogs_path }\n format.xml { render :xml => @blog, :status => :created, :location => @blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @moto_blog = MotoBlog.new(moto_blog_params)\n\n respond_to do |format|\n if @moto_blog.save\n format.html { redirect_to @moto_blog, notice: 'Moto Blog was successfully created.' }\n format.json { render :show, status: :created, location: @moto_blog }\n else\n format.html { render :new }\n format.json { render json: @moto_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(params[:blog])\n\n respond_to do |format|\n if @blog.save\n flash[:notice] = 'Blog was successfully created.'\n format.html { redirect_to(@blog) }\n format.xml { render :xml => @blog, :status => :created, :location => @blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @myblog = Myblog.new(params[:myblog])\n\n respond_to do |format|\n if @myblog.save\n format.html { redirect_to @myblog, notice: 'Myblog was successfully created.' }\n format.json { render json: @myblog, status: :created, location: @myblog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = params[:page] ? params[:page].to_i : 1\n \n if (@page > 1)\n @user = \"feedback\"\n @new_blog = Blog.new # Not actually used\n @new_blog.home_id = 0\n @home = Home.find_by_ublog_name(@user);\n @nothread = true\n if load_page(@home.id, @page)\n @blogs = Blog.all_blogs(@home, PAGE_SIZE+1, offset = (@page -1)*PAGE_SIZE)\n if @blogs.length > PAGE_SIZE\n @blogs.pop\n @paginate = true\n end\n else\n return # error already shown\n end\n output = session[:narrow_view] ? \"narrow\" : \"html\"\n\n respond_to do |format|\n format.html { render :template => \"alls/show.#{output}.erb\"}\n format.mobile { render :template => 'alls/show.mobile.erb' }\n format.xml { render :xml => @blogs }\n end\n else\n session[:mobile_view] = params[:mobile].to_i if params[:mobile]\n session[:narrow_view] = params[:narrow] == '1'\n \n respond_to do |format|\n format.html { redirect_to all_path }\n format.mobile { redirect_to all_path }\n format.xml { render :xml => Home.new.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @myblog = Myblog.new(myblog_params)\n\n respond_to do |format|\n if @myblog.save\n format.html { redirect_to @myblog, notice: 'Myblog was successfully created.' }\n format.json { render :show, status: :created, location: @myblog }\n else\n format.html { render :new }\n format.json { render json: @myblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(params[:blog])\n @blog.user_id = current_user.id\n @blog.rating = 0\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to(@blog, :notice => 'Blog was successfully created.') }\n format.xml { render :xml => @blog, :status => :created, :location => @blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(blogs_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render json: @blog, status: :created, location: @blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def create\n @blog_entry = BlogEntry.new(params[:blog_entry])\n\n respond_to do |format|\n if @blog_entry.save\n flash[:notice] = 'BlogEntry was successfully created.'\n format.html { redirect_to(@blog_entry) }\n format.xml { render :xml => @blog_entry, :status => :created, :location => @blog_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = current_admin.blogs.build(blog_params)\n respond_to do |format|\n if @blog.save\n format.html { redirect_to [:admins, @blog], notice: '新しいブログを投稿しました。' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end",
"def create_new_xml_blog( body, time )\n p \"new xml doc created for time=#{time}\"\n \n #this is our template for a an individual entry in the blog import file\n item_template = <<-eos\n<item>\n<title>xxx</title>\n<link>xxx</link>\n<pubDate>xxx</pubDate>\n<dc:creator><![CDATA[xxx]]></dc:creator>\n\n\t\t<category><![CDATA[Uncategorized]]></category>\n\n\t\t<category domain=\"category\" nicename=\"uncategorized\"><![CDATA[Uncategorized]]></category>\n\n<guid isPermaLink=\"false\">xxx</guid>\n<description></description>\n<content:encoded><![CDATA[xxx]]></content:encoded>\n<excerpt:encoded><![CDATA[]]></excerpt:encoded>\n<wp:post_id>xxx</wp:post_id>\n<wp:post_date>xxx</wp:post_date>\n<wp:post_date_gmt>xxx</wp:post_date_gmt>\n<wp:comment_status>closed</wp:comment_status>\n<wp:ping_status>closed</wp:ping_status>\n<wp:post_name>xxx</wp:post_name>\n<wp:status>publish</wp:status>\n<wp:post_parent>0</wp:post_parent>\n<wp:menu_order>0</wp:menu_order>\n<wp:post_type>post</wp:post_type>\n<wp:post_password></wp:post_password>\n</item>\n\n eos\n \n doc = Hpricot.XML(item_template)\n \n #xanga names entries on date, so we will do same\n doc.search(\"title\")[0].inner_html = \"#{time.gsub(\" +0000\",\"\")}\"\n #link is constructed as follows: [base_blog_url]/[YYYY]/[MM]/[DD]/[title.downcase]\n #for dates, this looks like: [base_blog_url]/[YYYY]/[MM]/[DD]/tue-10-mar-2009-001259-0000/, for example\n doc.search(\"link\")[0].inner_html = \"#{@options[:base_blog_url]}/#{Time.now.strftime(\"%Y\")}/#{Time.now.strftime(\"%m\")}/#{Time.now.strftime(\"%d\")}/#{time.downcase.gsub(\",\", \"\").gsub(\":\",\"\").gsub(\" +\",\"-\").gsub(\" \",\"-\")}/\"\n \n #pubDate is 'time' passed in\n doc.search(\"pubDate\")[0].inner_html = \"#{time}\"\n #the creator is the username that gets credit for the posting i guess\n doc.search(\"dc:creator\")[0].inner_html = \"<![CDATA[#{@options[:creator]}]]>\"\n #guid is, as far as i can tell follows base_blog_url/?p=N format, where N=sequence of blog \n doc.search(\"guid\")[0].inner_html = \"#{@options[:base_blog_url]}/?p=#{@curr_blog_entries}\"\n #content:encoded is the blog body passed here\n doc.search(\"content:encoded\")[0].inner_html = \"<![CDATA[#{body}]]>\"\n #wp:post_id is as far as i can tell, just the sequential ordering of imported entries \n doc.search(\"wp:post_id\")[0].inner_html = \"#{@curr_blog_entries}\"\n\n #I've a conflict with my Time class; so I have to hack around, so sorry\n #input: time formatted as Tue, 10 Mar 2009 00:12:59 +0000\n #output: 2009-03-10 00:12:59, for example\n def convert_to_wp_post_date(time)\n ret = time.split(\" \")\n month_value = { 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' =>10, 'NOV' =>11, 'DEC' =>12 }\n ret[2] = month_value[ ret[2].upcase ] \n ret[2] = \"0\" + ret[2].to_s if ret[2].to_s.size == 1 #we want month padded to 2 digits\n ret[1] = \"0\" + ret[1].to_s if ret[1].to_s.size == 1 #we want day padded to 2 digits\n \n \"#{ret[3]}-#{ret[2]}-#{ret[1]} #{ret[4]}\"\n end\n \n #wp:post_date /wp:post_date_gmt is yet another format for the time field passed in\n #it looks like: 2009-03-10 00:12:59, for example\n doc.search(\"wp:post_date\")[0].inner_html = \"#{convert_to_wp_post_date(time)}\"\n doc.search(\"wp:post_date_gmt\")[0].inner_html = \"#{convert_to_wp_post_date(time)}\"\n #wp:post_name with xanga, it is same asthe last part of the link tag\n doc.search(\"wp:post_name\")[0].inner_html = \"#{time.downcase.gsub(\",\", \"\").gsub(\":\",\"\").gsub(\" +\",\"-\").gsub(\" \",\"-\")}\"\n\n doc\n end",
"def new\n @entrada = @mini_blog.entradas.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entrada }\n end\n end",
"def create\r\n\t\t@blog = Blog.new(params[:blog])\r\n\t @blog.posted_by = current_user\r\n\r\n\t\trespond_to do |format|\r\n if @blog.save\r\n flash[:notice] = 'Blog was successfully created.'\r\n format.html { redirect_to(@blog) }\r\n format.xml { render :xml => @blog, :status => :created, :location => @blog }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n\t\tparams[:blog_post][:tags] = params[:blog_post][:tags].split(',').map(&:strip)\n\t\t@blog_post = BlogPost.new(blog_post_params)\n respond_to do |format|\n if @blog_post.save\n format.html { redirect_to @blog_post, notice: 'Blog post was successfully created.' }\n format.json { render :show, status: :created, location: @blog_post }\n else\n format.html { render :new }\n format.json { render json: @blog_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def create\n @siteblog = Siteblog.new(siteblog_params)\n\n respond_to do |format|\n if @siteblog.save\n format.html { redirect_to @siteblog, notice: 'Siteblog was successfully created.' }\n format.json { render :show, status: :created, location: @siteblog }\n else\n format.html { render :new }\n format.json { render json: @siteblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(refined_blog_params)\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog_post = BlogPost.new(params[:blog_post])\n\n respond_to do |format|\n if @blog_post.save\n flash[:notice] = 'BlogPost was successfully created.'\n format.html { redirect_to(@blog_post) }\n format.xml { render :xml => @blog_post, :status => :created, :location => @blog_post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @blog_entry = BlogEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_entry }\n end\n end",
"def create\n @bs_blog = BsBlog.new(bs_blog_params)\n respond_to do |format|\n if @bs_blog.save\n format.html { redirect_to @bs_blog, notice: 'Bs blog was successfully created.' }\n format.json { render :show, status: :created, location: @bs_blog }\n else\n format.html { render :new }\n format.json { render json: @bs_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def new\n @blog = Blog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog }\n end\n end",
"def create\n @blog = current_user.blogs.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to users_blog_index_path, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @blog_post = BlogPost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def destroy\n @mini_blog = MiniBlog.find(params[:id])\n @mini_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to(mini_blogs_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @blog_post = BlogPost.new(params[:blog_post])\n # @blog_post.super_user_id = session[:current_super_user_id].to_i\n @blog_post.status = blog_status params\n \n respond_to do |format|\n if @blog_post.save\n format.html { redirect_to([:admin, @blog_post], :notice => 'Blog post was successfully created_at.') }\n format.xml { render :xml => @blog_post, :status => :created, :location => @blog_post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @my_blog = MyBlog.new(my_blog_params)\n\n respond_to do |format|\n if @my_blog.save\n format.html { redirect_to @my_blog, notice: 'My blog was successfully created.' }\n format.json { render :show, status: :created, location: @my_blog }\n else\n format.html { render :new }\n format.json { render json: @my_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n if @blog.save\n render json: @blog\n else\n render json: @blog.errors, status: :unprocessable_entity\n end\n end",
"def new\n @blogger = Blogger.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blogger }\n end\n end",
"def new\r\n @blog = Blog.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @blog }\r\n end\r\n end",
"def create\n @testblog = Testblog.new(testblog_params)\n\n respond_to do |format|\n if @testblog.save\n format.html { redirect_to @testblog, notice: 'Testblog was successfully created.' }\n format.json { render :show, status: :created, location: @testblog }\n else\n format.html { render :new }\n format.json { render json: @testblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@blog = current_user.blogs.new(blog_params)\n\n\t\trespond_to do |format|\n\t\t\tif @blog.save\n\t\t\t\tformat.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @blog }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @blog.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @blogs = Blog.all.joins(:payment)\n @blogs = @blogs.joins(:category).order(created_at: :desc).page(params[:page]).per(PRE)\n @blog = current_user.blogs.build(blog_params)\n\n # @blog.save\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog }\n # format.json { render :json, status: :created, location: @blog }\n format.js { @status = \"success\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n format.js { @status = \"fail\" }\n end\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n\n @blog.user_id = @current_user.id\n\n params[:technologies][:id].each do |technology_id|\n if !technology_id.empty?\n @blog.blog_technologies.build(:technology_id => technology_id)\n end\n end\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: \"Blog was successfully created.\" }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to blogs_path, notice: 'Blog was successfully created.' }\n format.json { render action: 'show', status: :created, location: @blog }\n else\n format.html { render action: 'new' }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog1 = Blog1.new(blog1_params)\n\n respond_to do |format|\n if @blog1.save\n format.html { redirect_to @blog1, notice: \"Blog1 was successfully created.\" }\n format.json { render :show, status: :created, location: @blog1 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @blog1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def redirect_to_blogs\n respond_to do |format|\n format.html { redirect_to(blogs_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @admin_blog = Admin::Blog.new(params[:admin_blog])\n\n respond_to do |format|\n if @admin_blog.save\n format.html { redirect_to admin_blogs_path, notice: I18n.t(\"flash.create_admin_blog\") }\n format.json { render json: @admin_blog, status: :created, location: @admin_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_blog = Admin::Blog.new(admin_blog_params)\n\n respond_to do |format|\n if @admin_blog.save\n format.html { redirect_to @admin_blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @admin_blog }\n else\n format.html { render :new }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @mini_blog = MiniBlog.find(params[:id])\n @entradas = @mini_blog.entradas\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def addLogsBatchXML(collection=\"lclsLogs\", dizList, bulk: false)\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/#{collection}/update\") \n # uri = URI.parse(\"http://psmetric04:8983/solr/lclsLogs/update\") \n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/xml')\n req.body = formatLogBatchAsXML(dizList)\n # puts req.body \n # res = http.request(req, xml: formatLogBatchAsXML(dizList) )\n res = http.request(req)\n # puts \"response: #{res.body}\"\n return [dizList.length, req.body.size, res]\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def new\n @blog = Blog.find(params[:blog_id])\n @post = Post.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @post }\n end\n end",
"def postSales_logSyndication( action_type, syndication_type, publisher_id, expiry_date, entity_id, group_id, seed_masheryid, supplier_masheryid, country, reseller_masheryid)\n params = Hash.new\n params['action_type'] = action_type\n params['syndication_type'] = syndication_type\n params['publisher_id'] = publisher_id\n params['expiry_date'] = expiry_date\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n params['seed_masheryid'] = seed_masheryid\n params['supplier_masheryid'] = supplier_masheryid\n params['country'] = country\n params['reseller_masheryid'] = reseller_masheryid\n return doCurl(\"post\",\"/sales_log/syndication\",params)\n end",
"def rss\n @title = t('titles.news', brand: website.brand_name)\n @description = website.value_for(\"default_meta_tag_description\")\n @news = News.all_for_website(website)\n respond_to do |format|\n format.xml # render rss.xml.builder\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n @blog.user_id = current_user.id\n\n @blog.subcategory_ids.each do |subid|\n s = Subcategory.find(subid)\n array = s.blog_ids\n array << @blog.id\n s.update_attributes(blog_ids: array)\n s.save!\n end\n\n if params[:blog][:pins].present?\n @blog.pins.purge\n @blog.pins.attach(params[:blog][:pins])\n end\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_blog = current_user.user_blogs.build(user_blog_params)\n\n respond_to do |format|\n if @user_blog.save\n format.html { redirect_to @user_blog, notice: 'User blog was successfully created.' }\n format.json { render :show, status: :created, location: @user_blog }\n else\n format.html { render :new }\n format.json { render json: @user_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spree_blog = Spree::Blog.new(spree_blog_params)\n respond_to do |format|\n if @spree_blog.save\n format.html { redirect_to admin_blogs_path, notice: 'Blog Post was successfully created.' }\n format.json { render action: 'index', status: :created, location: @spree_blog }\n else\n format.html { render action: 'new', notice: \"#{@spree_blog.errors.full_messages.first}\"}\n format.json { render json: @spree_blog.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def index\n @blog_categories = BlogCategory.all\n @blog_category = BlogCategory.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_categories }\n end\n end",
"def feed\r\n\t\t@blogs = Blog.find(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\")\r\n\t\trender :action => :feed, :layout => false\r\n\tend",
"def create\n @tag_blog = TagBlog.new(tag_blog_params)\n\n respond_to do |format|\n if @tag_blog.save\n format.html { redirect_to @tag_blog, notice: 'Tag blog was successfully created.' }\n format.json { render :show, status: :created, location: @tag_blog }\n else\n format.html { render :new }\n format.json { render json: @tag_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n blog = Blog.create(blog_params)\n\n if blog.save\n render json: blog, status: :created\n else\n render json: blog.errors, status: :unprocessable_entity\n end\n end",
"def create\n @blog = Blog.new(params[:blog])\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render json: @blog, status: :created, location: @blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @harsha_blog = HarshaBlog.new(harsha_blog_params)\n\n respond_to do |format|\n if @harsha_blog.save\n format.html { redirect_to @harsha_blog, notice: 'Harsha blog was successfully created.' }\n format.json { render :show, status: :created, location: @harsha_blog }\n else\n format.html { render :new }\n format.json { render json: @harsha_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newsfeed\n check_auth :newsfeed\n \n response = connection.post do |req|\n req.url '/user/newsfeed'\n req.body = { :format => @format }\n end\n response\n end",
"def create\n @office_blog = Office::Blog.new(office_blog_params)\n\n respond_to do |format|\n if @office_blog.save\n format.html { redirect_to @office_blog, notice: 'Blog was successfully created.' }\n format.json { render action: 'show', status: :created, location: @office_blog }\n else\n format.html { render action: 'new' }\n format.json { render json: @office_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_blog_info = UserBlogInfo.new(user_blog_info_params)\n\n respond_to do |format|\n if @user_blog_info.save\n format.html { redirect_to @user_blog_info, notice: 'User blog info was successfully created.' }\n format.json { render :show, status: :created, location: @user_blog_info }\n else\n format.html { render :new }\n format.json { render json: @user_blog_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blogger = Blogger.new(params[:blogger])\n @blogger.created_by = current_admin.email\n respond_to do |format|\n if @blogger.save\n format.html { redirect_to(admin_bloggers_url, :notice => 'Blogger was successfully created.') }\n format.xml { render :xml => @blogger, :status => :created, :location => @blogger }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blogger.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @blog_post = BlogPost.new\n @categories = BlogCategory.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blog_post }\n end\n end",
"def create\n @blog_category = BlogCategory.new(params[:blog_category])\n\n respond_to do |format|\n if @blog_category.save\n format.html { redirect_to(admin_blog_categories_path, :notice => 'Blog category was successfully created.') }\n format.xml { render :xml => @blog_categories, :status => :created, :location => @blog_category }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @blog_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @watercolor_blog = WatercolorBlog.new(watercolor_blog_params)\n\n respond_to do |format|\n if @watercolor_blog.save\n format.html { redirect_to @watercolor_blog, notice: \"Watercolor blog was successfully created.\" }\n format.json { render :show, status: :created, location: @watercolor_blog }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @watercolor_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(blog_params)\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render json: @blog, status: :created, location: @blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog_post = @current_user.blogs.create!(params[:blog_post])\n if @blog_post.save\n flash[:notice] = \"Message save.\"\n redirect_to :controller=>\"blog_posts\", :action => \"index\"\n end\n \n\n\n end",
"def create\n @running_blog = RunningBlog.new(running_blog_params)\n\n respond_to do |format|\n if @running_blog.save\n format.html { redirect_to @running_blog, notice: 'Running blog was successfully created.' }\n format.json { render :show, status: :created, location: @running_blog }\n else\n format.html { render :new }\n format.json { render json: @running_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t\tauthorize! :manage, Blog\n\t\t\t\n\t\t\t@blog = Blog.new\n\n\t\t\tif request.post?\n\t\t\t\tif @blog.save_with_params params[:blog]\n\t\t\t\t\trender json: { status: 0, result: { redirect: _route_helpers.blogs_path } }\n\t\t\t\telse\n\t\t\t\t\trender json: { status: 2 }\n\t\t\t\tend\n\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\trender layout: 'layout_back'\n\t\tend",
"def create\n @c_blog = CBlog.new(params[:c_blog])\n\n respond_to do |format|\n if @c_blog.save\n format.html { redirect_to @c_blog, notice: 'A bew blog was successfully created.' }\n format.json { render json: @c_blog, status: :created, location: @c_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @c_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mush_crawler = MushCrawler.new(params[:mush_crawler])\n\n respond_to do |format|\n if @mush_crawler.save\n flash[:notice] = 'MushCrawler was successfully created.'\n format.html { redirect_to(@mush_crawler) }\n format.xml { render :xml => @mush_crawler, :status => :created, :location => @mush_crawler }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mush_crawler.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @blogs = Blog.all\n\n if user_signed_in?\n visited = Visit.new(ip_address: request.remote_ip, :what => \"blogs\", :user_id => current_user.id)\n visited.save\n else\n visited = Visit.new(ip_address: request.remote_ip, :what => \"blogs\")\n visited.save\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blogs }\n end\n end",
"def save\n self.client.api_post(\"/feed\", self.create_params)\n end",
"def create\n @blog = Blog.create(blog_params)\n params[:tags][:tag_id].each do |p|\n @tagging = Tagging.create(tag_id: p.to_i, blog_id: @blog.id)\n end\n respond_to do |format|\n\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n\n end\nend",
"def create\n @microsite = Microsite.new(params[:microsite])\n @microsites = Microsite.all\n @categories = Category.all\n respond_to do |format|\n if @microsite.save\n @microsite.create_form_details\n format.html { redirect_to admins_microsite_path(@microsite, :notice => 'Microsite was successfully created.') }\n format.xml { render :xml => @microsite, :status => :created, :location => @microsite }\n else\n build_microsite(@microsite)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @microsite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @blogs = Blog.all_project_blogs\n\n @blogs = @blogs.paginate :page => (params[:page] || 1), :per_page=> 15\n \n if params[:format] == \"rss\"\n render :action => \"all_blogs_rss\", :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\n end\n \n @selected_subnav_link = \"project_updates\"\n end",
"def create\n @blog_profile = BlogProfile.new(params[:blog_profile])\n respond_to do |format|\n if @blog_profile.save\n format.html { redirect_to(@blog_profile, :notice => 'Blog profile was successfully created.') }\n format.xml { render :xml => @blog_profile, :status => :created, :location => @blog_profile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog_profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @moto_blogs = MotoBlog.all\n end",
"def create\n @blogcr = Blogcr.new(params[:blogcr])\n\n respond_to do |format|\n if @blogcr.save\n format.html { redirect_to @blogcr, notice: 'Blogcr was successfully created.' }\n format.json { render json: @blogcr, status: :created, location: @blogcr }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blogcr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postFlatpackSitemap( flatpack_id, filedata)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/flatpack/sitemap\",params)\n end",
"def index\r\n\t\tblog_show_params = params[:blog_show_params] || {}\r\n @blogs = Blog.paginate(:all, :conditions => { :is_indexed => true, :is_complete => true }, :order => \"created_at DESC\", :page => blog_show_params[:page] || 1, :per_page => 15)\r\n\t\t#set_page_title(\"Relentless Simplicity - The Bonanzle Blog\")\r\n \r\n\t\trespond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @blogs }\r\n end\r\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create\n @titre = t('blog.titre')\n @blog = Blog.new(blog_params)\n @blog.id = Blog.last.id + 1\n @blog.users_id = current_user.id\n if @blog.save\n flash[:success] = t('blog.post_creer')\n redirect_to @blog\n end\n end",
"def create\n @blog_detail = BlogDetail.new(blog_detail_params)\n\n respond_to do |format|\n if @blog_detail.save\n format.html { redirect_to @blog_detail, notice: 'Blog detail was successfully created.' }\n format.json { render :show, status: :created, location: @blog_detail }\n else\n format.html { render :new }\n format.json { render json: @blog_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postSyndication_log( entity_id, publisher_id, action, success, message, syndicated_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['publisher_id'] = publisher_id\n params['action'] = action\n params['success'] = success\n params['message'] = message\n params['syndicated_id'] = syndicated_id\n return doCurl(\"post\",\"/syndication_log\",params)\n end",
"def siteblog_params\n params.require(:siteblog).permit(:title, :desc, :longdesc, :status, :date)\n end",
"def blog_article_params\n params.require(:blog_article).permit(:title, \n :body, \n :pinned_value, \n entry_attributes: [:id, \n :title,\n :summary,\n :pinned_value, \n :publish_at, \n :seo_title,\n :seo_description,\n :tag_list,\n :skill_list,\n :interest_list,\n :image, \n ])\n end",
"def index\n @blog_posts = BlogPost.where(:super_user_id => 1).order(\"created_at DESC\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_posts }\n end\n end",
"def create\n @blog = Blog.new(blog_params) #these are the allowable fields - set below\n\n respond_to do |format|\n if @blog.save\n # any reference to @blog will mean the same as blog_path(@blog)\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n #format.json { render :show, status: :created, location: @blog }\n else\n format.html { render :new }\n #format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_blog = UserBlog.new(params[:user_blog])\n\n respond_to do |format|\n if @user_blog.save\n format.html { redirect_to \"/home/blog\", notice: '绑定成功.' }\n format.json { render json: @user_blog, status: :created, location: @user_blog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog_post = BlogPost.new(params[:blog_post])\n\n respond_to do |format|\n if @blog_post.save\n format.html { redirect_to blog_posts_url, :notice => 'Blog post was successfully created.' }\n format.json { render :json => blog_posts_url, :status => :created, :location => @blog_post }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\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 create\n blog_post_creator = BlogPostCreator.new(ActivityLogger.new(BlogTweeter.new(self)))\n blog_post_creator.create_with(params[:blog_post])\n end",
"def create\n\n @entry = Entry.new(entry_params)\n @entry.blog_id = params[:blog_id]\n @entry.save\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to blog_entries_url, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: blog_entries_url }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.64741516",
"0.63926864",
"0.5779235",
"0.57445955",
"0.5705277",
"0.5639441",
"0.5634057",
"0.5502933",
"0.5481555",
"0.5465955",
"0.545359",
"0.54524106",
"0.54491687",
"0.54095256",
"0.5407907",
"0.5390425",
"0.5390367",
"0.53758526",
"0.53669846",
"0.5362362",
"0.53387463",
"0.53373915",
"0.5317855",
"0.53011155",
"0.5298975",
"0.5282469",
"0.5268721",
"0.5260308",
"0.5248873",
"0.5248873",
"0.5248873",
"0.5246152",
"0.5242218",
"0.5242147",
"0.52300584",
"0.52108544",
"0.5210634",
"0.5203662",
"0.5202516",
"0.52015793",
"0.51880026",
"0.5180095",
"0.5156805",
"0.51565313",
"0.51506966",
"0.51452816",
"0.51433",
"0.51351523",
"0.51302296",
"0.51290816",
"0.51247007",
"0.5122433",
"0.5120341",
"0.5117382",
"0.5114963",
"0.5112816",
"0.5112339",
"0.511123",
"0.51048917",
"0.5104886",
"0.50972325",
"0.50963414",
"0.5094961",
"0.5076724",
"0.5076577",
"0.5072773",
"0.50664955",
"0.50610816",
"0.5045354",
"0.5039656",
"0.50364983",
"0.5035857",
"0.5016526",
"0.50124866",
"0.49928993",
"0.4991225",
"0.4984681",
"0.49801213",
"0.49739036",
"0.4963678",
"0.496129",
"0.49576467",
"0.4945691",
"0.49426237",
"0.4939846",
"0.49370968",
"0.49316263",
"0.49291736",
"0.49289814",
"0.492553",
"0.49215668",
"0.4916955",
"0.49157444",
"0.49138486",
"0.49083352",
"0.48990595",
"0.48981544",
"0.48977473",
"0.48837745",
"0.48827806"
] |
0.6977585
|
0
|
PUT /mini_blogs/1 PUT /mini_blogs/1.xml
|
def update
@mini_blog = MiniBlog.find(params[:id])
respond_to do |format|
if @mini_blog.update_attributes(params[:mini_blog])
flash[:notice] = 'Mini-Blog actualizado exitosamente'
format.html { redirect_to(@mini_blog) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @blog = Blog.find_by_url(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(blogs_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @mini_blogs = MiniBlog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mini_blogs }\n end\n end",
"def update\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n flash[:notice] = 'Blog was successfully updated.'\n format.html { redirect_to(@blog) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n format.html { redirect_to(@blog, :notice => 'Blog was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n# @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n format.html { redirect_to @blog, :notice => 'Blogs was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @blog = Blog.find(params[:id])\r\n\r\n respond_to do |format|\r\n\t\t\tif @blog.update_attributes(params[:blog])\r\n flash[:notice] = 'Blog was successfully updated.'\r\n format.html { redirect_to(@blog) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n if @myblog.update_attributes(params[:myblog])\n format.html { redirect_to @myblog, notice: 'Myblog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @myblog = Myblog.find(params[:id])\n\n respond_to do |format|\n if @myblog.update_attributes(params[:myblog])\n format.html { redirect_to @myblog, notice: 'Myblog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog = Blog.friendly.find(params[:id])\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n #format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n #format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_post = @current_user.blogs.find(params[:id])\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n format.html { redirect_to :controller=>\"blog_posts\", :action => \"index\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n flash[:success] = 'Blog was successfully updated.'\n format.html { redirect_to blogs_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @blog = Blog.find(params[:id])\n\n if @blog.update_attributes(params[:blog])\n redirect_to @blog, notice: 'Blog was successfully updated.'\n else\n render action: \"edit\"\n render json: @blog.errors, status: :unprocessable_entity\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @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 rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def create\n @mini_blog = MiniBlog.new(params[:mini_blog])\n\n respond_to do |format|\n if @mini_blog.save\n flash[:notice] = \"Mini-Blog creado exitosamente\"\n format.html { redirect_to(@mini_blog) }\n format.xml { render :xml => @mini_blog, :status => :created, :location => @mini_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mini_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @moto_blog.update(moto_blog_params)\n format.html { redirect_to @moto_blog, notice: 'Moto Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @moto_blog }\n else\n format.html { render :edit }\n format.json { render json: @moto_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n \n respond_to do |format|\n if @incident.update_attributes(params[:incident]) \n format.html { redirect_to(@incident, :notice => 'Incident was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n \n #todo: may be required for events and sources as well...\n #todo: only create blogpost when reviewed == true, not just after any change\n if params[:incident][:create_blog] == \"1\"\n #if false\n # create blog entry\n b = Blogpost.new()\n id = @incident.id.to_s\n name = @incident.name\n b.header = \"New incident \" + \"<a href=\\\"http://www.osidb.org/incidents/\"+ id +\"\\\">\"+ \"OSIDB-ID: \" + id +\"</a> \" + name\n b.content = @incident.summary\n b.user_id = @incident.user_id\n b.save\n\n # create tweet\n @incident.tweet!\n end\n \n end",
"def update\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_blog = Admin::Blog.find(params[:id])\n\n respond_to do |format|\n if @admin_blog.update_attributes(params[:admin_blog])\n format.html { redirect_to admin_blogs_path, notice: I18n.t(\"flash.update_admin_blog\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog1.update(blog1_params)\n format.html { redirect_to @blog1, notice: \"Blog1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @blog1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blog1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @mini_blog = MiniBlog.find(params[:id])\n @mini_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to(mini_blogs_url) }\n format.xml { head :ok }\n end\n end",
"def update\n if @blog.update(blog_params)\n render json: @blog\n else\n render json: @blog.errors, status: :unprocessable_entity\n end\n end",
"def update\n @blog_entry = BlogEntry.find(params[:id])\n\n respond_to do |format|\n if @blog_entry.update_attributes(params[:blog_entry])\n flash[:notice] = 'BlogEntry was successfully updated.'\n format.html { redirect_to(@blog_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @mini_blog = MiniBlog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mini_blog }\n end\n end",
"def update\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n flash[:notice] = 'BlogPost was successfully updated.'\n format.html { redirect_to(@blog_post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format| \n if @spree_blog.update(spree_blog_params)\n format.html { redirect_to admin_blogs_path , notice: 'Blog Post was successfully updated.' }\n format.json { render action: 'index', status: :created, location: @spree_blog }\n else\n format.html { redirect_to edit_admin_blogs_path(@spree_blog), notice: \"#{@spree_blog.errors.full_messages.first}\" }\n format.json { render json: @spree_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @myblog.update(myblog_params)\n format.html { redirect_to @myblog, notice: 'Myblog was successfully updated.' }\n format.json { render :show, status: :ok, location: @myblog }\n else\n format.html { render :edit }\n format.json { render json: @myblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_post = BlogPost.find_by_slug!(params[:id])\n @blog_post.status = blog_status params\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n format.html { redirect_to([:admin, @blog_post], :notice => 'Blog post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @kevin_blog = KevinBlog.find(params[:id])\n\n respond_to do |format|\n if @kevin_blog.update_attributes(params[:kevin_blog])\n format.html { redirect_to @kevin_blog, notice: 'Kevin blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kevin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @news_blast = NewsBlast.find(params[:id])\n\n respond_to do |format|\n if @news_blast.update_attributes(params[:news_blast])\n format.html { redirect_to(@news_blast, :notice => 'News blast was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @news_blast.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n if params[:blog][:pins].present?\n @blog.pins.purge\n @blog.pins.attach(params[:blog][:pins])\n end\n\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog = Blog.find(params[:id])\n @blog.update_attributes(params[:blog])\n respond_with scoped_user, @blog\n end",
"def update\n respond_to do |format|\n if @siteblog.update(siteblog_params)\n format.html { redirect_to @siteblog, notice: 'Siteblog was successfully updated.' }\n format.json { render :show, status: :ok, location: @siteblog }\n else\n format.html { render :edit }\n format.json { render json: @siteblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(refined_blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @c_blog = CBlog.find(params[:id])\n\n respond_to do |format|\n if @c_blog.update_attributes(params[:c_blog])\n format.html { redirect_to @c_blog, notice: 'The blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @c_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n\n\n\n if @blog.update(blog_params)\n format.html { redirect_to blogs_path, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @office_blog.update(office_blog_params)\n format.html { redirect_to @office_blog, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @office_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_url = BlogUrl.find(params[:id])\n\n respond_to do |format|\n if @blog_url.update_attributes(params[:blog_url])\n format.html { redirect_to @blog_url, notice: 'Blog url was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bs_blog.update(bs_blog_params)\n format.html { redirect_to @bs_blog, notice: 'Bs blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @bs_blog }\n else\n format.html { render :edit }\n format.json { render json: @bs_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n if @weibo.update_attributes(params[:weibo])\n format.html { redirect_to @weibo, notice: 'Weibo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @weibo = Weibo.find(params[:id])\n\n respond_to do |format|\n if @weibo.update_attributes(params[:weibo])\n format.html { redirect_to @weibo, notice: 'Weibo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @weibo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: \"Blog was successfully updated.\" }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog.published_at = Time.now if params[:commit] == 'Publish now'\n respond_to do |format|\n if @blog.update(blog_page_params)\n format.html { redirect_to @blog, notice: \"Blog was successfully updated.\" }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @blogs = Blog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blogs }\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @user_blog = UserBlog.find(params[:id])\n\n respond_to do |format|\n if @user_blog.update_attributes(params[:user_blog])\n format.html { redirect_to \"/home/blog\", notice: '绑定成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_blog.update(my_blog_params)\n format.html { redirect_to @my_blog, notice: 'My blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_blog }\n else\n format.html { render :edit }\n format.json { render json: @my_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag_blog.update(tag_blog_params)\n format.html { redirect_to @tag_blog, notice: 'Tag blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_blog }\n else\n format.html { render :edit }\n format.json { render json: @tag_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blog = Blog.new(params[:blog])\n @blog.user_id = current_user.id\n @blog.rating = 0\n\n respond_to do |format|\n if @blog.save\n format.html { redirect_to(@blog, :notice => 'Blog was successfully created.') }\n format.xml { render :xml => @blog, :status => :created, :location => @blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_profile = BlogProfile.find(params[:id])\n\n respond_to do |format|\n if @blog_profile.update_attributes(params[:blog_profile])\n format.html { redirect_to(@blog_profile, :notice => 'Blog profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blog_profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@post, blog_post_params)\n end",
"def update\n @blog_category = BlogCategory.find(params[:id])\n\n respond_to do |format|\n if @blog_category.update_attributes(params[:blog_category])\n format.html { redirect_to([:admin, @blog_category], :notice => 'Blog category was successfully updated.') }\n # format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @blog_category.errors, :status => :unprocessable_entity }\n format.json { respond_with_bip(@blog_category) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: \"Blog item -- #{@blog.title} --was successfully updated\" }\n# format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n# format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @harsha_blog.update(harsha_blog_params)\n format.html { redirect_to @harsha_blog, notice: 'Harsha blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @harsha_blog }\n else\n format.html { render :edit }\n format.json { render json: @harsha_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update_external_blogs\n users = User.find(:all, :conditions=>'blog_feed is not null')\n users.each do |user| \n if user.blog_feed.length > 0\n BlogPost.update_from_feed(user.blog_feed, user.id)\n end\n end\n end",
"def update\n @mush_crawler = MushCrawler.find(params[:id])\n\n respond_to do |format|\n if @mush_crawler.update_attributes(params[:mush_crawler])\n flash[:notice] = 'MushCrawler was successfully updated.'\n format.html { redirect_to(@mush_crawler) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mush_crawler.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testblog.update(testblog_params)\n format.html { redirect_to @testblog, notice: 'Testblog was successfully updated.' }\n format.json { render :show, status: :ok, location: @testblog }\n else\n format.html { render :edit }\n format.json { render json: @testblog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def set_moto_blog\n @moto_blog = MotoBlog.find(params[:id])\n end",
"def update\n @family_blog = FamilyBlog.find(params[:id])\n\n respond_to do |format|\n if @family_blog.update_attributes(params[:family_blog])\n format.html { redirect_to @family_blog, notice: 'Family blog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog = Blog.find(params[:id])\n\n respond_to do |format|\n if @blog.update_attributes(params[:blog])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to blog_url(:id => @blog) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def set_blog1\n @blog1 = Blog1.find(params[:id])\n end",
"def update\n @blogpost = Blogpost.find(params[:id])\n\n respond_to do |format|\n if @blogpost.update_attributes(params[:blogpost])\n format.html { redirect_to @blogpost, notice: 'Blogpost was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blogpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to users_blog_index_path, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n format.html { redirect_to blog_posts_url, :notice => 'Blog post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @blog_post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_blog = PersonalBlog.new(params[:personal_blog])\n @personal_blog.feed = @personal_blog.feed.gsub(/^feed/, 'http')\n\n respond_to do |format|\n if @personal_blog.save\n format.html { redirect_to(@personal_blog) }\n format.xml { render :xml => @personal_blog, :status => :created, :location => @personal_blog }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @personal_blog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n blog_post_updater = BlogPostUpdater.new(self)\n blog_post_updater.update(params)\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 respond_to do |format|\n if @blog.update(blog_params)\n format.html { redirect_to [:admins, @blog], notice: 'ブログを編集しました。' }\n format.json { render :show, status: :ok, location: @blog }\n else\n format.html { render :edit }\n format.json { render json: @blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blogcr = Blogcr.find(params[:id])\n\n respond_to do |format|\n if @blogcr.update_attributes(params[:blogcr])\n format.html { redirect_to @blogcr, notice: 'Blogcr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blogcr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @blog.update(blog_params)\n\t\t\t\tformat.html { redirect_to @blog, notice: 'Blog was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @blog }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @blog.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @second_blog.update(second_blog_params)\n format.html { redirect_to @second_blog, notice: 'Second blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @second_blog }\n else\n format.html { render :edit }\n format.json { render json: @second_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @watercolor_blog.update(watercolor_blog_params)\n format.html { redirect_to @watercolor_blog, notice: \"Watercolor blog was successfully updated.\" }\n format.json { render :show, status: :ok, location: @watercolor_blog }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @watercolor_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @blog_post = BlogPost.find(params[:id])\n\n respond_to do |format|\n if @blog_post.update(blog_post_params)\n format.html { redirect_to @blog_post, notice: 'Blog post was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog_post.errors, status: :unprocessable_entity }\n format.xml { render xml: @blog_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @blog_post.update_attributes(params[:blog_post])\n format.html { redirect_to @blog_post, notice: 'Blog post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blog_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entrada = @mini_blog.entradas.find(params[:id])\n\n respond_to do |format|\n if @entrada.update_attributes(params[:entrada])\n flash[:notice] = 'Entrada actualizada exitosamente'\n format.html { redirect_to([@mini_blog, @entrada]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entrada.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def update_space_webapi(slug, body, headers=default_headers)\n @logger.info(\"Updating the \\\"#{slug}\\\" Web API on the Space.\")\n put(\"#{@api_url}/webApis/#{slug}\", body, headers)\n end",
"def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end",
"def update\n respond_to do |format|\n if @user_blog_info.update(user_blog_info_params)\n format.html { redirect_to @user_blog_info, notice: 'User blog info was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_blog_info }\n else\n format.html { render :edit }\n format.json { render json: @user_blog_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_blog.update(admin_blog_params)\n format.html { redirect_to @admin_blog, notice: 'Blog was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_blog }\n else\n format.html { render :edit }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end",
"def set_blog\n @blog = Blog.find(params[:id])\n end"
] |
[
"0.59715545",
"0.5907054",
"0.5874204",
"0.58332056",
"0.5816163",
"0.5801453",
"0.578742",
"0.5777944",
"0.5777944",
"0.57766056",
"0.5773019",
"0.5724527",
"0.566851",
"0.5627786",
"0.56163806",
"0.56160504",
"0.56120396",
"0.5584735",
"0.55616367",
"0.55095285",
"0.54978055",
"0.5484209",
"0.54700834",
"0.5468485",
"0.5440602",
"0.5439175",
"0.54241794",
"0.54076463",
"0.5402535",
"0.5392572",
"0.5379439",
"0.53758",
"0.5354631",
"0.534873",
"0.5343665",
"0.53282857",
"0.53216684",
"0.528606",
"0.52859277",
"0.5285119",
"0.5281958",
"0.5280916",
"0.52784634",
"0.52784634",
"0.5270303",
"0.5264978",
"0.5263206",
"0.5261095",
"0.52516097",
"0.5249476",
"0.5238052",
"0.52349836",
"0.5234737",
"0.5234737",
"0.5234737",
"0.5233647",
"0.52302337",
"0.52214485",
"0.521761",
"0.5211732",
"0.5211574",
"0.5209795",
"0.5209196",
"0.52086735",
"0.52050966",
"0.5204511",
"0.51952595",
"0.5174275",
"0.5171824",
"0.5170213",
"0.5170162",
"0.51547235",
"0.51499784",
"0.5147013",
"0.5141565",
"0.5141512",
"0.51388603",
"0.51281464",
"0.5115411",
"0.51133674",
"0.5112348",
"0.51121914",
"0.51002234",
"0.5094974",
"0.50865793",
"0.50844073",
"0.50827867",
"0.5080343",
"0.5080207",
"0.5080207",
"0.50795174",
"0.5070269",
"0.50642264",
"0.5063356",
"0.5062612",
"0.5062612",
"0.5062612",
"0.5062612",
"0.5062612",
"0.5062612"
] |
0.67778814
|
0
|
DELETE /mini_blogs/1 DELETE /mini_blogs/1.xml
|
def destroy
@mini_blog = MiniBlog.find(params[:id])
@mini_blog.destroy
respond_to do |format|
format.html { redirect_to(mini_blogs_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @blogger = Blogger.find(params[:id])\n @blogger.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_bloggers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @blog = Blog.find(params[:id])\r\n @blog.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(blogs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to(blogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to(blogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n format.html { redirect_to myblogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myblog = Myblog.find(params[:id])\n @myblog.destroy\n\n respond_to do |format|\n format.html { redirect_to myblogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @blog_post = @current_user.blogs.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog_entry = BlogEntry.find(params[:id])\n @blog_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entrada = @mini_blog.entradas.find(params[:id])\n @entrada.destroy\n\n respond_to do |format|\n format.html { redirect_to(mini_blog_path(@mini_blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog.destroy\n \n flash[:success] = \"Successfully deleted blog.\"\n \n respond_to do |format|\n format.html { redirect_to blogs_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @myblog.destroy\n respond_to do |format|\n format.html { redirect_to myblogs_url, notice: 'Myblog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog = Blog.friendly.find(params[:id])\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Entry was deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spree_blog.destroy\n respond_to do |format|\n format.html { redirect_to admin_blogs_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_post = BlogPost.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog_post = BlogPost.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_blast = NewsBlast.find(params[:id])\n @news_blast.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_blasts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog = Blog.find_by_url(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @c_blog = CBlog.find(params[:id])\n @c_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to c_blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @blog = Blog.find(params[:id])\n @blog.destroy\n\n redirect_to blogs_url\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 @blog1.destroy\n respond_to do |format|\n format.html { redirect_to blog1s_url, notice: \"Blog1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog = Blog.find(params[:id])\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @office_blog.destroy\n respond_to do |format|\n format.html { redirect_to office_blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @blog.destroy\n\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moto_blog.destroy\n respond_to do |format|\n format.html { redirect_to moto_blogs_url, notice: 'Moto Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kevin_blog = KevinBlog.find(params[:id])\n @kevin_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to kevin_blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @harsha_blog.destroy\n respond_to do |format|\n format.html { redirect_to harsha_blogs_url, notice: 'Harsha blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mush_crawler = MushCrawler.find(params[:id])\n @mush_crawler.destroy\n\n respond_to do |format|\n format.html { redirect_to(mush_crawlers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n\t b = Blog.find(params[:id])\n\t b.taggings.each do |t|\n\t\t if (t.tag.taggings.count == 1)\n\t\t\t t.tag.destroy\n\t\t end\n\t end\n Blog.find(params[:id]).destroy\n flash[:sucess] = \"Blog deleted.\"\n redirect_to life_index_path\n end",
"def destroy\n @blog_profile = BlogProfile.find(params[:id])\n @blog_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @bs_blog.destroy\n respond_to do |format|\n format.html { redirect_to bs_blogs_url, notice: 'Bs blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to cms_blog_pages_path, notice: \"Blog was successfully removed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_blog = UserBlog.find(params[:id])\n @user_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to user_blogs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @family_blog = FamilyBlog.find(params[:id])\n @family_blog.destroy\n\n respond_to do |format|\n format.html { redirect_to family_blogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_url = BlogUrl.find(params[:id])\n @blog_url.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_urls_url }\n format.json { head :no_content }\n end\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 destroy\n @siteblog.destroy\n respond_to do |format|\n format.html { redirect_to siteblogs_url, notice: 'Siteblog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blogcr = Blogcr.find(params[:id])\n @blogcr.destroy\n\n respond_to do |format|\n format.html { redirect_to blogcrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to admin_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id], :include => :blog)\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_blog_posts_url(@post.blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_blog.destroy\n respond_to do |format|\n format.html { redirect_to admin_blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_blog.destroy\n respond_to do |format|\n format.html { redirect_to my_blogs_url, notice: 'My blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog_post = BlogPost.find(params[:id])\n @blog_post.destroy\n\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @photo_blog.destroy\n respond_to do |format|\n format.html { redirect_to photo_blogs_url }\n format.json { head :no_content }\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @blog.destroy\n flash.notice = 'ブログを削除しました。'\n redirect_to :admins_blogs\n end",
"def destroy\n @changelog = Changelog.find(params[:id])\n @changelog.destroy\n\n respond_to do |format|\n format.html { redirect_to(changelogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_blog = Admin::Blog.find(params[:id])\n\n respond_to do |format|\n if @admin_blog.update_attributes(deleted_at: Time.now())\n format.html { redirect_to admin_blogs_path, notice: I18n.t(\"flash.destroy_admin_blog\") }\n format.json { head :no_content }\n else\n format.html { render action: \"destroy\" }\n format.json { render json: @admin_blog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @news_update = NewsUpdate.find(params[:id])\n @news_update.destroy\n\n respond_to do |format|\n format.html { redirect_to(news_updates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testblog.destroy\n respond_to do |format|\n format.html { redirect_to testblogs_url, notice: 'Testblog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: \"Blog item -- #{@blog.title} --was successfully destroyed\"}\n format.json { head :no_content } # json calls are inserted by the scaffold to support api calls, should you want them.\n end\n end",
"def destroy\n @update = Update.find_by_permalink(params[:id])\n @update.destroy\n\n respond_to do |format|\n format.html { redirect_to(updates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blogpost = Blogpost.find(params[:id])\n @blogpost.destroy\n\n respond_to do |format|\n format.html { redirect_to blogfeed_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @update_log = UpdateLog.find(params[:id])\n @update_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(update_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog.destroy\n redirect_to me_user_blogs_path(current_user), notice: 'Blog was successfully deleted.'\n end",
"def destroy\n @forum_cat_l1 = ForumCatL1.find(params[:id])\n @forum_cat_l1.destroy\n\n respond_to do |format|\n format.html { redirect_to(forum_cat_l1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(dlogs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog.destroy\n flash[:success] = t('blog.post_supprimer')\n redirect_to blogs_url\n end",
"def destroy\n @second_blog.destroy\n respond_to do |format|\n format.html { redirect_to second_blogs_url, notice: 'Second blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @helibase = Helibase.find(params[:id])\n @helibase.destroy\n\n respond_to do |format|\n format.html { redirect_to(helibases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n @post.save\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n make_rss\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to blogs_url, notice: \"Blog was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @b_log = BLog.find(params[:id])\n @b_log.destroy\n\n respond_to do |format|\n format.html { redirect_to b_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metabolite = Metabolite.find(params[:id])\n @metabolite.destroy\n\n respond_to do |format|\n format.html { redirect_to(metabolites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog_link.destroy\n respond_to do |format|\n format.html { redirect_to blog_links_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @watercolor_blog.destroy\n respond_to do |format|\n format.html { redirect_to watercolor_blogs_url, notice: \"Watercolor blog was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recycling_site = RecyclingSite.find(params[:id])\n @recycling_site.destroy\n\n respond_to do |format|\n format.html { redirect_to(recycling_sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tag_blog.destroy\n respond_to do |format|\n format.html { redirect_to tag_blogs_url, notice: 'Tag blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entrada_blog.destroy\n respond_to do |format|\n format.html { redirect_to entrada_blogs_url, notice: 'Entrada blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with @blog.destroy\n head :no_content\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n @blog_post.destroy\n end",
"def destroy\n @rssnew = Rssnews.find(params[:id])\n @rssnew.destroy\n\n respond_to do |format|\n format.html { redirect_to(rssnews_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site_banner = SiteBanner.find(params[:id])\n @site_banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_banners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @blog.destroy\n respond_to do |format|\n format.html { redirect_to users_blog_index_path, notice: 'Blog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_post = @club.small_posts.find(params[:id])\n @small_post.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_club_large_posts_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.68957335",
"0.6853874",
"0.684108",
"0.684108",
"0.6751144",
"0.6751144",
"0.66002786",
"0.6552462",
"0.6514873",
"0.64637816",
"0.6446654",
"0.64075494",
"0.6404979",
"0.6397588",
"0.6364859",
"0.63308936",
"0.63308936",
"0.633009",
"0.63214064",
"0.6317189",
"0.6311259",
"0.6285664",
"0.62647885",
"0.6262517",
"0.6236042",
"0.62164587",
"0.61796683",
"0.61792606",
"0.61407155",
"0.61407155",
"0.61365485",
"0.61347723",
"0.6128874",
"0.6116471",
"0.6115054",
"0.6108189",
"0.6101722",
"0.6098736",
"0.6092989",
"0.60812944",
"0.60763663",
"0.60728204",
"0.6061927",
"0.6045483",
"0.6044706",
"0.60419893",
"0.60378355",
"0.6032043",
"0.6030126",
"0.60255504",
"0.6024628",
"0.602244",
"0.60089415",
"0.60088485",
"0.59960437",
"0.59960437",
"0.5994101",
"0.59935665",
"0.59932786",
"0.5993089",
"0.5990549",
"0.5989147",
"0.5984226",
"0.5982767",
"0.59797126",
"0.5978257",
"0.5977472",
"0.59676665",
"0.5964047",
"0.5963759",
"0.5953251",
"0.5952761",
"0.594535",
"0.5942459",
"0.59329104",
"0.59276485",
"0.5927628",
"0.59257823",
"0.59257823",
"0.59257823",
"0.59257823",
"0.59257823",
"0.59257823",
"0.59177524",
"0.5915587",
"0.5894693",
"0.58906424",
"0.5888132",
"0.5872679",
"0.58704734",
"0.5869865",
"0.5861194",
"0.58577365",
"0.58574957",
"0.58564794",
"0.58449835",
"0.5831259",
"0.5826637",
"0.5826544",
"0.58214897"
] |
0.75205654
|
0
|
write the getter for us def name
|
def initialize(name)
@name = name
@accounts = {} # Initialize accounts as an empty hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end",
"def name() end",
"def name # getter method (or reader method)\n @name\n end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] |
[
"0.79177445",
"0.7741643",
"0.7543874",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567",
"0.7539567"
] |
0.0
|
-1
|
, on: :create makes sure password is present, confirmed and 6 to 20 characters
|
def password=(unencrypted_password) #setter method for password.
unless unencrypted_password.empty? #if there is no password, take the inputed password, salt and hash it. Then set it in the record for that user.
@password = unencrypted_password
self.password_digest = BCrypt::Password.create(unencrypted_password)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_on_create\n\t\t#puts \"--- ENTRANDO A VALIDATE ON CREATE ----- password, password_confirmation : #{self.password}, #{password_confirmation}\" \n\t\terrors.add('contraseña','no puede estar en blanco') unless !self.password.blank?\n\t\terrors.add('confirmación','no puede estar en blanco') unless !self.password_confirmation.blank?\t\t\t\t\t\n\tend",
"def before_create\n\t\tself.password = Hospede.hash_password(self.password)\n\tend",
"def generate_password\n if new_record?\n self.password = self.password_confirmation = /\\w{0,10}/.gen unless password\n end\n end",
"def validate_create_user(params)\n params[\"username\"].length < 25 and params[\"password\"].length < 25\n end",
"def password_required?; end",
"def valid_password?; end",
"def test_valid_length_password \n user = User.new(:login => \"abder\", :email => \"abder.rahman.ali@gmail.com\", :password_confirmation => \"aa\")\n \n\t user.password = \"aaaaa\"\n\t assert user.valid?\n end",
"def test_invalid_length_password\n\t user = User.new(:login => \"abder\", :email => \"abder.rahman.ali@gmail.com\", :password_confirmation => \"aa\")\n\t \n\t user.password = \"aa\"\n\t assert !user.valid?\n\t assert_equal \"The password must be at least 4-characters long\", user.errors.on(:password)\n\t \n\t user.password = \"aaa\"\n\t assert !user.valid?\n\t assert_equal \"The password must be at least 4-characters long\", user.errots.on(:password)\n end",
"def create_new_password\n pass = generate_password\n set_password(pass)\n pass\n end",
"def generate_password\n self.password = SecureRandom.urlsafe_base64(10)\n self.password_confirmation = self.password\n end",
"def validate_on_update\n unless plain_password.blank?\n unless plain_password == password_confirmation\n errors.add_to_base(\"Passwords don't match\")\n end\n # Validate password criteria\n unless plain_password.length >= 6\n errors.add_to_base(\"Password must be at least 6 characters long.\")\n end\n end\n end",
"def validate_on_update\n unless plain_password.blank?\n unless plain_password == password_confirmation\n errors.add_to_base(\"Passwords don't match\")\n end\n # Validate password criteria\n unless plain_password.length >= 6\n errors.add_to_base(\"Password must be at least 6 characters long.\")\n end\n end\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\nend",
"def password_required?; false; end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def password_required?\n super if confirmed?\n end",
"def generate_password!(model:, **)\n model.password = SecureRandom.urlsafe_base64(8)\n end",
"def check_create_user_password_is_valid\n return self.password != \"\" ? true : false\n end",
"def validate_new_password\n if new_record? and self.read_attribute(:crypted_password).to_s.blank? and !@password_updated\n errors.add :password, :blank\n elsif @password_updated\n if @password.to_s.size < 4\n errors.add :password, :invalid_password\n elsif @password.to_s != @password_confirmation.to_s\n errors.add :password, :no_match_password\n end\n end\n end",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def new_password(data)\n data.strip!\n unless data =~ /^\\w{6,20}$/\n ask_password\n return\n end\n @display.echo_on\n @new_password = data\n ask_color\n end",
"def strong_password\n /^(?=.*\\d)(?=.*[a-z])(?=.*[\\W_]).{6,}$/i\n end",
"def password_required?\n confirmed? ? super : false\n end",
"def password_required?\n confirmed? ? super : false\n end",
"def password_change_new\n\n end",
"def generate_password\n if password_confirmation.nil?\n self.password = Devise.friendly_token.first(8)\n end\n end",
"def create_password\n self.uuid = TempPassword.get_uuid\n self.hashed_uuid = Digest::SHA1.hexdigest(uuid)\n end",
"def valid_password?(password); end",
"def clean_up_passwords; end",
"def new_password; nil; end",
"def after_create\n @password = nil\n @confirm_password = nil\n end",
"def validate_password(new_password)\n new_password.is_a?(String) && new_password.length >= 6 && new_password =~ /\\d/\n end",
"def validate_password(new_password)\n new_password.is_a?(String) && new_password.length >= 6 && new_password =~ /\\d/\n end",
"def password_strength\n minimum_length = 8\n # Regex matches at least one lower case letter, one uppercase and one digit\n complexity_regex = /\\A(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/\n # When a user is updated but not its password, the password param is nil\n if password.present? &&\n (password.length < minimum_length || !password.match(complexity_regex))\n errors.add :password, :weak_password\n end\n end",
"def password_required?\n new_record? ? super : false\n end",
"def password_required?\n new_record? ? super : false\n end",
"def needs_password?\n self.new_record? || !self.password.blank?\n end",
"def needs_password?\n self.new_record? || !self.password.blank?\n end",
"def password_field; end",
"def after_create\n @password = nil\n end",
"def after_create\n @password = nil\n end",
"def password_required?\n self.new_record? or !self.password.nil?\n end",
"def generate_new_password\n chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'\n password = ''\n 10.times { password << chars[rand(chars.size)] }\n self.update_attributes(:encrypted_password => User.encrypt(password, self.salt))\n UserMailer.deliver_forgot_password_mail(self, password)\n password\n end",
"def require_password?(action)\n action == \"new\" ? true : false\n end",
"def password_required?\n\n ( new_record? && meetup_uid.nil? ) || !password.nil? || !password_confirmation.nil?\n end",
"def password_required?\n if new_record?\n !(password.blank? && password_confirmation.blank?)\n else\n super\n end\n end",
"def generate_and_send_new_password\n new_password = \"\"\n chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#,.;:?%&\".split(//)\n (0..8).each do |i|\n new_password += chars.at(rand(chars.length))\n end\n self.update_attributes(:password => new_password)\n save!\n AdminMailer.password_reset(self, new_password).deliver\n new_password\n end",
"def validate_before_create\n self.errors.clear\n \n if @password.blank?\n self.errors.add :password, \"can't be blank\"\n else\n self.errors.add :password, \"must be between 6 and 32 characters\" unless (6..32).include?(@password.length)\n self.errors.add :password, \"can't be the same as your username\" if @password == self.username\n self.errors.add :password, \"can't contain spaces\" if @password =~ /\\s/\n end\n\n if @password != @password_confirm\n self.errors.add :password, \"the password and confirmation provided do not match\"\n end\n \n if @question.blank?\n self.errors.add :question, \"can't be blank\"\n else\n self.errors.add :question, \"can't exceed 256 characters\" if @question.length > 256\n end\n \n if @answer.blank?\n self.errors.add :answer, \"can't be blank\" if @answer.blank?\n else\n self.errors.add :answer, \"can't exceed 256 characters\" if @answer.length > 256\n end\n \n # Catch empty inputs when creating a non-member account\n if self.client.blank?\n self.errors.add :name_first, \"can't be blank\" if self.name_first.blank?\n self.errors.add :name_first, \"can't exceed 32 characters\" if self.name_first && self.name_first.length > 32\n \n self.errors.add :name_last, \"can't be blank\" if self.name_last.blank?\n self.errors.add :name_last, \"can't exceed 32 characters\" if self.name_last && self.name_last.length > 32\n end\n end",
"def create_password_on_update\n if !@password.blank?\n self.salt = User.make_salt(self.username) if self.salt.blank?\n self.hashed_password = User.hash_with_salt(@password, self.salt)\n end\n end",
"def ensure_password\n self.password ||= Devise.friendly_token[0,20]\n end",
"def password_required?\n new_record? ? false : super\n end",
"def password_required?\n new_record? ? false : super\n end",
"def password_required?\n new_record? ? false : super\n end",
"def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end",
"def password_required?\n confirmed? && (!password.blank?)\n end",
"def random_password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n password = ''\n 40.times { |i| password << chars[rand(chars.size-1)] }\n self.password = password\n self.password_confirmation = password\n self\n end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def test_assert_that_password_with_5_chars_is_invalid\n\t\tpassword = \"hTi\"\n\t\tassert_equal(\"invalid\", set_up_password(password))\n\tend",
"def password\n\n end",
"def send_on_create_confirmation_instructions; end",
"def send_on_create_confirmation_instructions; end",
"def password_required?\n # new_record? ? false : super\n false\n end",
"def generate_password\n self.password = Devise.friendly_token.first(8)\n end",
"def validate_password?\n new_record? || password.present? || password_confirmation.present?\n end",
"def test_valid_length_email \n user = User.new(:login => \"abder\", :password => \"aaaaa\", :password_confirmation => \"aaaaa\")\n \n\t user.email = \"abder.rahman.ali@gmail.com\"\n\t assert user.valid?\n end",
"def password\n end",
"def password\n end",
"def random_password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n password = ''\n #40.times { |i| password << chars[rand(chars.size-1)] }\n 15.times { |i| password << chars[rand(chars.size-1)] }\n self.password = password\n self.password_confirmation = password\n self.pwd = password\n self\n end",
"def validate_password? \n self.new_record? && self.staff?\n end",
"def password_complexity\n if password.present? and not password.match(/\\A(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*/)\n errors.add :password, I18n.t('weak_password')\n end\n end",
"def create\n\n generate_password = Devise.friendly_token.first(8)\n\n if params[:user][:password].blank? && params[:user][:password_confirmation].blank?\n params[:user][:password] = generate_password\n params[:user][:password_confirmation] = generate_password\n end\n @user = User.new(user_params)\n\n puts \"################################################################################\"\n puts \"################################################################################\"\n puts \"################################################################################\"\n puts generate_password\n puts \"################################################################################\"\n puts \"################################################################################\"\n puts \"################################################################################\"\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to admin_users_path, notice: \"Cliente (#{@user.name}), foi cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: [:admin, @user] }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_password_contents\n if /[a-zA-Z]+/.match(@password) && /\\d+/.match(@password) && /[[:punct:]]/.match(@password)\n else\n generate\n end\n end",
"def password_required?\n (!password.blank? && !password_confirmation.blank?) || new_record?\n end",
"def password_required?\n (!password.blank? && !password_confirmation.blank?) || new_record?\n end",
"def password_required?\n if new_record? && oauth_account\n false\n else\n super\n end\n end",
"def input(user_id, password)\n if user_id == password\n 'Password and username cannot be the same'\n elsif user_id.length <= 6 && password.length <= 6\n 'Password and username must be at least six characters long'\n end\nend",
"def validate_password_length\n if @password.present? && @password.length < MIN_PASSWORD_LENGTH\n errors.add(:password, \"must be at least #{MIN_PASSWORD_LENGTH} characters\")\n end\n end",
"def password_required? \n false \n end",
"def password_required?\n new? or password\n end",
"def generate_password\n self.password = \"1234\"\n end",
"def insert_dummy_password_if_blank\n # if the fields are blank AND the record exists... (use find rather than new_record to be SURE)\n if password.blank? && password_confirmation.blank? && id && User.find(id)\n self.password = DUMMY_PASSWORD\n self.password_confirmation = password\n end\n end",
"def confirm_new_password_field()\n\t\t# unit_test_no_generate: confirm_new_password_field, input.className(create_ats_regex_string(\"ats-confirmpwdfield\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(input.className(create_ats_regex_string(\"ats-confirmpwdfield\")), __method__)\n\tend",
"def new_user_password(username)\n password = @prompt.mask('Password >')\n raise RequirementError.new, 'Requirements not met' if password.match?(/[!@#$%^&*(),.?\":{}|<>]/)\n\n @user = User.new(username, password, gen_uid)\n @user_playlist = Playlist.new(@user)\n store_user\n rescue RequirementError\n puts 'Password cannot contain special characters. Please try again!'.colorize(:light_red)\n end",
"def user_long_enough(user)\n if user.length <= 6 && user.length <= 6\n 'Sorry, username and password must be at least 6 characters.'\n else\n 'Yay, username and password are at least 6 characters.'\n end\nend",
"def create\n super\n resource.update(password: params[:password], password_confirmation: params[:password_confirmation], member_id: SecureRandom.alphanumeric(6))\n post_gmo_with_create_member(resource)\n end",
"def requires_password?\n is_new = (respond_to?(:new_record?) && new_record?)\n is_new || !ZeroAuth::Utils.empty?(password)\n end",
"def test_valid_length_login\t \n user = User.new(:email => \"abder.rahman.ali@gmail.com\", :password => \"aaaaa\", :password_confirmation => \"aaaaa\")\n \n\t user.login = \"aaa\"\n\t assert user.valid?\n end",
"def password_required?\n super && uid.blank?\n end"
] |
[
"0.707499",
"0.7041856",
"0.7013879",
"0.69517136",
"0.68391645",
"0.6764066",
"0.66373885",
"0.6614064",
"0.6549531",
"0.65397495",
"0.65289646",
"0.6524361",
"0.6519417",
"0.6519417",
"0.6519417",
"0.6519417",
"0.6519417",
"0.6519417",
"0.6517804",
"0.64795953",
"0.6470556",
"0.6470556",
"0.6470556",
"0.6425811",
"0.63954216",
"0.63843185",
"0.63814735",
"0.63814735",
"0.63561434",
"0.6340375",
"0.63292736",
"0.6315577",
"0.6291823",
"0.6276018",
"0.6273697",
"0.62568927",
"0.6255651",
"0.6251771",
"0.62449616",
"0.6241676",
"0.6241676",
"0.62373084",
"0.6230332",
"0.6230332",
"0.62279254",
"0.62279254",
"0.622562",
"0.6218571",
"0.6218571",
"0.6208347",
"0.6197602",
"0.61962616",
"0.6191936",
"0.6187549",
"0.617669",
"0.61718863",
"0.6168909",
"0.6158297",
"0.61579055",
"0.61579055",
"0.61579055",
"0.6155968",
"0.61547613",
"0.615092",
"0.61405724",
"0.61405724",
"0.61405724",
"0.61405724",
"0.61405724",
"0.61405724",
"0.61396605",
"0.61349785",
"0.61327946",
"0.61327946",
"0.6132282",
"0.613113",
"0.61165935",
"0.6107668",
"0.6104027",
"0.6104027",
"0.61005753",
"0.60838336",
"0.606825",
"0.6067179",
"0.6066068",
"0.60606134",
"0.60606134",
"0.6052036",
"0.6041789",
"0.6034466",
"0.603363",
"0.6030914",
"0.6023219",
"0.60229737",
"0.60228825",
"0.6022521",
"0.60210663",
"0.60003936",
"0.59973955",
"0.5995857",
"0.59934354"
] |
0.0
|
-1
|
Initialize and run walker
|
def initialize(root, block)
@root, @block = root, block
dispatch(root)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(folder_walker)\n\t\t@folder_walker = folder_walker\n\tend",
"def walk; end",
"def run\n\t\t\t@walker.run do\n\t\t\t\tself.update\n\t\t\t\t\n\t\t\t\tyield @walker if block_given?\n\t\t\tend\n\t\tend",
"def walk(&block)\n instance_eval(&block)\nend",
"def set_walker\n @walker = Walker.find(params[:id])\n end",
"def walk\n \t\tputs \"Walking...\"\n \tend",
"def set_walker\n @walker = Walker.find(params[:id])\n end",
"def initialize(p_args)\n\n\t\t\t# Scan path (where to start the file search from)\n\t\t\t@scan_path = p_args[:path]\n\n\t\t\t# Scan extension (only look at files with the given extension),\n\t\t\t# e.g. \".mp3\", \".jpg\" and so on\n\t\t\t@scan_extension = p_args[:extension]\n\n # How many files are scanned per folder (default is 1 -- fastest)\n @scan_depth = p_args[:depth] || 1\n\n # A cache containing folders which have been scanned\n @scan_history = {}\n\t\tend",
"def initialize(loom, depth, &blk)\n @depth = depth\n super() do |*args|\n self.class.start(loom, *args, &blk)\n end\n end",
"def initialize\n @dir_cases = nil\n @dir_results = nil\n @tidy = TidyExe.new\n end",
"def initialize(*args, &block)\n @options = _init_options(args.last.is_a?(Hash) ? args.pop : {})\n @directories = args.flatten.map { |path| Pathname.new(path).realpath }\n @changes = []\n @block = block\n _init_debug\n end",
"def initialize_pipetree!\n heritage.record :initialize_pipetree!\n\n self[\"pipetree\"] = Railway.new\n\n strut = ->(last, input, options) { [last, Instantiate.(input, options)] } # first step in pipe.\n self[\"pipetree\"].add(Railway::Right, strut, name: \"operation.new\") # DISCUSS: using pipe API directly here. clever?\n end",
"def initialize dir = nil # yield loader, o\n @root = (dir && Pathname(dir)) || ROOT\n @logs = @root + LOGS\n \n CliConfig::DIR_CONFIG.unshift @root\n @conf = CliConfig.new\n @conf[:plugins_path] = [@root + PLUGINS, SYSTEM_PLUGINS]\n @conf.load do |o|\n yield self, o if block_given?\n o.on('-I DIR', 'Include DIR in search for plugins.') {|i|\n @conf[:plugins_path] << Pathname.new(i) if File.directory?(i)\n }\n o.on('--plugins-path', 'Print all searchable directories.') {\n print_plugins_path\n exit EX_OK\n }\n end\n \n print_env\n FileUtils.mkdir_p [@conf[:plugins_path], @logs]\n end",
"def initialize\n @findings = []\n @handler = VerifyCommandHandler.new\n end",
"def walk(path); end",
"def initialize_pipetree!\n heritage.record :initialize_pipetree!\n self[\"pipetree\"] = ::Pipetree::Flow.new\n end",
"def initialize(dir=nil, expression=\".*\")\r\n @sleepTime = 5\r\n @priority = 0\r\n @stopWhen = nil\r\n\r\n @directories = Array.new()\r\n @files = Array.new()\r\n\r\n @foundFiles = nil\r\n @firstLoad = true\r\n @watchThread = nil\r\n \r\n initializeState()\r\n\r\n if dir then\r\n addDirectory(dir, expression)\r\n end\r\n end",
"def start(options={},&block)\n @stdout = options[:stdout] || $stdout\n @stderr = options[:stdout] || @stdout\n @stdin = options[:stdin] || $stdin\n while line = @stdin == $stdin ? Readline.readline(\"> \", true) : @stdin.gets \n line.strip!\n next if line.length==0\n parse_tree_node = parser.parse line\n if parse_tree_node\n evaluate parse_tree_node, &block\n else\n errputs parser.parser_failure_info :verbose => true\n end\n end\n end",
"def setup\n @root = Tree::TreeNode.new(\"ROOT\", \"Root Node\")\n\n @child1 = Tree::TreeNode.new(\"Child1\", \"Child Node 1\")\n @child2 = Tree::TreeNode.new(\"Child2\", \"Child Node 2\")\n @child3 = Tree::TreeNode.new(\"Child3\", \"Child Node 3\")\n @child4 = Tree::TreeNode.new(\"Child4\", \"Grand Child 1\")\n @child5 = Tree::TreeNode.new(\"Child5\", \"Child Node 4\")\n\n end",
"def initialize(settings={}, &block)\n @format = nil\n @autopath = nil\n @chdir = nil\n @files = []\n @tags = []\n @match = []\n @units = []\n @requires = []\n @loadpath = []\n\n #apply_environment\n\n apply(settings)\n\n # save for lazy execution\n @block = block\n end",
"def initialize(file_parser)\n @file_parser = file_parser\n @sub_commands = @file_parser.runnable_methods.map { |m| m.name.to_s }\n @sub_commands_text = @file_parser.runnable_methods.map do |m|\n [\n m.name.to_s,\n FileParser.select_runnable_tags(m).map(&:text).join(\"\\n\")\n ]\n end.to_h\n @parser = Optimist::Parser.new\n @parser.opt(:debug, 'Run in debug mode.', type: :flag)\n @parser.stop_on @sub_commands\n @initialize_method = nil\n end",
"def initialize(code)\n @code = code\n @root = Tree::TreeNode.new(\"root\", nil)\n @walker = PlsqlWalker.new(@code)\n @level = 0\n @current_parent = @root\n @begin_level = 0\n register_spots()\n @walker.walk\n rescue Exception => e\n # be prepare for any nasting parse error.\n # Failing here is kind of usual, having in mind\n # that we often parse incomplete code.\n Vorax.debug(e.to_s)\n Vorax.debug(e.backtrace)\n end",
"def init\n return if @initialized\n\n # Fill start places with tokens to let the process start\n put_token(start_place)\n start_place[:enabled] = true\n\n # Terminators are used to identify which transitions can be executed\n @terminators = {}\n @net.places.select(&:start?).each do |start_place|\n outgoing_transitions(start_place).each do |transition|\n (@terminators[transition] ||= []) << start_place\n end\n end\n\n # Without weights assigned transition execution path search won't work\n PetriTester::DistanceWeightIndexator.new(@net).reindex\n\n @initialized = true\n execute_automated!\n end",
"def initialize(*args, &block)\n @options = _init_options(args.last.is_a?(Hash) ? args.pop : {})\n @directories = args.flatten.map { |path| Pathname.new(path).realpath }\n @changes = []\n @block = block\n @registry = Celluloid::Registry.new\n _init_debug\n end",
"def initialize(settings={}, &block)\n @parent = settings[:parent]\n @subject = settings[:subject]\n @label = settings[:label]\n @tags = settings[:tags]\n #@skips = settings[:skips]\n #@hooks = settings[:hooks]\n\n if @parent\n @hooks = parent.hooks.clone\n @skips = parent.skips.clone\n @omits = parent.omits.clone\n else\n @hooks = Hooks.new\n @skips = []\n @omits = []\n end\n\n @specs = []\n\n @scope = Scope.new(self)\n\n evaluate(&block)\n end",
"def setup\n t = Thread.new { build_directories_records }\n @adapter = initialize_adapter\n t.join\n end",
"def run\n super\n\n uri = _get_entity_attribute \"name\"\n\n # Scanner options\n @opt_threads = _get_option(\"threads\").to_i\n @opt_max_pages = _get_option(\"max_pages\").to_i\n #@opt_user_agent = _get_option \"user_agent\"\n @opt_extract_uris = _get_option \"extract_uris\" # create an object for each page\n @opt_extract_dns_records = _get_option \"extract_dns_records\" # create an object for each dns_record\n @opt_extract_file_metadata = _get_option \"extract_file_metadata\" # create a Uri object for each page\n @opt_extract_patterns = _get_option(\"extract_patterns\").split(\",\") # only extract entities withthe following patterns\n\n crawl_and_extract(uri)\n\n end",
"def initialize\n @paths = []\n @trace = 0\n end",
"def start_crawling\n begin\n if @params[:url]\n page = @agent.get(@params[:url])\n else\n @pre_middlewares.each { |mw| mw.call(@params) }\n page = @params[:page]\n raise 'internal error' if page.nil?\n end\n rescue => _\n raise CrawlingException::InitializationError.new\n end\n\n # starting from Depth 0\n process(page, 0)\n end",
"def walk()\n @state.each do |state|\n desc = state.respond_to?(:name) ? state.name : @name\n boots(state,@path,desc)\n end\n return @results\n end",
"def walk_node(code, &block)\n yield(self, code)\n @esquerda.walk_node(code + '0', &block) unless @esquerda.nil? # Zero para caminhos para a esquerda\n @direita.walk_node(code + '1', &block) unless @direita.nil? # Uns para caminhos para direita\n end",
"def run\n extractor = ::SourceAnnotationExtractor.new(tags.join('|'))\n extractor.find(dirs)\n end",
"def walk(arg=true, &block)\n children do |child|\n if ch_arg = block.call(arg, child)\n child.walk(ch_arg, &block)\n end\n end\n end",
"def initialize(turtletext_reader,&block)\n @reader = turtletext_reader\n @page = 1\n @inclusive = false\n if block_given?\n if block.arity == 1\n yield self\n else\n instance_eval &block\n end\n end\n end",
"def walk(options = {}, &blk)\n retrieve_members unless @members\n @root_member.traverse(0, options, &blk)\n end",
"def initialize\n @dir = N\n end",
"def initialize(parse_tree)\n @parse_tree = parse_tree\n end",
"def initialize\n @json_searchers = get_json_searchers\n @loop = true\n reset_file_selection\n end",
"def walk \n puts \"Hmm.. not in a mood to walk...\"\n super # parent 'walk' method\n end",
"def initialize(&block)\n\t\t\t@events = {}\n\t\t\t@rules = []\n\t\t\t@otherwise = nil\n\n\t\t\t@logger = Logger.new($stderr)\n\n\t\t\tif block_given?\n\t\t\t\tinstance_eval &block\n\t\t\tend\n\t\tend",
"def initialize(source_dir)\n @clean_first = false\n @first_pass = true\n @quick_mode = false\n @check_mtime = false\n @show_statistics = false\n @source_dir = source_dir\n @time = Time.now\n @stats = Statistics.new\n stats.record(:site, :load) { load }\n end",
"def initialize(dictionary_file_path, distance_adapter = :gem)\n @tree = Tree.new distance_adapter\n # start = Time.now\n File.open(dictionary_file_path, \"r\") do |f|\n f.readlines.each do |word|\n @tree.add word.delete!(\"\\n\")\n end\n end\n # puts \"Tree created after #{(((Time.now)-start)*1000).to_i}ms.\"\n end",
"def initialize root_dir\n find_files root_dir\n end",
"def initialize(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n directories = args.flatten\n initialize_directories_and_directories_records(directories)\n initialize_relative_paths_usage(options)\n @block = block\n\n ignore(*options.delete(:ignore))\n filter(*options.delete(:filter))\n\n @adapter_options = options\n end",
"def init_root binding, &block\n block.call(self)\n @is_first = @is_last = true\n @level = 0\n @item = nil\n @tabs ||= 0\n root = eval('@items',binding).find{|x| x.identifier == root_identifier}\n children_populate_recursive [root]\n end",
"def walk\n\t\tputs \"walking around\"\t\n\tend",
"def initialize(dir, **opts)\n raise Errors::NoDirectoryError, dir: dir unless File.directory? dir\n\n @options = { nesting_levels: 2, folder_limit: 10_000 }.update(opts)\n @directory = dir\n @current_directory = File.join @options.fetch(:link_location, directory),\n CURRENT_STORE_PATH\n\n @tree = init_existing || init_new(nesting_levels)\n link_target\n end",
"def initialize\n\t\t@tokenizer = Lexer.new # why the defined method is initialize and the called method is new mystifies me\n\t\t@token = nil\n\t\t@blocklevel = 0\n\t\t@node = nil\n\t\t@sav = nil\n\tend",
"def walk(oidorname)\n\t\tprint_status(\"Trying to Walk the '#{oidorname}' tree......\")\n\t\t@manager.walk(\"#{oidorname}\") { |x| print_good(\"#{x}\") }\n\tend",
"def scan\n @top_level.comment = remove_private_comments(@content)\n @top_level.parser = self.class\n @top_level\n end",
"def scan\n remove_commented_out_lines\n do_classes\n do_constants\n do_methods\n do_includes\n do_aliases\n @top_level\n end",
"def walk()\r\n @warrior.walk!\r\n end",
"def walk()\r\n @warrior.walk!\r\n end",
"def start_lvl(output, depth = 0, args = {})\n end",
"def initialize(tree)\n @tree = tree\n @buffering = false\n @buff_file = nil\n @buffered_count = 0\n end",
"def setup_managers\n\t\t@crawler_op = Crawler_Operator.new(self)\n\tend",
"def initialize( opts = Options.instance )\n @opts = opts\n\n @sitemap = {}\n @redirects = []\n @paths = []\n @visited = Set.new\n\n @on_each_page_blocks = []\n @on_each_response_blocks = []\n @on_complete_blocks = []\n\n @pass_pages = true\n @pending_requests = 0\n\n seed_paths\n end",
"def initialize(exp)\n @orig, @tree = exp, create_tree(exp)\n @prefix, @infix, @postfix = @tree.preorder_traverse, @tree.inorder_traverse, @tree.postorder_traverse\n end",
"def walk(&blk)\n yield self\n self.each_child do |child|\n child.walk(&blk)\n end\n end",
"def initialize top_level, file_name, content, options, stats\n @top_level = top_level\n @top_level.parser = self.class\n @store = @top_level.store\n\n @file_name = file_name\n @content = content\n @options = options\n @stats = stats\n\n @preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include\n @preprocess.options = @options\n end",
"def initialize\n # Define instance variables\n @log = nil\n @config = nil\n @robot = nil\n @socket = nil\n # Initialize those that should be done now.\n parse_arguments()\n setup_logger()\n # Call the block if necessary.\n yield(self) if block_given?\n end",
"def initialize(name, &block)\n @name = name\n @modules = []\n @writer_mode = :multiple\n @requesting_console = false\n @force_rebuild = false\n\n @options = {\n :include_paths => [],\n :library_paths => [],\n :libraries => [],\n :cxxflags => [],\n :ldflags => [],\n :include_source_files => [],\n :includes => []\n }\n\n @node = nil\n\n parse_command_line\n\n if requesting_console?\n block.call(self) if block\n start_console\n elsif block\n build_working_dir(&block)\n block.call(self)\n build\n write\n compile\n end\n end",
"def initialize(depth: 2, debug: false)\n @root = nil\n @modules = find_subcommands(depth)\n @services = find_services(depth)\n\n Docker.logger = Dockit::Log.new if debug\n end",
"def initialize(*args) # :yields: tree_list\n super\n @item_map = {}\n end",
"def initialize(commandlineopts)\n \n #Requiring things we need. Most of these are in stdlib, but nokogiri ain't\n begin\n require 'rubygems'\n require 'logger' \n require 'json'\n require 'date'\n #require 'resolv'\n\n rescue LoadError => e\n puts \"Couldn't load one of the required gems\"\n puts \"The error message may be useful\"\n puts e.to_s\n exit\n end\n \n @options = commandlineopts\n \n @base_dir = @options.report_directory\n @scan_dir = @options.scan_directory\n if !File.exists?(@base_dir)\n Dir.mkdirs(@base_dir)\n end\n\n if @options.logger\n @log = Logger.new(@base_dir + '/' + @options.logger)\n else\n @log = Logger.new(STDOUT)\n end\n #Change the line below to Logger::DEBUG to get debugging messages during the program run\n @log.level = Logger::WARN\n @log.debug(\"Log created at \" + Time.now.to_s)\n @log.debug(\"Scan type is : #{@options.scan_type}\")\n @log.debug(\"Directory being scanned is : #{@options.scan_directory}\") if @options.scan_type == :directory\n @log.debug(\"File being scanned is : #{@options.scan_file}\") if @options.scan_type == :file\n \n end",
"def initialize\n @logger = Logging::Logger[self]\n\n @builder = Builder.new\n ::Webby.load_files\n\n @watcher = DirectoryWatcher.new '.', :interval => 2\n @watcher.add_observer self\n\n glob = []\n glob << File.join(::Webby.site.layout_dir, '**', '*')\n glob << File.join(::Webby.site.content_dir, '**', '*')\n @watcher.glob = glob\n\n @web_server = ::Webby.site.use_web_server ? WebServer.new : nil\n\n @launchy = ::Webby.site.autobuild_launch_url\n unless @launchy\n @launchy = \"http://localhost:#{::Webby.site.web_port}\" if @web_server\n end\n end",
"def initialize\n DebugOutput.debug_level = DEBUG_LEVEL\n\n @is_running = false\n\n @parser = Parser.new self\n @tokenizer = Tokenizer.new\n @symbol_table = SymbolTable.new\n\n init_constants\n end",
"def initialize(dir)\n\t\t@dir = dir\n\tend",
"def initialize(dir)\n\t\t@dir = dir\n\tend",
"def traverse; end",
"def run( pass_pages_to_block = true, &block )\n return if !@opts.crawl?\n\n # options could have changed so reseed\n seed_paths\n\n if block_given?\n pass_pages_to_block ? on_each_page( &block ) : on_each_response( &block )\n end\n\n while !done?\n wait_if_paused\n while !done? && url = @paths.shift\n wait_if_paused\n\n visit( url ) do |res|\n obj = if pass_pages_to_block\n Page.from_response( res, @opts )\n else\n Parser.new( res, @opts )\n end\n\n if @on_each_response_blocks.any?\n call_on_each_response_blocks( res )\n end\n\n if @on_each_page_blocks.any?\n call_on_each_page_blocks( pass_pages_to_block ? obj : Page.from_response( res, @opts ) )\n end\n\n push( obj.paths )\n end\n end\n\n http.run\n end\n\n http.run\n\n call_on_complete_blocks\n\n sitemap\n end",
"def initialize(&compare_proc)\n @size = 0\n @root = nil\n @compare_proc = compare_proc\n end",
"def initialize ( )\n @buffer = [] # буфер для символов входного потока\n @states = [] # массив с состояниями парсера, <ParserState> объекты\n @chain = [] # цепочка работающих состояний\n #\n # Машина состояний для метода classify.\n #\n @matchstate = {\n\t:state => 0,\n\t:index => 0\n }\n @parserstate = ''\n end",
"def initialize &blk\n @writers = []\n instance_exec &blk if block_given?\n end",
"def initialize programa\n\t\t@tk = []\n\t\t@error = []\n\t\t@parserTk = []\n\t\tlexer(programa)\n\tend",
"def perform\n if perform_crawl?\n if get_page\n store_page\n normalize_links\n filter_links\n continue_crawl\n end\n else\n # puts \"Depth limit reached for #{@url}\"\n end\n end",
"def walk(*args) walk_direction[*args] end",
"def init_worker\n callback = Proc.new do |change|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.dirname(change.path)\n end\n end\n\n WDM::Monitor.new.tap do |worker|\n @directories.each { |d| worker.watch_recursively(d, &callback) }\n end\n end",
"def test_resetting_walker\n oid = \"8496071c1b46c854b31185ea97743be6a8774479\"\n @walker.push(oid)\n walk = @walker.each.to_a\n assert_equal oid, walk[0].oid\n assert_equal 1, walk.count\n @walker.reset\n walk = @walker.each.to_a\n assert_equal 0, walk.count\n end",
"def start\n yield self if block_given?\n classpath = self.classpath.is_a?(Array) ? self.classpath : []\n start_process(classpath)\n end",
"def initialize(directory, &block)\n # Set root object\n @data = directory\n\n # Populate configurables from DSL block\n instance_eval(&block)\n\n\n raise(ArgumentError, \"A query must specify a 'select' clause\") unless @what\n raise(ArgumentError, \"A query must specify a 'from' clause\") unless @from\n\n warn(\"Multiple selections made without using an 'as' clause\") unless @name_transforms || (@what.count == @what.uniq.count)\n\n # Gather relevant objects from root object and filters\n @data = CQL::MapReduce.gather_objects(@data, @from, @filters)\n\n # Extract properties from gathered objects\n @data = format_output(@data)\n end",
"def run\n setup\n fuzzing_loop\n end",
"def _init_worker\n KQueue::Queue.new.tap do |queue|\n _directories_path.each do |path|\n Find.find(path) { |file_path| _watch_file(file_path, queue) }\n end\n end\n end",
"def initialize *args\n super(*args)\n @indexer = Wonderdog::Parser.new(\"foo\", \"tweet\")\n @aggregator = []\n end",
"def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\n end",
"def initialize( *args )\n\t\t@dir = Treequel.directory\n\t\t@people = @dir.ou( :people )\n\n\t\tsuper\n\tend",
"def initialize(_src)\n\t\t@tokenizer = Lexer.new(_src)\n\t\t@token = nil\n\t\t@blocklevel = 0\n\t\t@node = nil\n\t\t@sav = nil\n\tend",
"def forceWalk _obj, _args\n \"_obj forceWalk _args;\" \n end",
"def scan\n entries = parse_entries\n grouped_entries = group_entries entries\n\n doc = create_document grouped_entries\n\n @top_level.comment = doc\n\n @top_level\n end",
"def scan\n @time_cache = {}\n\n entries = parse_entries\n grouped_entries = group_entries entries\n\n doc = create_document grouped_entries\n\n @top_level.comment = doc\n\n @top_level\n end",
"def init_worker\n @worker = FSEvent.new\n @worker.watch(@directory, :latency => @latency) do |changed_dirs|\n next if @paused\n\n changed_dirs.map! { |path| path.sub /\\/$/, '' }\n @callback.call(changed_dirs, {})\n end\n end",
"def initialize(site, base, dir, name)\n @site = site\n @base = base\n @dir = dir\n @name = name\n @path = if site.in_theme_dir(base) == base # we're in a theme\n site.in_theme_dir(base, dir, name)\n else\n site.in_source_dir(base, dir, name)\n end\n\n process(name)\n read_yaml(PathManager.join(base, dir), name)\n generate_excerpt if site.config[\"page_excerpts\"]\n\n data.default_proc = proc do |_, key|\n site.frontmatter_defaults.find(relative_path, type, key)\n end\n\n Jekyll::Hooks.trigger :pages, :post_init, self\n end",
"def init_worker\n FSEvent.new.tap do |worker|\n worker.watch(@directories.dup, :latency => @latency) do |changes|\n next if @paused\n @mutex.synchronize do\n changes.each { |path| @changed_dirs << path.sub(LAST_SEPARATOR_REGEX, '') }\n end\n end\n end\n end",
"def initialize\n root = Rush::Dir.new('/')\n home = Rush::Dir.new(ENV['HOME']) if ENV['HOME']\n pwd = Rush::Dir.new(ENV['PWD']) if ENV['PWD']\n\n @config = Rush::Config.new\n\n @history = Coolline::History.new config.history_file.full_path\n\n @readline = Coolline.new do |c|\n c.transform_proc = proc { syntax_highlight c.line }\n c.completion_proc = proc { complete c.completed_word }\n end\n\n @box = Rush::Box.new\n @pure_binding = @box.instance_eval \"binding\"\n $last_res = nil\n\n eval config.load_env, @pure_binding\n\n commands = config.load_commands\n Rush::Dir.class_eval commands\n Array.class_eval commands\n\n # Multiline commands should be stored somewhere\n @multiline_cmd = ''\n end",
"def initialize setup\n @requests = setup[:requests]\n @response = setup[:response]\n @vos = setup[:vos]\n @related_scrapers = setup[:related_scrapers] || {}\n @is_root = setup[:is_root] \n @pager = setup[:pager] || {}\n @scrapers = setup[:scrapers] || {}\n @name = setup[:name]\n \n # load in a named helper for this scraper, or the base one\n if @name && Helper.const_defined?(@name)\n @helper = Helper.const_get(@name).new\n else \n @helper = Helper::Base.new\n end\n \n end",
"def initialize(run, xml)\n @run = run\n\n parse_xml(xml)\n end",
"def startMethods()\n @orderMethods = OrderTree.new(@root) ##Metodos de recorridos\n @addMethods = AddTree.new(@root,@compare) ##Metodos de agregado\n @searchMethods = SearchTree.new(@root,@compare) ## Metodos de busqueda en arbol\n @removeMethods = RemoveTree.new(@root,@compare) ##Metodos para remover elementos\n @drawMethods = DrawTree.new(@root,@compare)\n end",
"def initialize(website)\n\t\t@subpages = website.subpages\n\t\t@base_url = website.base_url\n\t\t@pattern_finder, @pattern_tester = PatternFinder.new(website), PatternTester.new(@subpages)\n\t\t@crawler_patterns, @duplicate_patterns = [], []\n\tend",
"def initialize(parsed_test_element = nil)\n super\n\n @steps = []\n\n build_test_element(parsed_test_element) if parsed_test_element\n end",
"def scan!\n Dir.chdir(@path) do\n Find.find('.') do |file|\n next if file == '.'\n\n # ignore the ./\n file = file[2..-1]\n name = File.basename(file)\n\n # ignore certain files/directories\n Find.prune if IGNORE.include?(name)\n\n if File.directory?(file)\n @directories << file\n elsif File.file?(file)\n src = File.join(@path,file)\n\n case File.extname(name)\n when '.erb'\n # erb template\n if name.start_with?('_')\n # partial template\n template_dir = File.dirname(file)\n template_name = name[1..-1].chomp('.erb').to_sym\n\n @includes[template_dir][template_name] = src\n else\n dest = file.chomp('.erb')\n\n @templates[dest] = src\n end\n else\n # static file\n @files[file] = src\n end\n end\n end\n end\n end",
"def initialize(node)\n super(node)\n @children = []\n rev = node.xpath(\"./commit\").first['revision'].to_i\n date = node.xpath(\"./commit/date\").text.split('T')[0]\n @info = {type: 'dir', rev: rev, date: date}\n end"
] |
[
"0.68178755",
"0.6643266",
"0.62453014",
"0.6156959",
"0.6048646",
"0.59823686",
"0.588834",
"0.58429426",
"0.58297706",
"0.582517",
"0.5813887",
"0.5809127",
"0.5749318",
"0.57279736",
"0.5670276",
"0.5598362",
"0.55786276",
"0.5570632",
"0.5545121",
"0.55060863",
"0.5499847",
"0.54921216",
"0.54900485",
"0.54661274",
"0.5460328",
"0.5442212",
"0.5440356",
"0.5436182",
"0.5432396",
"0.5423494",
"0.54187363",
"0.54175717",
"0.54124165",
"0.54064083",
"0.5396434",
"0.53324056",
"0.53313726",
"0.532463",
"0.5320664",
"0.5315479",
"0.53121257",
"0.5309815",
"0.53001326",
"0.5292504",
"0.52879816",
"0.5285234",
"0.5283975",
"0.5282855",
"0.5282228",
"0.52633345",
"0.52631694",
"0.5261033",
"0.5261033",
"0.5256194",
"0.5242264",
"0.52415293",
"0.5234501",
"0.52339876",
"0.5231067",
"0.52292717",
"0.5223025",
"0.52208525",
"0.5216119",
"0.521534",
"0.52073944",
"0.5202718",
"0.5197411",
"0.5197284",
"0.5197284",
"0.5189655",
"0.5182097",
"0.5181246",
"0.5173638",
"0.51640123",
"0.51604646",
"0.5157038",
"0.5142515",
"0.51410085",
"0.5132769",
"0.5126355",
"0.5123875",
"0.51209384",
"0.5118308",
"0.5114721",
"0.51100725",
"0.5106176",
"0.5104923",
"0.51008517",
"0.5099607",
"0.50985354",
"0.5095277",
"0.5094664",
"0.5094612",
"0.5093806",
"0.5092127",
"0.50896466",
"0.50869143",
"0.50809926",
"0.50791067",
"0.50776917",
"0.5076544"
] |
0.0
|
-1
|
(prices on days 0, 1, ...) and outputs the most profitable pair of days on which to first buy the stock and then sell the stock,
|
def stock_picker(prices)
min_index, max_index = -1, -1
min_diff = 1.0/0.0 # positive infinity
i, j = 0, 1
while i < prices.length - 1
while j < prices.length
if prices[i] - prices[j] < min_diff
min_diff = prices[i] - prices[j]
min_index, max_index = i, j
end
j += 1
end
i += 1
j = i + 1
end
return min_index, max_index
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stock_picker(prices) \n min_price = Float::INFINITY\n day_min_cost = 0\n max_price = -Float::INFINITY\n profit = -Float::INFINITY\n best_days = []\n\n prices.each_with_index do |price, day|\n if price < min_price \n min_price = price\n day_min_cost = day\n end\n \n if price - min_price > profit && day > day_min_cost\n max_price = price\n profit = price - min_price\n best_days = [day_min_cost, day]\n end\n end\n\n if best_days.empty?\n # In the case that the prices are decreasing order and there are no duplicates, the best days \n # to buy is the second to last day and the best day to sell is the last day\n best_days = [prices.length - 2, prices.length - 1]\n else\n best_days\n end\nend",
"def computeBuySellToMaximizeProfit()\n currentStock = \"\"\n i = 0 # Loop counter\n while i < @days.size do # Traverse the data for each date to find price differences\n if i == @days.size - 1 # For the final week\n puts \"#{@days[i]} SELL #{currentStock}\"\n break\n end\n weeklyDifferences = [] # Stores the price differences between closing prices for all stocks in a particular week\n @data.each_with_index do |(key, value), index| # Traverse the data corresponding to current date for each key (stock)\n stockDifferences = {} # Stores the price difference between closing prices for a stock in a particular week\n stockDifferences[:stock] = key\n stockDifferences[:difference] = (value[i+1][:close].to_f - value[i][:close].to_f).round(5) # value[i+1] represents the next date for the stock data\n weeklyDifferences << stockDifferences\n end\n mostProfitableStock = getMostProfitableStock(weeklyDifferences)\n if i == 0 # For week 1\n puts \"#{@days[i]} BUY #{mostProfitableStock}\"\n currentStock = mostProfitableStock\n elsif mostProfitableStock == currentStock # If the stock already bought is more profitable\n puts \"#{@days[i]} HOLD #{mostProfitableStock}\"\n else\n puts \"#{@days[i]} SELL #{currentStock}, BUY #{mostProfitableStock}\"\n currentStock = mostProfitableStock \n end\n i = i + 1\n end\n end",
"def pick_stocks(prices)\n profits = []\n pairs = []\n prices.each_with_index do |price_b, buy_date|\n prices.each_with_index do |price_s, sell_date|\n if sell_date > buy_date\n profits << price_s - price_b\n pairs << [buy_date, sell_date]\n end\n end\n end\n pairs[profits.index(profits.max)]\nend",
"def stock_picker(prices)\n buy_date = 0\n sell_date = 0\n max_profit = 0\n \n (0...prices.size).each do |buy|\n ((buy + 1)...prices.size).each do |sell|\n \n profit = prices[sell] - prices[buy] \n if max_profit < profit\n max_profit = profit\n buy_date = buy\n sell_date = sell\n end\n end\n end\n [buy_date, sell_date]\nend",
"def stock_picker(prices)\n\n\t# Best available [buy, sell] days for each buy day\n\tbest_days = []\n\tprices.each_index do |i|\n\t\tavailable_days = prices[i...prices.size] # only same day or after are valid sell days\n\t\tbest_days << [i, prices.index(available_days.max)]\n\tend\n\n\t# Calculates profit of each best day, same size and index as best_days\n\tprofits = []\n\tbest_days.each {|i| profits << prices[i[1]] - prices[i[0]] }\n\n\t# Returns [buy, sell] day pair matching index of highest profit\n\tbest_days[profits.index(profits.max)]\nend",
"def stock_picker(prices)\n\tgreatest_profit = 0\n\tbuy_day, sell_day = nil, nil\n\n\t(prices.length - 1).times do |day|\n\t\t((day+1)..(prices.length - 1)).each do |day2|\n\t\t\tcurrent_profit = prices[day2] - prices[day]\n\n\t\t\tif current_profit > greatest_profit\n\t\t\t\tbuy_sell = [day,day2] \n\t\t\t\tgreatest_profit = profit\n\t\t\tend\n\t\tend\n\tend\n\n\treturn [buy_day, sell_day]\nend",
"def stockPicker(prices)\n pair = [0,0]\n profit = 0\n prices.each_with_index do |buy, i|\n # Find highest sell day\n sell = prices[i..-1].max\n if profit < (sell-buy)\n pair[0] = i\n pair[1] = prices[i..-1].index(sell)+i # Find index of that sell day\n profit = sell-buy\n end\n end\n pair\nend",
"def stock_picker(array)\n best_buy = 0\n best_sell = 0\n max_profit = 0\n\n #first iterate through the array to find a buy day\n (0..(array.length-2)).each do |buy_date|\n\n #for each possible buy day, iterate through each sell day\n ((buy_date + 1)..array.length - 1).each do |sell_date|\n\n #check the price difference for those two days\n price_difference = array[sell_date] - array[buy_date]\n\n #if price diff is larger than the current max profit, store those days and max profit\n if price_difference > max_profit\n best_buy = buy_date\n best_sell = sell_date\n max_profit = price_difference\n end\n end\n end\n puts \"day #{best_buy}: buy at #{array[best_buy]}\"\n puts \"day #{best_sell}: sell at #{array[best_sell]}\"\n puts \"profit of #{max_profit}\"\n\n return [best_buy, best_sell]\nend",
"def stock_picker prices\n max_profit = 0-Float::INFINITY\n buy_day = 0\n sell_day = 0\n\n prices.each.with_index do |first_price,first_index|\n profits_for_day = prices.map.with_index do |second_price,second_index|\n if first_index < second_index\n second_price - first_price\n else\n 0-Float::INFINITY\n end\n end\n max_profit_for_day = profits_for_day.max\n if max_profit_for_day > max_profit\n max_profit = max_profit_for_day\n buy_day = first_index\n sell_day = profits_for_day.index(max_profit_for_day)\n end\n end\n\n return [buy_day,sell_day]\nend",
"def stock_picker(prices)\n profits_per_day = {}\n prices.each_with_index do |value, index|\n break if index == prices.length - 1\n profit = prices[index + 1] - value\n if (index + 1 == prices.length - 1)\n profits_per_day[profit] = [index, index + 1]\n break\n end\n for i in (index + 2..prices.length - 1)\n profit = prices[i] - value > profit ? prices[i] - value : profit\n end\n profits_per_day[value] = profit\n end\n return profits_per_day.max_by{|k,v| v}\nend",
"def best_profit (stock_prices_yesterday)\n possible_sale_combinations = stock_prices_yesterday.combination(2).to_a\n profits = []\n possible_sale_combinations.each do |pair|\n buy_price = pair[0]\n sell_price = pair[1]\n profit = sell_price - buy_price\n profits << profit\n end\n profits.sort!\n profits.count\n max_profit = profits[-1]\n if max_profit < 0\n return 0\n else\n return max_profit\n end\nend",
"def stock_picker(prices)\n acc_profit = 0\n acc_buy_date = 0\n acc_sell_date = 0\n \n profits = prices.map.with_index do |price, index|\n remaining_days = prices[index..-1] # to create an array that becomes smaller each iteration from index 0\n maximum = remaining_days.max # to identify the maximum number in that iteration's array\n highest_value = maximum - price # price is at index 0, so maximum minus minimum for each one will help identify the best buy/sell dates\n \n # create accumilator for index and value of highest profit\n if highest_value > acc_profit\n acc_profit = highest_value\n acc_buy_date = prices.index(price)\n acc_sell_date = prices.index(maximum)\n end\n\n end\n \n p \"Buy on day #{acc_buy_date} and sell on day #{acc_sell_date} for a profit of $#{acc_profit}.\"\n end",
"def stock_picker(stocks)\n buy_day, sell_day, max_profit = 0, 0, 0\n for i in (0...stocks.length - 1)\n buy, possible_sales = stocks[i], stocks[i+1..-1]\n best_sale = possible_sales.max # Find the best price we can still sell for\n current_profit = best_sale - buy\n if current_profit > max_profit\n max_profit = current_profit # New standard we'll have to beat\n buy_day = i + 1 # If i is 0, we should buy on day 1\n sell_day = sales.index(best_sale) + buy_day + 1 # Add 1 in both cases to correct for indexing\n end\n end\n print [buy_day,sell_day]\nend",
"def stock_picker(prices)\n combinations = prices.combination(2).to_a\n profits = combinations.map { |days| days[1] - days[0] }\n (0...prices.size).to_a.combination(2).to_a[profits.index(profits.max)]\nend",
"def stock_picker prices\n\tbest_days = []\n\tbest_profit = 0\n\n\tprices.length.times do |i|\n\t\tj = i\n\t\tfor j in i...prices.length\n\t\t\tif prices[j] - prices[i] > best_profit\n\t\t\t\tbest_profit = prices[j] - prices[i]\n\t\t\t\tbest_days[0] = i\n\t\t\t\tbest_days[1] = j\n\t\t\tend\n\t\tend\n\tend\n\tbest_days\nend",
"def stock_prices(array)\n i = 0\n \n max_profit = -1\n buy_day = nil\n sell_day = nil\n \n length = array.length\n \n while i < length - 1\n j = i + 1\n \n while j < length\n profit = array[j] - array[i]\n \n if profit > max_profit\n max_profit = profit\n buy_day = i\n sell_day = j\n end\n \n j += 1\n end\n \n i += 1\n end\n \n return \"Buy day: #{buy_day}. Sell day: #{sell_day}.\"\nend",
"def stock_picker daily_prices_array\n best_buy_day = 0\n best_sell_day = 0\n best_profit = 0\n for buy_day in 0...daily_prices_array.length\n for sell_day in buy_day...daily_prices_array.length\n if daily_prices_array[sell_day] - daily_prices_array[buy_day] > best_profit\n best_profit = daily_prices_array[sell_day] - daily_prices_array[buy_day]\n best_sell_day = sell_day\n best_buy_day = buy_day\n end\n end\n end\n [best_buy_day, best_sell_day]\nend",
"def stock_picker(array)\n best_days = Hash.new(0)\n\n array.each_with_index do |buy_price, idx1|\n buy_day = idx1\n (idx1 + 1...array.length).each do |idx2|\n sell_day = idx2\n sell_price = array[idx2]\n if buy_price <= sell_price\n best_days[[buy_day, sell_day]] = sell_price - buy_price\n end\n end\n end\n result = greatest_value_in_hash(best_days)\n\n # Days start at 0, wchich is the very first day of the prices\n return \"Best day to buy: #{result[0]}\\nBest day to sell: #{result[1]}\\nProfit: $#{result[2]}\"\nend",
"def stock_picker(input)\n \n best_profit = 0\n buy_sell_days = [0,0]\n \n# Since we need to buy before we can sell, we should only consider\n# buying up until the second-to-last day:\n \n for x in 0..input.length-2\n \n# We'll always sell after we buy, so we use nested 'for' loops to\n# check our sell value against our buy value and store our max profit:\n \n for y in 1+x..input.length-1\n \n profit = (input[y] - input[x])\n \n if profit > best_profit\n best_profit = profit\n buy_sell_days = [x,y]\n end\n \n end\n \n end\n \n return buy_sell_days\n \nend",
"def stock_picker(stock_prices)\n\n max_profit = 0\n best_days = []\n\n stock_prices.each_with_index do |buying_price, index|\n (index+1).upto(stock_prices.length - 1) do |selling_index|\n selling_price = stock_prices[selling_index]\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n best_days = [index, selling_index]\n end\n\n end\n end\n best_days\nend",
"def stock_picker(prices)\n\t# Empty hash for saving the buy & sell days (key) and the proffit (value)\n\tbuy_sell = Hash.new\n\n\tprices.each do |buy|\n\t\t# loop inside the loop that caluclates proffit ONLY IF the sell date has higher index than the buy date in the array.\n\t\tprices.each do |sell|\n\t\t\tif prices.index(sell) > prices.index(buy)\n\t\t\t\tproffit = sell - buy\n\t\t\t\t# Saves the buy index, sell index and proffit into our hash\n\t\t\t\tbuy_sell[\"#{prices.index(buy)}, #{prices.index(sell)}\"] = proffit\n\t\t\tend\n\t\tend\n\tend\n\t# lists the hash key (buy & sell day) that had the highest proffit value.\n\tputs buy_sell.key(buy_sell.values.max)\nend",
"def stock(prices)\n\n all_choices = []\n\n prices.each_with_index do |buy, i1|\n prices.each_with_index do |sell, i2|\n next if i1 >= i2 \n all_choices << [buy, sell]\n end\n end\n\n best_choice = 0 # []\n\n all_choices.each do |combination| # [ [] ] \n buy_price, sell_price = combination\n profit = sell_price - buy_price\n if profit > best_choice[1] - best_choice[0]\n best_choice = [buy_price, sell_price]\n end\n end\n best_choice\nend",
"def stock_picker(prices)\n days = [0,0]\n profit = 0\n i = 0\n\n while i < prices.size\n n = i + 1\n while n < prices.size\n dividend = (prices[n].to_i - prices[i].to_i)\n if dividend > profit\n profit = dividend\n days[0] = prices.index(prices[i])\n days[1] = prices.index(prices[n])\n end\n n += 1\n end\n i += 1\n end\n print \"Buy at $#{prices[days[0]]} and sell at $#{prices[days[1]]}\"\n puts \" on days #{days} for a profit of $#{prices[days[1]] - prices[days[0]]}!\"\nend",
"def stock_picker stock_prices\n coll = Hash.new \n stock_prices.each_index do |i|\n stock_prices.map.with_index(i) do |e, j|\n if stock_prices[j] && stock_prices[j] > stock_prices[i]\n coll[[i, j]] = stock_prices[j] - stock_prices[i]\n end\n end\n end\n\n coll = coll.key(coll.values.max)\n puts \"Buy on day:\\t#{coll[0]} \\nSell on day:\\t#{coll[1]}\"\n puts \"Profit ($):\\t#{stock_prices[coll[1]] - stock_prices[coll[0]]}\"\nend",
"def stock_picker(prices)\n\tmax_diffs_for_each_day = []\n\tsecond_days_for_each_max_diff = []\n\t# the - 1 ignores buys on the last day, which can't be sold\n\t# also keeps the remaining_prices range beginning from overshooting its end\n\tfor day in (0...(prices.length - 1)) \n\t\tremaining_prices = prices[(day + 1)...prices.length]\n\t\tmax_remaining_price = remaining_prices.max\n\t\tmax_diffs_for_each_day << (max_remaining_price - prices[day])\n\t\t# for tied maxes, index will return the earliest day, which we want\n\t\t# the + 1 accounts for zero-indexing of remaining_prices\n\t\tsecond_days_for_each_max_diff << (remaining_prices.index(max_remaining_price) + day + 1)\n\tend\n\tmaxest_diff = max_diffs_for_each_day.max\n\t# for tied maxes, index will return the earliest day, which we want\n\tfirst_day = max_diffs_for_each_day.index(maxest_diff)\n\tsecond_day = second_days_for_each_max_diff[first_day]\n\t[first_day, second_day]\nend",
"def stock_picker prices\n\tbest_buy_date = nil\n\tbest_sell_date = nil\n\tbest_profit = 0\n\tprices.each_index do |buy_date|\n\t\t(buy_date+1...prices.length).each do |sell_date|\n\t\t\tprofit = prices[sell_date] - prices[buy_date]\n\t\t\tif profit > best_profit\n\t\t\t\tbest_profit = profit\n\t\t\t\tbest_buy_date = buy_date\n\t\t\t\tbest_sell_date = sell_date\n\t\t\tend\n\t\tend\n\tend\n\t[best_buy_date,best_sell_date]\nend",
"def stock_picker(stocks)\n profit = 0\n\n for i in 0...stocks.length\n # ensures when looping through the prices, sell date comes after buy date\n for j in (i + 1)...stocks.length\n if (stocks[j] - stocks[i]) > profit\n profit = stocks[j] - stocks[i]\n buy_date = i\n sell_date = j\n end\n end\n end\n\n days = [buy_date, sell_date]\n p days\n p \"Total profit would be $#{profit}\"\nend",
"def stock_picker(stocks)\n biggest_price = 0\n profitable_days = []\n (0...stocks.length).each do |i|\n (i + 1...stocks.length).each do |j|\n day = stocks[i][0]\n price = stocks[i][1]\n other_day = stocks[j][0]\n other_price = stocks[j][1]\n stock_price = price - other_price\n if stock_price.abs > biggest_price\n biggest_price = stock_price\n profitable_days = [day, other_day]\n end\n end\n end\n\n profitable_days\nend",
"def stock_picker(stock_prices)\n buying_price = 0\n buying_index = 0\n selling_price = 0\n max_profit = -1\n max_buy_index = 0\n max_sell_index = 0\n\n change_buy = true\n\n stock_prices.each_with_index do |price, day|\n selling_price = stock_prices[day + 1].to_i\n\n if change_buy\n buying_price = price.to_i\n buying_index = day\n end\n\n if buying_price > selling_price\n change_buy = true;\n else\n profit = selling_price - buying_price\n if profit > max_profit\n max_profit = profit\n max_sell_index = day + 1\n max_buy_index = buying_index\n end\n change_buy = false;\n end\n\n end\n\n [max_buy_index, max_sell_index]\n\nend",
"def stock_picker(stock_arr)\n highest_profit = 0 \n best_day_to_buy = 0 \n best_day_to_sell = 0 \n\n # Return 0- 9 but due to \"...\" it means it will exclude running the last number \n for i in 0...stock_arr.length \n #I am using a nested array so I can keep track of one number and use the other to iterate \n # Ex. [0, 1-8],[1, 2-8], [2, 3-8], .. [8, 8-8] and so on \n #I am doing this so I can use the i index postion to keep track of each day \n # Then I will use the second for loop to iterate through the stock_arr again and compare and calculate\n # those value to what I have in i(the tracked day) \n # I keep the calculation in profit_calculating until I find the profit_calculating becomes a number with the highest_profit \n for j in i+1...stock_arr.length do \n profit_calculating = stock_arr[j] - stock_arr[i]\n if highest_profit < profit_calculating\n highest_profit = profit_calculating\n best_day_to_buy = i \n best_day_to_sell = j \n end\n end \n end\n return \"[#{best_day_to_buy}, #{best_day_to_sell}] with a profit of #{highest_profit}\"\n\nend",
"def stock_picker(array)\n max_profit = 0\n buy_sell_days = [0,0]\n array.each_with_index do |buy_price, buy_day|\n array.each_with_index do |sell_price, sell_day|\n if buy_day > sell_day\n next\n end\n if sell_price - buy_price > max_profit\n max_profit = sell_price - buy_price\n buy_sell_days = [buy_day, sell_day]\n end\n end \n end \n p buy_sell_days\nend",
"def stock_picker(prices)\n index = 0\n lowest = 0\n best_value = []\n for i in prices\n for j in prices[index..prices.length-1]\n if i - j < lowest\n lowest = i - j # lowest will be equal to the greatest price difference (greatest negative number)\n min = prices.index(i) # index of buy date\n max = prices.index(j) # index of sell date\n end\n end\n index += 1 # increments each iteration to ensure sell dates cannot be past dates\n end \n best_value << min\n best_value << max\n puts \"#{best_value} If you buy on day #{min} and sell on day #{max},\n you will make $#{lowest.abs} profit.\"\nend",
"def stock_picker(prices)\n\n profit = 0\n\n (prices.length - 1).times do |i|\n\n curr_buy_price = prices[0]\n prices.delete_at(0)\n\n if prices.max - curr_buy_price > profit\n profit = prices.max - curr_buy_price\n buy_index = i\n sell_index = i + prices.index(prices.max) + 1\n @best_days = [buy_index, sell_index]\n end\n\n end\n\n p @best_days\n \nend",
"def stock_picker(stock_values)\n n = stock_values.length\n max_profit = 0;\n start_day = nil\n end_day = nil\n\n for i in (0...n)\n for j in (i + 1...n)\n potential_profit = stock_values[j] - stock_values[i]\n if potential_profit > max_profit\n max_profit = potential_profit\n start_day = i\n end_day = j\n end\n end\n end\n\n [start_day, end_day]\nend",
"def bestonetradeprofit(prices)\n # find highest difference between price and subsequent price\n # starting best is second - first\n max = prices[1] - prices[0]\n while prices.length > 1\n e = prices.shift\n prices.each {|v| \n if (v - e) > max \n max=(v-e)\n end\n }\n end\n return max\nend",
"def stock_picker(stock_prices)\n best_pick = 0\n first_index = 0\n second_index = 0\n\n stock_prices.each_with_index do |val, idx|\n current_pick = stock_prices.slice((idx + 1)..(stock_prices.length - 1))\n current_pick.each_with_index do |num, i|\n new_pick = num - val\n if new_pick > best_pick\n best_pick = new_pick\n first_index = idx\n second_index = idx + i + 1\n end\n end\n end\n p \"Best day to buy: #{first_index}. Best day to sell: #{second_index}\"\n p \"Profit: #{best_pick}\"\nend",
"def get_max_profit(stock_prices_yesterday)\n # check for at least 2 prices\n if stock_prices_yesterday.length < 2\n raise IndexError, 'Need at least 2 prices to test.'\n end\n # initialize first price and the first possible profit\n min_price = stock_prices_yesterday[0]\n max_profit = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n\n stock_prices_yesterday.each_with_index do |current_price, index|\n if index == 0 then next end\n # see what our profit would be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n # update max_profit\n max_profit = [max_profit, potential_profit].max\n # update min_price\n min_price = [min_price, current_price].min\n end\n return max_profit\nend",
"def stock_picker(prices)\n\t# Initialize everything to 0\n\tmin = 0\t\t\t# Day with lowest price so far\t\t\t\t\t\n\tbuy = 0\t\t\t# Buy day with best max_diff so far\n\tsell = 0\t\t# Sell day with best max_diff so far\n\tmax_diff = 0\t# Best value of prices[sell]-prices[buy]\n\t(1...prices.length).each do |i|\n\t\t# Go through each day - not necessary to do the first\n\t\tif prices[i] < prices[min]\n\t\t\t# If current price is less than current min:\n\t\t\tmin = i\t\t\t\t\t\t# Set as current min\n\t\tend\n\t\tdiff = prices[i] - prices[min]\t# Compare difference to current min\n\t\tif diff > max_diff\n\t\t\t# If it's better:\n\t\t\tbuy = min\t\t\t\t\t# Record min as day to buy\n\t\t\tsell = i\t\t\t\t\t# Record current day as day to sell\n\t\t\tmax_diff = diff\t\t\t\t# Record new max difference\n\t\tend\n\tend\n\t[buy, sell]\nend",
"def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = data[day2] - data[day1] #update these variables if profit margin is larger than existing\n\t\t\t\tsellDate = day2\n\t\t\t\tbuyDate = day1\n\t\t\tend\n\t\t\tday2 += 1\n\t\tend\n\t\tday1 += 1\n\tend\n\treturn [buyDate, sellDate] \nend",
"def get_max_profit_v2(yesterday_stock_prices)\n\n max_profit = 0\n\n # go through every price (with its index as the time)\n yesterday_stock_prices.each_with_index do |earlier_price, earlier_time|\n\n # and go through all Later Prices\n (yesterday_stock_prices[+1..-1]).each do |later_price|\n\n # see what our profit will be if we bought at the\n # earlier price and sold at the later price\n potential_profit = later_price - earlier_price\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n\n end\n\n end\n\n max_profit\n end",
"def stock_picker(prices)\n\t# Storing variables what I use later\n\t$d = 0\n\t$small = 0\n\t$big = 0\n\tprices.each do |x|\t\t\t# iterating through all prices elements\n\t\ty = prices.index(x)+1 \t# y is the next element in prices array\n\t\twhile y < (prices.length)\t# it runs till we have something in the array\n\t\t\tif (x-prices[y]) < $d \t# only runs when the difference of x element and the next one is lower than the previous pair's (which is stored in $d)\n\t\t\t\t$d = x-prices[y] \t# so we store the lowest difference in $d\n\t\t\t\t$small = prices.index(x) \t# we store in $small the index number of x in the array, that is the day when we need to buy, the lowest price\n\t\t\t\t$big = y \t\t\t\t\t# y is the index number in the array of the number, which is the highest, and have the biggest difference with x\n\t\t\t\ty += 1 \t\t\t\t\t\t# add +1 to y so we can loop through the array\n\t\t\telse\n\t\t\t\ty += 1 \t\t\t\t\t\t# if the difference of the following pair is not smaller than the previous ones then we just move on and don't change $small and $big and $d\n\t\t\tend\n\t\tend\n\tend\n\tresult = []\n\tresult.push($small, $big) \t\t\t# pushing the results into result array\n\tputs result\nend",
"def stock_picker(array)\n sorted_stocks = array.sort.reverse\n profit = 0\n days_buy_sell = []\n sorted_stocks.each do |price_sell|\n array.each do |price_buy|\n if price_buy < price_sell && array.index(price_sell) > array.index(price_buy) && price_sell - price_buy > profit\n days_buy_sell = [array.index(price_buy), array.index(price_sell)]\n profit = price_sell - price_buy\n end\n end\n end\n days_buy_sell\nend",
"def stock_picker(prices)\r\n\tprice_to_buy = 0\r\n\tprice_to_sell = 0\r\n\tprofit = 0\r\n\r\n\tprices[0..-2].each_with_index do |buy, index_buy|\r\n\t\tprices[(index_buy + 1)..-1].each_with_index do |sell, index_sell|\r\n\t\t\tif profit < sell - buy\r\n\t\t\t\tprofit = sell - buy\r\n\t\t\t\tprice_to_buy = index_buy\r\n\t\t\t\tprice_to_sell = index_sell + (index_buy + 1)\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t[price_to_buy, price_to_sell]\r\nend",
"def max_profit(prices)\n sell_one, sell_two = 0, 0\n buy_one, buy_two = Float::INFINITY, Float::INFINITY\n \n prices.each do |price|\n buy_one = [buy_one, price].min\n sell_one = [sell_one, price - buy_one].max\n buy_two = [buy_two, price - sell_one].min\n sell_two = [sell_two, price - buy_two].max\n end\n sell_two\nend",
"def stock_picker(stock_array)\n\n day_hash = Hash.new(0)\n day_index = 0\n stock_array.each { |day_number|\n day_hash[day_index] = day_number\n day_index += 1\n }\n\n day_hash_sell = day_hash.clone\n profit_best = Hash.new(0)\n profit_best_counter = nil\n day_hash.each do |key, value|\n\n buy = -value \n day_hash_sell.each do |key_sell, value_sell|\n\n #ensure day is only in futue\n if key_sell <= key then \n next\n end\n\n profit = buy + value_sell \n if profit_best_counter == nil || profit > profit_best_counter then \n #reset hash to ensure only 1 answer given\n profit_best = Hash.new(0)\n\n #track best days to buy/sell in array\n profit_best[key] = key_sell\n\n #keep track of best profit so far\n profit_best_counter = profit\n end \n end \n end\n puts profit_best\nend",
"def stock_picker(number_array)\n #Stores current profit to be gained\n profit = 0\n #Stores the maximum profit from the combination of previous days\n max_profit = 0\n #Stores the days in which max profit can be had. stored_days[0] is buy day. stored_days[1] is sell day\n stored_days = [0, 0]\n\n #Loops through all numbers in array. Compares each iteration against all numbers from the iteration to the end of the array for max profit\n for i in 0..number_array.length-1\n # p \"Day #{i}: \"\n for j in i..number_array.length-1\n if number_array[j] < number_array[i]\n break\n else\n profit = number_array[j] - number_array[i]\n # p \"buy: \" + number_array[i].to_s + \" sell: \" + number_array[j].to_s + \" profit: \" + profit.to_s\n if profit > max_profit\n max_profit = profit\n stored_days[0] = i\n stored_days[1] = j\n end\n end\n end\n end\n return stored_days\nend",
"def stock_picker(prices)\n i = 0\n diff = 0\n best_days = []\n (i...prices.length).each do |index_one|\n (i + 1...prices.length).each do |index_two|\n if prices[index_two] - prices[index_one] > diff\n diff = prices[index_two] - prices[index_one]\n best_days = [index_one, index_two]\n end\n end\n end\n best_days\n end",
"def stock_profit(stocks)\n minimum = stocks[0]\n profit = stocks[1] - stocks[0]\n\n (1...stocks.size).each do |price|\n current_price = stocks[price]\n current_profit = current_price - minimum\n\n minimum = [minimum, current_price].min\n\n profit = [profit, current_profit].max\n end\n\n profit\nend",
"def get_max_profit(stocks)\n min_price = stocks[0]\n biggest_diff = stocks[1] - min_price\n\n # keep track of biggest difference, and smallest price\n stocks.each_with_index do |stock, i|\n next if i == 0 # skip first\n curr_diff = stock - min_price\n biggest_diff = curr_diff if curr_diff > biggest_diff\n\n min_price = stock if stock < min_price\n end\n\n biggest_diff\nend",
"def max_profit(stocks)\n max = 0\n buy = stocks[0]\n\n stocks.each_with_index do |sell, index|\n # ignore the first index just because already set it above\n next if index == 0\n\n current_profit = sell - buy\n\n # if the current profit is less than 0, there is no way the\n # prices could possibly be used to generate the max profit\n # therefore start making new comparisons from this point\n # forward\n if current_profit < 0\n buy = sell\n end\n\n # evaluate the max everytime\n max = [max, current_profit].max\n end\n\n if max == 0\n return -1\n end\n\n return max\nend",
"def stock_picker(arr)\n\n max_profit = 0 \n\n days = []\n\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx1 < idx2 && (num2 - num1) > max_profit\n max_profit = num2 - num1\n days = [idx1, idx2]\n end\n end\n end\n\n # return most profitable days \n days \n \n end",
"def stock_picker(price_arr)\n profit = 0\n trade_days = [0,0]\n price_arr.each_with_index do |buy_value, buy_day|\n price_arr.each_with_index do |sell_value, sell_day|\n if (sell_value - buy_value) > profit\n profit = (sell_value - buy_value)\n trade_days[0] = buy_day\n trade_days[1] = sell_day\n end\n end\n end\n \"buy on #{trade_days[0]} and sell on #{trade_days[1]} for a profit of #{profit}\"\nend",
"def buy_and_sell_price(prices)\n return if prices.length < 2\n\n buy_price = prices[0]\n current_buy_price = buy_price\n max_profit = (prices[1] - buy_price)\n\n for i in 2..prices.length - 1\n profit = prices[i] - current_buy_price\n\n if profit > max_profit\n buy_price = current_buy_price\n max_profit = profit\n else\n current_buy_price = [current_buy_price, prices[i]].min\n end\n end\n\n [buy_price, max_profit + buy_price]\nend",
"def get_max_profit(stocks)\n profit = 0\n transaction = Array.new(2)\n stocks.each_with_index do |buy, i|\n stocks[i+1..-1].each do |sell|\n potential_profit = sell - buy\n if potential_profit > profit\n profit = potential_profit \n transaction[0] = buy\n transaction[1] = sell\n end\n end\n end\n p \"Buy: #{transaction[0]}, Sell: #{transaction[1]} for Profit: #{profit}\"\nend",
"def stock_picker(arr)\n best_days = []\n arr.each do |i|\n arr.each do |x|\n if arr.index(x) > arr.index(i)\n if x - i > 0\n best_days.insert(x - i, \"Buying day #{arr.index(i)} and selling day #{arr.index(x)} gives the highest possible profit of #{x - i}\")\n end\n end\n end\n end\n best_days.last\nend",
"def find_greatest_profit\n\n @stock_prices_yesterday.each.with_index do |buy_amount, index|\n\n #Set biggest profit to the first transaction to avoid errors caused by a comparision with nil.\n @biggest_profit ||= @stock_prices_yesterday[0] - @stock_prices_yesterday[1]\n\n counter = 1\n while index + counter < 480\n if (@stock_prices_yesterday[index + counter] - buy_amount) > @biggest_profit\n @biggest_profit = @stock_prices_yesterday[index + counter] - buy_amount\n @buy_price = @stock_prices_yesterday[index]\n @buy_time = index\n @sell_price = @stock_prices_yesterday[index + counter]\n @sell_time = index + counter\n counter += 1\n puts counter\n else\n counter +=1\n puts counter\n end\n end\n end\n @biggest_profit\n end",
"def stock_picker(arr)\n final_profit = 0\n current_profit = 0\n final_dates = []\n\n arr.each do |buy_price|\n buy_date = arr.index(buy_price)\n \n arr.each do |sell_price| \n sell_date = arr.index(sell_price)\n \n if (sell_date > buy_date && sell_price > buy_price) \n current_profit = sell_price - buy_price\n if current_profit > final_profit\n final_profit = current_profit\n final_dates = [buy_date, sell_date]\n end\n end \n end\n end\n puts final_dates\nend",
"def stock_picker(stock_prices)\n\n\tstock_prices.map!{|price| price.to_i}\t#Convert array values to integers\n\n#Empty array for buy-low and sell-high differences\n\tdifference = []\n\n#Each day is considered a (low_price) and respective (high_price) is determined\n\tstock_prices.map.with_index do |price, i|\n\t\tlow_price = price\n\t\thigh_price = stock_prices[i+1..-1].max\n#The differnces array collects all high-low differences\t\t\n\t\tdifference.push(high_price.to_i - low_price.to_i)\n\tend\n\n\tday_1 = difference.index(difference.max)\t#Get day of highest difference possible\n\tday_2 = stock_prices.index(stock_prices[day_1+1..-1].max)\t#Calculate correspoinding high value\n\n\ta = [day_1]\n\tb = [day_2]\n\n\tprint a + b\nend",
"def get_max_profit_v3(yesterday_stock_prices)\n\n min_price = yesterday_stock_prices[0]\n max_profit = 0\n\n # go through every price on the list\n yesterday_stock_prices.each do |current_price|\n\n # ensure min price is lowest price we've seen so far\n min_price = [min_price, current_price].min\n\n # see what our profit woudl be if we bought at the\n # min price and sold at the current price\n potential_profit = current_price - min_price\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n\n end\n\n max_profit\n\n end",
"def get_max_profit_v4(yesterday_stock_prices)\n\n # make sur we have at least two prices\n if yesterday_stock_prices.length < 2\n #raise ArgumentError, 'Getting a profit requires at least 2 prices'\n return 'Getting a profit requires at least 2 prices'\n end\n\n # we'll greedly min_price and max_profit, so we initialize\n # them to the first price and first possible profit\n min_price = yesterday_stock_prices[0]\n max_profit = yesterday_stock_prices[1] - yesterday_stock_prices[0]\n\n # go through every price\n yesterday_stock_prices.each_with_index do |current_price, index|\n\n # skip the first time since we already used it\n # when we initialize min_price and max_profit\n next if index.zero?\n\n # see what profit will be if we bought at min_price\n # and sold at the current_price\n potential_profit = current_price - min_price\n\n # update max_profit if we can do better\n max_profit = [max_profit, potential_profit].max\n\n # update min_price so it's always the\n # lowest price we've seen so far\n min_price = [min_price, current_price].min\n\n end\n\n max_profit\n\n end",
"def stock_picker(prices, best_profit = -(2**(0.size * 8 -2)) )\t\n\tabs_max_sell = prices[1..-1].max\n\n\tmin_buy = prices[0..-2].min\n\tmin_buy_index = prices.index(min_buy)\n\n\tmax_sell = prices[(min_buy_index+1)..-1].max\n\tmax_sell_index = (min_buy_index + 1) + prices[(min_buy_index+1)..-1].index(max_sell)\n\n\tprofit = max_sell - min_buy\n\t\n\tif (profit > best_profit)\n\t\tbest_profit = profit\n\tend\n\tif (max_sell == abs_max_sell || prices[0..(min_buy_index-1)].length == 1)\n\t\tputs \"Best profit is #{best_profit}, buying on day #{min_buy_index} and selling on day #{max_sell_index}\"\n\telse\n\t\tprices = prices[0..(min_buy_index-1)]\n\t\tstock_picker(prices, best_profit)\n\tend\nend",
"def max_profit(stock_prices)\n\tmin_buying_point = stock_prices[0]\n\tmax_profit = 0;\n\n\tstock_prices.each do |price|\n\t\tmin_buying_point = [min_buying_point, price].min()\n\n\t\tcurrent_profit = price - min_buying_point \n\n\t\tmax_profit = [max_profit, current_profit].max()\n\tend\n\n\treturn max_profit\nend",
"def stock_picker(arr)\n profit = 0\n bestdays = []\n\n arr.each_with_index do |buyp, buyi|\n arr.each_with_index do |sellp, selli|\n next unless buyi < selli && (sellp - buyp) > profit\n\n profit = sellp - buyp\n bestdays[0] = buyi\n bestdays[1] = selli\n end\n end\n puts \"#{bestdays[0]} and #{bestdays[1]}\"\nend",
"def max_profit(prices)\n current_profit = 0\n buy = 0\n sell = 0\n in_trade = false\n arr_idx_length = prices.length - 1\n\n prices.each_with_index do |value,index|\n if index == arr_idx_length && in_trade == true\n sell = value\n puts \"last day must sell. at #{value}\"\n current_profit += (sell-buy)\n puts \"current_profit: #{current_profit}\"\n break\n elsif index == arr_idx_length && in_trade == false\n break\n else\n end\n\n if in_trade == false\n if value < prices[index+1]\n buy = value\n in_trade = true\n puts \"buy at #{value}\"\n end\n else\n if value > prices[index+1]\n sell = value\n in_trade = false\n puts \"sell at #{value}\"\n current_profit += (sell-buy)\n puts \"current_profit: #{current_profit}\"\n end\n end\n end\n\n puts \"total profit: #{current_profit}\"\n\nend",
"def max_profit(stock_prices_per_day)\n overall_max = 0\n stock_prices_per_day.each_with_index do |current_price,i| # [7,6,4,3,1]\n while (i < stock_prices_per_day.length - 1) do\n net_result = (current_price - stock_prices_per_day[i+1]) * -1 # (7 - 6) * -1\n if net_result > overall_max\n puts \"(#{current_price} - #{stock_prices_per_day[i+1]}) * -1. net_result '#{net_result}' is greater than '#{overall_max}'\"\n overall_max = net_result\n else\n puts \"(#{current_price} - #{stock_prices_per_day[i+1]}) * -1. net_result '#{net_result}' was less than overall_max '#{overall_max}'\"\n end\n i += 1\n end\n end\n overall_max\nend",
"def best_profit (stock_prices_yesterday)\n min_price = stock_prices_yesterday[0]\n max_profit = stock_prices_yesterday[1] - stock_prices_yesterday[0]\n\n stock_prices_yesterday.each do |stock_price|\n if stock_price <= min_price\n min_price = stock_price\n elsif (stock_price - min_price) > max_profit\n max_profit = stock_price - min_price\n end\n end\n max_profit\nend",
"def stock_picker(prices)\n current_max = 0\n buy_index = 0\n sell_index = 1\n (0...prices.length - 1).each do |buy|\n (buy + 1...prices.length).each do |sell|\n if prices[sell] - prices[buy] > current_max\n current_max = prices[sell] - prices[buy]\n buy_index = buy\n sell_index = sell\n end\n end\n end\n [buy_index, sell_index]\nend",
"def max_profit(prices)\n profit = 0\n 0.upto(prices.size - 2) do |current_pointer|\n next_pointer = current_pointer + 1\n diff = prices[next_pointer] - prices[current_pointer]\n profit += diff > 0 ? diff : 0\n end\n profit\nend",
"def get_max_profit(stock_prices_yesterday)\n min_price = stock_prices_yesterday.first\n max_profit = stock_prices_yesterday[1] - min_price\n stock_prices_yesterday.each.with_index do |price, idx|\n next if idx == 0\n potential_profit = price - min_price\n max_profit = potential_profit if potential_profit > max_profit\n min_price = price if price < min_price\n end\n max_profit\nend",
"def stock_picker(arr)\n\tbuy_day = 0\n\tsell_day = 0\n\told_profit = -999\n\n\tarr.each_with_index do |buy_price, buy_index|\n\t\tarr.each_with_index do |sell_price, sell_index|\n\t\t\tif sell_index <= buy_index\n\t\t\t\tnext\n\t\t\tend\n\t\t\tnew_profit = sell_price - buy_price\n\t\t\tif new_profit > old_profit\n\t\t\t\told_profit = new_profit\n\t\t\t\tbuy_day = buy_index\n\t\t\t\tsell_day = sell_index\n\t\t\tend\n\t\tend\n\tend\n\treturn [buy_day,sell_day]\nend",
"def stock_picker(prices)\n price_diff = 0\n count = 0\n best_days_array = []\n\n prices.each do |price1|\n count += 1\n prices.each do |price2|\n if count > prices.index(price2)\n next\n else\n if (price2 - price1) > price_diff\n price_diff = (price2 - price1)\n best_days_array = [prices.index(price1), prices.index(price2)]\n end\n end\n end\n end\n puts best_days_array\nend",
"def stock_picker(arr)\n \n max = 0\n day1 = 0\n day2 = 0\n\n arr.length.times do |buy|\n arr.length.times do |sell|\n if buy < sell && (arr[sell] - arr[buy] > max)\n day1 = buy\n day2 = sell\n max = arr[day2] - arr[day1]\n end\n end\n end\n\n return [day1, day2]\nend",
"def get_max_profit(prices)\n raise IndexError(\"Must be at least 2 prices\") if prices.length < 2\n #initialize a current_max_profit and current_min\n current_min = prices[0]\n current_max_profit = prices[1] - prices[0]\n\n prices.each do |price|\n #calculate the potential profit and check if it's larger than current max profit\n potential_profit = price - current_min\n current_max_profit = [potential_profit, current_max_profit].max\n #update current_min\n current_min = [current_min, price].min\n end\n current_max_profit\nend",
"def get_max_profit(stock_prices)\n return 0 if stock_prices.length < 2\n \n min_stock = stock_prices[0]\n max_profit = stock_prices[1] - stock_prices[0]\n puts \"\\n#{min_stock}\"\n puts \"#{max_profit}\"\n stock_prices[1...stock_prices.length].each do |price|\n min_stock = [min_stock, price].min \n puts \"\\n#{min_stock}\"\n pot_max_profit = price - min_stock\n puts \"#{max_profit}\"\n max_profit = [max_profit, pot_max_profit].max\n puts \"#{max_profit}\"\n end\n \n max_profit\nend",
"def max_profit(prices)\n\n n = prices.length\n return 0 if prices.empty?\n return prices.first if n == 1\n\n #left: buy, right: sell\n left,right = 0, 1\n maxProf = 0\n\n while right < n\n if prices[left] < prices[right]\n profit = prices[right] - prices[left]\n maxProf = [maxProf, profit].max\n else\n left = right\n end\n right += 1\n end\n maxProf\nend",
"def on2_2(prices)\n max_profit = 0\n\n return max_profit if prices.empty?\n\n prices.each_with_index do |number, index|\n max_price_after_date = prices[index..-1].max\n\n next if max_price_after_date <= number\n\n max_profit = [max_price_after_date - number, max_profit].max\n end\n\n max_profit\n end",
"def on2(prices)\n max_profit = 0\n\n prices.each_with_index do |number, index|\n prices.each_with_index do |another_number, another_index|\n next if index >= another_index\n\n max_profit = [another_number - number, max_profit].max\n end\n end\n\n max_profit\n end",
"def stock_picker(days)\n\tx = 0\n\tsets_of_two = days.permutation(2).to_a\n\tdifference = sets_of_two.map { |a,b| a-b }\n\tdiff_low_to_high = difference.sort\n\tbuy_sell = sets_of_two[difference.index(diff_low_to_high[0])]\n\n\twhile days.find_index(buy_sell[0]) > days.find_index(buy_sell[1])\n\t\tbuy_sell = sets_of_two[difference.index(diff_low_to_high[x])]\n\t\tx += 1\n\tend\n\n\tprint [days.find_index(buy_sell[0]), days.find_index(buy_sell[1])]\t\nend",
"def highest_possible_profit(prices)\n best_profit = 0\n # iterate over the dataset\n prices.each_with_index do |price, index|\n # in each hour compare with the future hours to find difference\n\n # check if difference is positive\n # check if difference is greater than current best\n # keep best difference\n # check next hour\n\n end\n # end return the best difference\n\nend",
"def max_profit_cooldown(prices)\n return 0 if prices.length < 2\n\n p \"has1_doNothing\", has1_doNothing = -prices[0]\n\tp \"has0_Buy\", has0_Buy = -prices[0]\n\tp \"has0_doNothing\", has0_doNothing = 0\n p \"has1_Sell\", has1_Sell = 0\n i = 1\n while i < prices.length\n\t\tp \"has1_doNothing\", has1_doNothing = has1_doNothing > has0_Buy ? has1_doNothing : has0_Buy\n\t\tp \"has0_Buy\", has0_Buy = -prices[i] + has0_doNothing\n\t\tp \"has0_doNothing\", has0_doNothing = has0_doNothing > has1_Sell ? has0_doNothing : has1_Sell\n\t\tp \"has1_Sell\", has1_Sell = prices[i] + has1_doNothing\n i += 1\n\tend\n has1_Sell > has0_doNothing ? has1_Sell : has0_doNothing\nend",
"def pick_best_day(optimized, days)\n\tbuy_day = 0\n\tsell_day = 0\n\tprofit = 0\n\tdays.each do |day|\n\t\tdaily_profit = days[optimized[days.index day]] - day\n\t\tif daily_profit > profit\n\t\t\tprofit = daily_profit\n\t\t\tbuy_day = days.index day\n\t\t\tsell_day = optimized[days.index day]\n\t\tend\n\tend\n\t[buy_day, sell_day]\nend",
"def stock_picker(data)\n #setup\n buy_day = 0\n sell_day = 0\n #algorithm\n for i in 0...data.length\n for j in (i+1)...data.length\n if (data[j]-data[i]) > (sell_day-buy_day)\n buy_day = i\n sell_day = j\n end\n end\n end\n #return\n [buy_day,sell_day]\nend",
"def on_2(prices)\n max_profit = 0\n min_valley = prices.max\n\n prices.each do |number|\n if number < min_valley\n min_valley = number\n elsif number - min_valley > max_profit\n max_profit = number - min_valley\n end\n end\n\n max_profit\n end",
"def max_profit(prices)\n buy = nil\n profit = 0\n \n prices.each do |p|\n if buy.nil?\n buy = p\n elsif p < buy\n buy = p\n else\n profit = p - buy if p - buy > profit\n end\n end\n profit\nend",
"def stock_picker(prices)\n\n buy = 0\n sell = 0\n max = 0\n \n prices.each_index do |x|\n prices.each_index do |y|\n if prices[y] - prices[x] > 0 and prices[y] - prices[x] > max and y > x\n buy = x\n sell = y\n max = prices[y] - prices[x]\n end\n end\n end\n \n [buy, sell]\nend",
"def stock_picker(stock_prices)\n lowest, highest = 9999999999, 0\n index_of_highest, index_of_lowest = 0\n\n stock_prices.each_with_index do |price, index|\n \n if price > highest\n highest, index_of_highest = price, index\n end\n\n end\n\n index = 0\n while index < index_of_highest\n\n if stock_prices[index] < lowest\n lowest, index_of_lowest = stock_prices[index], index\n end\n\n index += 1\n end\n \n\n\n\n puts \"You bought stock on Day #{index_of_lowest + 1}, for $#{lowest}, and sold it on Day #{index_of_highest + 1} for $#{highest}. Your profit is $#{highest - lowest}.\"\nend",
"def stock_picker(arr)\n buy = \"\"\n sell = \"\"\n biggest_difference = 0\n profit = 0\n arr.each_with_index do |day, index|\n #no days after last day so last day can't be the buy day\n if (day != arr[-1])\n #sell date must be after purchase date, therefore only want indicies after current\n future_date = (index +1)\n while future_date < arr.length\n profit = arr[future_date] - arr[index]\n if profit > biggest_difference\n buy = index\n sell = future_date\n biggest_difference = profit\n end\n future_date += 1\n end\n end\n end\n [buy,sell]\nend",
"def max_profit(prices)\n buy1 = Float::INFINITY\n buy2 = Float::INFINITY\n profit1 = 0\n prices.reduce(0) do |total_profit, price|\n buy1 = [buy1, price].min\n profit1 = [profit1, price - buy1].max\n buy2 = [buy2, price - profit1].min\n [total_profit, price - buy2].max\n end\nend",
"def maximum_profit(prices)\n max_profit = 0\n (2..prices.length - 2).to_a.each do |idx|\n first_transaction = max_difference(prices.slice(0, idx))\n second_transaction = max_difference(prices.slice(idx, prices.length))\n profit = first_transaction + second_transaction\n max_profit = profit if profit > max_profit\n end\n max_profit\nend",
"def max_profit(prices)\n min_price = prices[0]\n best_profit = 0\n \n prices.each do |price|\n if price < min_price\n min_price = price\n else\n profit = price - min_price\n if profit > best_profit\n best_profit = profit\n end\n end\n end\n \n return best_profit\nend",
"def stock_picker(arr)\n profits = []\n arr.each_with_index do |price, day|\n arr[day + 1..-1].each do |price2, day2|\n profit = price - price2\n profits << profit.abs if profit.negative?\n end\n end\n profits.empty? ? -1 : profits.max\nend",
"def max_profit(prices)\n min_price = prices[0]\n max_pro = 0 \n price.each do |price|\n if price <= min_price\n min_price = price\n elsif price - min_price > max_pro\n max_pro = price - min_price\n end\n end\n max_pro\nend",
"def pick_stocks(stocks)\n stocks = stocks[0]\n max_profit = 0\n min_stock = stocks[0]\n index1_temp = 0\n index1_lock = 0\n index2 = 0\n for i in 1...stocks.length()\n if stocks[i] < min_stock\n min_stock = stocks[i]\n index1_temp = i\n else\n if max_profit < (stocks[i]-min_stock)\n max_profit = stocks[i]-min_stock\n index2 = i\n index1_lock = index1_temp\n end\n end\n end\n if index1_lock == index2\n puts \"Not a good time to invest\"\n else\n puts \"I would recommend buying on Day #{index1_lock + 1} and selling on Day #{index2 + 1}.\"\n end\nend",
"def stock_picker(array)\n\n\n\ti = 0 \n\tj = 1\n\n\tprofit_list = Array.new\n\n\twhile i < array.length do\n\t\twhile (j <= array.length && j > i) do\n\t\t\tprofit = array[j].to_i - array[i].to_i\n\t\t\tprofit_list << profit\n\t\t\tif profit_list.max == profit\n\t\t\t\tbuy = i\n\t\t\t\tsell = j\n\t\t\tend\n\t\t\t\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\t\tj = i + 1\n\tend\n\tputs [buy,sell]\nend",
"def best_profit_from_yesterday_greedy(prices_array)\n\n lowest_thus_far = prices_array[0]\n max_profit = 0\n\n prices_array.each do |price|\n if price < lowest_thus_far\n lowest_thus_far = price\n end\n\n potential_profit = price - lowest_thus_far\n if(potential_profit > max_profit)\n max_profit = potential_profit\n end\n end\n max_profit\nend",
"def single_profit(prices)\n profit = 0\n i = 0\n while i < prices.length do\n remainder = prices.slice(i+1, prices.length-1)\n if remainder.length > 0\n value = remainder.max - prices[i]\n if value > profit\n profit = value\n end\n end\n i+=1\n end\n profit\n \nend",
"def max_profit(prices)\n len = prices.length\n dp = Array.new(3) { Array.new(2) }\n dp[0][0] = -prices[0]\n dp[1][0] = 0\n dp[2][0] = 0\n for i in 1...len\n dp[0][i%2] = [dp[0][(i-1)%2], dp[2][(i-1)%2]-prices[i]].max\n dp[1][i%2] = [dp[1][(i-1)%2], prices[i] + dp[0][(i-1)%2]].max\n dp[2][i%2] = [dp[2][(i-1)%2], dp[1][(i-1)%2]].max\n end\n [dp[0][(len-1)%2],dp[1][(len-1)%2],dp[2][(len-1)%2]].max\nend",
"def max_profit(prices)\n max_profit = 0\n min_price = prices[0]\n \n prices.each do |price|\n min_price = [min_price, price].min\n max_profit = [max_profit, price - min_price].max\n end\n \n max_profit\nend",
"def stock_picker(prices)\n #results array indicates the best time to buy and then sell the stock\n results = [0, 0]\n #this variable keeps tabs of the best positive price difference\n greatest_price_difference = 0\n prices.each_with_index do |price, current_index|\n #index_counter keeps track of the index in the array as it's being\n #looped in the while loop\n \n index_counter = current_index + 1\n #the while loop loops through the array starting with the first \n #potential day to buy and compares the potential difference\n #each day going forward to determine which day would be best to sell on\n #should they buy the stock today\n while index_counter < prices.length\n \n price_difference = prices[index_counter] - prices[current_index]\n if price_difference > greatest_price_difference\n #price difference is updated if a greater difference is found\n greatest_price_difference = price_difference\n results[0] = current_index \n results[1] = index_counter \n end\n index_counter += 1\n end\n end\n\n\n\n puts results\nend",
"def max_stock_profit(stock_prices)\n\tlocal_min = stock_prices[0]\n\tlocal_max = stock_prices[1]\n\tmax_profit_so_far = local_max - local_min\n\n\tstock_prices[2..-1].each do |price|\n\n\t\tif local_max == nil || price > local_max\n\t\t\tlocal_max = price\n\t\t\tprofit = local_max - local_min\n\t\t\tmax_profit_so_far = profit if profit > max_profit_so_far\n\n\t\t# must 'reset' the max when the min is reset\n\t\t# I set the max to nil because you can't buy and sell\n\t\t# at the same time\n\t\telsif price < local_min\n\t\t\tlocal_min = price\n\t\t\tlocal_max = nil \n\t\tend \n\t\t# log(local_min, local_max, max_profit_so_far)\n\tend\n\t\treturn max_profit_so_far\nend",
"def stock_picker(price_arr)\n\n profit = 0\n \n # Handles edge case of first price being a low point\n if price_arr[0] < price_arr[1]\n if price_arr.max - price_arr[0] > profit\n profit = price_arr.max - price_arr[0]\n best_range = [0, price_arr.index(price_arr.max)]\n end\n end\n \n #finds low points and their max earning potential updating the best range as it goes\n index = 1 # index is stepped up each loop to keep up with the index of the price\n price_arr[1..-2].each do |price|\n remaining_prices = price_arr[index..-1]\n if price_arr[index - 1] > price && price_arr[index + 1] > price\n if remaining_prices.max - price > profit\n profit = remaining_prices.max - price\n best_range = [price_arr.index(price), remaining_prices.index(remaining_prices.max) + index]\n end\n end\n index +=1 # index stepper\n end\n \n puts \"profit = #{profit}$\"\n best_range\n end"
] |
[
"0.83291537",
"0.8301248",
"0.8255051",
"0.82026064",
"0.81974506",
"0.81904966",
"0.81758815",
"0.8160288",
"0.8076529",
"0.80755687",
"0.8053499",
"0.8033491",
"0.797434",
"0.79628557",
"0.79492766",
"0.7941219",
"0.79200363",
"0.7916135",
"0.790684",
"0.79021865",
"0.7875401",
"0.78591853",
"0.7850062",
"0.7844787",
"0.78265435",
"0.78248876",
"0.78187704",
"0.7784375",
"0.7784219",
"0.77531445",
"0.7750838",
"0.7737583",
"0.7697917",
"0.7692969",
"0.7692399",
"0.76907563",
"0.7636133",
"0.7631781",
"0.76276106",
"0.76092017",
"0.76001334",
"0.75737643",
"0.7557427",
"0.75527084",
"0.7547571",
"0.74973553",
"0.74945325",
"0.7483601",
"0.7483243",
"0.74495417",
"0.743639",
"0.74318093",
"0.74304914",
"0.7426452",
"0.742353",
"0.7417833",
"0.7408492",
"0.7398512",
"0.7394639",
"0.7378845",
"0.73728585",
"0.73719037",
"0.73706573",
"0.7349137",
"0.73455375",
"0.7342592",
"0.73131937",
"0.73127097",
"0.73088276",
"0.73058623",
"0.73057425",
"0.7259856",
"0.72571635",
"0.72557926",
"0.7252808",
"0.72480243",
"0.7246704",
"0.7241925",
"0.7237639",
"0.72308624",
"0.7228633",
"0.72011673",
"0.7199848",
"0.7198221",
"0.71859545",
"0.71755654",
"0.7169984",
"0.7163604",
"0.71515125",
"0.7149565",
"0.7143117",
"0.7140845",
"0.71280336",
"0.7112113",
"0.7107594",
"0.71020234",
"0.7101898",
"0.7094901",
"0.707558",
"0.70725787",
"0.70592356"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions. def set_post
|
def set_post
@post = Post.find(params[:id])
rescue ActiveRecord::RecordNotFound => e
render json: { error: e.to_s }, status: :not_found
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post\n raise NotImplementedError\n end",
"def post; end",
"def post_task\n end",
"def post\r\n end",
"def _eval_post\n _eval_action('post')\n end",
"def post\n end",
"def post_setup\n end",
"def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end",
"def post(action, **args); end",
"def post(*args, &block); end",
"def post(*args, &block)\n map_method(:post, args, &block)\n end",
"def post_process\n end",
"def after_set_callback; end",
"def action_hook; end",
"def POST; end",
"def process_post\n true\n end",
"def set_merchant_post_action\n @merchant_post_action = Merchant::PostAction.find(params[:id])\n end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def notify_post\n raise \"not yet implemented\"\n end",
"def post_init\n end",
"def post_process; end",
"def save_action; end",
"def post_updates\n reload if new_resource.updated_by_last_action? && new_resource.reload\n post_up(new_resource.post_up) unless new_resource.post_up.nil? || !new_resource.updated_by_last_action?\n end",
"def post(&a_proc)\n @@post_block = a_proc\n end",
"def after_create; end",
"def process_post(post)\n # No-op.\n end",
"def post_data; end",
"def post_block\n end",
"def post_block\n end",
"def post_execute(&block)\n @hooks[:post_execute] = block\n end",
"def define_action_hook; end",
"def post_init\n end",
"def post_init\n\tend",
"def fetch_create_post\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def actions; end",
"def set_post\n @post = Post.find(params[:id])\n #@event = Event.find(params[:event_id])#\n end",
"def post_init\n send_data @init_request\n end",
"def handle_inputs\n collect_inputs(form_model: :post)\n\n if state.post.has_errors?\n set_state post: state.post\n else\n state.post.create.then do |post|\n if post.has_errors?\n set_state post: post\n else\n $HISTORY.pushState(nil, \"/posts/#{post.id}\")\n end\n end\n end\n end",
"def post data\n commit data\n end",
"def ready_to_post\n self.update_attribute('state', 'ready_to_post')\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def post_reader; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 after_initialize\n # test if request == post and if so if authtoken is present and valid\n if @request.post?\n token=@params[:_authtoken]\n if token\n raise \"Doozer Authtoken Tampered With!\" if not authtoken_matches?(token)\n else\n raise \"Doozer Authtoken Missing! By default, post requests require an authtoken. You can override this by adding the action to the after_initialize_exclude list.\" if not authtoken_matches?(token)\n end\n end\n end",
"def after_add_callback(unused_submission)\n end",
"def setup(server)\n @server = server\n @server.on('method:GET', method(:http_get_early), 90)\n @server.on('method:GET', method(:http_get), 200)\n @server.on('onHTMLActionsPanel', method(:html_actions_panel), 200)\n\n @server.on('method:POST', method(:http_post)) if @enable_post\n end",
"def after_create post\n \n # update points\n PointManager::add_points post.user, 'ppx' \n\n # update buyer address info\n update_contact_info post\n \n UserMailer.send_pixipost_request(post).deliver_later if post.status == 'active'\n UserMailer.send_pixipost_request_internal(post).deliver_later if post.status == 'active'\n end",
"def post #:doc:\n end",
"def add_actions; end",
"def post_import\n end",
"def after_build\n end",
"def posts # proxy the posts struct\n @post_cb = lambda{|post,fobj| yield post,fobj }\n self\n end",
"def post_init(&block)\n @hooks[:post_init] = block\n end",
"def post!\n request! :post\n end",
"def after_validate\n end",
"def after_created; end",
"def initialize(*args)\n super\n @action = :save\nend",
"def post *args, &block\n handle @conn.post *args, &block\n end",
"def post_data=(_arg0); end",
"def poteti_post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'POST')\n end",
"def set_post\n @post = Post.friendly.find(params[:id])\n # authorize @post\n end",
"def callbacks; end",
"def callbacks; end",
"def sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end",
"def save_post_before_authenticating\n if request.env['warden'].unauthenticated? and request.post?\n logger.info \"Will save the POST request for later execution\"\n session[:pre_sign_in_post] = {:controller => controller_name, :action => action_name, :params => params.dup}\n end\n \n authenticate_user!\n end",
"def on_response( &block )\n @postprocessor = block\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 post_initialize\n end",
"def auto_post(state=true)\n unless (state.is_a?(TrueClass) || state.is_a?(FalseClass))\n raise JiakResource, \"auto_post must be true or false\"\n end\n jiak.auto_post = state\n end",
"def after_request\n end",
"def after_view_setup\n end",
"def run_actions; end",
"def create\n\n current_user_or_redirect ? nil : return\n\n @post = Post.new(params[:post])\n @post.user_id = @current_user.id\n\n if @post.link?\n @post.status = 'live'\n @post.link = \"http://#{@post.link}\" unless @post.link[/^https?/]\n end\n\n respond_to do |format|\n if @post.save\n @post.delay.update_slug\n @post.delay.add_interactions\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def post(action, parameters = {}, session = nil, flash = nil)\n parameters[:locale] = I18n.locale\n super(action, parameters, session, flash)\n end",
"def set_post\n @post = Blogelator::Post.find_by_slug(params[:id])\n set_previous_post\n set_next_post\n end",
"def submits; end",
"def set_request; end",
"def after_create(obj); end",
"def after(action)\n yield HashMutator.new(responder.defaults[action])\n end",
"def post_initialize_fields\n end",
"def on_pre_request( request ); end",
"def set_post\n @post = Post.find(params[:id])\n @talk = @post.talk\n @originator_person = @post.person\n end",
"def post(name,&block)\n build_resource(name, :post, &block)\n end",
"def set_post\n @post = Post.find(params[:id])\n @job = Job.find(params[:id])\n end",
"def post_init\n @request = Request.new\n @response = Response.new\n end",
"def post_request(object)\n end",
"def setup_signals; end",
"def after_request\n end",
"def create\n post\n end",
"def submit; end",
"def post(data = {})\n call data, method: :post\n end",
"def callback_phase\n super\n end",
"def post_process_exposed_object(resource, type, singular)\n end",
"def setPostProcess(callback, data)\n @entry_field.setPostProcess(callback, data)\n end",
"def post_configure\n # noop\n end",
"def install_post_hook\n end",
"def set_post\n @post = Post.new post_params\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end"
] |
[
"0.65034115",
"0.6446669",
"0.6432541",
"0.64084876",
"0.64011943",
"0.63968515",
"0.6164632",
"0.6105911",
"0.6056664",
"0.6000905",
"0.5967724",
"0.5889567",
"0.5873356",
"0.5849263",
"0.582722",
"0.5787437",
"0.57558125",
"0.57431746",
"0.57355917",
"0.571892",
"0.56864434",
"0.5655928",
"0.5655389",
"0.563568",
"0.56342",
"0.56306833",
"0.5611815",
"0.5609357",
"0.5609357",
"0.56011975",
"0.5592772",
"0.5587961",
"0.5553508",
"0.55500364",
"0.5548879",
"0.5513021",
"0.5503975",
"0.5493109",
"0.5493082",
"0.5483211",
"0.54759",
"0.54741085",
"0.54716694",
"0.5470397",
"0.5463532",
"0.54516816",
"0.5449609",
"0.5448935",
"0.5427485",
"0.5418273",
"0.5417608",
"0.5406389",
"0.53926015",
"0.53890073",
"0.53782433",
"0.536538",
"0.53466874",
"0.5337701",
"0.53194946",
"0.5313006",
"0.5305946",
"0.5296424",
"0.52955526",
"0.5294637",
"0.5294637",
"0.5292574",
"0.5291564",
"0.52894753",
"0.5289128",
"0.52865905",
"0.5279809",
"0.52752",
"0.52565944",
"0.5255148",
"0.5245128",
"0.5238502",
"0.52371156",
"0.52336454",
"0.5231786",
"0.52259296",
"0.5224784",
"0.5221596",
"0.5221462",
"0.52198315",
"0.52189696",
"0.52187824",
"0.52105147",
"0.52044994",
"0.5201057",
"0.5189016",
"0.5187996",
"0.51807827",
"0.51807046",
"0.51802224",
"0.51753193",
"0.5174499",
"0.5173081",
"0.51726633",
"0.5171783",
"0.51654893",
"0.51652783"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def post_params
params.require(:post).permit(:caption, :user_id, images: [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def params(list)\n @declared_params = list\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def safelist; end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69490993",
"0.6812977",
"0.6801889",
"0.67950445",
"0.6745037",
"0.6740698",
"0.65270424",
"0.6519444",
"0.6492448",
"0.6430671",
"0.6430671",
"0.6430671",
"0.63992614",
"0.6355569",
"0.6354901",
"0.63456345",
"0.63430274",
"0.63376623",
"0.6327184",
"0.6327184",
"0.6327184",
"0.6312343",
"0.6298636",
"0.6264699",
"0.62606114",
"0.6257774",
"0.62360454",
"0.6227809",
"0.62203985",
"0.6220124",
"0.6208926",
"0.6198754",
"0.61961126",
"0.61733264",
"0.61565864",
"0.6156045",
"0.61525464",
"0.6135898",
"0.6120792",
"0.61104727",
"0.6074026",
"0.60715514",
"0.6061967",
"0.6055065",
"0.6044363",
"0.60349673",
"0.60197556",
"0.60169685",
"0.60148275",
"0.6010643",
"0.60085577",
"0.6007718",
"0.6006462",
"0.6004975",
"0.6004975",
"0.599722",
"0.599272",
"0.5991751",
"0.59836066",
"0.5970689",
"0.59686905",
"0.5965213",
"0.59646696",
"0.59614",
"0.5960139",
"0.5933335",
"0.5928459",
"0.59223276",
"0.5907845",
"0.5903901",
"0.5903133",
"0.58924323",
"0.58886814",
"0.5880674",
"0.5880674",
"0.5880674",
"0.58724785",
"0.58617043",
"0.5853673",
"0.5843668",
"0.5842991",
"0.58351576",
"0.5831751",
"0.58289963",
"0.5827831",
"0.58164775",
"0.5814396",
"0.5814107",
"0.58099633",
"0.5802532",
"0.5802532",
"0.57996815",
"0.57947254",
"0.5784507",
"0.57802397",
"0.5776441",
"0.57747304",
"0.5767034",
"0.5766118",
"0.57619715",
"0.57567734"
] |
0.0
|
-1
|
Replaces 'current_user' to provide account and accounts_user in Context.
|
def pundit_user
@pundit_user ||= Context.new(
account: current_account,
accounts_user: current_accounts_user,
user: current_user
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_account\n @account = current_user\n end",
"def context; { user: current_user } end",
"def current_user\n current_account\n end",
"def set_current_user\n User.current = current_user\n end",
"def update_current_user(user)\n @current_user = user if user\n end",
"def set_current_user\n User.current = current_user\n end",
"def set_current_user\n User.current = current_user\n end",
"def update_current_user(user)\n @current_user = user\n @current_user\n end",
"def set_current_user\n User.current = current_user\n end",
"def current_user\n current_account.user\n end",
"def current_user_with_account\n user = current_user_without_account\n @current_account = user.account unless (user.nil? || user == false) || !@current_account.nil?\n return user\n end",
"def context\n { current_user: current_user }\n end",
"def current_user\n authentication.account\n end",
"def current_user\n @current_user ||= context[:current_user]\n end",
"def set_current_user\n User.current_user = current_user\n end",
"def set_current_user\n AuthorizationData.current_user = current_user\n yield\n ensure\n AuthorizationData.current_user = nil\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_account\n #@current_account = CurrentAccount.find(params[:id])\n @current_account = current_user.current_accounts.find(params[:id])\n end",
"def set_user_as_current_user\n @user = @current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user_for_auth\n Authorization.current_user = current_user\n end",
"def current_user\n @current_user ||= auth_user\n end",
"def current_user\n current_user = Account.find_by(id: session[:account_id])\n end",
"def set_global_current_user\n Current.user = current_user\n end",
"def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end",
"def set_current_user(current_user)\n @current_user = current_user\n end",
"def select_account_and_user\n Account.current = if Talgud.config.domain\n Account.find_by_domain(Talgud.config.domain)\n else\n Account.first\n end\n Authorization.current_user = current_user\n end",
"def set_current_user\n if logged_in?\n User.current_user = current_user\n else\n User.current_user = nil\n end\n end",
"def with_current_user(user, &block)\n saved_user = User.current\n User.current = user\n yield\n ensure\n User.current = saved_user\n end",
"def set_fake_env\n if current_user.nil?\n @current_account = if params[:account_id].blank?\n Account.first\n else\n Account.find(params[:account_id])\n end\n\n @current_user = @current_account.permissioned_users.first\n end\n end",
"def make_current\n Account.current_account = self\n end",
"def user_context(options = nil)\n original_user_context = context.user\n\n if options\n context.user = context.user.merge(options)\n else\n context.user = {}\n end\n\n yield if block_given?\n context.user\n ensure\n context.user = original_user_context if block_given?\n end",
"def current_user\n super\n if @current_user\n return @current_user\n end\n\n authenticate_user!\n @current_user\n end",
"def set_current_user\n current_user\n authorize\n end",
"def current_user(options = {})\n @current_users ||= {}\n u = @current_users[options.inspect]\n u ||= (session[:user] && User.find_by_id(session[:user], :include => [:on_behalf]))\n u ||= created_user if options[:include_inactivated]\n u ||= Guest.new\n if u.is_a?(Project)\n log.warn \"current user was Project (%s). This is invalid.\" % u.login\n u = Guest.new\n end\n @current_users[options.inspect] ||= u\n u\n end",
"def current_user\n return @current_user if @current_user\n \n @current_user = super.decorate if super\n @current_user\n end",
"def current_account\n\t\t\t\t@current_account ||= login_from_api_token\n\t @current_account ||= login_from_session\n\t end",
"def get_user\n @current_user = current_user\n end",
"def current_user(user)\n @current_user = user\n end",
"def set_account\n @account = current_user.accounts.find(current_account.id)\n end",
"def set_account\n @account = current_user.accounts.find(current_account.id)\n end",
"def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end",
"def set_aux_user\n Authorization.current_user = current_aux_user\n end",
"def sign_in!(user)\n user.is_a?(Account) ? self.current_account = user : self.current_user = user\n end",
"def current_account=(account)\n set_session(account)\n @current_user = account_user_mapper.account_to_user(account)\n @current_account = account\n end",
"def current_account\n nil\n end",
"def copy_account_to_user(account)\n return account if account.current_user.nil?\n\n account.current_user.phone_number = account.contact_number\n account.current_user.email_address = account.email_address\n account.current_user.email_address_confirmation = account.email_address_confirmation\n account\n end",
"def set_current_user\n # for access to authenticate method\n t = ActionController::HttpAuthentication::Token\n @current_user = t.authenticate(self, &AUTH_PROC)\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def get_user\n @current_user = current_user\n end",
"def alter_current_user(&block)\n user = current_user\n user = User.find(user.id) if user.frozen? # Since we're modifying it, we can't use the one from memcached.\n yield(user)\n user.save if logged_in?\n $CACHE.delete(\"users/#{session[:user_id]}\")\n set_current_user(user)\n user\n end",
"def set_current_user(user)\n if user.new_record?\n set_unlogged_in_user(user)\n else\n set_logged_in_user(user)\n end\n end",
"def set_current_user\n @current_user ||= warden.authenticate(scope: :api_user)\n end",
"def current_user=(user)\n @current_account = account_user_mapper.user_to_account(user)\n set_session(@current_account)\n @current_user = user\n end",
"def current_user\n import_user\n end",
"def current_user\n @current_user ||= Account.find(session[:user_id]) if session[:user_id]\n\tend",
"def edit_account\n @user = User.find(current_user.id)\n end",
"def set_account_user\n @account_user = ::User.in_account(current_user.account.id).find(params[:id])\n end",
"def current_account\n @current_account\n end",
"def current_account\n load_session\n @current_account\n end",
"def actual_user\n if @current_user.nil? || session[:cas_user] != @current_user.cas_directory_id\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n end\n @current_user\n end",
"def current_user\n @usys_logged_in_user ||= lookup_user\n end",
"def actual_user\n if @current_user.nil? || session[:cas][:user] != @current_user.cas_directory_id\n update_current_user(User.find_by(cas_directory_id: session[:cas][:user]))\n end\n @current_user\n end",
"def current_account\n @current_account ||= Account.find_by(id: session[:user_id])\n end",
"def set_current_user\n @current_user = current_student || current_admin\n end",
"def current_user\n @current_user = temporary_session? ? temporary_user : remembered_user\n end",
"def set_current_account\n @current_account = CurrentAccount.find(params[:id])\n end",
"def clear_current_user; end",
"def current_user=(user)\n @current_user = user\n end",
"def set_current_account(account=nil)\n\t\t session[Notes.config['session_id']] = account ? account.id : nil\n\t\t @current_account = account\n\t\t end",
"def current_user\n @user || @api_user || @social_user\n end",
"def current_user=(user)\n \t#sets an instance variable @current_user, effectively storing the user for later use\n @current_user = user\n end",
"def current_user=(user)\r\n @current_user = user\r\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end",
"def current_user=(user)\n @current_user = user\n end"
] |
[
"0.6942678",
"0.6908841",
"0.687852",
"0.6868451",
"0.6853231",
"0.68381894",
"0.683534",
"0.6792495",
"0.6782303",
"0.6777079",
"0.6741104",
"0.6740072",
"0.6732967",
"0.67285234",
"0.66682327",
"0.66582125",
"0.66571486",
"0.66571486",
"0.66571486",
"0.66571486",
"0.66502714",
"0.66465807",
"0.6639457",
"0.6639457",
"0.66083044",
"0.66083044",
"0.6585459",
"0.6551253",
"0.6546594",
"0.6523205",
"0.6494394",
"0.64778304",
"0.6451085",
"0.64386743",
"0.64324623",
"0.6351424",
"0.6313224",
"0.6288176",
"0.62877685",
"0.6277672",
"0.6275952",
"0.6275527",
"0.627296",
"0.62573355",
"0.62509584",
"0.62408054",
"0.62408054",
"0.623308",
"0.6225447",
"0.6212832",
"0.6203055",
"0.6200512",
"0.61932874",
"0.61868036",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6179265",
"0.6162934",
"0.6162004",
"0.6157416",
"0.61549366",
"0.6152261",
"0.6149775",
"0.61466396",
"0.6140009",
"0.61398906",
"0.61386985",
"0.61384773",
"0.6137804",
"0.61204946",
"0.6116236",
"0.60977775",
"0.6094782",
"0.6092809",
"0.6082182",
"0.60821587",
"0.6082021",
"0.6066492",
"0.6065278",
"0.60628045",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923",
"0.6057923"
] |
0.0
|
-1
|
Users are always allowed to manage their session, registration, subscription and account
|
def access_required?
user_signed_in? &&
!devise_controller? &&
!%w(
subscriptions
accounts
).include?(controller_name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def on_users_account\n true\n end",
"def manage_account\n if @user\n manage_account_menu\n else\n login\n manage_account_menu\n end\n end",
"def manage?\n super || (@user && @user.is_curator?)\n end",
"def create?\n #everyone who is loggedin can do this action\n true\n end",
"def check_permission\n if ((session[:register].nil? || session[:register]==false) &&\n (session[:student_current_user].nil? || session[:student_current_user]==false) &&\n (session[:admin_current_user].nil? || session[:admin_current_user]==false))\n redirect_to \"/registration_home/index\"\n end\n end",
"def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end",
"def check_auth\n @slot.user == (current_user ) or raise AccessDenied\n end",
"def require_user_can_manage( object )\n\t\tunless ( object.user == @current_user ) || ( @current_site.admins.include? @current_user )\n\t\t\tfail \"Not your #{obj.class.to_s}\", :error\n\t\t\treturn false\n\t\tend\n\tend",
"def allow_access\n !@current_user.nil?\n end",
"def mode_settings\n authorize!(@user)\n end",
"def login_required\n raise Forbidden unless @current_member #ログイン状態でないとForbiddenを発生させる\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def check_admin\n if current_user && current_user.admin\n logger.info \"[auth] Allowed for #{current_user.email}\"\n true\n else\n logger.info (\"[auth] Access Denied\")\n redirect_to new_user_session\n end\n end",
"def authorize_admin_manage_users\n unless current_user.permission.manage_users\n redirect_back fallback_location: root_path\n end\n end",
"def access_control\n \n end",
"def allow_reg_modifications?\n cookies.signed[:user_permissions] == \"yes\"\n end",
"def allow_reg_modifications?\n cookies.signed[:user_permissions] == \"yes\"\n end",
"def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end",
"def active_for_authentication?\n super && !banned\n end",
"def active_for_authentication? \n super && approved? \n end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def active_for_authentication?\n super && assigned?\n end",
"def active_for_authentication? \n \tsuper && approved?\n \t\n\tend",
"def reg_only!\n\tif !current_user || current_user.pro || current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def guest_user(_user)\n if RuntimeConfig.vote_signin_active?\n can :access, :sessions\n end\n end",
"def allow_registration?\n true\n end",
"def require_same_user\n if current_user != @user && !current_user.admin?\n flash[:alert] = \"you dont have access to do anything with #{@user.username}'s account\"\n redirect_to user_path(@user)\n \n end\n \n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def manage?\n return false if assumed_identity_from_profile\n !doorkeeper_token && site_admin?\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def allow_access\n !current_cas_user.nil?\n end",
"def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend",
"def authorize_user!\n \n unless can?(:manage, @question)\n flash[:alert] = \"Access denied!\"\n redirect_to root_path\n end\n end",
"def show?\n @current_user.permission('Bid', :guest)\n end",
"def allow_sign_up?\n @allow_sign_up\n end",
"def active_for_authentication?\n super && !banned?\n end",
"def active_for_authentication?\n super && !suspended_account\n end",
"def permitted?; end",
"def active_for_authentication?\n super && approved?\n end",
"def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end",
"def require_admin \n if Affiliate.find(session[:id]).email != \"tech@trunkclub.com\"\n redirect_to root_url, :notice => 'Must be admin.'\n end\n end",
"def set_reg_modifications_allowed(allow = true)\n if allow\n cookies.signed[:user_permissions] = {\n value: \"yes\",\n expires: 24.hours.from_now\n }\n else\n cookies.delete :user_permissions\n end\n end",
"def set_reg_modifications_allowed(allow = true)\n if allow\n cookies.signed[:user_permissions] = {\n value: \"yes\",\n expires: 24.hours.from_now\n }\n else\n cookies.delete :user_permissions\n end\n end",
"def user_access_control\n bot = Bot.find(params[:id])\n\n if current_user.admin?\n @bot = User.find(bot.account.user_id).admin? ? current_user.bots.find(params[:id]) : bot\n else\n @bot = current_user.bots.find(params[:id])\n end\n\n rescue\n response_access_denied\n end",
"def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end",
"def check_user\n unless user_signed_in?\n redirect_to root_url, alert: \"Sorry, only authorized users can add.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def active_for_authentication? \n super && (approved? || self.admin) \n end",
"def active_for_authentication?\n super && bloqueado == 0\n end",
"def require_user\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end",
"def admin_required\n #just a patch until i can implement users and roles\n \n # \"Speak friend, and enter\" (Moria)\n session[:friend] ||= params[:friend]\n session[:friend] || redirect_to(home_path)\n end",
"def can_edit_users?\n ['reseller', 'admin'].include?(session[:usertype]) or session[:acc_user_manage].to_i == 2\n end",
"def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end",
"def can?\n current_user\n end",
"def authorization_required\n\n return true if is_admin?\n\n if !is_me?(@user)\n flash[:notice] = \"You don't have permission to do that.\"\n permission_denied\n false\n end\n end",
"def require_ownership\n\t\tunless current_user\n\t\t\tredirect_to login_path\n\t\tend\n\tend",
"def match_user\n unless admin?\n user = User.find(current_user)\n\n unless user.id == set_user.id\n redirect_to user_path(current_user), notice: 'You do not have any permission to grant this page !'\n end\n end\n end",
"def user_access\n @bot = current_user.admin? ? Bot.find(params[:id]) : current_user.bots.find(params[:id])\n\n check_user_access(@bot.account.user_id)\n\n rescue\n flash_access_denied\n end",
"def show\n # authorize Admin\n end",
"def check_manager_or_admin\n unless current_user && (current_user.privilege_manager? || current_user.privilege_admin?)\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def active_for_authentication?\n super && self.enabled? && self.is_allowed_in?\n end",
"def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end",
"def access_required_member\n\tlogger.debug session.to_yaml\n\t\tredirect_to '/access_denied.html' and return unless session[\"user_#{current_user.id}\"][:access_level] >= Role.access_level('Member')\n\tend",
"def can_log_in?\n !disabled\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def manage?\n @user && @user.is_admin?\n end",
"def check_access\n if not user_signed_in?\n redirect_to('/users/sign_in')\n end\n end",
"def active_for_authentication? \n super && is_approved? \n end",
"def admin_auth\n\t\tif signed_out?\n deny_access \"You must sign in first.\"\t\t\t\n\t\telse\n\t deny_access \"You must be an admin to perform that action.\" unless current_user.admin\n\t\tend\n end",
"def is_potential_user?\n\t\ttrue\n\tend",
"def active_for_authentication?\n super && account_active?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end",
"def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end",
"def authorize_user_as_member_of_paid_account!\n railse CanCan::AccessDenied if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?) \n # handle_unauthorized_access if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?)\n end",
"def user_authorize\n if session[:user_id]\n return true\n else\n redirect_to new_session_path\n return false\n end\n end",
"def permitted?\n appctrl_not_permitted() if ( @current_user.restricted? )\n end",
"def authorize?(user)\n user && user.moderator?\n end",
"def rollcall_admin_required\n if current_user.is_rollcall_admin?\n return true\n else\n redirect_to :action => \"unauthorized\", :controller => 'rollcall/rollcall_app'\n return false\n end\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def active_for_authentication?\n super && !deleted? && approved?\n end",
"def active_for_authentication?\n super && !deleted? && approved?\n end",
"def ensure_user_has_rights\n redirect_to root_path unless current_user\n end",
"def is_valid?\n self.current_user && (self.user == self.current_user || self.current_user.admin?)\n end"
] |
[
"0.7012217",
"0.67214894",
"0.6632757",
"0.6624118",
"0.65385675",
"0.65361595",
"0.65332615",
"0.6531607",
"0.65237486",
"0.65136564",
"0.6470299",
"0.64487445",
"0.64463395",
"0.642896",
"0.64105314",
"0.64040375",
"0.6395701",
"0.6395701",
"0.63791597",
"0.63746303",
"0.6359048",
"0.63538283",
"0.6342807",
"0.632729",
"0.6325905",
"0.63130105",
"0.63097787",
"0.6308127",
"0.63072973",
"0.6303772",
"0.63030154",
"0.62907714",
"0.62768227",
"0.6275389",
"0.626602",
"0.62552464",
"0.6251168",
"0.6248",
"0.6245438",
"0.6240051",
"0.6239853",
"0.6237667",
"0.62203574",
"0.62203574",
"0.62178004",
"0.62168026",
"0.6216592",
"0.6210062",
"0.6210062",
"0.6210062",
"0.6210062",
"0.620572",
"0.62054104",
"0.6197855",
"0.61960745",
"0.619472",
"0.619472",
"0.619472",
"0.619472",
"0.619472",
"0.619472",
"0.619472",
"0.61938757",
"0.6183649",
"0.6181192",
"0.61797833",
"0.61790645",
"0.6177068",
"0.61646605",
"0.6160625",
"0.6150082",
"0.6149689",
"0.61463356",
"0.6144398",
"0.6139922",
"0.61376876",
"0.613761",
"0.6137067",
"0.61315405",
"0.61309206",
"0.6129905",
"0.6128611",
"0.6115367",
"0.6113593",
"0.61129385",
"0.61129385",
"0.61129385",
"0.61104906",
"0.61035615",
"0.61025816",
"0.6101635",
"0.61010873",
"0.60970205",
"0.6095116",
"0.6085568",
"0.6085568",
"0.6083851",
"0.6083851",
"0.6083607",
"0.6080325"
] |
0.644266
|
13
|
Redirect users in accounts in bad standing to billing page
|
def check_access
redirect_to billing_path, flash: { error: "Your account is inactive. Access will be restored once payment succeeds." } if current_account.try(:inactive?)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def redirect_if_not_active\n unless current_user.status == :paid\n redirect_to action: \"choose_plan\"\n end\n end",
"def redirect_from_hop\n if session[:pay_post_made]\n if current_user and current_user.orders.order('created_at DESC').first\n order = current_user.orders.order('created_at DESC').first\n if order.paid?\n flash[:success] = \"You successfully purchased, \" # + fill in what user purchased\n else\n flash[:fail] = \"Uh oh, your purchase was not completed. Your credit card was not charged. Your cart will retain the items you original wanted to purchase.<br><br><b>Please verify that you entered your credit card information correctly and try again.</b> If the Problem persists please contact the administrator.\".html_safe\n end\n end\n session[:pay_post_made] = nil\n end\n #redirect to index of all payments\n redirect_to payments_path\n end",
"def redirect_if_active\n if current_user.status == :paid || current_user.status == :cancelled\n redirect_to action: \"choose_plan\"\n end\n end",
"def require_active_account\n get_current_account_and_membership\n return user_not_authorized unless @current_account\n\n if @current_account.billing_error?\n if @current_membership.owner?\n redirect_to account_billing_path(@current_account), alert: 'Your account is past due. Please enter payment details to reactivate.'\n else\n redirect_to account_past_due_path(@current_account), alert: \"This account is past due. Please contact your account owner (#{@current_account.owner.first_name} #{@current_account.owner.last_name}).\"\n end\n end\n end",
"def check_account_filling\n return unless depricated_page?\n\n redirect_to edit_account_path(current_account) unless\n request.get? &&\n current_user&.valid? &&\n current_account&.valid?\n end",
"def redirect\n # Request the ChargeBee server about the Update Card Hosted Page status \n # and provides details about the subscripton and customer.\n \n if \"succeeded\" == params[\"state\"]\n result = ChargeBee::HostedPage.retrieve(params[\"id\"])\n hosted_page = result.hosted_page\n if hosted_page.state != \"succeeded\"\n redirect_to \"/400\"\n return\n end\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_card/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end",
"def verify_primary_account_holder\n redirect_to dashboard_path and return\n end",
"def check_account\n \tif session[:username]\n \t\t@current_user = Account.find_by_username(session[:username])\n \t\t\n \t\tif @current_user\n \t\t\t\n \t\t\tif @current_user.expires_at <= DateTime.now\n\t\t\t\tredirect_to :controller => 'account', :action => 'expired'\n\t\t\tend\n \t\telse \t\t\t\n\t \t\tredirect_to :controller => 'marketing', :action => 'index'\n \t\tend\n \telse\n \t\tunless params[:controller] == 'marketing' || params[:controller] == 'account'\n\t \t\tredirect_to :controller => 'marketing', :action => 'index'\n\t\tend\n \tend\n end",
"def redirect_path\r\n if !(@target =~ /invoice/i).nil?\r\n redirect_to new_invoice_path\r\n else\r\n redirect_to @account\r\n end\r\n end",
"def redirect_to_current_account\n redirect_to account_url(username: current_account.username) and return unless current_account.username.blank?\n redirect_to new_username_url\n end",
"def post_billing(req)\n with_stripe_error_handlers do\n dealership = update_dealership(req)\n live_domain = Lynr.config('app').fetch(:live_domain, 'www.lynr.co')\n req.session.destroy\n Lynr::Events.emit(type: 'dealership.upgraded', dealership_id: dealership.id.to_s)\n redirect \"https://#{live_domain}/signin/#{token(req).id}\", 302\n end\n end",
"def redirect_handler\n id = params['id']\n result = ChargeBee::HostedPage.retrieve(id)\n if result.hosted_page.state == \"succeeded\"\n redirect_to \"/ssp/subscription\"\n else \n redirect_to \"/400\"\n end\n end",
"def bounce\n redirect_to users_path unless current_user\n end",
"def myaccount\n redirect_to user_path(current_user)\n end",
"def collect_billing_info\n return if self.class.to_s.match(/^Devise/) # Don't prevent logins, etc.\n return if request.path.match(/^\\/saas_admin/) # Admins don't need to pay\n return unless account = current_account # Nothing to do if there is no account\n return if !(sub = account.subscription) || sub.state.nil?\n return if sub.state == 'active' && sub.current? && !sub.needs_payment_info?\n return if sub.state == 'trial' && (!Saas::Config.require_payment_info_for_trials || !sub.needs_payment_info?)\n redirect_to billing_account_path\n end",
"def redirect\n \n if \"succeeded\" == params[\"state\"]\n # Acknowledge the update payment method hosted page id passed in return URL. \n # The response will have customer and their masked payment details.\n result = ChargeBee::HostedPage.acknowledge(params[\"id\"])\n hosted_page = result.hosted_page\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_payment_method/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end",
"def redirect_csrs\n if current_user6.email != \"admin\"\n redirect_to action: \"list\"\n end\n end",
"def verify_action\n if current_user.customer?\n redirect_to root_url\n end\n end",
"def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n if admin_user_pending?\n redirect_to activate_path(@user.activation_code)\n else\n flash[:notice] = 'Your billing information has been updated'\n redirect_to :action => \"billing\"\n end\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end",
"def users_only\n redirect_to band_path(current_user.accountable) if is_band\n end",
"def show\n # fix login bug that redirects to accounts/1\n @account = Account.find(params[:id]) \n\n # if current_user && current_user.email.present? && current_user.email.ends_with?('_admin@leadplace.com')\n # current_user.update_attribute :admin, true\n # end\n\n @buying = session[:feewise_inproc_buying]\n @purchase_preference = current_user.purchase_preference if !current_user.blank?\n\n begin\n # Rails.env.production? || Rails.env.staging? do\n#### logger.warn \"Sending email to: #{current_user.email} subject: #{current_user.full_name} has signed up\"\n#### UserMailer.welcome_email(current_user).deliver if current_user\n # end\n rescue Exception => e\n note = \"Attempted to notify feewise that there is a paying customer but email failed for #{current_user.full_name} #{current_user.email}\"\n logger.error note\n Bulletin.create! :body => note, :kind => 'error'\n errors.add :base, \"There was a problem notifying Feewise of your request. Your request will be resent until it is acknowledged. Thank you! Feel free to contact us by phone. We want you to have the most timely service \"\n end\n redirect_to PurchaseFlow.step_path(2, @purchase_preference) and return if @buying && current_user\n\n if !@buying && current_user\n render :show and return\n else\n redirect_to admin_root_path\n end\n\n end",
"def index\n redirect_to accounts_path, notice:'Entries can only be accsessed through Accounts'\n end",
"def index\n redirect_to :action => 'request_bill'\n end",
"def company_active?\n if !@company.blank? && !@company.active? && !@company.plan.free_plan?\n flash[:error] = \"Your subscription has been deactivated, renew your subscription to activate again.\".html_safe\n redirect_to \"/billing/index\"\n end\n end",
"def plan_only\n unless current_user\n redirect_to \"/\", :alert => \"Access denied. You must be a member to suggest a charity. Explore with us as a member now for free.\"\n end\n end",
"def validate_merchant\n redirect_to merchants_login_path unless is_merchant_logged_in?\n end",
"def create\n billing_record = GatewayTransaction.gateway.start( current_user, request )\n if current_user.power_plan? || billing_record.new_record?\n redirect_to :action => :error, :s => billing_record.plan_id.nil? ? 0 : 1\n else\n redirect_to billing_record.premium_link\n end\n end",
"def generate_bill\n if !user_signed_in?\n render :js => \"window.location = '/users/sign_in'\"\n end\n end",
"def confirm_own_account_page\n #\t unless ((@user_id == session[:user_id])||(session[:admin]))\n # \t\tflash[:notice] = \"That URL is not for your account!\"\n #\t\t redirect_to(user_path( :id => session[:user_id]))\n #\t end\n end",
"def checkaccount(user)\n return unless user\n\n link = user.service\n if (link == 'Both' && !user.sel_detail && !current_page?('/both_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\")) ||\n (link == 'customer' && !user.cus_detail && !current_page?('/cus_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\"))\n render 'layouts/checkaccount'\n end\n end",
"def paid_shop?\n @shop ||= Shop.find(params[:id])\n redirect_to billing_index_path unless @shop.paid\n end",
"def my_account\r\n if !logged_in?\r\n redirect_to :controller=>'user' , :action=>'list'\r\n end\r\n end",
"def check_user\n if current_user.type != \"Buyer\" \n redirect_to root_url, :alert => \"Please create a buyer account to view this page\"\n end\n end",
"def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice] = \"You don't have permission to view that page!\"\n # redirect_to current_user\n # return\n # end\n\n end",
"def place_order\n \n @job = Job.find(params[:job_id])\n fetch_decrypted(@job)\n \n if @logged_user.credits > 0\n render(:action => \"confirm_order\")\n return\n else\n #place order will have our paypal buttons\n render(:action => \"place_order\")\n return\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"Buying credits for fun?\"\n redirect_to :action => \"profile\"\n end",
"def paid_user_verify(partner)\n go_to_plan(partner) # my plan page\n go_to_devices(partner) # devices\n go_to_profile(partner) # profile page\n go_to_downloads(partner)\n go_to_stash(partner)\n go_to_acct(partner) # default is to load this page w/o a 'go to account' link\n end",
"def index\n if current_user.amount.nil?\n redirect_to users_p20_path(current_user.id)\n else\n redirect_to user_path(current_user.id)\n end\n end",
"def check_if_user_access_transactions\n if current_user && current_user.admin?\n @transactions = Transaction.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n end\n end",
"def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end",
"def access_denied\n redirect_to(new_account_login_path)\n end",
"def correct_account\n @post = Post.find(params[:id])\n redirect_to(root_path) unless current_account.fullname == @post.username\n\n\n # @account = Account.find(params[:id])\n # redirect_to(root_path) unless current_account == @account\n end",
"def checkCCN\n if !session[:paid]\n redirect_to bikes_path\n end\n end",
"def show\n # if !current_user\n # redirect_to \"Sign Up\", new_user_registration_path\n # else\n # @bill = Bill.get_bill\n # end\n @bill = Bill.find(params[:id])\n end",
"def paypal_return\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n #render :text => params \r\n if Purchase.exists?(params[:id])\r\n redirect_to(:action=>'order_confirmed/'+params[:id].to_s)\r\n else\r\n flash[:notice] = I18n.t 'event.purchase.pur_can'\r\n redirect_to(:controller => 'home', :action=>'index') \r\n end \r\n end",
"def return_url\n @transaction = Bancard::Transaction.find(params[:id])\n if params[:status] == \"payment_fail\"\n flash[:error] = \"Error al recibir el pago\"\n redirect_to @transaction.failure_url\n else\n flash[:notice] = \"Pagado exitosamente\"\n redirect_to @transaction.success_url\n end\n end",
"def accounts_not_available\n flash[:warning] = I18n.t(:user_system_down)\n redirect_to root_url\n end",
"def show\n redirect_to @bussiness.user\n end",
"def purchase\r\n redirect_to \"http://www.1shoppingcart.com/app/javanof.asp?MerchantID=31593&ProductID=3257357\"\r\n end",
"def redirect_to_404_if_not_authorized\n\n # Admin should not be allowed to act like a regular user, i.e. view personal accounts, transactions, etc.\n redirect_to_login_if_admin\n\n # If the user calls the index for their account, it's a GET request identifying the user by the session, hence not no need for further authentication\n unless(params.has_key?(:account_id))\n return\n end\n\n # Authentication for transactions for a specific account, authentication needs to be done\n unless(params.has_key?(:account_id) && Account.exists?(params[:account_id]) && Account.find(params[:account_id]).user_id == current_user.id)\n redirect_to_404 # Render 404 page\n end\n end",
"def check_destination(charge)\n # Redirect to the dashboard if the charge doesn't belong to current user\n unless charge.destination.eql?(current_user.stripe_account)\n flash[:error] = \"You don't have access to this charge.\"\n redirect_to dashboard_path\n end\n end",
"def correct_user\n @user = Customer.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def redirect_verified_users\n if current_user.account_verified\n redirect_to root_path and return\n end\n end",
"def show\n # check that the current user has access to the account page\n if !@account.users.include?(current_user) and current_user != @account.user\n flash[:notice] = 'You do not have access to that, please sign in again'\n sign_out current_user\n redirect_to new_user_session_path\n else\n @accounts = current_user.accounts\n @transactions = @account.transactionSummary.reverse\n @auto_payment = @account.auto_bill_payments.new\n end\n end",
"def redirect\n redirect_to volunteershome_url if current_user.volunteer?\n redirect_to serviceusershome_url if current_user.service_user?\n show_browser_alert\n end",
"def guest_checkout\n @customer = Customer.new\n redirect_to new_customer_path, :alert => t('store.errors.guest_checkout_not_allowed') unless allow_guest_checkout?\n end",
"def redirect_if_active_or_not_pending\n if @bar.active or !@bar.pending\n flash[:error] = t(\"global.access_denied\")\n redirect_to root_url\n end\n end",
"def free_user_verify(partner)\n go_to_referrals(partner) # referrals page, they have a free plan\n go_to_upgrade(partner) # this page takes them into phoenix\n go_to_devices(partner) # devices\n go_to_downloads(partner)\n go_to_stash(partner)\n go_to_acct(partner) # default is to load this page w/o a 'go to account' link\n end",
"def guest_checkout\n redirect_to checkout_path and return if current_user || current_order.guest_checkout?\n \n if current_order.enable_guest_checkout\n redirect_to checkout_path\n else\n redirect_to checkout_registration_url\n end\n end",
"def redirect_path\n if @bank_dup.present?\n latest_ofxes_path\n elsif session[:current_acct].present?\n account_path(session[:current_acct])\n else\n account_path(@entry.splits.order(:id).first.account)\n end\n end",
"def redirect_for_inactive\n if @connection.contact.deactivated?\n flash[:error] = \"Invalid connection request: person deactivated\"\n redirect_to home_url\n end\n end",
"def index\n redirect_to account_path\n end",
"def redirect_back_or_default_with_account(default)\n if logged_in? && session[:return_to] =~ /^\\/dt\\/accounts\\/false/\n session[:return_to].sub!(/^\\/dt\\/accounts\\/false/, \"/dt/accounts/#{current_user.id}\")\n end\n redirect_back_or_default_without_account(default)\n end",
"def redirect_user_to_dashboard\n redirect_to dashboard_path if current_contact\n end",
"def show\n redirect_to account_details_home_path(id: @account) and return\n end",
"def index\n if buyer_signed_in? || seller_signed_in?\n redirect_to '/offers'\n end\n end",
"def reactivate\n plan = Billingly::Plan.find_by_id(params[:plan_id])\n if current_customer.reactivate(plan).nil?\n return render nothing: true, status: 403\n end\n on_reactivation_success\n end",
"def reactivate\n plan = Billingly::Plan.find_by_id(params[:plan_id])\n if current_customer.reactivate(plan).nil?\n return render nothing: true, status: 403\n end\n on_reactivation_success\n end",
"def landing\n redirect_to dashboard_path if current_user\n end",
"def redirect_if_not_admin_or_owner\n if current_user\n if !(self_account? || current_user.admin)\n redirect_back fallback_location: user_path(current_user), alert: \"You requested the page only the owner can access.\"\n end\n end\n end",
"def snapify!\r\n\tif !current_user.delivery\r\n\t\tredirect \"/dashboard\"\r\n\tend\r\nend",
"def check_user_account!\n if(current_user.present? && (current_user.service_type == 'pending' || !current_user.is_active?))\n service_type = current_user.service_type\n sign_out(current_user)\n redirect_to root_path, :flash => {:notice => \"Your account is in waiting list for approval by Aa Express Staff.You will be notified when your account is ready.\"} and return if service_type == 'pending'\n redirect_to root_path, :flash => {:notice => \"Your account is de-activated by Aa Express Staff, please contact to Aa Express Staff for account activation.\"}\n end\n end",
"def authorize\n transaction = GatewayTransaction.gateway.authorize( request )\n landing_url = transaction.success? ? GatewayTransaction.gateway.success_url( transaction ) : GatewayTransaction.gateway.error_url( transaction )\n redirect_to landing_url\n end",
"def custom_redirect\n redirect_to('https://carto.com/signin/') if CartoDB.extract_subdomain(request) == 'developers'\n end",
"def link_form\n @purchase = Purchase.find_by_id params[:id]\n if !@purchase\n redirect_to '/admin/purchases'\n return\n end\n end",
"def invalid_tenant\n flash[:error] = \"Wrong tenant access\"\n redirect_back\n end",
"def check_user\n\n redirect_to root_path if current_user == nil\n if current_user \n redirect_to root_path if current_user.vendor == false\n end\n end",
"def bill_to_existing\n address = Address.find params[:id]\n unless address.customer_id.eql?(@customer.id)\n redirect_to :controller=>'cart', :action=>'billing_address'\n return\n end\n @cart.billing_address = address\n @cart.save\n redirect_to build_url_options_for_checkout\n end",
"def landing_page\n if current_user\n redirect_to actions_path(current_user[:id])\n end\n end",
"def home_check\n if logged_in? && @current_user.admin?\n puts @current_user\n redirect_to account_url(@current_user.id)\n return\n elsif logged_in?\n redirect_to cases_path\n else\n redirect_to page_path(\"home\")\n return\n end\n end",
"def paypal\n if params[:token]\n if @subscription.complete_paypal(params[:token])\n login_and_email\n render :action => :thanks\n else\n render :action => 'billing'\n end\n else\n redirect_to :action => \"billing\"\n end\n end",
"def active_customer\n if (current_customer && !current_customer.active?)\n redirect_to(job_requests_url)\n end\n end",
"def ensure_correct_user!\n @member = Member.find(params[:id])\n @user = @member.warband.user\n redirect_to(user_path(current_user), :alert => \"You may not perform this action on another user's Warband member!\") and return unless current_user?(@user)\n end",
"def show\n redirect_to :root unless @participation.state == \"paid\"\n end",
"def check_registration\n return if current_user || current_order.guest_checkout?\n store_location\n redirect_to checkout_registration_path \n end",
"def correct_customer\n @customer = Customer.find(params[:id])\n redirect_to(root_url) unless current_customer?(@customer)\n end",
"def landing\n if student_signed_in?\n redirect_to shops_path\n elsif shop_signed_in?\n redirect_to current_shop\n end\n end",
"def correct_user\n @order = current_user.orders.find_by(id: params[:id])\n redirect_to root_url if @order.nil?\n end",
"def check_for_pending_account\n user = User.pending.find_by_login(params[:login]) || User.pending.find_by_identity_url(params[:openid_identifier])\n user = nil unless (user && user.authenticated?(params[:password])) unless params[:openid_identifier]\n flash.now[:notice] = 'Please activate your account first by clicking on the link emailed to you' if user\n end",
"def confirm\n @model = User::BillingLog.find params[:id]\n @billable = @model.billable\n\n authorize @model\n\n if request.post?\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::BALANCE\n case @billable.class.name\n when 'Billing::Delocoin::Buy'\n run Billing::Delocoin::Buy::Operation::Finish, id: @billable.id do |result|\n roistat.push_async(:delocoin_buy_finish, cost: result['model'].cost)\n end\n\n return redirect_to status_my_billing_path(@model.billing_log.id)\n end\n end\n\n not_found\n end\n\n case @billable.pay_type.to_sym\n when *Billing::PaymentTypeList::YANDEX_KASSA\n @fields = Billing::YandexKassa::RequestFieldsService.new(@billable).perform\n\n render 'my/billing/confirm/yandex_kassa'\n when *Billing::PaymentTypeList::BALANCE\n render 'my/billing/confirm/balance'\n else\n not_found\n end\n end",
"def redirecionar_usuario_logado\n if current_account != nil \n redirect_to accounts_url\n end\n end",
"def payout\n\t\t# if !current_user.merchant_id.blank?\n # \t\t\taccount = Stripe::Account.retrieve(current_user.merchant_id)\n # \t\t\t@login_link = account.login_links.create()\n\t\t# end\n end",
"def index\n if(current_user.company && (current_user.check_payment_status? == true || (current_user.check_payment_status? == false && current_user.company.membership.is_trial_period_allowed?)))\n load_instances\n if current_user.check_payment_status? == false\n current_user.company.payments.create({:company_id => @company.id, :status => Payment::STATUS[:success], :vendor => \"Free Trial Period\", :amount => 0})\n flash[:notice] = \"Your brand #{current_user.company.name} for which payment is pending is upgraded to free trail period of 30-days\"\n end\n elsif current_user.company && current_user.check_payment_status? == false\n @no_post_panel = true\n redirect_to payment_options_users_path(:membership_id => current_user.company.membership_id, :user_id => current_user.id, :from_company => true)\n else\n render :partial => \"shared/company/business_plan\", :layout => \"application\"\n end\n end",
"def admin_customer\n redirect_to(root_url) unless current_customer.admin?\n end",
"def show\n if current_user && current_user.admin?\n else\n #flash[:notice] = \"No such page exists\"\n redirect_to new_sponsorship_path\n end \n end",
"def redirect_to_appropriate_page_after_sign_in\n if params[:redirect_back_url]\n redirect_to params[:redirect_back_url]+\"?auth_token=#{@current_user.auth_token}\"\n else\n redirect_to default_redirect_url_after_sign_in\n end\n return\n end",
"def correct_customer\n @customer = Customer.find(params[:id])\n redirect_to(root_url) unless @customer == current_customer\n end",
"def purchase_events_existing_card_couple\n\n @number = params[:peu][:number]\n coupon = params[:peu][:coupon] # this is the coupon name/code, a string\n cost = params[:peu][:cost]\n\n # retrieve stripe customer object (downstream from user having a customer_id)\n c = Stripe::Customer.retrieve(current_user.customer_id)\n \n if existing_customer_purchase_events_existing_card(@number, cost, coupon)\n #if the customer had a coupon, update that coupon to be inactive, and attach customer's user id to it\n #if !coupon.blank?\n # redeem_single_use_coupon(coupon)\n #end \n flash[:success] = \"Thank you! You have purchased #{@number} VoiceGems pages.\"\n redirect_to current_user\n else #errors in processing the card shouldn't usually happen, because the card was originally ok. Can test by using stripes card number that binds to customer but does not charge correctly.\n # YES THE REDIRECT WORKS WITH THAT STRIPE TESTING NUMBER\n redirect_to existing_couple_purchase_select_path({:peu => {:number => @number }, :coupon => coupon})\n end \n\nend",
"def redirect_to_overview\n if current_order.confirming?\n redirect_to wizard_path(:overview) and return unless step == :overview\n end\n end",
"def redirect_for_inactive\n if @connection.contact.deactivated?\n flash[:error] = t('connections.flash.error.invalid')\n redirect_to home_url\n end\n end",
"def public_url\n # the public url will go through the normal API unless it's BorderGuru which we have to scrap locally\n # to remove elements.\n if order_tracking.delivery_provider == \"borderguru\"\n redirect_to guest_order_tracking_public_borderguru_path(order_tracking)\n else\n redirect_to tracking_handler.api_gateway.public_url(callback_url: navigation.with_url.back(1))\n end\n end"
] |
[
"0.6979145",
"0.6678717",
"0.66289866",
"0.6368841",
"0.634281",
"0.6341985",
"0.63417107",
"0.6301136",
"0.6294412",
"0.62793434",
"0.62494624",
"0.621584",
"0.6197758",
"0.61514485",
"0.61498094",
"0.6146709",
"0.61345613",
"0.60887116",
"0.60686517",
"0.6066532",
"0.6042676",
"0.6036501",
"0.6033536",
"0.60328156",
"0.60242975",
"0.602151",
"0.6007465",
"0.60047233",
"0.5998525",
"0.59819645",
"0.5974319",
"0.597187",
"0.59636796",
"0.5959642",
"0.589903",
"0.5893058",
"0.58701193",
"0.58687097",
"0.5860146",
"0.58597904",
"0.58518153",
"0.58478916",
"0.58360654",
"0.58311933",
"0.58146507",
"0.579651",
"0.5793259",
"0.5792672",
"0.5787104",
"0.5784257",
"0.5782126",
"0.57798326",
"0.5774244",
"0.5748923",
"0.57361275",
"0.5731497",
"0.5730307",
"0.57235",
"0.5710184",
"0.570818",
"0.57061803",
"0.5704559",
"0.5703665",
"0.56996626",
"0.569854",
"0.56959814",
"0.56959814",
"0.5695613",
"0.56879896",
"0.56744164",
"0.56616193",
"0.56612945",
"0.56589305",
"0.56405973",
"0.5637927",
"0.5635684",
"0.5626488",
"0.5625504",
"0.5619605",
"0.56161964",
"0.5614393",
"0.5613102",
"0.5606044",
"0.5603733",
"0.5596897",
"0.5589476",
"0.5580065",
"0.55752534",
"0.5573452",
"0.5571304",
"0.5567041",
"0.5566335",
"0.5557277",
"0.5557259",
"0.55568445",
"0.55551505",
"0.5554861",
"0.55534256",
"0.5549914",
"0.55392885"
] |
0.7094632
|
0
|
returns the users for the project.
|
def users
set_attributes_for(User)
User.find(:all)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getUsers(projectId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/users/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap)\t\t\r\n\t\t\t\treturn $userParser.getUsers(response)\r\n\t\t\tend",
"def users\n @users_collection ||= DataStore.users_for_project(self)\n end",
"def get_project_users(project_oid)\n project_users_url = make_project_users_url(project_oid)\n args = {:method => :get}\n params = {:fetch => \"UserName\", :order=> \"UserName ASC\"}\n results_json = @rally_json_connection.get_all_json_results(project_users_url, args, params, limit = 99999)\n\n these_project_users = []\n results = results_json[\"QueryResult\"][\"Results\"]\n results.each do | this_user_hash |\n username = this_user_hash[\"UserName\"]\n user = find_user(username)\n these_project_users.push(user)\n end\n return these_project_users\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def get_project_users(project_id_or_key)\n get(\"projects/#{project_id_or_key}/users\")\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def projects_users\n all_users_ids = projects.map { |project| project.user_ids }\n all_users_ids.flatten!\n all_users_ids.uniq!\n User.all(conditions: {:_id.in => all_users_ids})\n end",
"def project_users\n request :user\n end",
"def get_users\n if @project\n if ProjectUser.verify_role(current_user.id, @project, 'client')\n render json: @project.project_users, status: 200\n else\n render json: { error: 'You must be a member of a project to see its content' }, status: :unauthorized\n end\n else\n render json: { error: \"no project found with id of #{params[:id]}\" }, status: 404\n end\n end",
"def users\n @users ||= begin\n users = client.team_members ENV[\"GITHUB_TEAM_ID\"], :per_page => 100\n while client.last_response.rels[:next] && client.rate_limit.remaining > 0\n users.concat client.get client.last_response.rels[:next].href\n end\n users.map { |u| User.new u[:login] }\n end\n end",
"def users\n users = Backlogjp.base._command \"getUsers\", self.id\n users.map {|hash| User.new(hash)}\n end",
"def project_users(project = 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 # Check that a project slug was passed\n unless project\n return Hash[@error =>\n 'Missing project slug, please include in method call']\n end\n\n # Construct query url\n url = format('%s/projects/%s?token=%s', @baseurl, project, @token)\n # Return valid user object if in test mode\n if @test\n m = MockTimeSync.new\n return m.project_users\n end\n # Try to get the project object\n begin\n # Success!\n response = RestClient.get(url)\n project_object = response_to_ruby(response.body, response.code)\n rescue => e\n # Request Error\n return Hash[@error => e]\n end\n\n # Create the user dict to return\n # There was an error, don't do anything with it, return as a list\n return project_object if project_object.key?('error')\n\n # Get the user object from the project\n users = project_object['users']\n\n # Convert the nested permissions dict to a list containing only\n # relevant (true) permissions\n\n rv = Hash[]\n\n users.each do |user, permissions|\n rv_perms = Array[]\n permissions.each do |perm, value|\n rv_perms.push(perm) if value\n end\n rv[user] = rv_perms\n end\n\n rv\n end",
"def project_users(project_id, params = {})\n make_get_request(\"/projects/#{project_id}/users\", params)\n end",
"def authorized_users\n ProjectAuthorization.select(:user_id).where(project_id: project_ids)\n end",
"def get_users\n users = call(CMD_GET_USERS)[:users]\n users.map {|account| User.new(account) }\n end",
"def index\n @project_users = ProjectUser.all\n end",
"def users\n return @users\n end",
"def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end",
"def show\n @project_users = @project.users\n end",
"def users\n if design.only_unblinded\n project.unblinded_members_for_site(subject.site)\n else\n project.members_for_site(subject.site)\n end\n end",
"def users\n res = []\n\n tmp = GoodData.get @json['project']['links']['users']\n tmp['users'].map do |user|\n res << GoodData::Membership.new(user)\n end\n\n res\n end",
"def users\n @users\n end",
"def list\n get('users')['users']\n end",
"def all_users()\n User.all\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end",
"def index()\n @projects = Project.where(:id => Team.select(:project_id).where(user_id: session[:user_id] ).map(&:project_id))\n \n @users = User.all\n end",
"def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end",
"def users\n @users_by_href.values\n end",
"def users\n @users ||= AssociationProxies::ProjectUsers.new(self)\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end",
"def users\n User.where(network_id: context[:current_network]&.id)\n end",
"def roles_users_list(project)\r\n return [] unless project\r\n roles_users = project.users_by_role.sort.map {|t| [t[0], t[1].sort{|a,b| a.login <=> b.login}] }\r\n if @roles && @roles.any?\r\n return roles_users.delete_if{|t| !t[0].id.in?(@role_ids)}\r\n else\r\n return roles_users\r\n end\r\n end",
"def users\n get('get_users')\n end",
"def get_repo_users\n repo_users = Array.new\n github = Github.new :oauth_token => github_token\n\n github.repos.list.body.each do |repo|\n repo_users << repo[\"owner\"][\"login\"]\n end\n\n repo_users\n end",
"def returning_users\n []\n end",
"def users\n result_hash['usr']\n end",
"def all_redmine_users()\n return @@redmine_cxn.all_users\n end",
"def users\n @users ||= rows.map { |r| UserImport::User.new(r) }\n end",
"def index\n\t\trender json: Project.find(params[:project_id]).users.map { |user| user.id }.join(\",\").to_json\n\tend",
"def users\n return [member_1, member_2];\n end",
"def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def users\n return @users_array\n \tend",
"def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end",
"def users\n gateway_check\n @users\n end",
"def index\n @users = User.all\n if current_user.pivitol_tracker_token != nil\n tracker_api = TrackerAPI.new\n @tracker_projects = tracker_api.projects(current_user.pivitol_tracker_token)\n end\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def get_all\n @user_repository.get_all_users\n end",
"def users_list\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('users/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tusers=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['users'].each_element('//user') { |user|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['name']=user.elements['name'].text\n\t\t\t\tentry['admin']=user.elements['admin'].text\n\t\t\t\tentry['lastlogin']=user.elements['lastlogin'].text\n\t\t\t\tusers.push(entry)\n\t\t\t}\n\t\t\treturn users\n\t\tend",
"def find_users\n if @dir.exist?\n return @dir.entries.each_with_object([]) do |entry, users|\n user_name = entry.basename\n user = User.new(user_name, self)\n if user.exist?\n users << user\n end\n end\n else\n return []\n end\n end",
"def users\n\t\tusers = []\n\t\trooms.each do |room|\n\t\t\troom.users.each do |user|\n\t\t\t\tusers << user\n\t\t\tend\n\t\tend\n\t\tusers\n\tend",
"def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end",
"def current_organization_users\n endpoint = '/api/org/users'\n @logger.debug(\"Getting organization users (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def list_users\n @users = User.find(:all)\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def users\n @users ||= Harvest::API::Users.new(credentials)\n end",
"def users()\n\t\t\t\tuserlist = UserList.new()\n\n\t\t\t\tFile.open('/etc/passwd', File::RDONLY) { |fp|\n\t\t\t\t\tregex = /^([a-zA-Z0-9-]+):[^:]+:([0-9]+):([0-9]+):([^:]*):([^:]*):([^:]*)$/\n\t\t\t\t\tfp.each_line() { |line|\n\t\t\t\t\t\tmatch = regex.match(line)\n\t\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\t\tuser = UserInfo.new()\n\t\t\t\t\t\t\tuser.username = match[1]\n\t\t\t\t\t\t\tuser.uid = match[2].to_i()\n\t\t\t\t\t\t\tuser.gid = match[3].to_i()\n\t\t\t\t\t\t\tuser.fullname = match[4]\n\t\t\t\t\t\t\tuser.homedir = match[5]\n\t\t\t\t\t\t\tuser.shell = match[6]\n\t\t\t\t\t\t\tuserlist[user.username] = user\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn(userlist)\n\t\t\tend",
"def getUsers() #:name, :default_currency, :locale\r\n returnArray = []\r\n retrieveData(\"/v1/users\")[\"data\"].each do |item|\r\n returnArray << User.new(item[\"name\"], item[\"default_currency\"], item[\"locale\"])\r\n end\r\n return returnArray\r\n end",
"def users\n @users = User.find(:all)\n end",
"def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end",
"def get_users\n res = search(@config[:userdn])\n \n if (res[:message] != \"Success\")\n # tbd handle error\n return nil\n end\n \n if (res[:values] == [])\n return nil\n end\n \n users = []\n \n res[:values].each do |user|\n begin\n uid = user.uidnumber.first\n gid = user.gidnumber.first\n rescue\n uid = 0\n gid = 0\n end\n \n users << {\n :username => user.uid.first,\n :uid => uid,\n :gid => gid,\n :first => user.givenname.first,\n :last => user.sn.first\n }\n end\n \n return users\n end",
"def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend",
"def users()\n\t\t\t\tusers = UserList.new()\n\n if dscl?\n # The dscl version is still limited\n idlist = `#{DSCLBIN} . -list /Users UniqueID`\n grouplist = `#{DSCLBIN} . -list /Users PrimaryGroupID`\n idlist.each do | line |\n user = UserInfo.new()\n name,id = line.split\n user.username = name\n user.uid = id.to_i\n users[name] = user\n end\n else\n # get the list of users using niutil\n textlist = `niutil -list . /users`\n textlist.each() { |line|\n line.strip!()\n user = UserInfo.new()\n user.username = line[/^[0-9]+\\s+(\\S+)$/, 1]\n userlist = `niutil -read . /users/#{user.username}`\n userlist.each() { |subline|\n subline.strip!()\n case(subline)\n when(/^home:/)\n user.homedir = subline[/:\\s*(.*)$/, 1]\n when(/^uid:/)\n user.uid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^gid:/)\n user.gid = subline[/:\\s*(.*)$/, 1].to_i()\n when(/^realname:/)\n user.fullname = subline[/:\\s*(.*)$/, 1]\n end\n }\n users[user.username] = user\n }\n end\n\t\t\t\treturn(users)\n\t\t\tend",
"def users_in_target_project\n @project.notification_settings.select(:user_id)\n end",
"def users\n gateway_check\n unavailable_servers_check\n @users\n end",
"def list_of_users\n\tusers=[]\n\tfor username in Dir.entries(\"/Users\")\n\t\tif !username.start_with?(\".\")\n\t\t\tusers.push(username)\n\t\tend\n\tend\n\treturn users\nend",
"def list_users\n BrickFTP::API::User.all\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def getAllApprovedUsers()\n users = [] \n docs = @usersColl.find({ \"approval_status.code\" => 1 }, { :username => 1 })\n index = 0\n docs.each do |doc|\n users[index] = doc[:username]\n index += 1\n end # End of docs iteration\n return users\n end",
"def get_all_user_names\n @user_manager.get_all_user_names\n end",
"def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end",
"def users\n signups.map do |signup|\n user_id = signup.user_id\n User.all.find {|user| user.id == user_id}\n end\n end",
"def public_users\n raw_users = GitHub::API.json(\"/organizations/#{self.login}/public_members\")['users']\n users = []\n\n raw_users.each do |user|\n users << GitHub::User.new(user)\n end\n\n return users\n end",
"def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end",
"def index\n get_logged_in_user\n @projects = Project.all.select {|project| project.user_id == logged_in_user_id }\n end",
"def users\n watches_unique_by_user.map(&:user)\n end",
"def users\n []\n end",
"def collaborators\n self.users.where(\"project_memberships.active = ?\", true)\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def users\n call(\"UserGroup\", \"get_user_collection_from_role\", \"roleName\" => @name).xpath(\"//spdir:User\", NS).map do |row|\n attributes = clean_attributes(row.attributes)\n User.new(@site, attributes[\"LoginName\"])\n end\n end",
"def getUsers\n return @Users \n end",
"def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def all_users\r\n result = []\r\n\r\n self.descendants_and_self.each do |role|\r\n if role == self\r\n result << role.users \r\n else\r\n result << role.all_users\r\n end\r\n end\r\n self.all_groups.each { |group| result << group.all_users }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end",
"def index\n @users = current_user.users\n end",
"def visible_users\n is_superadmin? ? User.all : title.users\n end",
"def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend",
"def users\n users = Set.new\n\n @channels.each do |channel|\n users.merge(channel.users)\n end\n\n users\n end",
"def users\n @attributes[:users]\n end",
"def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end",
"def list_users\n abort \"You have no users within your config file!\".yellow if config.empty?\n puts \"\\nUser Configuration\"\n config.each do |k, v|\n next if k == 'current_user'\n puts \"\\nEnvironment: #{k}\"\n print_hash_values v\n end\n\n list_current_user if current_user_exists?\n end",
"def getAllUsers()\n puts \"\\nUSERS:\"\n puts \"-------------------------------------------------\"\n @users.each {|user| puts \"ID: \" + user.id.to_s + \" Name: \" + user.name}\n puts \"-------------------------------------------------\"\n end",
"def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end",
"def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end",
"def active_users\n PullRequest.active_users(current_year)\n end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n res = []\n url = data['links']['roleUsers']\n tmp = GoodData.get url\n tmp['associatedUsers']['users'].each do |user_url|\n user = GoodData.get user_url\n res << GoodData::Profile.new(user)\n end\n res\n end",
"def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException, \"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\"\n end\n end\n users.uniq(&:id)\n end",
"def index\n @users = User.find_all_with_authorization(current_user)\n end",
"def edit_users\n return self[:edit_users] unless persisted?\n (self[:edit_users] + (Wayfinder.for(self).ephemera_project&.edit_users || [])).uniq\n end"
] |
[
"0.8190731",
"0.7951698",
"0.7932548",
"0.7911717",
"0.79039216",
"0.78936076",
"0.78936076",
"0.78934443",
"0.7852999",
"0.7758238",
"0.7667056",
"0.7590525",
"0.75703436",
"0.7509743",
"0.7407559",
"0.73978883",
"0.7393979",
"0.73749566",
"0.7363079",
"0.73381823",
"0.73380315",
"0.7313485",
"0.72592586",
"0.7252399",
"0.7225127",
"0.7225127",
"0.7208045",
"0.71477014",
"0.7143332",
"0.7126137",
"0.7116161",
"0.7097113",
"0.70877504",
"0.7086315",
"0.70828354",
"0.70774496",
"0.70619273",
"0.7044492",
"0.70259",
"0.7022058",
"0.70173293",
"0.7016855",
"0.70153207",
"0.7003371",
"0.70005393",
"0.6993108",
"0.69860923",
"0.6977033",
"0.69725764",
"0.69661736",
"0.6959641",
"0.69576216",
"0.6957203",
"0.69506115",
"0.6926131",
"0.69236195",
"0.69199467",
"0.69112194",
"0.6902513",
"0.6886332",
"0.68854636",
"0.68845606",
"0.68828845",
"0.68800503",
"0.6876077",
"0.6874774",
"0.6873595",
"0.6854554",
"0.6854554",
"0.6825924",
"0.68247193",
"0.6815992",
"0.68118423",
"0.6811784",
"0.6808799",
"0.6806308",
"0.6804473",
"0.68041104",
"0.6786117",
"0.678381",
"0.6777791",
"0.6750048",
"0.674288",
"0.6735594",
"0.67014116",
"0.6693085",
"0.6688645",
"0.6683734",
"0.6678432",
"0.6671361",
"0.665329",
"0.66351104",
"0.66319627",
"0.6631045",
"0.66291976",
"0.66236603",
"0.6618113",
"0.66132253",
"0.66070217",
"0.6603972",
"0.66003036"
] |
0.0
|
-1
|
returns the wikis for the project.
|
def wikis
set_attributes_for(Wiki)
Wiki.find(:all)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @wikifiles = Wikifile.all\n end",
"def wikinames\n $_wikinames ||= build_wikinames\n end",
"def index\n @doc_pu_wikis = @doc_pu.doc_pu_wiki_pages\n end",
"def index\n @wikis = Wiki.all\n end",
"def index\n @wikis = @project.wikis\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wikis }\n end\n end",
"def index\n @wikipages = Wikipage.all\n end",
"def index\n @wikipages = Wikipage.all\n end",
"def wiki(project, slug)\n get(\"/projects/#{url_encode project}/wikis/#{slug}\")\n end",
"def wikipedia\n uri = nil\n @artist_data[\"relations\"].each do |rel|\n if rel[\"type\"] == \"wikipedia\"\n uri = rel[\"url\"][\"resource\"]\n end\n end\n return uri\n end",
"def index\n #@wikis = Wiki.visible_wiki(current_user)\n @wikis = policy_scope(Wiki)\n end",
"def projects\n Harvest::Resources::Project\n end",
"def index\n @wikis = Wiki.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wikis }\n end\n end",
"def get_interwikis(min = nil, lllimit = 500)\n llcontinue = nil\n iws = Hash.new\n count = 0\n loop {\n result = @site.query_prop_langlinks(@normtitle, lllimit, llcontinue)\n if result['query']['pages']['page'].key?('missing')\n raise NoPage.new(), \"Page [[#{title}]] does not exist\"\n end\n if !result['query'].key?('interwikis')\n return nil\n end\n if result['query']['interwikis']['iw'].is_a? Array\n iws = iws + result['query']['interwikis']['iw']\n else\n iws.push(result['query']['interwikis']['iw'])\n end\n if result.key?('query-continue') && min && count < min\n count += lllimit\n llcontinue = result['query-continue']['langlinks']['llcontinue']\n else\n break\n end\n }\n return iws\n end",
"def all_works\n [ScannedResource, ScannedMap, RasterResource, VectorResource, Numismatics::Issue, Playlist]\n end",
"def list_wiki_pages\n results = WikiPage.joins(wiki: :project)\n .where(\"CONCAT_WS(':', `projects`.`name`, `wiki_pages`.`title`) LIKE ? \", \"%#{params[:term]}%\")\n .select('projects.name, wiki_pages.title')\n .limit(10)\n\n render :json => results.map { |x| \"#{x.name}:#{x.title}\" }\n end",
"def index\n @wikis = Wiki.order('created_at DESC').paginate(:page => params[:page])\n end",
"def platforms\n get(\"project/platforms\")[\"platforms\"]\n end",
"def index\n # @wikis = Wiki.all\n @user = current_user\n @wikis = policy_scope(Wiki)\n end",
"def wiki_images(project, on_page = nil)\n opts = {}\n opts[:page] = on_page if on_page\n fetch_all(\"projects/#{project}/features/wiki/images\", 'images', opts)\n end",
"def path\n File.join Dubya.root_path, 'vendor/wiki'\n end",
"def index\n @wks = Wk.all\n end",
"def wiki\n @wiki ||= Smeagol::Wiki.new(wiki_dir)\n end",
"def index\n #anyone\n # @wikis = policy_scope(Wiki)\n @wikis = Wiki.all\n @wikis = Wiki.visible_to(current_user)\n\n @wiki = policy_scope(Wiki)\n end",
"def wikifile(path, version=nil)\n log_info \"wikifile: #{path}, #{version}\"\n path = Gollum::Page.cname(path)\n\n ext = File::extname(path)\n if ext == ''\n name = File.basename(path)\n dir = File.dirname(path)\n\n if page = @wiki.paged(name, dir, version)\n WikiFile.find(self, page.filename, version)\n else\n WikiFile.path = path+'.md'\n end\n else\n WikiFile.find(self, path, version)\n end\n end",
"def japanese\n puts \"Let's explore the whiskies of Japan\"\n #call method to list whiskies for this particular type\n list_whiskies('c/35/japanese-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end",
"def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end",
"def solution_files\n get_folder_files(SOLUTION_PATH)\n end",
"def list_whiskies(whisky_url)\n #scrape and and create array of whisky hashes for all selected whiskies using url\n @whiskies = WhiskyPicker::Whisky.scrape_index_page(BASE_PATH + whisky_url)\n #display list of whiskies\n @whiskies.each_with_index do |whisky, index|\n puts \"#{index+1}. #{whisky.name}\"\n end\n menu\n end",
"def my_websites\n websites = Website.search_by_user(get_current_user)\n websites.each do |w| \n if w.status == Website::STATUS_VERIFIED\n w.count_tagged_images\n w.count_spots\n w.count_total_income\n end\n end\n return websites\n end",
"def private_to_public\n current_user.wikis.each do |wiki|\n wiki.update_attributes(:private => false)\n end\n end",
"def wikidata_client\n client = MediawikiApi::Wikidata::WikidataClient.new('https://www.wikidata.org/w/api.php')\n client.log_in(ENV[\"WIKIDATA_USERNAME\"], ENV[\"WIKIDATA_PASSWORD\"])\n client\nend",
"def get_possible_uris(page)\n\n @wiki_full_uri = getWikiRepositoryUrl\n\n @uri = URI.parse(@wiki_full_uri)\n\n pageName = page.data['wikiPageName'] # Page name\n\n @patterns = []\n\n # page name can have different working forms ranging from \"page name\" to \"Page-Name\"\n possible_name = [pageName]\n # normalize to lowercase and - as separator\n possible_name += [pageName.gsub(' ', '-').downcase] #page-name\n possible_name += camel_case(pageName, '-') #Page-name + Page name\n possible_name += camel_caps(pageName, '-') #Page-Name + Page Name\n possible_name += [pageName.gsub('-', ' ').downcase] #page name\n\n possible_name.uniq.each do |name|\n @patterns += [\n # possible WORKING internal links patterns that can be found in wiki pages\n # [link text](https://github.com/userName/RepositoryName/wiki/Page-name)\n @wiki_full_uri + '/' + name,\n # [link text](https://github.com/userName/RepositoryName/wiki/Page-name/) trailing slash\n @wiki_full_uri + '/' + name + '/',\n # [link text](/userName/RepositoryName/wiki/Page-name)\n @uri.path + '/' + name,\n # [link text](/userName/RepositoryName/wiki/Page-name/) trailing slash\n @uri.path + '/' + name + '/',\n # [link text](Page-name)\n name\n ]\n end\n\n # Home page has two other patterns that are the wiki root url with no page name\n # because Home is the default page\n if pageName.downcase == 'home'\n @patterns += [\n # home page direct uris\n # [link text](https://github.com/userName/RepositoryName/wiki)\n @wiki_full_uri,\n # [link text](https://github.com/userName/RepositoryName/wiki) trailing slash\n @wiki_full_uri + '/',\n # [link text](/userName/RepositoryName/wiki)\n @uri.path,\n # [link text](/userName/RepositoryName/wiki) trailing slash\n @uri.path + '/'\n ]\n end\n\n return @patterns\n end",
"def wiki_key\n # This assumes the project is Wikipedia, which is true for all wikis with the articlequality\n # or the language is nil, which is the case for Wikidata.\n @wiki_key ||= \"#{@wiki.language || @wiki.project}wiki\"\n end",
"def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def show\n @wiki = @project.wikis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"def url\n\t\t\"#{base}/wiki/#{page}\"\n\tend",
"def get_folders\n doc = Nokogiri::HTML(open(url))\n doc.xpath(\"//@href\").map do |url|\n url.value\n end\n end",
"def wms_path\n url = Array.wrap(resource_decorator.wms_url)\n return url.first if url.try(:first).present?\n return unless generate_wms_path?\n \"#{path}/#{@config[visibility][:workspace]}/wms\"\n end",
"def published_works(repository_client, publication)\n @published_works ||= repository_client.search('web_of_science_uid', publication.web_of_science_source_record[:uid])\n end",
"def list_worksets (username, token, include_public)\n Rails.logger.debug \"list_public_worksets #{username}\"\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets?public=#{include_public}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n request.add_field(\"Accept\", \"application/vnd.htrc-workset+xml\")\n response = http.request(request)\n Rails.logger.debug \"Response Code: #{response.code}\"\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n response_xml = response.body\n #Rails.logger.debug response_xml\n\n worksets = Array.new\n\n doc = REXML::Document.new(response_xml)\n\n doc.elements.each('worksets/workset/metadata') { |metadata|\n hash = Hash.new\n hash['name'] = metadata.elements['name'].text\n hash['description'] = metadata.elements['description'].text\n hash['author'] = metadata.elements['author'].text\n\n if (hash['author'] == username)\n worksets.unshift(hash)\n else\n worksets.push(hash)\n end\n }\n\n id = 1\n worksets.each { |w|\n w['id'] = id;\n id = id+1\n\n }\n\n return worksets\n end",
"def index\n @howitworks = Howitwork.all\n end",
"def index (path = \".\")\n files = Array.new\n # search path and fill with files\n Dir.foreach(path) do |entry|\n if File.file?(path + \"/\" + entry)\n if entry.length > 5 && entry[-5..-1] == \".whip\"\n files.push(Whip::File.new(path + \"/\" + entry, path + \"/\" + entry[0...entry.rindex(\".\")] + \".html\"))\n end \n end\n end\n return files\n end",
"def get_wikipedia_articles\n Geonames::WebService.find_nearby_wikipedia :lat => @latitude, :long => @longitude\n end",
"def projects\n config[:projects]\n end",
"def wiki_pages(project, on_page = nil)\n opts = {}\n opts[:page] = on_page if on_page\n fetch_all(\"projects/#{project}/features/wiki/pages\", 'pages', opts)\n end",
"def workspace_folders\n attributes.fetch(:workspaceFolders)\n end",
"def lang_files\n @@languages\n end",
"def wiki\n strong_memoize(:wiki) do\n create_wiki_repository\n Gitlab::Git::Wiki.new(repository.raw)\n end\n end",
"def index\n @wits = Wit.all\n end",
"def wikipage(page, subreddit = nil)\n name = extract_attribute(subreddit, :display_name)\n\n path = \"/wiki/#{page}.json\"\n path.prepend(\"/r/#{name}\") if subreddit\n object_from_response :get, path\n end",
"def projects\n @projects\n end",
"def stories\n project.stories_in_iteration(self)\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_stores }\n cs\n end",
"def wikipedia_link\n\t\tp = localized_page\n\t\tbase = \"https://#{langtag(I18n.locale)}.wikipedia.org\"\n\t\treturn base unless p && p.title\n\t\t\"#{base}/wiki/#{p.title}\"\n\tend",
"def public_pages\n list = []\n self.div(:id=>\"lhnavigation_public_pages\").links.each do |link|\n list << link.text\n end\n return list\n end",
"def published_templates\n\t\treturn templates.where(\"published = ?\", true)\n\tend",
"def projects\n DataStore.projects\n end",
"def projects\n if is_deploy_key\n [project]\n else\n user.projects\n end\n end",
"def index\n @twoprojects = Twoproject.all\n end",
"def websites\n self.dig_for_array(\"webSites\")\n end",
"def wikilink_available?\n wikilink && !wikilink.empty?\n end",
"def index\n semantic_breadcrumb @project.name, @project\n semantic_breadcrumb \"Lexicons\", project_lexicon_groups_path(@project)\n @lexicon_groups = @project.lexicon_groups.page params[:page]\n end",
"def websites\n Array(@websites)\n end",
"def get_workspaces &block\n response = self.search :workspaces => nil\n doc = Nokogiri::XML(response)\n workspaces = doc.xpath(Workspace.root_xpath).collect{|w| w.text.to_s }\n list Workspace, workspaces, {}, &block\n end",
"def projects\n settings.projects.map do |project_settings|\n Project.new(project_settings)\n end\n end",
"def get_page\n @html_doc = Nokogiri::HTML(open(\"https://en.wikipedia.org/wiki/2020_NBA_playoffs\"))\n return @html_doc\n end",
"def projects\n @projects ||= Project.all\n end",
"def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end",
"def public_urls\n urls = []\n self.used_locales.each do |l|\n urls << self.public_url(l)\n end\n urls.flatten.compact.uniq\n end",
"def index\n @wiki_posts = WikiPost.all\n end",
"def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end",
"def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end",
"def index\n @wx_publics = WxPublic.all\n end",
"def wikify_path(path)\n wiki_parts = path.split(File::SEPARATOR).collect do |part|\n wikify(part)\n end\n return File.join(wiki_parts)\n end",
"def pick_whiskies\n countries\n end",
"def save_wiki_path( wikipath )\n filename = wikipath.split( ':' ).last\n extension = filename.split( '.' ).last\n case extension\n when 'jpg', 'jpeg', 'png', 'svg', 'pdf', 'csv', 'txt', '.text'\n url = @dokuwiki_media_url + wikipath\n save_wiki_media( filename, url )\n when 'css'\n url = @dokuwiki_css_url + wikipath.sub( /[.]css$/, '' )\n save_wiki_media( filename, url )\n when 'html'\n url = @dokuwiki_page_url + wikipath.sub( /[.]html$/, '' )\n save_wiki_body( filename, url )\n else\n url = edit_url( wikipath )\n filename << \".#{EXTENSION}\"\n page = get( url )\n save_wiki_source( page, filename )\n end\n end",
"def get_imageinfo(files,props = :imageinfo)\n result=Array.new\n \n iiprop=CGI.escape(\"timestamp|user|url|dimensions|comment\")\n doc=Nokogiri::XML(open(\"http://commons.wikipedia.org/w/api.php?format=xml&action=query&prop=#{props.to_s}&titles=#{files}&iiprop=#{iiprop}\"))\n\n xp=\"//api/query/pages/page/imageinfo/ii\"\n xp=\"//api/query/pages/page/globalusage/gu\" if props==:globalusage\n\n ctr=0\n element=doc.xpath(xp).each do |element| \n img=Hash.new\n element.attributes.each do |a|\n img[a[0].to_sym]=element.get_attribute(a[0])\n end \n result << img\n \n @stockpile[\"#{@imagelist[ctr]}\"]=Hash.new unless @stockpile[\"#{@imagelist[ctr]}\"]\n @stockpile[\"#{@imagelist[ctr]}\"][props]=img\n ctr=ctr+1\n end\n result\n end",
"def get_wiki(search)\n return Wikipedia::article(search).first\n search = search.split(/\\s+/).map {|w| w.capitalize }.join(' ')\n page = Wikipedia.find(search)\n g = JSON.parse(page.json)\n content = g[\"query\"][\"pages\"].first.last[\"revisions\"].first\n\n\n content = content[\"*\"]\n\n\n wiki = WikiCloth::Parser.new({ data: content })\n\n html = wiki.to_html\n\n doc = Nokogiri::HTML(html)\n doc = doc.xpath(\"//p\").to_s\n doc = Nokogiri::HTML(doc)\n doc = doc.xpath(\"//text()\").to_s\n\n doc = doc.split(\"\\n\")\n\n plaintext = []\n\n doc.each do |d|\n unless d.empty?\n plaintext << d\n end\n end\n\n\n return plaintext\n end",
"def projects\n doc = Nokogiri::HTML(trending_page_html)\n doc.css('.repo-list-item').map do |list_item|\n project_from_node(list_item)\n end\n end",
"def base_path\n wiki.base_path\n end",
"def get_workspace_projects(wid, active=true)\n get \"/workspaces/#{wid}/projects\", {:active => active}\n end",
"def projects\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:proj, RDF.type, Ruta::Class.project],\n [:proj, RDF::FOAF.member, :mir],\n [:mir, Ruta::Property.has_member, uri]\n )\n projs = []\n query.each_solution { |sol| projs.push(sol.proj.as(Organisation)) }\n projs\n end",
"def get_projects\n me = request('/services/v5/me')\n me['projects']\n end",
"def index\n @wises = Wise.all\n end",
"def get_info_page_links(page)\n info_links = page.links_with(href: %r{info.html})\n if not info_links\n info_links = page.links_with(href: %r{aboutus.html})\n end\n if not info_links\n info_links = page.links_with(text: '会社概要')\n end\n return info_links\nend",
"def privacy_tags\n self.privacy_project\n end",
"def dirs; end",
"def dirs; end",
"def templates\n Dir.glob(::Webby.path('examples') / '*').sort\n end",
"def extract_web_entries\n @web_sites = myworkspace.web_sites\n @web_pages = myworkspace.web_pages\n @web_forms = myworkspace.web_forms\n @web_vulns = myworkspace.web_vulns\n end",
"def all\n @projects\n end",
"def all\n @projects\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def knowledge_bases\n KnowledgeBase.all(self)\n end",
"def get_interwiki_links_in_page(title, limit = @query_limit_default)\n params = {\n prop: 'iwlinks',\n titles: title,\n tllimit: get_limited(limit)\n }\n\n query(params) do |return_val, query|\n pageid = query['pages'].keys.find { |id| id != '-1' }\n return unless pageid\n iwlinks = query['pages'][pageid].fetch('iwlinks', [])\n return_val.concat(iwlinks.collect { |l| { prefix: l['prefix'], title: l['*']} })\n end\n end",
"def public_workspace\n Figgy.config[\"geoserver\"][\"open\"][\"workspace\"]\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end",
"def links_to_workspace_collection(workspaces)\n return nil if workspaces.empty?\n workspaces.collect { |ws| link_to_workspace(ws) }.join(', ')\n end",
"def find_public_chapters\n # self.chapters.where(\"publish_date <= ?\", Date.today).where(status: 'published', language: 'en').order(chapter_number: :desc).limit(25)\n self.chapters.released.lang\n end"
] |
[
"0.6643206",
"0.6343877",
"0.6255705",
"0.61966074",
"0.61767596",
"0.60621107",
"0.60621107",
"0.5765324",
"0.5747786",
"0.5681829",
"0.55781853",
"0.55375206",
"0.5535804",
"0.54898787",
"0.5461689",
"0.54462326",
"0.5416881",
"0.5352968",
"0.53497803",
"0.53372884",
"0.53356355",
"0.5317145",
"0.53156495",
"0.5277787",
"0.525968",
"0.5253577",
"0.5228569",
"0.51551676",
"0.51463366",
"0.5145243",
"0.51404554",
"0.51174754",
"0.5108657",
"0.5092954",
"0.5087006",
"0.50838244",
"0.5079955",
"0.5064056",
"0.50636786",
"0.50607514",
"0.50508654",
"0.5040625",
"0.5040427",
"0.5034432",
"0.503049",
"0.5030437",
"0.50298893",
"0.5029707",
"0.5024402",
"0.50043315",
"0.5000333",
"0.499906",
"0.49951956",
"0.49737072",
"0.49688673",
"0.49642488",
"0.4960548",
"0.49579602",
"0.49466005",
"0.4945181",
"0.49372345",
"0.4933849",
"0.4926439",
"0.49255714",
"0.49149185",
"0.49014646",
"0.49009737",
"0.48968506",
"0.48895442",
"0.48815942",
"0.48813534",
"0.48721525",
"0.48654696",
"0.48636797",
"0.48612472",
"0.4852096",
"0.4843297",
"0.48389408",
"0.48387536",
"0.4838427",
"0.48247764",
"0.48194045",
"0.48167932",
"0.48125967",
"0.48088226",
"0.480691",
"0.48038533",
"0.47974798",
"0.47974798",
"0.4795631",
"0.47879466",
"0.47826523",
"0.47826523",
"0.47784477",
"0.4775514",
"0.47746038",
"0.47658724",
"0.47647202",
"0.47641063",
"0.4763156"
] |
0.76151276
|
0
|
returns the property definitions for the project.
|
def property_definitions
set_attributes_for(PropertyDefinition)
PropertyDefinition.find(:all)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def properties()\n @properties ||= begin\n pom = %w(groupId artifactId version packaging).inject({}) { |hash, key|\n value = project[key] || (parent ? parent.project[key] : nil)\n hash[key] = hash[\"pom.#{key}\"] = hash[\"project.#{key}\"] = value_of(value) if value\n hash\n }\n pom = %w(groupId artifactId version).inject(pom) { |hash, key|\n value = parent.project[key]\n hash[key] = hash[\"pom.parent.#{key}\"] = hash[\"project.parent.#{key}\"] = value_of(value) if value\n hash\n } if parent\n props = project['properties'].first rescue {}\n props = props.inject({}) { |mapped, pair| mapped[pair.first] = value_of(pair.last, props) ; mapped }\n (parent ? parent.properties.merge(props) : props).merge(pom)\n end\n end",
"def properties\n properties = []\n\n rules.values.each do |declarations|\n declarations.each {|property, value| properties << [property, value] }\n end\n \n properties\n end",
"def property_properties\n _property_properties\n end",
"def get_properties()\n return @properties\n end",
"def properties\n return @properties\n end",
"def properties\n self.class.properties.keys\n end",
"def properties\n @properties\n end",
"def properties\n @properties\n end",
"def definitions\n return @definitions\n end",
"def properties\n _properties\n end",
"def index\n @r_property_definitions = RPropertyDefinition.all\n end",
"def properties\n @properties = Ken::Collection.new\n types.each do |type|\n @properties.concat(type.properties)\n end\n @properties\n end",
"def properties\n []\n end",
"def properties\n @properties ||= {}\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 properties\n @properties ||= {}\n end",
"def properties\n @properties = PropertyList.new(self.prototype) if @properties.nil?\n @properties\n end",
"def properties\n @properties ||= {}\n end",
"def properties\n @properties ||= {}\n end",
"def definitions() return @definitions end",
"def properties\n map(element_type: :hash) { |v| v.properties }\n end",
"def props\n ret = {}\n property_names.each do |property_name|\n ret[property_name] = respond_to?(property_name) ? send(property_name) : send(:[], property_name)\n end\n ret\n end",
"def properties\n @properties ||= load_files\n end",
"def properties\n @properties ||= []\n return((superclass.respond_to?(:properties) ? superclass.properties : []) + @properties)\n end",
"def properties\n self.class.get_properties\n end",
"def properties\n hash = {}\n Parser::PROPERTIES.each { |property| hash[property] = send(property) }\n hash\n end",
"def properties\n self.class.properties\n end",
"def parse_props(pom_doc)\n return pom_doc.css('properties').children.map {|c| [c.name, c.text]}.to_h\n end",
"def properties\n []\n end",
"def property_names\n @property_names ||= properties.keys\n end",
"def property_objects\n hash = {}\n self.class.properties.each { |prop| hash[prop] = @properties[prop] }\n hash\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end",
"def property_names\n @properties.values.map(&:name)\n end",
"def properties(ctx)\n properties = Properties.new()\n ctx.each { |key, value| properties.put(key, value) }\n return properties\n end",
"def properties\n self.class.properties.collect { |prop| @parameters[prop.name] }.compact\n end",
"def properties\n PropertySet.new(query.fields)\n end",
"def property_names\n trait[:PROPERTIES].keys\n end",
"def definitions\n definitions_repository.all\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 property_names\n properties.symbolize_keys.keys\n end",
"def properties\n model.properties\n end",
"def properties\n $properties ||= Properties.new\n end",
"def project_properties(project=nil)\n\n project = \"#{project}:\" if project\n\n result = %x[gradle #{project}properties]\n convert_values_to_hash result\n end",
"def properties\n decorate_with_methods(read_attribute(:properties))\n end",
"def definitions\n @definitions ||= g_definitions\n end",
"def props()\n @props\n end",
"def props\n ret = {}\n iter = @internal_node.getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = @internal_node.getProperty(key)\n end\n ret\n end",
"def properties\n @properties ||=\n Hash[Array(@grpc.properties).map { |p| [p.name, p.value] }]\n end",
"def properties\n self.values\n end",
"def web_properties\n Management::WebProperty.all(self)\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def properties\n @properties ||= Hash.new\n end",
"def property_options\n return @array.map {|property|\n {\n name: property.print_list,\n value: property.property_id\n }\n }\n end",
"def definitions\n Element.definitions.collect { |e| e['contents'] }.flatten.compact\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(path, ctype=DEFAULT_CTYPE)\n node = metadata(path, ctype, :properties)[:properties]\n node ? node.contents : @metadata_tree.default_data(:properties)\n end",
"def properties\n return @values['properties'] if @values.key?('properties')\n @values['properties'] = {}\n @values['properties']\n end",
"def properties\n object = orientdb.get_class_properties self\n {:properties => object['properties'], :indexes => object['indexes']}\n end",
"def properties\n keys = @_properties.keys\n ret = []\n\n # example element, if there is one\n if @define\n @_properties['emptyElement'] = %($sel(\"#resources? .#{@item_id}:1:1\"))\n ret << _partial_properties(['emptyElement'])\n end\n\n # outlets first\n if keys.include?('outlets')\n outlets = @_properties['outlets']\n @_properties['outlets'] = '[\"' + (outlets * '\",\"') + '\"]'\n ret << _partial_properties(['outlets'])\n ret << _partial_properties(outlets,\",\\n\\n\")\n keys.reject! { |k| outlets.include?(k) || (k == 'outlets') }\n end\n\n bindings = keys.reject { |k| !k.match(/Binding$/) }\n if bindings.size > 0\n ret << _partial_properties(bindings)\n keys.reject! { |k| bindings.include?(k) }\n end\n\n if keys.size > 0\n ret << _partial_properties(keys)\n end\n\n ret = ret * \",\\n\\n\"\n ' ' + ret.gsub(\"\\n\",\"\\n \")\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 properties\n @properties ||= Properties.new self\n end",
"def definitions\n run_context.definitions\n end",
"def property_predicates\n _property_predicates\n end",
"def currentpropvalues\n # It's important to use the 'properties' method here, as it follows the order\n # in which they're defined in the class. It also guarantees that 'ensure'\n # is the first property, which is important for skipping 'retrieve' on\n # all the properties if the resource is absent.\n ensure_state = false\n return properties.inject({}) do | prophash, property|\n if property.name == :ensure\n ensure_state = property.retrieve\n prophash[property] = ensure_state\n else\n if ensure_state == :absent\n prophash[property] = :absent\n else\n prophash[property] = property.retrieve\n end\n end\n prophash\n end\n end",
"def properties\n @properties ||= Element::Properties.new(self)\n end",
"def intersys_properties\n properties = Intersys::Object.common_get_or_set('@properties', {})\n properties[class_name] ||= intersys_reflector.properties.to_a\n end",
"def values_for_properties; end",
"def properties\n { 'object_type' => 'array', 'elements' => @elements.map(&:properties) }\n end",
"def definitions\n definitions = Element.definitions.flat_map { |e| e[\"contents\"] }\n definitions.compact!\n definitions\n end",
"def properties\n properties = sky_table.get_properties()\n properties.select!{|p| p.transient && p.name.to_s.index(/^__\\w+__$/).nil? }\n return properties\n end",
"def parse_properties(input = @tokens)\n input = TokenScanner.new(input) unless input.is_a?(TokenScanner)\n properties = []\n\n consume_declarations(input).each do |decl|\n unless decl[:node] == :declaration\n properties << decl\n next\n end\n\n children = decl[:value].dup\n children.pop if children.last && children.last[:node] == :semicolon\n\n properties << create_node(:property,\n :name => decl[:name],\n :value => parse_value(decl[:value]),\n :children => children,\n :important => decl[:important] == true,\n :tokens => decl[:tokens])\n end\n\n 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 available_properties\n @properties ||= list.properties\n end",
"def property_map\n self.class.properties.map do |name, opts|\n if opts\n yreq = opts[:req] ? :req : :opt\n [\"@#{ name }\", yreq] if yreq\n end\n end.compact\n end",
"def property_map\n self.class.class_variable_get(:@@property_map)\n end",
"def property_names\n raise NotImplementedError\n end",
"def reporting_properties\n {\n title: self.title,\n id: self.id,\n created_by: self.created_by&.reporting_properties,\n project: self.project&.reporting_properties\n }\n end",
"def definitions\n # Some httparty work to fetch definitions from Websters\n end",
"def get_properties\n instance_methods.each_with_object([]) { |key, acc| acc << key.to_s.gsub(/=$/, '') if key.match(/\\w=$/) }\n end",
"def property_annotations\n trait[:PROPERTIES]\n end",
"def props\n props = {}\n props[:triggers] = @triggers if @triggers\n props[:functions] = @functions if @functions\n props\n end",
"def properties\n games.flat_map(&:properties).uniq\n end",
"def properties\n {}\n end",
"def properties\n pairs_properties = @pairs.map { |key, value| { 'key' => key.properties, 'value' => value.properties } }\n { 'object_type' => 'map', 'pairs' => pairs_properties }\n end",
"def properties\n rev_properties.merge(svn_properties).merge(yaml_properties)\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 return if @properties.empty?\n @properties.uniq.sort\n end",
"def properties\n component ? component.properties : []\n end",
"def all_property_hash\n hash = {}\n items = @all_properties\n for prop in items\n hash[prop] = {}\n end\n return hash\n end",
"def properties\n @properties ||= FileProperties.new(self)\n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def properties\n {}\n end"
] |
[
"0.7043262",
"0.69731706",
"0.6845802",
"0.6790796",
"0.6775503",
"0.6716253",
"0.66997534",
"0.66730136",
"0.66397107",
"0.6573263",
"0.65577",
"0.65552264",
"0.6529151",
"0.6494841",
"0.6492099",
"0.6440219",
"0.6425124",
"0.6393894",
"0.6393894",
"0.63913625",
"0.63177973",
"0.628918",
"0.626145",
"0.6222802",
"0.62033623",
"0.61976683",
"0.61936677",
"0.61528194",
"0.61428994",
"0.6118188",
"0.6094319",
"0.60761917",
"0.60601395",
"0.6059114",
"0.6053675",
"0.6052146",
"0.6048334",
"0.6046778",
"0.6034484",
"0.6032844",
"0.60269296",
"0.602427",
"0.600444",
"0.5971352",
"0.5969798",
"0.59442925",
"0.593678",
"0.59236807",
"0.59121245",
"0.5911184",
"0.59056586",
"0.59056586",
"0.58767724",
"0.58277446",
"0.58258224",
"0.58251727",
"0.5821338",
"0.58140117",
"0.5803543",
"0.57627183",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57613516",
"0.57170135",
"0.57135385",
"0.5712336",
"0.5705469",
"0.5703458",
"0.57020307",
"0.57016265",
"0.5700666",
"0.5689299",
"0.56828815",
"0.5657755",
"0.5656536",
"0.56456226",
"0.56311893",
"0.56288904",
"0.5626749",
"0.56256026",
"0.5620649",
"0.5611696",
"0.5605963",
"0.5583649",
"0.558063",
"0.5573211",
"0.5545382",
"0.55400693",
"0.5529509",
"0.5525489",
"0.55042523",
"0.5493284",
"0.54619795",
"0.5457081",
"0.5455884"
] |
0.75724435
|
0
|
returns the murmurs for the project.
|
def murmurs
set_attributes_for(Murmur)
Murmur.find(:all)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def projects\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:proj, RDF.type, Ruta::Class.project],\n [:proj, RDF::FOAF.member, :mir],\n [:mir, Ruta::Property.has_member, uri]\n )\n projs = []\n query.each_solution { |sol| projs.push(sol.proj.as(Organisation)) }\n projs\n end",
"def build_project_lists\n # call the application controller connect funtion\n conn = basecamp_connect\n unless conn \n raise \"url or authkey not set\"\n end\n projects = Basecamp::Project.find_by_status(conn, 'active')\n @project_list = projects.collect{|p| [p.name, p.id] }.sort_by{|name, id| name }\n @mantis_list = MantisProjectTable.order(\"name\").all.collect{|p| [ p.name, p.id ] }\n end",
"def index\n @crew_muns = Crew::Mun.all\n end",
"def index\n @milddew_imms = MilddewImm.all\n end",
"def projects\n @projects\n end",
"def index\n @project_step_ms = ProjectStepM.all\n end",
"def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end",
"def projects\n PivotalTracker::Project.all\n end",
"def projects\n Project.all.select { |project| project.creator == self }\n end",
"def projects\n @projects ||= Project.all\n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def all\n @projects\n end",
"def all\n @projects\n end",
"def index\n @maturis = Maturi.all\n end",
"def pending_refund_payments_projects\n pending_refund_payments.map(&:project)\n end",
"def user_pledge_rewards\n user_pledge_rewards = []\n self.project_pledge_remaining.each do |project_id, pledge_amount_remaining|\n project = Project.find(project_id)\n reward_list = project.rewards\n reward_list.each do |reward|\n if pledge_amount_remaining >= reward.dollar_amount\n user_pledge_rewards << reward\n end\n end\n end\n return user_pledge_rewards\n end",
"def projects\n Harvest::Resources::Project\n end",
"def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end",
"def projects ; end",
"def index\n @project = Project.find_by_id(params[:project_id])\n @phase = Project::Phase.find_by_id(params[:phase_id])\n @project_phase_milestones = Project::Phase::Milestone.where(project_phases_id: params[:phase_id])\n end",
"def visited_museums\n visited = self.visits.select { |visit| visit.visited == true }\n visited.map { |visit| visit.museum }\n end",
"def milestones\n milestones = Milestone.where(project_id: project_ids_relation)\n milestones = milestones.search(query)\n milestones.reorder('updated_at DESC')\n end",
"def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end",
"def index\n @maturations = Maturation.all\n end",
"def minions\r\n @minions.list\r\n end",
"def cross_project\n []\n end",
"def scheduled_projects(start_date, end_date)\n suitable_entries = Entry.for_user_period(self.id, start_date, end_date)\n Project.find(suitable_entries.map(&:project_id))\n end",
"def projects_tracked\n timings = Timing.for_period_of_time(self.id, 1.month.ago, Time.now)\n if timings.present?\n timings.map(&:project_id).uniq\n else\n []\n end\n end",
"def index\n @minumen = Minuman.all\n end",
"def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end",
"def index\n @featured_memorials = Memorial.most_recent\n end",
"def index\n @projects = (Project.includes(:users).includes(:owner).includes(:errands).where(owner: current_user.id) + current_user.projects.includes(:owner).includes(:users).includes(:errands)).uniq\n end",
"def index\n @project_utilities = ProjectUtility.all\n end",
"def index\n @minuts = Minut.joins(:users).where(\"users.id = ?\", current_user)\n end",
"def projects\n my_proj = self.my_projects\n my_memb = self.collaborations\n my_proj + my_memb\n end",
"def index\n @project = Project.find(current_project_id)\n @members = @project.members\n end",
"def index\n @mrvs = Mrv.all\n end",
"def index\n @site_msts = SiteMst.all\n end",
"def index\n @admin_murals = Admin::Mural.all\n end",
"def index\n @immunizations = Immunization.all\n end",
"def portfolio()\n # uniq_funding = self.funding_rounds().uniq\n # uniq_funding.map {|funding| funding.startup}\n startups = self.funding_rounds().map { |funding| funding.startup}\n startups.uniq \n end",
"def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end",
"def projects\n doc = Nokogiri::HTML(trending_page_html)\n doc.css('.repo-list-item').map do |list_item|\n project_from_node(list_item)\n end\n end",
"def index\n\t\t@projects = Array.new\n\t\t\n\t\t# Se houver um usuário logado, verifica os projetos que ele já faz parte\n\t\tif current_user\n\t\t\t\n\t\t\t@teams = Array.new\n\t\t\tTeam.all.each do |t|\n\t\t\t\tif t.user_id == current_user.id\n\t\t\t\t\t@teams.push(t)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Alguns projetos podem nao estar visiveis, de acordo com as \n\t\t# condicoes abaixo\n\t\tProject.all.each do |p|\n\t\t\t\n\t\t\t# Se o projeto esta como publico, deve aparecer (exceto se for recem criado / iniciado)\n\t\t\tif p.status_ace && ( p.andamento == 'C' || p.andamento == 'E' )\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é coordenador do projeto, o projeto deve aparecer para ele sempre\n\t\t\t\telsif current_user && current_user.id == p.user_id\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# O administrador tambem pode ver todos os projetos sempre\n\t\t\t\telsif current_user && current_user.user_role_id == 1\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é pesquisador e o status do projeto é em\n\t\t\t\t\t# andamento ou concluído, mesmo que não esteja publico,\n\t\t\t\t# deve aparecer para ele\n\t\t\t\telsif current_user\n\t\t\t\t\n\t\t\t\t# Busca o papel deste usuario no time, se houver\n\t\t\t\t@curr_team = Team.find_by user_id: current_user.id, project_id: p.id\n\t\t\t\tif @curr_team && @curr_team.status_ace\n\t\t\t\t\t@projects.push(p)\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend",
"def portfolio\n funding_rounds.map{|fr| fr.startup}.uniq\n #binding.pry\n end",
"def projects\n investigation.try(:projects) || []\n end",
"def index\n\t\t@tasks = Task.all\n\t\t@milestone = Milestone.all\n\tend",
"def leave_management_backup_project_list(date = Date.today)\r\n\t\t\t\tbackup_rule_users = LeaveManagementRule.joins(:leave_exception_rules).where(action: LeaveManagementRule.actions[\"is_managed_by\"], leave_exception_rules: {user_id: self.id, actor_concerned: LeaveExceptionRule.actors_concerned[\"backup_receiver\"]}).flatten.map(&:to_users)\r\n\r\n\t\t\t\tusers_on_leave = LeaveRequest.are_on_leave(backup_rule_users.map{|o| [o[:user_receivers].map(&:id)]}.flatten.uniq, date)\r\n\r\n\t\t\t\trule_users_per_project= backup_rule_users.group_by{|r| r[:rule].project}\r\n\r\n\t\t\t\tmanagers = {}\r\n\t\t\t\trule_users_per_project.each do |project, rules|\r\n\t\t\t\t\tmanagers[project] ||= []\r\n\r\n\t\t\t\t\trules.each do |rule|\r\n\t\t managers[project] << rule[:user_receivers] if rule[:user_receivers].map{|u| u.id.in?(users_on_leave)}.all?\r\n \t\tend\r\n\t\t\t\tend\r\n\t\t\t\treturn managers.delete_if {|k,v| v == []}\r\n\t\t\tend",
"def index\n @misions = Mision.all\n\n end",
"def portfolio\n self.funding_rounds.map do |round|\n round.startup.uniq \n end\n end",
"def managers\n @members = self.user_workspace_memberships.where({:manager => 1})\n @users = []\n @members.each do |member|\n @users.push member.user if member.user\n end\n return @users\n end",
"def targets\n project.targets\n end",
"def ring_projects\n @ring_projects ||= [\n ObsProject.new(\"#{name}#{RINGS_PREFIX}0-Bootstrap\", '0'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}1-MinimalX\", '1'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}2-TestDVD\", '2') ]\n end",
"def projects\n map(&:projects).flatten.uniq.sort\n end",
"def project_get(project)\n project_find(project)\n projects = @project.all('a[class=table-link]') if @project\n\n project_names = []\n if projects\n projects.each do |proj|\n project_names << proj.text\n end\n else\n project_names = nil\n end\n project_names\n end",
"def targets\n\t\tWmapTarget.find(:all)\n\tend",
"def games\n self.results.map {|r|;r.game}\n end",
"def projects\n\t\tProject.order(\"created_at\").find_all_by_account_id(account_id).reverse\n\tend",
"def projects\n DataStore.projects\n end",
"def projects(params = nil)\n params = params.merge({ :current_user => @options[:current_user]})\n params = params.except(:manufacturer_id, :catg_slug, :office_id, :max_matches)\n params[:order] ||= 'recently_active'\n\n @projects_response = ProjectsIndexPresenter.new(params[:current_user], params).response\n projects = @projects_response[:projects] || []\n projects\n end",
"def project_evaluations\n ProjectEvaluation.where(user_id: @id)\n end",
"def all_members\n members = []\n\n project_members.owner.each { |u| members[u.user_id] = u }\n project_members.manager.each do |u|\n if members[u.user_id].nil?\n members[u.user_id] = u\n else\n members[u.user_id].role_id += ', ' + u.role_id\n end\n end\n\n project_members.member.each do |u|\n if members[u.user_id].nil?\n members[u.user_id] = u\n else\n members[u.user_id].role_id.to_s << ', ' << u.role_id\n end\n end\n\n members.compact\n end",
"def portfolio\n funding_rounds.map{|funding| funding.startup}.uniq\n end",
"def index\r\n @muscle_masses = MuscleMass.all\r\n end",
"def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end",
"def index\n @matriculacions = Matriculacion.all\n end",
"def index\n @gommis = Gommi.all\n end",
"def index\n @m6s = M6.all\n end",
"def index\n @mestres = Mestre.all\n end",
"def portfolio\n funding_rounds.map {|funding_round| funding_round.startup}.uniq\n end",
"def index\n @projects = current_power.projects\n end",
"def index\n @project_members = @project.project_members\n end",
"def all_monitors\n web + groups\n end",
"def index\n @marquages = Marquage.all\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def project_all\n prj = { '_id' => 0 }\n prj.merge!(make_grp_prj_periods[1])\n prj.merge!(make_grp_prj_nodes[1])\n prj.merge!(project_bookingnet)\n prj.merge!(project_baselist) unless @sensitivity >= 2\n prj.merge!(project_standardcost) unless @sensitivity >= 1\n { '$project' => prj }\n end",
"def recruit_boards\n default_recruit_boards[program.id.to_s].map { |id| program.recruit_boards.where(:_id => id).first }.compact || []\n end",
"def index\n @members = @project.memebers\n end",
"def index\n @materias = Materia.all\n end",
"def index\n @moussaillons = Moussaillon.all\n end",
"def index\n @mohrs = Mohr.all\n end",
"def get_global_variables\n @project = Project.where(:id => params[:project_id])\n if @project.present?\n @project = @project.first\n @steps = @project.steps.order(\"position\")\n @numSteps = @steps.count\n @ancestry = @steps.pluck(:ancestry) # array of ancestry ids for all steps\n @allBranches # variable for storing the tree structure of the process map\n @users = @project.users # user who created the project\n @authorLoggedIn = user_signed_in? && @users.map(&:username).include?(current_user.username)\n else\n # redirect to error page - project no longer exists\n render :file => \"errors/404.html\", :status => 404\n end\n end",
"def index\n @mileagelogs = Mileagelog.all\n end",
"def result(name)\n dir = @@RESULT_DIRS[name.to_sym]\n return nil if dir.nil?\n MiGA::Result.load(\"#{path}/data/#{dir}/miga-project.json\")\n end",
"def index\n @groupusers = User.where(organization_id: current_user.organization_id)\n @groupresolutions = []\n @groupusers.each do |item| \n Resolution.all.each do |addition|\n if (addition.creator == item.id && !(@groupresolutions.include?(addition)))\n @groupresolutions << addition\n end\n end\n end\n puts @groupresolutions\n @resolutions = Resolution.all\n end",
"def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end",
"def projects\n projects = object.projects.select { |p| !current_user || p.users.include?(current_user) }\n projects.map { |p| p.id }\n end",
"def getProjectsNoMember()\r\n\t\tnoMemberProjects = []\r\n\t\t@allProjects.each do |project|\r\n\t\t\tif !(User.current.member_of?(project))\r\n\t\t\t\tnoMemberProjects = noMemberProjects << project\r\n\t\t\tend\t\r\n\t\tend\r\n\t\treturn noMemberProjects\r\n\tend",
"def povuci_mrezu\n return @mreza\n end",
"def index\n if current_user.school\n @projects = current_user.school.projects\n elsif current_user.site\n @projects = current_user.site.projects\n else\n @projects = Project.all\n end\n @projects = @projects.order('updated_at DESC', 'id DESC').limit(400)\n end",
"def index\n @mdistantmetastasis = Mdistantmetastasi.all\n end",
"def get_mubees_for_user\n return {\n 'crew' => Mubee.where(crew_id: current_user.id),\n 'producer' => Mubee.where(producer_id: current_user.id)\n }\n end",
"def index\n\t\t@projects = Project.where(user_id: current_user.id).order(created_at: :asc)\n\tend",
"def project_team(project_name)\n team.select { |member| member.in_project?(project_name) }\n rescue => err\n warn(\"Reviewer roulette failed to load team data: #{err.message}\")\n []\n end",
"def getMilestone\r\n\t\t\t\t\treturn @milestone\r\n\t\t\t\tend",
"def index\n @managers_projects = ManagersProject.all\n end",
"def redmine_my_tasks_by_project(m, params)\n \tbegin\n\t\tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\t## Loading All issues for this user\n\t\t\t# Configuration of the connector\n\t\t\t::Issue.site = @redmine_rapid_url\n\t\t\t::Issue.user = certificate[:username]\n\t\t\t::Issue.password = certificate[:password]\n\t\t\t# Get All Issues for a user and for one project\n\t\t\tissues = Issue.find(:all, :params => { :assigned_to_id => 'me',:set_filter => 1, :project_id => params[:id_project] })\n\t\t\tissues.each do |issue|\n\t \t # Display Issues one by one\n\t \t redmine_display_an_issue(m, issue)\n\t \tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\t\n end",
"def index\n @maestros = Maestro.all\n end",
"def index\n @curriculum_projects = CurriculumProject.all\n end",
"def ultimas_compras\n\t\tresu = []\n\t\tlista = current_user.compras.limit(10).order(\"created_at DESC\")\n\n\t\tlista.each do |compra|\n\t\t\tif(compra.users.first == current_user)\n\t\t\t\tresu << compra\n\t\t\tend\n\t\tend\n\t\tresu\n\tend"
] |
[
"0.5621407",
"0.5550539",
"0.5447138",
"0.5432856",
"0.53935486",
"0.53611296",
"0.53516936",
"0.5330961",
"0.5324999",
"0.5318412",
"0.5310657",
"0.5301935",
"0.5301935",
"0.5291625",
"0.5224376",
"0.520722",
"0.52027243",
"0.5172757",
"0.5167284",
"0.51617825",
"0.51493025",
"0.51284623",
"0.5108874",
"0.5079376",
"0.5067674",
"0.5059883",
"0.50562304",
"0.5052766",
"0.5052281",
"0.50275713",
"0.5027342",
"0.5024011",
"0.5011702",
"0.5006868",
"0.49992755",
"0.49955192",
"0.4990346",
"0.49899137",
"0.49894637",
"0.4983037",
"0.49819994",
"0.49776205",
"0.49769187",
"0.49741763",
"0.49741688",
"0.49699348",
"0.49687853",
"0.49621835",
"0.49543428",
"0.4950765",
"0.49481556",
"0.49460497",
"0.4936794",
"0.4930977",
"0.4930518",
"0.49292368",
"0.49286088",
"0.4926876",
"0.4915491",
"0.49111924",
"0.49061543",
"0.4905406",
"0.4904906",
"0.49022287",
"0.48983082",
"0.4897275",
"0.48934022",
"0.4886785",
"0.48811278",
"0.4878963",
"0.48718825",
"0.48704675",
"0.48663524",
"0.48599768",
"0.48572803",
"0.48523125",
"0.4847025",
"0.48445293",
"0.48442304",
"0.48428684",
"0.48354027",
"0.48351094",
"0.4831316",
"0.48279607",
"0.4824386",
"0.4821289",
"0.48165894",
"0.48151287",
"0.48104283",
"0.48082638",
"0.48077303",
"0.48021317",
"0.48018253",
"0.47999042",
"0.47990602",
"0.47957546",
"0.47897404",
"0.4785171",
"0.47806513",
"0.47764927"
] |
0.5688828
|
0
|
finds a single card
|
def find_card(number)
set_attributes_for(Card)
Card.find(number)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_card(id)\n found_card = nil\n cards.each { |card| found_card = card if card.id == id.to_i }\n found_card\n end",
"def find_card\n @client.remove_cards\n card = PayuLatam::Card.new(@client) # info de payu\n card.load( PayuCard.find(@selected_card).token )\n @client.add_card({token: card.resource['token']})\n end",
"def search_card(player, id_card)\n player.cards.each do |card|\n return card if id_card.to_s == card.id.to_s\n end\n NIL\n end",
"def find_card\n @card = @trello.find_card_by_id(CONFIG['card_id']) # replace when move to real board\n end",
"def find_card(name)\n api = trello_api\n all_cards = api.all_cards_on_board_of(list_id)\n if card = all_cards.find { |card| card.name == name }\n card\n end\n end",
"def find_plain_card(id)\n cards[id]\n end",
"def find_card_by_id(id)\n @board.cards.find{|c| c.short_id == id.to_i}\n end",
"def search_by_name(card_name)\n card = Card.find_by(name: card_name)\n puts \"Name: #{card.name}\"\n puts \"Mana Cost: #{card.manaCost}\"\n puts \"Mana cost total: #{card.cmc}\"\n puts \"Colors: #{card.colors}\"\n puts \"Type: #{card.types}\"\n puts \"Subtypes: #{card.subtypes}\"\n puts \"Text: #{card.text}\"\nend",
"def find_card(name, suit)\r\n return @order.index(Card.to_s(name, suit))\r\n end",
"def find_by_id(card_id, full_info = false)\n cleaned_card_id = card_id.gsub(/t\\d+\\z/, '')\n full_info ? full_card_map[cleaned_card_id] : card_map[cleaned_card_id]\n end",
"def getCardById(deck,id)\n deck.each do |card|\n return card if card.id == id\n end\n return nil\nend",
"def get_a_card(card_number)\n @cards[card_number]\n end",
"def index_of_card(id)\n cards.find_index(find_card(id))\n end",
"def check_card\n @card = Card.where(uid: params[:card], user_id: nil).first\n if @card\n head :ok\n else\n head :forbidden\n end\n end",
"def payment_card(card_id)\n c_r Lokalise::Resources::PaymentCard, :find, card_id\n end",
"def leading_card\n \tCard.find_by(owner_id: id )\n end",
"def instance_of(card_id)\n @coll_card_instances.find_by(card_id: card_id)\n end",
"def get_card\n end",
"def get_card(card_id)\n http_request = Client::HTTP::Request.new(\n method: HTTP::Request::GET,\n endpoint: \"/#{Card::VC_VERSION}/card/#{card_id}\",\n )\n raw_response = self.read_cards_connection.send_request(http_request)\n card = Card.from_response(raw_response)\n self.validate_cards([card]) if self.card_validator\n card\n end",
"def pull(card)\n card = self.cards.delete(card)\n raise \"Cannot find card. May already have been dealt\" unless card\n return card\n end",
"def get_card (random_num)\n\t\t@deck[random_num]\n\tend",
"def set_card\n @card = @deck.cards.find(params[:id])\n end",
"def find_pair_card\n @hand_hash.each do |key, value| \n if value == 2\n @cards.each {|card| return card if card.value == key}\n end\n end\n end",
"def card\n if self.stripe_card_id.present?\n customer.sources.retrieve(self.stripe_card_id)\n else\n create_card\n end\n end",
"def card\n Card.from_response client.get(\"/actions/#{action_id}/card\")\n end",
"def id(id)\n req = Request.new(params = nil,\n headers = nil,\n body = nil)\n\n Scryfall::Card.new JSON.parse(connection.get(\"/cards/#{id}\", req).body)\n end",
"def card_id\n card.id\n end",
"def getCard(pos)\n @cardsShown[pos].get_code\n end",
"def get_card()\n @shoe.get_card()\n end",
"def retrieve_card\n card = @cards.pop\n if card.nil?\n self.reset\n card = @cards.pop\n end\n return card\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def play_like_a_master\r\n card = nil\r\n #TODO\r\n return card\r\n end",
"def full_card_search(search_term)\r\n # Takes a param and searches Title, Gametext, Lore in Cards for it\r\n # Returns a list of IDs of matching cards\r\n \r\n #horribly inefficient\r\n \r\n results_ids = []\r\n set_search_term(search_term)\r\n if search_term.nil?\r\n search_term = \"\"\r\n end\r\n \r\n (Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(title) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(gametext) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(lore) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ])).each{ |card| results_ids << card.id }\r\n \r\n #If this doesnt work, try LIKE instead of =\r\n \r\n results_ids\r\n end",
"def test_card_exists\n card = Card.new(\"What is the capital of Alaska?\", \"Juneau\", :Geography)\n turn = Turn.new(\"Juneau\", card)\n\n assert_equal card, turn.card\n end",
"def card(multiverse_id)\n get '/Pages/Card/Details.aspx', :multiverseid => multiverse_id\n end",
"def current_card\n @deck.cards[0]\n end",
"def get_card_at_index(index)\n x = @cardList[index]\n end",
"def hit \n card = self.cards_deck.pop\n return card\n end",
"def set_card # not private: taken out of private for accessibility\n begin\n @card = Card.find(params[:id])\n rescue\n render json: {error: \"The movie or series that you are looking for does not exist \"}, status: 404\n end\n end",
"def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def find(id)\n response = JSON.parse(@client.get(\"card_accounts/#{id}\").body)\n Promisepay::CardAccount.new(@client, response['card_accounts'])\n end",
"def show\n @card_one = Card.find( params[:id] )\n setup_for_display \n end",
"def set_card\n # @card = Card.find(params[:id])\n end",
"def set_card\n @card = @plan.cards.find(params[:id])\n end",
"def card(index)\n \tif index < 0 || index >= @cards.size\n \t raise Exception \"Position does not exist in hand: #{index}\"\n \tend\n \t@cards[index]\n end",
"def set_card\n @card = Cart.find(params[:id])\n end",
"def get_card\n @card ||= @user.get_valid_card\n end",
"def card(hand)\n loop do\n print \"What card do you want (only from sets you have): \"\n wanted_card_name = gets.chomp\n # check against sets, and validate input (i.e. wanted card set in hand, but wanted card is not)\n unless Deck.card_id(wanted_card_name).nil?\n if (hand.collect { |e| e[0] }.include? (Deck.card_id(wanted_card_name)[0])) && !(hand.include? (Deck.card_id(wanted_card_name)))\n return Deck.card_id(wanted_card_name)\n else\n print \"Please enter a valid card name...\\n\"\n end\n else\n print \"Please enter a valid card name...\\n\"\n end\n end\n end",
"def get_card(card)\n @hand.append(card)\n end",
"def card_exists?(card_to_check)\n if !Card.find_by(id: card_to_check.id).nil?\n return true\n else\n return false\n end\nend",
"def default_card\n Card.find_by_class_name!(self.class.name)\n end",
"def show_card\n\t\t@cards.shuffle.first\n\tend",
"def find_deck\n\t\tcurrent_user.decks.find(params[:deck_id])\n\t\t#Deck.find(params[:deck_id])\n\tend",
"def first_not_wild\n for card in @cards\n return card unless card.wild?\n end\n return nil\n end",
"def card(address_book_id, card_uri)\n end",
"def unique_collection_card\n !!!Collection.find_by(\n card_id: self.card_id,\n user_id: self.user_id,\n magic_set_id: self.magic_set_id,\n premium: self.premium,\n wishlist: self.wishlist,\n condition: self.condition\n )\n end",
"def play_card\n card = @my_hand.find { |c| live?(c) }\n return card.to_play if card\n \"d\" + @my_hand.first.to_play\n end",
"def random\n random_card = self.class.get('/cards/random')\n end",
"def get_card()\n card = @cards[@deck_index % @max_deck_mod]\n @deck_index += 1\n if @deck_index == @max_deck_mod\n #recreate shoe\n puts \"\\n\\n****CREATING NEW DECK****\\n\\n\"\n create_deck(@num_decks )\n end\n return card\n end",
"def open_card\n card_in_game\n return $hash_7_card\n end",
"def find_deck\n\t\tcurrent_user.decks.find(params[:id])\n\t\t#Deck.find(params[:deck_id])\n\tend",
"def player?(card)\n @@PLAYERS.each do |player|\n if hand(player).include?(card)\n return player\n end \n end\n return nil\n end",
"def show\n @card = Card.find params[:id]\n @card_type=@card.card_type\n end",
"def search\n @member_name = params[:member_name]\n @serial_num = params[:card_serial_num]\n if !@member_name.blank?\n @serial_num = \"\" if params[:p].blank?\n member = Member.where(:name => @member_name).where(:status => CommonResource::MEMBER_STATUS_ON).first\n if member.nil?\n @member_cards = []\n else\n @member_cards = MemberCard.where(:member_id => member.id)\n end\n end\n @member_card = MemberCard.new\n if \"num\" == params[:p] && !@serial_num.blank?\n @member_cards = [MemberCard.where(:card_serial_num => @serial_num).first]\n @member_card = @member_cards.present? ? @member_cards.first : MemberCard.new\n end\n #@member_card = @member_cards.present? ? @member_cards.first : MemberCard.new\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @member_cards }\n end\n end",
"def get_random_card\n return self.cards.where(:location => -1)[rand(self.cards.where(:location => -1).length)]\n end",
"def get_card(player, card_valid)\n puts ''\n puts '----------------------------------------------------------------------------------------'\n puts 'Digite el id de la carta a lanzar'\n\n puts \"player\"+player.id.to_s\n #condicional para validar la opcion a elejir por la maquina\n if(player.id.to_i==2)\n\n min_max\n end\n card_id = gets.chomp.to_s\n card = search_card(player, card_id)\n if !card.nil?\n player.card_thrown = card\n @cards_thrown.push(player.card_thrown)\n (0..player.cards.length - 1).each do |i|\n player.cards.delete_at(i) if player.cards[i] == card\n end\n card_valid = false\n else\n puts 'Id no valido'\n end\n card_valid\n end",
"def play_card(card)\n puts 'begin playcard id :' + card.id.to_s\n if self.respond_to?(card.name.gsub(' ','_'), true)\n update_attributes(played_card_id: card.id)\n self.send(card.name.gsub(' ','_'), nil)\n else\n puts 'No card played! gamemanager couldnt find details for ' + card.cardmapping.name\n end\n end",
"def set_card\n @card = Card.where(authorization_id: Authorization.current_id).find(params[:id])\n end",
"def choose_card \n\n @cards.shift\n end",
"def edit\n @card = Card.find(params[:id])\n end",
"def find_car\n\t\t\t@car = Car.find(params[:car_id])\n\t\tend",
"def has_card? test_card \n @card_list.has_card? test_card\n end",
"def read_card\n @format.read_card(@card_data)\n end",
"def find(id)\n find_result\n end",
"def check_cardOwn(card_id) #authroity\n\n value_return = false\n\n if Game.last.players.find_by(user: current_user,role: nil).id == Pockercard.find_by(id:card_id).player_id\n value_return = true\n end\n\n return value_return\n \n end",
"def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end",
"def find(id)\n first(\"Id = '#{id}'\")\n end",
"def vcard \n first_element('vCard')\n end"
] |
[
"0.82328606",
"0.80786943",
"0.8043857",
"0.79800695",
"0.7978989",
"0.7671493",
"0.75866395",
"0.7358201",
"0.7179182",
"0.70867455",
"0.7043636",
"0.70052356",
"0.6984753",
"0.6814153",
"0.6810912",
"0.6753832",
"0.6721989",
"0.6574799",
"0.6550437",
"0.6534133",
"0.65159583",
"0.64388263",
"0.64267254",
"0.63922304",
"0.6370324",
"0.63690424",
"0.63679624",
"0.63568103",
"0.633533",
"0.6335181",
"0.62847716",
"0.62847716",
"0.62847716",
"0.62847716",
"0.62847716",
"0.6273989",
"0.6264543",
"0.6252968",
"0.62468916",
"0.6243585",
"0.6243381",
"0.62194747",
"0.6216469",
"0.62129724",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6210344",
"0.6207544",
"0.6199461",
"0.61872035",
"0.61728626",
"0.61686724",
"0.6154478",
"0.6145854",
"0.614009",
"0.6124301",
"0.6117387",
"0.6099667",
"0.6098786",
"0.6096574",
"0.6089314",
"0.60863477",
"0.60854447",
"0.60802984",
"0.60652983",
"0.6029461",
"0.6017648",
"0.60159844",
"0.6005727",
"0.60051894",
"0.60039645",
"0.59985626",
"0.5994626",
"0.59899753",
"0.59889287",
"0.5973796",
"0.5964256",
"0.5963996",
"0.5951476",
"0.59300494",
"0.5927931",
"0.59263784",
"0.5924068",
"0.591555",
"0.5912576"
] |
0.78482664
|
5
|
returns a filtered list of cards
|
def filter_cards(filter_str)
set_attributes_for(Card)
Card.apply_filter(filter_str)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filter_cards(cards)\n cards = Array(cards) unless cards.respond_to?(:count) \n return cards.select { |card| Card.get(card.id).nil? } #TODO: move this to method\n end",
"def retrieve_cards(category)\n self.unused_cards = Card.where(category: Category.find_by(name: category)).where.not(id: self.used_cards).pluck(:id).shuffle if self.unused_cards.empty?\n return [Card.find(self.unused_cards[0]), Card.find(self.unused_cards[1])]\n end",
"def all_not_wild\n result = []\n for card in @cards\n result << card unless card.wild? \n end\n return result\n end",
"def cards\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end",
"def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end",
"def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end",
"def all_treasure_cards\n treasure_cards = []\n cards.each do |c|\n if c.cardmapping.is_treasure == true \n treasure_cards << c \n end\n end\n return treasure_cards\n end",
"def recipe_cards\n RecipeCard.all.select {|recipe_card| recipe_card.recipe == self}\n end",
"def show\n cards = @deck.cards\n cards = cards.where(is_disabled: false)\n @cards = cards.shuffle\n end",
"def cards\n @cards\n end",
"def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end",
"def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end",
"def filter_tasks(cards)\n cards = Array(cards) unless cards.respond_to?(:count)\n return cards.select { |card| Task.first(:name => card.name).nil? } #TODO: move this to method with descriptive name\n end",
"def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end",
"def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end",
"def get_cards(deck)\n\n end",
"def get_cards_from_trello\n list = get_doing_list\n return list.cards\n end",
"def cards_in_category(sel_category)\n @cards.select do |card|\n card.category == sel_category\n end\n end",
"def get_cards_above_10\n return ['V', 'Q', 'K', 'A']\nend",
"def recipe_cards\n RecipeCard.all.select { |recipe_card| recipe_card.user == self}\n end",
"def non_trump_cards\n @cards.select {|c| c.suit != @trump_suit}\n end",
"def my_recipe_cards\n RecipeCard.all.select do |recipecard|\n recipecard.recipe == self\n end\n end",
"def find_user_recipe_cards\n RecipeCard.all.map{|rcard| rcard if rcard.user_O == self}.compact\n\n end",
"def card_list(card_id, options = {})\n card_resource(card_id, \"list\", options)\n end",
"def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end",
"def recipecards\n RecipeCard.all.select do | card |\n card.user == self\n end\n end",
"def getCardArray()\n\t\treturn @cards\n\tend",
"def recipe_cards \n RecipeCard.all.select do |recipe|\n recipe.user == self\n end \n end",
"def filter(objects) objects end",
"def budget_cards(budget)\n budget.cards.uniq\n end",
"def remove_cards\n\t\t@cards.slice!(0,2)\n\tend",
"def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end",
"def played_cards\n player_cards.select { |c| c.played? }\n end",
"def all_cards_like_this\n user.creditcards.where(:cc_type => cc_type, :last_digits => last_digits, :first_name => first_name, :last_name => last_name, :year => year, :month => month)\n end",
"def unplayed_cards\n player_cards.select { |c| c.unplayed? }\n end",
"def find_categories\n categories = @deck.cards.group_by do |card|\n card.category\n end\n categories.keys\n end",
"def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end",
"def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end",
"def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend",
"def sharedCards\n \tcus_shared_with_user = cards_users.where(user_id: self.id, is_shared: true)\n\n \t# Have a list of CardsUsers, but want a list of Shared Cards\n \tshared_cards = []\n \tcus_shared_with_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\tshared_cards.push(card)\n \tend\n \tshared_cards\n end",
"def cards_list(opts = {})\n data, _status_code, _headers = cards_list_with_http_info(opts)\n data\n end",
"def suits\n cards.map(&:suit)\n end",
"def index\n @cards = Card.order(:full_name).page params[:page]\n end",
"def order_list\n\t\t@cards = @cards.order(:cmc)\n\tend",
"def flush_cards(cards)\n\t\thsh = {}\n\t\tcards.each {|c| hsh[c.suit] ||= []; hsh[c.suit] << c}\n\t\tret = []\n\t\thsh.each {|suit, suit_cards| ret = suit_cards if suit_cards.size > ret.size}\n\t\tret.sort_by {|x| x.sort_value}\n\tend",
"def all_discards(done)\n discard_list = done.discards.map{|squad|\n squad.list_of_cards\n }.flatten\n \n fighter_list = done.attacks.map{|attack|\n attack.fighter.list_of_cards\n }.flatten\n\n bomber_list = done.attacks.map{|attack|\n attack.bomber.list_of_cards\n }.flatten\n \n played_cards = discard_list + fighter_list + bomber_list + [done.card]\n played_cards.sort\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 full_deck\n Game::LANDS.collect do |land|\n (['Inv'] * 3 + (2 .. 10).to_a).collect do |value|\n Game::Card.new(value, land)\n end\n end.flatten\n end",
"def return_cards\n @hand = []\n end",
"def player_card_minors(_player)\n []\n end",
"def affordable_cards\n answer = Array.new()\n (@game.all_displayed_cards + @player.tableau.reserved_cards).each do |card|\n @cost = @player.tableau.tokens_required(card)\n answer << card if !@cost==false\n end\n answer\n end",
"def sort_cards\n return @cards.sort_by(&:color)\n self\n end",
"def get_cards\n \tif (!stripe_customer_id.nil?)\n\t customer = Stripe::Customer.retrieve(stripe_customer_id)\n\t puts customer.cards\n\t return customer.cards\n\telse\n\t\treturn nil\n\tend\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 available_cards(correct_card_ids)\n # Exclude cards that have already been successfully answered\n self.cards.reject do |card|\n puts \"correct_card_ids = #{correct_card_ids}\"\n correct_card_ids.include?(card.id)\n end\n end",
"def parse_cards\n cards = []\n card_nodes = search('tr.cardItem')\n card_nodes.each do |card_node|\n card = {}\n card[:name] = name(card_node)\n card[:mana_cost] = mana_cost(card_node)\n card[:cmc] = cmc(card_node)\n card[:rules] = rules(card_node)\n card[:power] = power(card_node)\n card[:toughness] = toughness(card_node)\n card[:set_versions] = set_versions(card_node)\n\n # Supertype, Subtype, P/T, Loyalty, Hand/Life Modifiers, etc are all stored in the same node\n type_data = type_data(card_node)\n card.merge! type_data\n\n cards << card\n p card if DEBUG\n end\n cards\n end",
"def get_high_cards(cards)\n @cards_by_score.each_key do |card|\n if cards.length < 5 && !cards.include?(card)\n cards << card\n end\n end\n end",
"def return(cards)\n @cards.concat(cards)\n end",
"def search_cards_by_app_bundle(bundle)\n return self.search_cards_by_criteria(\n SearchCriteria.by_app_bundle(bundle)\n )\n end",
"def remove_card\n cards.shift\n return cards\n end",
"def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end",
"def cards\n object.game_cards.map do |gc|\n { id: gc.card.id, word: gc.card.word, identity: gc.identity }\n end\n end",
"def show\n @cards = Card.where(:duelist_id == @duelist.id)\n end",
"def my_cards\n index = 0\n @my_cards = []\n @suits.each do |suit|\n (1..13).each do |value|\n card = Card.new(value, suit)\n @my_cards.push(card)\n end\n end\n return @my_cards\n end",
"def faceup\n cards.find_all {|card| !(card.facedown?) }.sort\n end",
"def sort_cards_by_same_value()\r\n\t\tresult=Array.new\r\n\t\tfor i in 2..14\r\n\t\t\tresult[i]=CardList.new\r\n\t\tend\r\n\t\t@list.each{|x| result[x.get_value].add_card(x)}\r\n\t\treturn result\r\n\tend",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def species_list_from_criteria\n show_seen = Settings::SPECIES_SHOWN == 'Seen'\n show_captured = Settings::SPECIES_SHOWN == 'Owned'\n return (1..GameData::Pokemon::LAST_ID).select do |i|\n next(false) if show_seen && !$pokedex.has_seen?(i)\n next(false) if show_captured && !$pokedex.has_captured?(i)\n next(false) if Settings::BLACK_LIST.include?(i) || Settings::BLACK_LIST.include?(GameData::Pokemon.db_symbol(i))\n\n next(true)\n end\n end",
"def matched_cards\n result = {}\n for card in @cards do\n if card.wild? ## wild cards belong to all ranks \n for rank in Rank::RANKS do\n result[rank] ||= []\n result[rank] << card\n end \n else \n result[card.rank] ||= []\n result[card.rank] << card\n end \n end\n return result\n end",
"def index\n @cards = @deck.cards.all\n end",
"def index\n @cards = MtgCard.order_by_color\n end",
"def index\n @cards = MtgCard.order_by_color\n end",
"def recipes\n recipe_cards.map {|recipe_card| recipe_card.recipe}\n end",
"def cards_in_category(category)\n # want to return an array of cards that only has :STEM category\n # run through array and check if ':STEM' matches the last\n # element in the array\n @cards.select {|card| card.category == category}\n end",
"def recipe_cards #return array of recipecards with this recipe\n RecipeCard.all.select do |card|\n card.recipe == self\n end\n #to test in pry, use instance ex. r1.recipe_cards\n end",
"def gamefield\n cards.find_all {|card| card.gamefield? }.sort\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def filter_data\n @data.map do |currency|\n currency.select { |attribute,_|\n selected_attributes.include? attribute.to_s\n }\n end\n end",
"def index\n #@cards = Card.all\n end",
"def index\n @cards = Card.all\n # p hoge = Member.joins(:card).select(\"cards.*, members.*\").first\n # p hoge.name\n\n # 検索用のセレクトボックスに表示する、名前一覧\n @name_list = @cards.select(:name).order(:name).distinct\n\n # 表示対象のカード\n if params[:name].present?\n @cards = @cards.get_by_name(params[:name])\n end\n if params[:rarity].present?\n @cards = @cards.get_by_rarity(params[:rarity])\n end\n @cards = @cards.order(:number).page(params[:page])\n end",
"def recipes\n recipe_card_array = RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n\n recipe_card_array.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def return(cards)\n @deck.concat(cards)\n end",
"def recipes\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n # RecipeCard.name\n end.map do |recipe_card|\n recipe_card.recipe\n end\n end",
"def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end",
"def cards\n #Card.joins(:duel_user_cards).\n end",
"def filter\n end",
"def full_card_search(search_term)\r\n # Takes a param and searches Title, Gametext, Lore in Cards for it\r\n # Returns a list of IDs of matching cards\r\n \r\n #horribly inefficient\r\n \r\n results_ids = []\r\n set_search_term(search_term)\r\n if search_term.nil?\r\n search_term = \"\"\r\n end\r\n \r\n (Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(title) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(gametext) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(lore) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ])).each{ |card| results_ids << card.id }\r\n \r\n #If this doesnt work, try LIKE instead of =\r\n \r\n results_ids\r\n end",
"def candies\n # all_candies = Candy.all\n Candy.all.select do |candy|\n candy.bucket == self && candy.name.downcase != \"penny\"\n end\n\n # my_candies.reject do |candy|\n # candy.name.downcase == \"penny\"\n # end\n end",
"def card_on_file(card)\n all_cards = cards.map(&:card)\n end",
"def filter(items)\r\n\tnew_items = Array.new\r\n\titems.each { |item| new_items.push(item) unless should_ban(item) }\r\n\tnew_items\r\nend",
"def index\n @deck_of_cards = DeckOfCard.all\n end",
"def filtered_bets\n filter_bets = Bet.played.traditional\n filter_bets = filter_bets.where('bets.created_at > ?', start_date) if start_date.present?\n filter_bets\n end",
"def list_cards_of_player_with_user_id(user_id)\n go_fish.list_cards_of_player_with_user_id(user_id)\n end",
"def sort\n @cards.sort\n end",
"def index\n @cards = Card.order(sku: :ASC)\n end",
"def have_new_cards\n cards = []\n suits = [\"♣\", \"♦\", \"♥\", \"♠\"]\n ranks = [\"A\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\"]\n suits.each do |suit|\n ranks.each do |rank|\n cards << [suit, rank]\n end\n end\n return cards\nend",
"def readied_cards\n if readyable?\n cards.readied\n else\n cards\n end\n end"
] |
[
"0.8104395",
"0.6942105",
"0.69083244",
"0.68344027",
"0.6712353",
"0.66446733",
"0.66267145",
"0.65148646",
"0.6489907",
"0.6477109",
"0.6446121",
"0.64297193",
"0.6391008",
"0.6357982",
"0.635634",
"0.63313264",
"0.6325586",
"0.63185734",
"0.6300373",
"0.6282775",
"0.62674564",
"0.62609124",
"0.6194318",
"0.6114502",
"0.6107474",
"0.60950685",
"0.60945475",
"0.60765725",
"0.60618013",
"0.60606855",
"0.6047892",
"0.604592",
"0.6040971",
"0.603379",
"0.6010887",
"0.5997984",
"0.5990829",
"0.59867275",
"0.59857965",
"0.59727865",
"0.5949459",
"0.5899994",
"0.5868409",
"0.5851573",
"0.5848258",
"0.5829057",
"0.58180064",
"0.5810723",
"0.5802289",
"0.5796721",
"0.5790904",
"0.5775052",
"0.5770165",
"0.5767629",
"0.57647437",
"0.5760678",
"0.5759707",
"0.57394654",
"0.5735397",
"0.57207674",
"0.5715316",
"0.57153004",
"0.5705302",
"0.56982195",
"0.56893027",
"0.56832165",
"0.5682225",
"0.56724274",
"0.56692785",
"0.5667374",
"0.5665955",
"0.5665686",
"0.5653718",
"0.5650128",
"0.5647269",
"0.56447124",
"0.56440496",
"0.56440496",
"0.56440496",
"0.56440496",
"0.5642491",
"0.56298274",
"0.562897",
"0.5626013",
"0.5625656",
"0.5622169",
"0.56213844",
"0.5616428",
"0.5606951",
"0.5601339",
"0.5596674",
"0.5591412",
"0.55898994",
"0.5589575",
"0.55843663",
"0.5583382",
"0.5573218",
"0.55731463",
"0.5570608",
"0.5566343"
] |
0.6523171
|
7
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.