query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Get the username provided in the URI. | def username
@username ||= match[3]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def username\n @digest_parts['username']\n end",
"def username\n @username ||= match[3]\n end",
"def username\n response = get 'v1/market/private/user/username.json'\n response[:username]\n end",
"def getUsername\n return @username\n end",
"def username\n username = user.username\n end",
"def username\n Shellwords.shellescape(SabreDAVExport.username)\n end",
"def get_username\n @user_name ||= self.user.username\n end",
"def extract_identity(uri)\n return $1.downcase if uri =~ %r[/user/([a-zA-Z_1-9-]*)] || uri =~ %r[://([a-zA-Z_1-9-]*)?\\.#{AppConfig.host(request.host)}] || uri =~ %r[://(.*?)/?$]\n return nil\n end",
"def username\n @username || @token['data']\n end",
"def username\n credentials.first\n end",
"def username\n user.username\n end",
"def username\n params[:username].downcase\n end",
"def username\n @username\n end",
"def user\n @user ||= @uri && client.user(@uri.split(':')[2])\n end",
"def username\n @username\n end",
"def username\n email.match(/[^@]+/).to_s\n end",
"def username\n user.username\n end",
"def username\r\n return @user.username\r\n end",
"def get_profile_name(uri)\n uri.host + uri.path\n end",
"def to_param\n username\n end",
"def username\n user.username\n end",
"def username\n user.username\n end",
"def getusername()\r\n return getvalue(SVTags::USER_ID)\r\n end",
"def username_from_cmd\n # the username is the first part of the path\n return self.cmd_opt.gsub(\"'\",\"\").split(\"/\")[0] if !self.cmd_opt.empty?\n end",
"def find_username\n @username || $config.fetch(:username) || prompt_username\n end",
"def get_username()\n username_gitconfig = %x(git config user.name).strip\n username_passwd = Etc.getpwnam(Etc.getlogin).gecos.gsub(/ - SBP.*/,'')\n\n username = username_gitconfig unless username_gitconfig.nil?\n username = username_passwd if username.empty?\n username\n end",
"def username\n @username ||= config_value.split('-')[0]\n end",
"def current_user\n # We just do a 'basename' on the principal to give back a sane value\n # here.\n user_name = Http::UrlUtil.split_path(current_principal)[1]\n\n user_name\n end",
"def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"login\"]\n end",
"def username\n profile['Username']\n end",
"def username\n @username || raise(Communicator::MissingCredentials.new(\"No Username specified for HTTP AUTH. Please configure using Communicator.username='xyz'\"))\n end",
"def username # best practice to reference the same name\n @username\n end",
"def username_domain(username = nil)\n username ||= options[:username] if options\n return unless username\n username.to_s.split('@').last\n end",
"def username\n @username || email\n end",
"def username\n @obj['username']\n end",
"def username\n client.username if client\n end",
"def user_username\n if self.user != nil\n self.user.username\n end\n end",
"def username\n name\n end",
"def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end",
"def username\n if @user.nil?\n @user = JavaSystem.getProperty(\"user.name\")\n end\n\n @user\n end",
"def username\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"username\"]\n end",
"def username\n @attributes[:username]\n end",
"def username\n @attributes[:username]\n end",
"def username\n @attributes[:username]\n end",
"def username\n @attributes[:username]\n end",
"def username\n return username_nada if !username_nada.nil?\n username_kth\n end",
"def username\n @username||=@options['username']\n end",
"def get_username(user_id)\n return User.find(user_id).username\n end",
"def username\n # this @user will always be an instance of a User\n @user.username\n end",
"def find_username\n # Default to the nickname provided in the Omniauth details. If a nickname\n # was not provided or a user with the same username already exists, use the\n # e-mail address as the username.\n username = auth_nickname\n username = auth_email if username.blank? ||\n User.exists?(username: username)\n\n username\n end",
"def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end",
"def real_username\n defined?(USERS_MAP) ? USERS_MAP[@username] : @username\n end",
"def param_user\n params[:username]\n end",
"def username\n @config[\"username\"]\n end",
"def username\n \"rocky\"\n end",
"def query_username\n @attributes[:query_username]\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def extract_user_id(username)\n username[2..-2]\n end",
"def get_username\r\n return @username\r\nend",
"def username\n\t\treturn @un\n\tend",
"def username\n \treturn session[:username]\n \tend",
"def username; end",
"def username; end",
"def username; end",
"def username; end",
"def uri_for_user(username)\n fail ArgumentError, 'Please provide a username' if username.empty?\n\n URI.parse(api_url % username)\n end",
"def username\n self['default_rhlogin']\n end",
"def username\n end",
"def username\n account = github_accounts.first || slack_accounts.first\n account ? account.username : id\n end",
"def get_username( session, data )\n username = session.gets.chomp\n unless data[username]\n debug_msg \"NOT AUTHORIZED. Unknown username \\\"#{username}\\\". Closing session with #{session.peeraddr[2]} #{Time.now}\"\n session.puts \"NOT AUTHORIZED\"\n session.close\n return false\n end\n return username\n end",
"def username \n #The code below will return the users email however, the split will seperate the email based on the parameters entered into the brackets. The code below will split the email at the @ symbol, resulting in the email changing from [email protected] to example @ example.com. The [0] after the brackets is used to determine the index value of the email that should be displayed. When the email is split each section is provided with an index value, starting at 0. The first part of the email (example) will be given the index of 0. This will result in the code displaying example. The capitalize at the end of the statement is used to caplitalise the first letter of the email address.\n return self.email.split('@')[0].capitalize\n end",
"def username\n params[:username].downcase\n end",
"def get_username_by_user_id(user_id)\n User.find(user_id).username\n end",
"def get_username_by_user_id(user_id)\n User.find(user_id).username\n end",
"def username\n @data['username']\n end",
"def username\n @data['username']\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param; username end",
"def to_param; username end",
"def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end",
"def to_param\n\t\tusername\n\tend"
] | [
"0.7776727",
"0.7617545",
"0.7286664",
"0.718011",
"0.7151728",
"0.7074652",
"0.70054626",
"0.6962541",
"0.69530493",
"0.69175553",
"0.6866879",
"0.6862728",
"0.6860857",
"0.6801869",
"0.6796414",
"0.6782567",
"0.67703384",
"0.67552054",
"0.67439604",
"0.6690375",
"0.66720414",
"0.66677415",
"0.66677415",
"0.66577816",
"0.6634423",
"0.6629873",
"0.66298234",
"0.6624591",
"0.66172034",
"0.66122824",
"0.6597788",
"0.6593978",
"0.6577007",
"0.6572874",
"0.65614283",
"0.65366995",
"0.6529638",
"0.6504704",
"0.6489492",
"0.64822435",
"0.6474558",
"0.6472299",
"0.64665943",
"0.64665943",
"0.64665943",
"0.64665943",
"0.64583564",
"0.6447399",
"0.6434017",
"0.6421381",
"0.6419412",
"0.6418396",
"0.64124256",
"0.64070314",
"0.6378139",
"0.63755304",
"0.6371667",
"0.6364589",
"0.6364589",
"0.6364589",
"0.6364589",
"0.636028",
"0.63552964",
"0.6351302",
"0.6305807",
"0.6294806",
"0.6294806",
"0.6294806",
"0.6294806",
"0.6282097",
"0.6260641",
"0.6255129",
"0.6254713",
"0.62182903",
"0.62105656",
"0.6208855",
"0.6206559",
"0.6206559",
"0.61895746",
"0.61895746",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.61873466",
"0.6174909",
"0.6174909",
"0.6169436",
"0.6161135"
] | 0.7334211 | 2 |
def search_property_for_rent value end | def select_filter_drop_downs search_filter , value
case search_filter
when 'filter_type'
select_from_drop_down 's:swfield', value
when 'filter_category'
select_from_drop_down 'rc:swfield', value
when 'filter_sub_category'
select_from_drop_down 'c1:swfield', value
when 'bathroom minimum'
select_from_drop_down 'bathrooms__gte:swfield', value
when 'item sorting'
select_from_drop_down 'id_sort_by', value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(input, property, value); end",
"def where(input, property, value); end",
"def search_property(name) \n name = name.to_sym\n \n if properties[name]\n properties[name]\n elsif superclass.respond_to?(:search_property)\n superclass.search_property(name)\n else\n nil\n end\n end",
"def rdfs_sub_property_of\n end",
"def search(value)\n # YOUR WORK HERE\n end",
"def search(property, value)\n url = ENV.fetch(REPOSITORY_SEARCH_URL).gsub('{property}', property).gsub('{value}', value)\n response = get(url)\n json = JSON.parse(response.body)\n docs = json['response']['docs']\n logger.debug \"#{url} query returned #{docs.count} result(s)\"\n docs\n end",
"def index\n @state = params[:state]\n @region = params[:region]\n @town = params[:town]\n @kind = params[:kind]\n @min_price = params[:min_price]\n @max_price = params[:max_price]\n @min_population = params[:min_population]\n @max_population = params[:max_population]\n @q = Property.search(:state_cont => @state,\n :region_cont => @region,\n :town_cont => @town,\n :kind_cont => @kind,\n :price_gt => @min_price,\n :price_lt => @max_price,\n :population_gt => @min_population,\n :population_lt => @max_population\n )\n @properties = @q.result\n end",
"def search_term\n if params[:props]\n params[:props][:search_term]\n else\n return nil\n end\n end",
"def rent\n @page = Pwb::Page.find_by_slug \"rent\"\n @page_title = @current_agency.company_name\n # @content_to_show = []\n if @page.present?\n @page_title = @page.page_title + \" - \" + @current_agency.company_name\n # TODO: - allow addition of custom content\n # @page.ordered_visible_page_contents.each do |page_content|\n # @content_to_show.push page_content.content.raw\n # end\n end\n # @page_title = I18n.t(\"searchForProperties\")\n # in erb template for this action, I have js that will render search_results template\n # for properties - like search_ajax action does\n @operation_type = \"for_rent\"\n # above used to decide if link to result should be to buy or rent path\n\n @properties = Prop.visible.for_rent.limit 45\n # .order('price_rental_monthly_current_cents ASC').limit 35\n\n @prices_from_collection = @current_website.rent_price_options_from\n @prices_till_collection = @current_website.rent_price_options_till\n # @prices_collection = %W(#{''}\n # 150 250 500 1,000 1,500 2,000 2,500 3,000 4,000 5,000 10,000)\n\n set_common_search_inputs\n set_select_picker_texts\n apply_search_filter filtering_params(params)\n set_map_markers\n @search_defaults = params[:search].present? ? params[:search] : {}\n\n js \"Main/Search#sort\" # trigger client-side paloma script\n render \"/pwb/search/rent\"\n end",
"def find_property\n @property ||= scope.find(params[:id])\n end",
"def search_results\n base_scope=Property.search(params[:property])\n properties=base_scope.valid\n invalid_properties=base_scope.invalid\n\n if invalid_properties.count>0\n #We have some properties that are now rented out in the search results, so offer alternatives in @alternative_properties\n @alternative_properties=Property.alternatives_to(invalid_properties)\n end\n\n @properties = properties.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:properties => @properties, :alternative_properties => @alternative_properties} }\n end\n end",
"def my_rents_office\n sc = SearchCondition.new(:user_id => session[:user_id],\n :city => \"Москва\", #todo: add code to process several cities in SearchCondition\n :realty_types => [\"office\",\"trading_floor\",\"warehouse\",\"catering\",\"free_app\",\"garage\",\"manufacture\",\"legal_address\",\"autoservice\",\"selling_business\"]\n )\n @entries = Entry.find_with_search_condition(sc)\n \n end",
"def index\n # @properties = Property.filter_by_building(params[:buildingnumber])\n # @building = Building.find(params[:building_id])\n @properties = Property.search(params[:search])\n end",
"def get_value(name)\n collection.find_one(get_search_query)[\"#{name}\"]\n end",
"def query\n @property_hash\n end",
"def search_type\n 0\n end",
"def search=(value)\n @search = value\n end",
"def search; end",
"def recent_properties_for_claim(status=nil, property_for='Sale', buyer_id=nil, search_str=nil, is_premium=false, page_number=1, owned_property=nil, count=false, latest_time=nil)\n ### District of that branch\n branch = self.branch\n district = branch.district\n query = Agents::Branches::AssignedAgents::Lead\n vendor = PropertyBuyer.where(id: buyer_id).select(:vendor_id).first if buyer_id\n vendor_id = vendor.vendor_id if vendor\n vendor_id ||= nil\n source_mailshot = Agents::Branches::AssignedAgents::Lead::SOURCE_MAP[:mailshot]\n branch_id = self.branch_id\n\n if !self.locked\n query = query.where('created_at > ?', Time.parse(latest_time)) if latest_time\n query = query.where(vendor_id: vendor_id) if buyer_id\n query = query.where(owned_property: owned_property) if !owned_property.nil?\n query = query.where(\"(((district = ? AND owned_property = 'f') OR (owned_property='t' AND agent_id = ?)) AND source is null ) OR ( source = ? AND pre_agent_id = ? )\", district, self.id, source_mailshot, self.id)\n \n if search_str && is_premium\n udprns = Enquiries::PropertyService.fetch_udprns(search_str)\n udprns = udprns.map(&:to_i)\n query = query.where(property_id: udprns)\n end\n \n if status == 'New'\n query = query.where(agent_id: nil)\n elsif status == 'Won'\n query = query.where(agent_id: self.id)\n elsif status == 'Lost'\n query = query.where.not(agent_id: self.id).where.not(agent_id: nil)\n end\n\n Rails.logger.info(\"QUERY_#{query.to_sql}\")\n\n if self.is_premium\n leads = query.order('created_at DESC')\n results = leads.map{|lead| populate_lead_details(lead, status) }\n return results, results.count\n else\n count = query.count\n page_number ||= 1\n page_number = page_number.to_i\n page_number -= 1\n leads = query.order('created_at DESC').limit(PAGE_SIZE).offset(page_number.to_i*PAGE_SIZE)\n results = leads.map{|lead| populate_lead_details(lead, status) }\n return results, count\n end\n else\n return [], 0\n end\n\n end",
"def [](term_or_property)\n get_values(term_or_property)\n end",
"def to_search\n self.class.properties.map do |name, opts|\n next unless opts\n val = instance_variable_get( \"@#{ name }\" )\n next unless val\n val = val.strftime \"%Y-%m-%dT%H:%M:%S\" if val.respond_to? :strftime\n case opts[:search]\n when :prefix\n \"#{ name }:\" + val.to_s\n when :fulltext\n val.to_s\n end\n end.compact.join \"\\n\"\n end",
"def search\n return @search\n end",
"def search\n # Invoke Searchkick's search method with our search constraints.\n @results ||= search_model.search(@query, search_constraints)\n\n # Wrap the information as a hash and pass it to PropertiesController.\n {\n results: @results,\n formatted_query: formatted_query,\n json_for_map: json_for_map,\n center_lng_lat: center_lng_lat\n }\n end",
"def car\n @value1\n end",
"def my_rents_flat_and_room\n sc = SearchCondition.new(:user_id => session[:user_id],\n :realty_types => [\"flat\",\"room\"]\n )\n @entries = Entry.find_with_search_condition(sc)\n end",
"def get_rental_info_by_book_title(searched_title)\n if searched_title == @title\n return @inventory[0][:rental_details]\n else\n return nil\n end\nend",
"def search\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:query])\n @result = Property.where(:address => params_map[:address]).take\n if @result\n @manager = Manager.find(@result.manager_id)\n flash.clear\n render 'search'\n else\n flash[:notice] = \"Your search returned no results.\"\n render 'search'\n end\n end",
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def find_relationship_by(attribute, value); end",
"def joining_criteria__index\r\nreturn read_attribute(:joining_criteria)\r\nend",
"def search\n\n end",
"def search(criteria = {})\r\n \r\n end",
"def get_properties_query\n\n s1='\"properties\".\"order_type\" = '+\"'#{params[:property][:order_type]}'\"\n if params[:property][:property_type] != 0 && params[:property][:property_type] != \"NILL\" && params[:property][:property_type].present?\n s1=s1+\" AND \"+'\"properties\".\"property_type\" = '+\"'#{params[:property][:property_type]}'\"\n end\n if params[:property][:property_type_code] != 0 && params[:property][:property_type_code] != \"NILL\" && params[:property][:property_type_code].present? \n s1=s1+\" AND \"+'\"properties\".\"property_type_code\" = '+\"'#{params[:property][:property_type_code]}'\"\n end\n if params[:property][:property_location] != 0 && params[:property][:property_location] != \"NILL\" && params[:property][:property_location].present? \n s1=s1+\" AND \"+'\"properties\".\"property_location\" = '+\"'#{params[:property][:property_location]}'\"\n end\n if params[:property][:property_locality] != 0 && params[:property][:property_locality] != \"NILL\" && params[:property][:property_locality].present? \n s1=s1+\" AND \"+'\"properties\".\"property_locality\" = '+\"'#{params[:property][:property_locality]}'\" \n end \n return s1\n end",
"def hit_value()\n #This is a stub, used for indexing\n end",
"def search \n\n end",
"def criteria1\n return @criteria1\n end",
"def index\n @properties = Property.all\n if params[:search]\n if params[:search_criteria] == \"address\"\n @properties = Property.searchAddress(params[:search]).order(\"created_at DESC\")\n elsif params[:search_criteria] == \"city\"\n @properties = Property.searchCity(params[:search]).order(\"created_at DESC\")\n elsif params[:search_criteria] == \"zip\"\n @properties = Property.searchZip(params[:search]).order(\"created_at DESC\")\n end\n else\n @properties = Property.all.order('created_at DESC')\n end\n end",
"def prop(name)\n properties.named(name).first.andand.value\n end",
"def my_rents_suburban\n sc = SearchCondition.new(:user_id => session[:user_id],\n :realty_types => [\"house\",\"part_of_house\",\"plot\",\"townhouse\"]\n )\n @entries = Entry.find_with_search_condition(sc)\n @qs = sc.get_sql_condition\n end",
"def values_for_properties; end",
"def properties_by_node(prop_find, node)\n emit('propFind', [prop_find, node])\n end",
"def property(name); end",
"def search\n\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def property_for(term)\n if mapping.key?(term) && metadata.respond_to?(mapping[term])\n mapping[term]\n elsif metadata.respond_to?(term)\n term\n end\n end",
"def obtain_items(column_value,nuix_case)\n\t\t# Run a search for the given property\n\t\tAnnotationCSVParser.log(\"Obtaining items based on property...\")\n\t\titems = nuix_case.search(\"properties:\\\"#{@property_name}:#{column_value}\\\"\")\n\t\t# Further refine matches to only items where the given property contains the exact\n\t\t# specified value\n\t\titems = items.select do |item|\n\t\t\tnext item.getProperties[@property_name] == column_value\n\t\tend\n\tend",
"def get_cis_by_property_value(property, value)\n get_cis_with_properties.select {|id, hash| hash.has_key? property and hash[property] == value }\n end",
"def search\t\t\n\t\t @query = params[:query]\n\t\t @storecunsumptions = Storecunsumption.search @query, :page => params[:page], :per_page => 10\t\t\n\tend",
"def search\n end",
"def index\n @properties = ((current_person== current_admin)? Property.all : Property.where(user:current_person)).paginate(:page => params[:page], :per_page => 3)\n\n end",
"def fetch_custom_search_params; end",
"def directors_hash\n search_by_itemprop_hash 'director'\n end",
"def getValue page, attribute\n if attribute == 'rating'\n return page.search('.ratingValue').children[1].text\n end\nend",
"def property\n @property\n end",
"def property_params\n params[:property]\n end",
"def search_value\n params[:search] || nil\n end",
"def search_value\n params[:search] || nil\n end",
"def find_property\n unless self.property_name.blank?\n my_properties = Property.active.find_all_by_name(self.property_name)\n unless my_properties.blank? || my_properties.length != Array(self.property_name).length\n self.properties = my_properties\n else\n self.property_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end",
"def fetch_property(name)\n properties.where(\"name = ?\", name).first\n end",
"def index\n\n @properties = Property.search( params[:query] || \"\" )\n\n respond_to do |format|\n\n format.html\n format.json { render json: @properties }\n\n end\n\n end",
"def full_text_search\n @attributes[:full_text_search]\n end",
"def criteria1=(value)\n @criteria1 = value\n end",
"def get_search_values\n search_by_values = [[I18n.translate(\"part_number\",:scope => \"open_orders.index\"),\"pn\"],[I18n.translate(\"po_number\",:scope => \"open_orders.index\"),\"po\"],\n [I18n.translate(\"all_refill_order\",:scope => \"order_refill.index\"),\"all\"]]\n\n search_by_values\n end",
"def index\n @rental_properties = RentalProperty.all\n end",
"def rent\r\n if self.actual_rent\r\n return self.actual_rent.price\r\n else\r\n return 0\r\n end\r\n end",
"def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.uk/api?place_name=#{@property.postCode}&action=search_listings&pretty=1&encoding=json&listing_type=rent&country=uk\")\n @data = @response['response']['listings']\n respond_to do |format|\n format.js\n end\n end",
"def search_string\n @search_string\n end",
"def get_property(property)\n rows = weather_properties.select do |row|\n row.header.text.downcase == property\n end\n\n return nil if rows.empty?\n\n rows.first.value.text\n end",
"def resourceType\n 'SearchParameter'\n end",
"def search(query)\n selected_laptop = PRODUCTS.select do |laptop|\n laptop[:name].downcase.include?(query[:q]) && (query[:price_min]..query[:price_max]).include?(laptop[:price])\n end\n p selected_laptop\nend",
"def criteria2\n return @criteria2\n end",
"def search_designer\n end",
"def find(value)\n end",
"def filtered\n @properties = Property.where('lower(name) LIKE ?', \"%#{params[:q].mb_chars.downcase}%\").order(:name)\n respond_with(@properties) do |format|\n format.html { render :template => \"admin/properties/filtered.html.erb\", :layout => false }\n end\n end",
"def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end",
"def value\n send property.type_field\n end",
"def search_room\n item_description\n end",
"def search(find_val)\n false\n end",
"def [](property); end",
"def services\n Car.all.find do |c| \n c.classification == self.specialty\n end\nend",
"def value\n \n end",
"def value\n @property_hash[:value]\n end",
"def criteria2=(value)\n @criteria2 = value\n end",
"def searching?\n @searching\n end",
"def search_text_field\n @page.find('search_term')\n end",
"def search\r\nend",
"def search_data\n {\n name: name,\n secondary: secondary_name,\n city: city,\n state: state\n }\n end",
"def property_for(term)\n if mapping.key?(term) && object.respond_to?(mapping[term])\n mapping[term]\n elsif object.respond_to?(term)\n term\n end\n end",
"def used_properties\n @properties.values.find_all &:used?\n end",
"def ordered_property?(property_name)\n %w[title creator abstract contributor additional_information].include? property_name\nend",
"def index\n \tif @current_user\n \t\tsetting_distance = Setting.first.mile_for_list\n # raise setting_distance.inspect\n \t\tif params[:lat].present? && params[:lon].present?\n # @property = Property.where.not(is_active: false,status:'Sold').order(\"id DESC\").includes(:property_detail).distance(params[:lat].to_f,params[:lon].to_f,distance)\n @property = Property.where.not(is_active: false,status:'Sold').includes(:property_detail).order(\"id DESC\").near(\"#{params[:lat]},#{params[:lon]}\",setting_distance)\n\n # @property = Property.where(is_active: true).distance(params[:lat].to_f,params[:lon].to_f,distance)\n \t\t\t# @property.delete_if {|x| x.status == \"Sold\" || x.is_active == false }\n \t\telse\n \t\t\t@property = Property.where(status: \"For Sale\",is_active: true).order(\"id DESC\").includes(:property_detail)\n \t\tend\n \t\tif @property.present?\n \t\t\trender :file => 'api/v1/property/index'\n \t\telse\n \t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n \t\tend\n \tend\n end",
"def show\n @property = Property.find(params[:id])\n\n do_search(@property.number_of_rooms, @property.location)\n @properties.delete @property\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end"
] | [
"0.6911654",
"0.6543509",
"0.63734984",
"0.6230323",
"0.6139207",
"0.6085541",
"0.6072958",
"0.60677445",
"0.60495543",
"0.5943662",
"0.59184605",
"0.58887976",
"0.58388466",
"0.58353114",
"0.5832827",
"0.58316654",
"0.58226824",
"0.5811934",
"0.58055544",
"0.5797646",
"0.5777622",
"0.5752274",
"0.57495975",
"0.57181513",
"0.57095104",
"0.5701195",
"0.5700745",
"0.56866395",
"0.56762385",
"0.56371474",
"0.5631597",
"0.5627493",
"0.5619123",
"0.5618639",
"0.56138396",
"0.56119776",
"0.560695",
"0.56064254",
"0.55933875",
"0.5580238",
"0.55770785",
"0.5571905",
"0.55445856",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.554247",
"0.5541697",
"0.55342335",
"0.55169994",
"0.55145943",
"0.55101377",
"0.55096364",
"0.5496317",
"0.54642826",
"0.54490113",
"0.5441437",
"0.5438503",
"0.5437799",
"0.5437799",
"0.5435749",
"0.5432013",
"0.5428009",
"0.54279923",
"0.54236877",
"0.5420594",
"0.54191786",
"0.5409205",
"0.5402693",
"0.5401543",
"0.5391868",
"0.5385874",
"0.5384889",
"0.5376581",
"0.53657615",
"0.5363883",
"0.53611434",
"0.5356579",
"0.5347488",
"0.53458124",
"0.53457457",
"0.5330708",
"0.53261703",
"0.53261346",
"0.53208345",
"0.53203785",
"0.5314249",
"0.53121555",
"0.5308539",
"0.52915424",
"0.5286938",
"0.52823824",
"0.52819145",
"0.52817684",
"0.5275507"
] | 0.0 | -1 |
Test parsing of an arff file. | def test_arff_parse
in_file = './test_arff.arff'
rel = Rarff::Relation.new
rel.parse(File.open(in_file).read)
assert_equal(rel.instances[2][1], 3.2)
assert_equal(rel.instances[7][4], 'Iris-setosa')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sparse_arff_parse\n in_file = './test_sparse_arff.arff'\n rel = Rarff::Relation.new\n rel.parse(File.open(in_file).read)\n\n assert_equal(rel.instances[0].size, 13)\n assert_equal(rel.instances[0][1], 0)\n assert_equal(rel.instances[0][3], 7)\n assert_equal(rel.instances[1][1], 2.4)\n assert_equal(rel.instances[1][2], 0)\n assert_equal(rel.instances[1][12], 19)\n assert_equal(rel.instances[2][6], 6)\n assert_equal(rel.instances[3][12], 0)\n#\t\tputs \"\\n\\nARFF: (\\n#{rel.to_arff}\\n)\"\n end",
"def parse_file(filename); end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def parse(file)\n puts \"Not yet implemented\"\nend",
"def test_legal_file_parsing\n assert_equal( Graph.new().parse_json_file(\"CSAirData.json\"), true ) \n end",
"def parse_input (input_file)\nend",
"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 initialize_from_arff( file )\n feature_list, t_class, f_class, instances = WekaCompatability.load_arff( file )\n initialize_model( feature_list, t_class, f_class )\n train_model( instances )\n end",
"def test_parse\n result = Yadis.parseXRDS(read_data_file(XRD_FILE))\n assert_not_nil result\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 test_astar\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : ( A )* ;\")\n expecting = \".s0-A->:s1=>1\\n\" + \".s0-EOF->:s2=>2\\n\"\n check_decision(g, 1, expecting, nil, nil, nil, nil, 0)\n end",
"def test_to_file\n @parser.text_line :comment, :match => /^#/\n @parser.text_line :blank, :match => /^\\s*$/\n @parser.record_line :record, :fields => %w{name one two}\n\n text = \"# This is a comment\n\njohnny one two\nbilly three four\\n\"\n\n# Just parse and generate, to make sure it's isomorphic.\nassert_nothing_raised do\n assert_equal(text, @parser.to_file(@parser.parse(text)),\n \"parsing was not isomorphic\")\n end\n end",
"def parse! filename\n parse_! filename\n end",
"def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end",
"def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end",
"def run\n src = ARGF.read\n exit 2 unless src\n\n interpreter = Expectr::Interpreter.new(src.untaint)\n interpreter.filename = $FILENAME\n interpreter.run\n end",
"def parse_actl(len, file)\n return -1 if len != 8\n framedata = file.read(4)\n if framedata.nil? || framedata.length != 4\n return -1\n end\n\n framedata.unpack1(\"N\".freeze)\n end",
"def find_apf( path_and_file = self.file_name_and_contents.path_and_file)\n match_apf = []\n regexp = /^t([^ \\#]+)( *$| )/\n File_name_and_contents.new( path_and_file ).contents.each do |line|\n if line.match(regexp) != nil\n if line.match(regexp)[1] != nil \n match_apf << ( self.file_name_and_contents.path_and_file.sub(/\\/.+/, '') + '/' + line.match(regexp)[1].chomp + '.apf' ) \n end\n end\n end\n match_apf\n end",
"def test_valid\n assert_equal(correct_results,\n ConfigParser.parse(\"data/valid.config\"))\n end",
"def testParseLine\n ep = EiBiScheduleParser.new\n\n line = \"7490;2300-0455;;;WBCQ;E;NA;;;;\"\n bc = ep.parseEiBiTextLine(line)\n assert_equal 7490, bc[:frequency]\n assert_equal \"WBCQ\", bc[:broadcaster]\n assert_equal 23, bc[:startHour]\n assert_equal 0, bc[:startMinute]\n assert_equal 4, bc[:endHour]\n assert_equal 55, bc[:endMinute]\n assert_equal \"NA\", bc[:targetRegion]\n end",
"def parse( logger = nil )\n result = nil\n line_count = 0\n detector_fin1_res = ContextDetector.new( FIN1_RESULT_TYPEDEF, logger )\n detector_fin2_res = ContextDetector.new( FIN2_RESULT_TYPEDEF, logger )\n detector_fin3_res = ContextDetector.new( FIN3_RESULT_TYPEDEF, logger )\n detector_uisp_res = ContextDetector.new( UISP_RESULT_TYPEDEF, logger )\n detector_fin1_sta = ContextDetector.new( FIN1_STARTLIST_TYPEDEF, logger )\n\n File.open( @full_pathname ) do |f|\n f.each_line do |curr_line| # Make sure each line has a valid UTF-8 sequence of characters:\n curr_line = EncodingTools.force_valid_encoding( curr_line )\n line_count += 1\n # While reading the file line by line, detect the type:\n if detector_fin3_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN3 RESULT-type file detected!\" ) if logger\n result = Fin3ResultDefs.new( logger )\n break\n\n elsif detector_fin1_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN1 RESULT-type file detected!\" ) if logger\n result = FinResultDefs.new( logger )\n break # Break as soon as we have a match (FIFO wins)\n\n elsif detector_fin2_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN2 RESULT-type file detected!\" ) if logger\n result = Fin2ResultDefs.new( logger )\n break\n\n elsif detector_uisp_res.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"UISP RESULT-type file detected!\" ) if logger\n result = UispResultDefs.new( logger )\n break\n\n elsif detector_fin1_sta.feed_and_detect( curr_line, line_count, nil )\n logger.info( \"FIN1 STARTLIST-type file detected!\" ) if logger\n result = FinStartListDefs.new( logger )\n break\n\n else\n nil\n end\n end\n end\n result\n end",
"def test_parser_recognizer_success\n assert_equal '4', @parser.recognizer(VALID_DIGIT.lines.to_a[1..3].map{|l| l.chomp})\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def test_validate_file\n file_list = [\n '0|0|SYSTEM>569274(100)|1553184699.650330000|288d',\n '1|288d|569274>735567(12):735567>561180(3):735567>689881(2):SYSTEM>532260(100)|1553184699.652449000|92a2',\n '2|92a2|569274>577469(9):735567>717802(1):577469>402207(2):SYSTEM>794343(100)|1553184699.658215000|4d25'\n ]\n assert validate_file file_list, [0, 0], '0'\n end",
"def parse(source); end",
"def parse_from_file filename\n parse File.open(filename)\n end",
"def test_parser_run\n Yay::PARSER_TESTS.each_pair { |input, expected|\n parser = Yay::Parser.new\n assert_equal expected, parser.parse(input), \"For |#{input}|\"\n }\n end",
"def extract_test_from_file(file)\n return nil if ! File.file?(file)\n tests = \"\"; inside = false\n fstr = File.read(file)\n fstr.split(/\\n/).each do |l|\n if l =~ /^=begin[ ]*test/i\n tests << \"\\n\"\n inside = true\n next\n elsif inside and l =~ /^=[ ]*end/\n inside = false\n next\n end\n if inside\n tests << l << \"\\n\"\n end\n end\n tests\n end",
"def parse_nfo\n @nfo.split(/\\n/).each do |line|\n case line\n when /subtitle|sub/i\n @srt << 'fr' if line =~ /fr|fre|french/i\n @srt << 'en' if line =~ /en|eng|english/i\n # TODO add more language parsing here\n @srt << 'none' if line =~ /none/i\n when /imdb\\.com\\/title\\//\n @imdb_link = (matched = line.match(/imdb.com\\/title\\/(tt[0-9]+)/)) && \"http://imdb.com/title/#{matched[1]}\"\n end\n end\n @srt << 'unknown' if @srt.empty?\n end",
"def test_can_it_read_text\n assert_equal @fr_read, \"Here is some sample text\"\n end",
"def is_parser_for?(ical)\n ical =~ BINARY.to_whole_line\n end",
"def parse\n end",
"def tests\n parser.flow_items\n end",
"def scan_file (file_name)\n #for each line\n File.open(file_name).each do |line|\n parsed_line = parse_line line\n raise \"Invalid spec format:\\n\" + line if parsed_line.class == InvalidLine\n update_on_new_line parsed_line\n end \n @test_suite.add_test_case current_test_case if current_test_case && @state.class == AddingTestCases\n @test_suite\n end",
"def test_format_verifier\n Recode.generate('test/fixtures/format.xrns', from: template) do |dir|\n song_file = File.join(dir, 'Song.xml')\n doc = Nokogiri::XML(IO.read(song_file))\n \n # declaration of the song's tracks (optionally with effects etc)\n assert_equal [\"SequencerTrack\"] * 6 + [\"SequencerMasterTrack\"], doc.search('/RenoiseSong/Tracks/*').map(&:name)\n \n # available patterns are grouped into a pattern pool (and later referenced from the sequence)\n assert_equal 1, doc.search('/RenoiseSong/PatternPool/Patterns/Pattern').count\n\n # each pattern has its own length\n assert_equal 8, Integer(doc.search('/RenoiseSong/PatternPool/Patterns/Pattern[1]/NumberOfLines').text)\n \n # each pattern must have data for the exact number of tracks configured for the song (see above)\n assert_equal [\"PatternTrack\"] * 6 + [\"PatternMasterTrack\"], doc.search('/RenoiseSong/PatternPool/Patterns/Pattern[1]/Tracks/*').map(&:name)\n end\n end",
"def parse_file_to_ar(f)\n pp_ok \"STARTING PARSE for file #{f}...\"\n\n @doc = Nokogiri::XML(File.open(f), 'UTF-8') do |config|\n config.options = Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NOBLANKS\n end\n\n # Extend name space to include METS\n # couldn't get the following to work\n # example: node.xpath('.//foo:name', {'foo' => 'http://example.org/'})\n # example: node.xpath('.//xmlns:name', node.root.namespaces)\n # my try: puts @doc.xpath(\"xmlns:METS\", {\"METS\" => \"http://www.loc.gov/METS/\"})\n\n # The following actually modifies the xml, which we don't want. But it works.\n ns = @doc.root.add_namespace_definition(\"xmlns:METS\", \"http://www.loc.gov/METS/\")\n\n\n\n pp_ok \"Current file is: #{f}\"\n # issue information -------------\n # note: issue_id is autoincremented by the db\n # and we will want to select it from the last row created\n\n pp_ok \"ISSUE INFO:\"\n hathitrust = @doc.xpath(\"//MODS:identifier[@type='hathitrust']/text()\").to_s\n pp_ok \"hathitrust value is #{hathitrust}\"\n\n volume = @doc.xpath(\"//MODS:detail[@type='volume']/MODS:number/text()\").to_s\n pp_ok \"volume value is #{volume}\"\n\n issue_no = @doc.xpath(\"//MODS:detail[@type='issue']/MODS:number/text()\").to_s\n pp_ok \"issues value is #{issue_no}\"\n\n edition = @doc.xpath(\"//MODS:detail[@type='edition']/MODS:number/text()\").to_s\n pp_ok \"edition value is #{edition}\"\n\n date_issued = @doc.xpath(\"//MODS:dateIssued/text()\").to_s\n pp_ok \"dateIssued value is #{date_issued}\"\n\n newspaper = @doc.xpath(\"/METS:mets/@LABEL\").to_s\n newspaper = newspaper.split(\",\").first.strip\n pp_ok \"newspaper is #{newspaper}\"\n\n\n issue_id = add_data_issue_ar(hathitrust, volume, issue_no, edition, date_issued, newspaper)\n\n pp_ok \"ISSUE ID IS: #{issue_id}\"\n\n # page information -------------\n # note: page_id is autoincremented by the db\n\n pages_target = \"//METS:structMap/METS:div[@TYPE='np:issue'][@DMDID='issueModsBib']/METS:div[@TYPE='np:page']\"\n\n pages = @doc.xpath(pages_target)\n\n @doc.xpath(pages_target).each do |node|\n\n pp_ok \"PAGE INFO:\"\n\n pp_ok \"issue_id value is #{issue_id}\"\n\n page_no = node.xpath(\"@ORDERLABEL\").to_s\n pp_ok \"page_no value is #{page_no}\"\n\n sequence = node.xpath(\"@ORDER\").to_s.to_i\n pp_ok \"sequence value is #{sequence}\"\n\n text_link = node.xpath(\"METS:mptr[1]/@xlink:href\").to_s\n pp_ok \"text_link value is #{text_link}\"\n\n img_link = node.xpath(\"METS:mptr[2]/@xlink:href\").to_s\n pp_ok \"img_link value is #{img_link}\"\n\n add_data_page_ar(issue_id, page_no, sequence, text_link, img_link)\n\n end # each\n\n pp \"File #{f} processed\"\n\n end",
"def from_file?\n [email protected]?\n end",
"def parse\n return parse_text unless @text.nil?\n return parse_file unless @file.nil? && @file_name.nil?\n return false\n end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parsef!(file: \"\")\n types = @type ? [@type] : VALID_TASKS\n\n File.open(file, \"r\") do |f|\n line_number = 1\n while line = f.gets\n types.each do |type|\n result = line.match(/#{Regexp.escape(type)}[\\s,:-]+(\\S.*)\\Z/) rescue nil\n\n unless result.nil?\n task = {\n file: file,\n line_number: line_number,\n task: result.to_a.last\n }\n\n @tasks[type.to_sym] << task\n end\n end\n\n line_number += 1\n end\n end\n end",
"def parse_file(file, lines)\n\t\traise \"Missing parse_file() implementation for Filter: #{@name}\"\n\tend",
"def parse (filename)\n f = File.open(filename)\n f.each do\t|line|\n next if line =~ /^#/\n sym, val = line.split(':')\n sym_strip = sym.gsub(/\\s+/, \"\").strip\n val_strip = val.strip\n add_accesor sym_strip, val_strip\n end\n # p \"XMP: file parsed\"\n f.close\n end",
"def parse\n parse_file\n self\n end",
"def parse_lfo(lfo)\n data = @bytes.next\n lfo.wave = (data & 0xC0) >> 6\n lfo.frequency = data & 0x3F\n\n data = @bytes.next\n mod_part_one = (data & 0xC0) >> 6\n lfo.level1 = data & 0x3F\n\n data = @bytes.next\n mod_part_two = (data & 0xC0) >> 6\n lfo.level2 = data & 0x3F\n\n lfo.modulator.source = (mod_part_one << 2) + mod_part_two\n\n data = @bytes.next\n lfo.reset = bit_true?(data)\n lfo.humanize = bit_true?(data, 2)\n lfo.delay = data & 0x3F\n end",
"def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equal(120, test_songs[:no_tempo].tempo)\n assert_equal([:verse], test_songs[:no_tempo].flow)\n \n assert_equal(100, test_songs[:repeats_not_specified].tempo)\n assert_equal([:verse], test_songs[:repeats_not_specified].flow)\n \n # These two songs should be the same, except that one uses a kit in the song header\n # and the other doesn't.\n [:example_no_kit, :example_with_kit].each do |song_key|\n song = test_songs[song_key]\n assert_equal([:verse, :verse,\n :chorus, :chorus,\n :verse, :verse,\n :chorus, :chorus, :chorus, :chorus,\n :bridge,\n :chorus, :chorus, :chorus, :chorus],\n song.flow)\n assert_equal(99, song.tempo)\n assert_equal([\"bridge\", \"chorus\", \"verse\"], song.patterns.keys.map{|key| key.to_s}.sort)\n assert_equal(4, song.patterns[:verse].tracks.length)\n assert_equal(5, song.patterns[:chorus].tracks.length)\n assert_equal(1, song.patterns[:bridge].tracks.length)\n end\n \n song = test_songs[:example_with_empty_track]\n assert_equal(1, song.patterns.length)\n assert_equal(2, song.patterns[:verse].tracks.length)\n assert_equal(\"........\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/snare_mono_8.wav\"].rhythm)\n \n song = test_songs[:multiple_tracks_same_sound]\n assert_equal(2, song.patterns.length)\n assert_equal(7, song.patterns[:verse].tracks.length)\n assert_equal([\"agogo\", \"bass\", \"bass2\", \"bass3\", \"bass4\", \"hh_closed\", \"snare\"],\n song.patterns[:verse].tracks.keys.sort)\n assert_equal(\"X...............\", song.patterns[:verse].tracks[\"bass\"].rhythm)\n assert_equal(\"....X...........\", song.patterns[:verse].tracks[\"bass2\"].rhythm)\n assert_equal(\"........X.......\", song.patterns[:verse].tracks[\"bass3\"].rhythm)\n assert_equal(\"............X...\", song.patterns[:verse].tracks[\"bass4\"].rhythm)\n assert_equal(\"..............X.\", song.patterns[:verse].tracks[\"snare\"].rhythm)\n assert_equal(\"X.XXX.XXX.X.X.X.\", song.patterns[:verse].tracks[\"hh_closed\"].rhythm)\n assert_equal(\"..............XX\", song.patterns[:verse].tracks[\"agogo\"].rhythm)\n \n song = test_songs[:with_structure]\n assert_equal([:verse, :verse], song.flow)\n assert_equal(1, song.patterns.length)\n assert_equal(1, song.patterns[:verse].tracks.length)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n end",
"def parse_file?(node_file)\n node_file.is_a?(String) && is_interesting_file?(node_file) && !is_ignored?(node_file)\n end",
"def test_parsing_from_pftrack\n fixture = File.open(File.dirname(__FILE__) + '/julik_pftrack.txt')\n trackers = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 720, :height => 576).to_a\n \n bl_kf = trackers[0][0]\n assert_in_delta 0.5, bl_kf.abs_x, DELTA\n assert_in_delta 0.5, bl_kf.abs_y, DELTA\n \n tr_kf = trackers[1][0]\n assert_in_delta 715.5, tr_kf.abs_x, DELTA\n assert_in_delta 571.514, tr_kf.abs_y, DELTA\n end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def parse(source_buffer); end",
"def liberal_parsing?() @liberal_parsing end",
"def parse\n fail StandardError.new('parse has not been implemented.')\n end",
"def probably_fasta?(file)\n File.read(file, 1) == '>'\n end",
"def initialize(filename)\n @filename = filename\n parse()\n end",
"def parse_test_file(test)\n gather_and_store_includes( test, extract_from_file(test) )\n end",
"def test_from_flame2012\n fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/Flame_Stabilizer_2012.stabilizer')\n trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a\n \n assert_equal 5, trackers.length\n assert_equal 61, trackers[0].length\n end",
"def openFile(folder, arquive)\n file = File.open(folder+\"/\"+arquive+\".txt\",\"r\")\n @dataLines=file.read\n file.close\n @vectorLines = split_input(@dataLines, \"\\n\")\n end",
"def test_parser\n errors = [\n \"a=b\\n[section]\\c=d\",\n \"[section]\\nc\",\n \"[section]\\n=d\"\n ]\n errors.each {|error|\n io = StringIO.new(error)\n exception = assert_raise(RuntimeError){ @svnauthz.parse(io) }\n assert_match /Syntax error/, exception.message\n }\n end",
"def parsed; end",
"def parsed; end",
"def parse file_contents\n raise NRSER::AbstractMethodError.new self, __method__ \n end",
"def perform\n accept(parse_file)\n end",
"def parse_file(filename)\n File.open(filename, 'r') { |f| parse f }\n end",
"def test_flame_2014_stabilizer_import\n fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/stabilizer_2014_stp.stabilizer')\n trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a\n assert_equal 2, trackers.length\n assert_equal 56, trackers[0].length\n assert_equal 56, trackers[1].length\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 main\n input = File.read('19.txt')\n messages, rules = parse(input)\n debug messages.select { |m| ok?(rules, m) }.size # 178\nend",
"def test_from_flame_setup\n fixture = File.open(File.dirname(__FILE__) + '/Flame_Smk2013_SubpixSample.stabilizer')\n t = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a[0]\n first_kf = t[0]\n assert_in_delta 0.5, first_kf.abs_x, DELTA\n assert_in_delta 0.5, first_kf.abs_y, DELTA\n end",
"def file\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 6:5: ( NL )? (a= definition )*\n # at line 6:5: ( NL )?\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == NL )\n alt_1 = 1\n end\n case alt_1\n when 1\n # at line 6:5: NL\n match( NL, TOKENS_FOLLOWING_NL_IN_file_27 )\n\n end\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = DefinitionListEval.new \n # <-- action\n end\n\n # at line 7:3: (a= definition )*\n while true # decision 2\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0 == COMPONENT || look_2_0.between?( ENTITY, ENUM ) || look_2_0 == OPEN || look_2_0 == SYSTEM )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 7:4: a= definition\n @state.following.push( TOKENS_FOLLOWING_definition_IN_file_37 )\n a = definition\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_definition(a) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 2\n end\n end # loop for decision 2\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 1 )\n\n\n end\n\n return value\n end",
"def test1\n rtext = \"\"\n parser = ZML::StreamToXML.new(rtext)\n REXML::Document.parse_stream(DOC1, parser)\n\n # The results should be byte-by-byte equal. (Actually, there might\n # be differences like attr='val' versus attr=\"val\", or ordering of\n # the attributes, but we choose our test case carefully!)\n assert_equal(DOC1, rtext)\n end",
"def parse_file!(file, arg={})\n spx = ICU::Util::File.read_utf8(file)\n arg[:is_utf8] = true\n parse!(spx, arg)\n end",
"def test_print_usage\n fr = FileReader.new\n assert_output(\"Usage: ruby verifier.rb <name_of_file>\\n\"\\\n \"\\tname_of_file = name of file to verify\\n\") { fr.print_usage }\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 parse\n body = [expr]\n expect(:EOF)\n Apparat::Byte::Root.new(@filename, body)\n end",
"def parse\n # Flac file maybe contain ID3 header on the start, so skip it if exists\n id3_header = ID3::V2Header.new(@file_io)\n id3_header.valid? ? @file_io.seek(id3_header.size) : @file_io.rewind\n\n return if @file_io.read(4) != TAG_ID\n\n loop do\n block = Flac::Block.new(@file_io)\n parse_block(block)\n\n break if block.is_last? || @file_io.eof?\n end\n end",
"def test_parse_valid\r\n array = @g.parse('abc:123', ':')\r\n assert_equal 2, array.size\r\n assert_equal \"abc\", array[0]\r\n end",
"def test_file\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf/\"\n end",
"def test_parse_line_empty\n assert_nil @grapher.parse_line_tokens('')\n end",
"def process(name)\n @test_flag = false\n @array_list = []\n\n detect_os\n\n puts 'Parsing file: ' + name\n\n test_pass = 0\n test_fail = 0\n test_ignore = 0\n puts ''\n puts '=================== RESULTS ====================='\n puts ''\n File.open(name).each do |line|\n # Typical test lines look like this:\n # <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0\n # <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented\n # <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS\n #\n # where path is different on Unix vs Windows devices (Windows leads with a drive letter)\n line_array = line.split(':')\n\n # If we were able to split the line then we can look to see if any of our target words\n # were found. Case is important.\n if (line_array.size >= 4) || (line.start_with? 'TEST(')\n # Determine if this test passed\n if line.include? ':PASS'\n test_passed(line_array)\n test_pass += 1\n elsif line.include? ':FAIL:'\n test_failed(line_array)\n test_fail += 1\n elsif line.include? ':IGNORE:'\n test_ignored(line_array)\n test_ignore += 1\n elsif line.start_with? 'TEST('\n if line.include? ' PASS'\n line_array = line.split(' ')\n test_passed_unity_fixture(line_array)\n test_pass += 1\n end\n # If none of the keywords are found there are no more tests for this suite so clear\n # the test flag\n else\n @test_flag = false\n end\n else\n @test_flag = false\n end\n end\n puts ''\n puts '=================== SUMMARY ====================='\n puts ''\n puts 'Tests Passed : ' + test_pass.to_s\n puts 'Tests Failed : ' + test_fail.to_s\n puts 'Tests Ignored : ' + test_ignore.to_s\n @total_tests = test_pass + test_fail + test_ignore\n\n return unless @xml_out\n\n heading = '<testsuite tests=\"' + @total_tests.to_s + '\" failures=\"' + test_fail.to_s + '\"' + ' skips=\"' + test_ignore.to_s + '\">'\n @array_list.insert(0, heading)\n write_xml_output\n end",
"def parse(filename)\n instructions = open filename\n instructions.read.split(//)\nend",
"def parse_file(file, arg={})\n begin\n parse_file!(file, arg)\n rescue => ex\n @error = ex.message\n nil\n end\n end",
"def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 'i' ] )\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 base_parser\n raise UnknownFile, \"No subtitle file specified\" if @file.nil?\n begin\n yield\n ensure\n @file.close\n end\n return true\n end",
"def test_init\n assert_raise(ArgumentError ) do \n tok = Tokenizer.new\n end\n \n tok = Tokenizer.new(\"test.as\")\n assert_equal( 11,tok.buffer.size ) #counts empty lines\n #assert_equal( tok.buffer[6], nil )\n assert_equal( tok.buffer[5], nil )\n assert_equal( tok.buffer[4].to_s, \"break:\" )\n assert_equal( tok.buffer[3], [\"break:\", \";\"] )\n assert_equal( tok.buffer[2].join(\" \"), \";This is also a comment\" )\n assert_equal( tok.buffer[1].join(\" \"), \";\" )\n assert_equal( tok.buffer[0].join(\" \"), \"; This is a comment\" )\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 get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend",
"def read_test_file(file)\n read_file(file)\n end",
"def process(opts)\n # create specific AirParse instance from rules file specified on commandline\n\n # some meta hacks\n mtk_rules_file = opts[:rules]\n mtk_rules_file_sym = mtk_rules_file.to_sym\n mtk_rules_file_sym_klass = Kernel.const_get(mtk_rules_file_sym) # to use Class with a name passed as string\n parser = mtk_rules_file_sym_klass.new # from this moment, parser is a normal class instance with our custom rules loaded\n\n # prepare output files\n\n ## if they exist, remove output files before processing\n [opts[:errors], opts[:output]].each do |e|\n if File.exist?(e)\n puts 'removing file: ' + e\n FileUtils.rm(e)\n end\n end\n ## write headers to output files, an output/error csv headers are specified in custom rules file/class\n File.open(opts[:output], 'w') { |f| f.write(parser.output_data_header) }\n File.open(opts[:errors], 'w') { |f| f.write(parser.errors_data_header) }\n\n ct = 0 # processed line counter\n @mtkfailreasons = [] # an array with all cumulated errors found in a processed line\n @air_model = [] # an array with input file column names\n\n # open(opts[:file]) do |csv|\n # csv.each_line do |line|\n CSV.foreach(opts[:file]) do |values|\n ct += 1\n\n # old 3 lines, before CSV.foreach, so parse method is obsolete now\n # parse current line\n # values = parser.parse(line)\n\n # read line 1 with csv header to model array;\n # we assume, that the first line of the csv file contains header with proper field names\n # the names must be matched by validator and processors defined in AirParseClasifyAirlineCodes\n if ct == 1\n @air_model = values # read parsed column names from header into model\n else # for all remaining lines\n if opts[:verbose]\n puts \"\\nprocessing:\"\n pp values\n end\n\n # business rules validation\n validation = { correct: true, reason: [] } # we assume correct validation results\n @mtkfailreasons = [] # an array with all cumulated errors found in a processed line\n\n # rule: numbers of data fields should eq to number of header/model variables\n if values.length != @air_model.length\n validation = { correct: false, reason: [] }\n\n @mtkfailreasons << ('incorrect number of columns: ' << values.length.to_s << ' instead of ' << @air_model.length.to_s)\n end\n\n data_output = []\n error_output = []\n if validation[:correct]\n data_output = []\n error_output = []\n cti = 0 # current field counter\n\n # process each value in a line\n values.each do |value|\n value = '' if value.nil? # change nil to empty string, we don't like nils in output csv\n # step 1. input data validation\n # =============================\n\n # a validator method name is constructed from processed values' field name\n dynamic_validator_mehod_name = 'is_valid_' + @air_model[cti]\n puts 'calling validator: ' + dynamic_validator_mehod_name if opts[:verbose]\n\n # call a proper validator method for each value\n if parser.respond_to?(dynamic_validator_mehod_name.to_sym) # check if custom validator is defined in AirParseClassifyAirlineCodes class\n validation = parser.send(dynamic_validator_mehod_name, value)\n else # if no custom validator defined, we must assume correct result, so that the field/line will be output unchanged\n validation = { correct: true, reason: [] }\n end\n\n puts 'row validation results: ' + validation.to_json if opts[:verbose]\n\n # process field validation results\n unless validation[:correct] # if validation failed\n if validation[:reason] # if exists, add detailed validation result description to row validation results array\n @mtkfailreasons << ('field: ' << @air_model[cti] << ' value: [' + value + ']' << ' errors: ' << validation[:reason].to_s)\n end\n end\n\n # step 2. if validation correct, process the data\n # ===============================================\n\n if validation[:correct] # if validation succeeded\n\n # a processor method name is constructed from processed values' field name\n dynamic_processor_mehod_name = 'process_' + @air_model[cti]\n\n # call a proper processor method for each value\n if parser.respond_to?(dynamic_processor_mehod_name.to_sym) # check if custom processor is defined in AirParseClassifyAirlineCodes class\n puts 'calling processor: ' + dynamic_processor_mehod_name if opts[:verbose]\n\n # call custom processor\n data_output_result = parser.send(dynamic_processor_mehod_name, value)\n puts 'processed result: ' + data_output_result.to_s if opts[:verbose]\n\n data_output_result.each { |e| data_output << e }\n\n else # if no custom processor defined, we return field value unchanged\n data_output << value\n end\n end # data processing\n\n error_output << value\n\n cti += 1 # let's move to the next field to be processed\n end # values.each\n end # if validation correct\n\n if @mtkfailreasons == [] # no errors during validation/processing\n # all fields in a line have been processed, so append the result line to result file\n File.open(opts[:output], 'a') { |f| f.write(data_output.to_csv) }\n else # error(s) found\n puts\n puts 'row ' + ct.to_s + ' VALIDATION FAILED'\n puts @mtkfailreasons\n puts\n # append bad csv line to the error file\n File.open(opts[:errors], 'a') { |f| f.write(error_output.to_csv) }\n # TODO: if output errors desc to result file\n # File.open('errors.csv', 'a') {|f| f.write(\"row \"+ct.to_s+' VALIDATION FAILED'+\"\\n\"[email protected]_s+\"\\n\\n\") }\n end\n end\n # end # csv.each_line do |line|\n end # do csv\n # return true if no fail reasons\n @mtkfailreasons == []\n end",
"def test_program_a_has_correct_tokens\n @program_a.scan\n\n token_a = @program_a.tokens[0]\n token_b = @program_a.tokens[9]\n token_c = @program_a.tokens[10]\n token_d = @program_a.tokens[15]\n\n assert(token_a.type == :keyword, \"Expected :keyword at token 1\")\n assert(token_b.type == :number, \"Expected :number at token 9\")\n assert(token_c.type == :comma, \"Expected :comma at token 10\")\n assert(token_d.type == :number, \"Expected :number at token 15\")\n\n assert(token_a.value == \"VALL\", \"Expected value 'VALL' at token 1\")\n assert(token_b.value == \"1\", \"Expected value '1' at token 9\")\n assert(token_c.value == \",\", \"Expected value ',' at token 10\")\n assert(token_d.value == \"3\", \"Expected value '3' at token 15\")\n end"
] | [
"0.69032866",
"0.62026334",
"0.61271423",
"0.61271423",
"0.6104418",
"0.60373396",
"0.59516",
"0.59054756",
"0.5867618",
"0.5751365",
"0.5680206",
"0.56800294",
"0.56449044",
"0.5518196",
"0.54999965",
"0.5462532",
"0.5443845",
"0.54411185",
"0.54323924",
"0.54307836",
"0.54293674",
"0.54194665",
"0.5362644",
"0.5350796",
"0.5350796",
"0.5350796",
"0.5350031",
"0.5314102",
"0.53099036",
"0.5308992",
"0.52643764",
"0.5246921",
"0.5209807",
"0.51982105",
"0.51975226",
"0.5197128",
"0.5178898",
"0.51676553",
"0.5154215",
"0.5151597",
"0.5147414",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5138316",
"0.5128136",
"0.51210576",
"0.51050144",
"0.5101852",
"0.5090902",
"0.5085003",
"0.5083003",
"0.5076416",
"0.5071535",
"0.5071535",
"0.5071535",
"0.50684756",
"0.5061535",
"0.50574124",
"0.5057306",
"0.5056338",
"0.5053148",
"0.5052358",
"0.504535",
"0.5042075",
"0.5042075",
"0.50382704",
"0.5028751",
"0.5023737",
"0.5009727",
"0.50061476",
"0.50061476",
"0.50061476",
"0.50061476",
"0.50061476",
"0.50061476",
"0.50025547",
"0.5000977",
"0.50001794",
"0.49968675",
"0.49964005",
"0.49945965",
"0.49938798",
"0.49936482",
"0.49900854",
"0.4983964",
"0.49837163",
"0.4982778",
"0.49810147",
"0.49753153",
"0.49701294",
"0.496032",
"0.49598944",
"0.4958532",
"0.49518695",
"0.4947964",
"0.49479285",
"0.49447185",
"0.493892",
"0.4936542"
] | 0.78511137 | 0 |
Test parsing of sparse ARFF format | def test_sparse_arff_parse
in_file = './test_sparse_arff.arff'
rel = Rarff::Relation.new
rel.parse(File.open(in_file).read)
assert_equal(rel.instances[0].size, 13)
assert_equal(rel.instances[0][1], 0)
assert_equal(rel.instances[0][3], 7)
assert_equal(rel.instances[1][1], 2.4)
assert_equal(rel.instances[1][2], 0)
assert_equal(rel.instances[1][12], 19)
assert_equal(rel.instances[2][6], 6)
assert_equal(rel.instances[3][12], 0)
# puts "\n\nARFF: (\n#{rel.to_arff}\n)"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arff_parse\n in_file = './test_arff.arff'\n rel = Rarff::Relation.new\n rel.parse(File.open(in_file).read)\n\n assert_equal(rel.instances[2][1], 3.2)\n assert_equal(rel.instances[7][4], 'Iris-setosa')\n end",
"def test_sparse_instance\r\n assert_respond_to(@fh, :sparse=)\r\n end",
"def read_sparse_matrix(str)\n sparse = str.split(SEP_LINE).map do |line|\n row , col , value = line.split(SEP_ITEM)\n [row.to_i , col.to_i , value.to_f]\n end\n sparse_to_full(sparse)\n end",
"def parse_actl(len, file)\n return -1 if len != 8\n framedata = file.read(4)\n if framedata.nil? || framedata.length != 4\n return -1\n end\n\n framedata.unpack1(\"N\".freeze)\n end",
"def test_parse\n result = Yadis.parseXRDS(read_data_file(XRD_FILE))\n assert_not_nil result\n end",
"def test_decode_streaming_array_1\n assert_decode(\"9f018202039f0405ffff\", [1, [2, 3], [4, 5]])\n end",
"def test_for_format_of_iasxx_is_valid\n # test conditions\n a1_list = %W{ isa11 isa14 isa15 isa16 } \n a2_list = %W{ isa01 isa03 isa05 isa07 }\n a4_list = %W{ isa10 }\n a5_list = %W{ isa12 }\n a6_list = %W{ isa09 }\n a9_list = %W{ isa13 }\n a10_list = %W{ isa02 isa04 }\n a15_list = %W{ isa06 isa08 }\n list = a1_list + a2_list + a4_list + a5_list + a6_list + a9_list + a10_list + a15_list\n\n # Create object\n e = Editransaction.new\n\n # Test for > 0, 1, max +\n list.each do |x|\n # test for 0\n e[x] = 0 \n e.valid?\n assert e.errors.invalid?(x)\n assert_equal I18n.translate('activerecord.errors.messages.invalid'), e.errors.on(x)\n e.errors.clear\n\n # test for 1\n e[x] = 1\n e.valid?\n assert !e.errors.invalid?(x)\n\n # test for max +\n e[x] = '123456789101112131415'\n e.valid?\n assert e.errors.invalid?(x)\n end \n end",
"def test_decode_streaming_array_3\n assert_decode(\"83018202039f0405ff\", [1, [2, 3], [4, 5]])\n end",
"def parse_sqft\n end",
"def parse_sqft\n end",
"def test_decode_streaming_array_2\n assert_decode(\"9f01820203820405ff\", [1, [2, 3], [4, 5]])\n end",
"def test_decode_streaming_array_4\n assert_decode(\"83019f0203ff820405\", [1, [2, 3], [4, 5]])\n end",
"def test_decode_streaming_array_5\n assert_decode(\"9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff\", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])\n end",
"def parse_atx_header_gfm_quirk; end",
"def test_sparse_matrix_sort_check\n puts \"#{File.basename(__FILE__)}: #{self.method_name}\"\n @study = Study.find_by(name: 'Negative Testing Study')\n user = User.first\n matrix = @study.study_files.by_type('MM Coordinate Matrix').first\n genes = @study.study_files.by_type('10X Genes File').first\n barcodes = @study.study_files.by_type('10X Barcodes File').first\n\n begin\n puts 'Parsing 10X incorrectly sorted matrix...'\n ParseUtils.cell_ranger_expression_parse(@study, user, matrix, genes, barcodes, {skip_upload: true, sync: true})\n rescue => e\n assert e.is_a?(StandardError), \"Did not raise the correct error, expected StandardError but found #{e.class}\"\n assert e.message.starts_with?('Your input matrix is not sorted in the correct order.'), \"Error message did not specify incorrect sort order: #{e.message}\"\n assert @study.genes.count == 0, \"Should not have saved any genes, found #{@study.genes.count}\"\n end\n\n puts \"#{File.basename(__FILE__)}: #{self.method_name} successful!\"\n end",
"def parse_lfo(lfo)\n data = @bytes.next\n lfo.wave = (data & 0xC0) >> 6\n lfo.frequency = data & 0x3F\n\n data = @bytes.next\n mod_part_one = (data & 0xC0) >> 6\n lfo.level1 = data & 0x3F\n\n data = @bytes.next\n mod_part_two = (data & 0xC0) >> 6\n lfo.level2 = data & 0x3F\n\n lfo.modulator.source = (mod_part_one << 2) + mod_part_two\n\n data = @bytes.next\n lfo.reset = bit_true?(data)\n lfo.humanize = bit_true?(data, 2)\n lfo.delay = data & 0x3F\n end",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17L boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17L', value)\n assert_equal(' boondocks', rest)\n end",
"def test_astar\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : ( A )* ;\")\n expecting = \".s0-A->:s1=>1\\n\" + \".s0-EOF->:s2=>2\\n\"\n check_decision(g, 1, expecting, nil, nil, nil, nil, 0)\n end",
"def test_legal_file_parsing\n assert_equal( Graph.new().parse_json_file(\"CSAirData.json\"), true ) \n end",
"def test1\n rtext = \"\"\n parser = ZML::StreamToXML.new(rtext)\n REXML::Document.parse_stream(DOC1, parser)\n\n # The results should be byte-by-byte equal. (Actually, there might\n # be differences like attr='val' versus attr=\"val\", or ordering of\n # the attributes, but we choose our test case carefully!)\n assert_equal(DOC1, rtext)\n end",
"def parse_annotation_file filename\n lines = File.open(filename,'r').read.split(\"\\n\")\n puts lines.size\n bad_header = lines.shift.split(\"\\t\")\n header = %w'seq_id reciprocal_id reciprocal_rank sp_symbol sp_evalue sp_description pfam_ids go_ids'\n data = []\n lines.each do |line|\n fields = line.split(\"\\t\")\n fields = fields.collect {|f| (f == \"#N/A\") ? nil : f}\n d = Hash[header.zip(fields)]\n d['pfam_ids'] = (d['pfam_ids']) ? d['pfam_ids'].split(\";\") : []\n\n d['go_ids'] = (d['go_ids']) ? d['go_ids'].split(\";\") : []\n data << d\n end\n data\nend",
"def hexadecimal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 4)\n\n type = HEXADECIMAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 21:5: ( '-' )? '0x' ( 'a' .. 'f' | 'A' .. 'F' | '0' .. '9' )+\n # at line 21:5: ( '-' )?\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == ?-) \n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 21:5: '-'\n match(?-)\n\n end\n match(\"0x\")\n # at file 21:15: ( 'a' .. 'f' | 'A' .. 'F' | '0' .. '9' )+\n match_count_8 = 0\n loop do\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0.between?(?0, ?9) || look_8_0.between?(?A, ?F) || look_8_0.between?(?a, ?f)) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line \n if @input.peek(1).between?(?0, ?9) || @input.peek(1).between?(?A, ?F) || @input.peek(1).between?(?a, ?f)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 4)\n\n end",
"def castro_sgf_parse(fd)\n\tfd.each{|line|\n\t\tline = line.strip\n\n\t\tnext if line.length == 0\n\t\tnext if line.scan(/^\\(;FF\\[4\\]/).length > 0\n\t\tnext if line.scan(/^;[BW]/).length > 0 #should replace root, not quite sure how best to do that\n\n\t\tif(line == \")\" || line == \"))\")\n\t\t\tyield nil\n\t\t\tnext\n\t\tend\n\n\t\tmatch = line.scan(/^\\W*\\(;([BW])\\[([a-z0-9]+)\\]C\\[([^\\]]*)\\](\\)?)/)\n\n\t\traise \"Multiple matches?\" if match.length > 1\n\t\traise \"No match?\" if match.length == 0\n\n\t\tside, move, comment, pop = match[0]\n\t\tcomment = comment.split(\", \").map{|a| a.split ':'}\n\t\tprops = Hash[comment]\n\t\tprops[comment[0][0]] = true\n\t\tyield [side, move, props, (pop.length > 0)]\n\t}\nend",
"def test_float9\n token, value, rest = @c.lex(\" 0xabcdef.123p-17boondocks\")\n assert_equal(:float, token)\n assert_equal('0xabcdef.123p-17', value)\n assert_equal(' boondocks', rest)\n end",
"def initialize_from_arff( file )\n feature_list, t_class, f_class, instances = WekaCompatability.load_arff( file )\n initialize_model( feature_list, t_class, f_class )\n train_model( instances )\n end",
"def num_f!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = NUM_F\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 47:8: ( '0' .. '9' )+ '.' ( '0' .. '9' )+\n # at file 47:8: ( '0' .. '9' )+\n match_count_5 = 0\n while true\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0.between?( 0x30, 0x39 ) )\n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_5 > 0 and break\n eee = EarlyExit(5)\n\n\n raise eee\n end\n match_count_5 += 1\n end\n\n\n match( 0x2e )\n # at file 47:24: ( '0' .. '9' )+\n match_count_6 = 0\n while true\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0.between?( 0x30, 0x39 ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_6 > 0 and break\n eee = EarlyExit(6)\n\n\n raise eee\n end\n match_count_6 += 1\n end\n\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n\n end",
"def test_decode_short_atom()\n input = [131, 115, 4, 97, 98, 99, 100]\n expected = Erlang::Atom.new('abcd')\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def test_states_on_examples\n assert_equal(4,@small_dfa.states.size)\n assert_equal(4,@small_nfa.states.size)\n end",
"def parse_features\n check = Hash.new(0)\n @features.each do |feat|\n feature = feat.feature\n position = feat.position\n\n # try to link gene-related features (CDS, mRNA etc.) by matching /locus_tag or /gene qualifier values\n qual = feat.to_hash\n gene_name = locus_tag = gene = nil\n if qual[\"locus_tag\"]\n if locus_tag = qual[\"locus_tag\"].first\n gene_name = locus_tag\n end\n elsif qual[\"gene\"]\n if gene = qual[\"gene\"].first\n gene_name = gene\n end\n end\n\n @feature_count[feature] += 1\n locations = Bio::Locations.new(position)\n min, max = locations.span\n strand = locations.first.strand\n feature_id = new_feature_uri(feature, min, max, strand, @feature_count[feature])\n if feature == \"gene\"\n @gene[gene_name] = feature_id\n check[gene_name] += 1\n end\n gene_id = @gene[gene_name] # expect that \"gene\" feature appears before \"CDS\", \"mRNA\", etc. features derived from a gene (otherwize use parse_genes() for fail-safe)\n\n # add type by Sequence Ontology\n so_id = \"SO:0000001\"\n so_obo_id = \"obo:SO_0000001\"\n so_term = \"region\"\n ft_id = \"Feature\"\n if so_id = @ft_so.so_id(feature)\n if so_id != \"undefined\"\n so_obo_id = @ft_so.obo_id(so_id)\n so_term = @ft_so.so_term(feature)\n ft_id = @ft_so.ft_id(feature)\n end\n end\n\n # feature types and labels\n puts triple(feature_id, \"rdf:type\", \"insdc:#{ft_id}\")\n puts triple(feature_id, \"rdfs:subClassOf\", so_obo_id) + \" # SO:#{so_term}\"\n # to make compatible with Ensembl RDF\n puts triple(feature_id, \"obo:RO_0002162\", \"<http://identifiers.org/taxonomy/#{@taxonomy_id}>\") + \" # RO:in taxon\"\n puts triple(feature_id, \"rdfs:label\", quote(locus_tag || gene || feature))\n puts triple(feature_id, \"dc:identifier\", quote(locus_tag || gene)) if locus_tag || gene\n if locus_tag || gene\n puts triple(feature_id, \"skos:prefLabel\", quote(locus_tag || gene))\n if qual[\"gene_synonym\"]\n qual[\"gene_synonym\"].first.split(/;\\s+/).each do |synonym|\n puts triple(feature_id, \"skos:altLabel\", quote(synonym))\n end\n end\n end\n\n # feature qualifiers\n parse_qualifiers(feature_id, qual)\n\n # parent-child relationship (gene -> mRNA|CDS|misc_RNA etc.)\n parent_uri = @sequence_uri\n if gene_id and gene_id != feature_id\n parent_uri = gene_id\n puts triple(feature_id, \"sio:SIO_010081\", gene_id) + \" # sio:is-transcribed-from\"\n # to make compatible with Ensembl RDF\n puts triple(feature_id, \"rdfs:subClassOf\", \"obo:SO_0000673\") + \" # SO:transcript\"\n if encoding = @ft_so.so_encoding(feature)\n if feature == \"ncRNA\"\n if ncrna_class = qual[\"ncRNA_class\"]\n if @ft_so.so_encoding(ncrna_class.first)\n encoding = @ft_so.so_encoding(ncrna_class.first)\n end\n end\n end\n so_encoding_id = encoding[\"so_id\"]\n so_encoding_term = encoding[\"so_term\"]\n puts triple(gene_id, \"rdfs:subClassOf\", @ft_so.obo_id(so_encoding_id)) + \" # SO:#{so_encoding_term}\"\n end\n end\n puts triple(feature_id, \"obo:so_part_of\", parent_uri)\n\n # add FALDO location and subparts (exons etc.)\n region_id, locations = new_location(feature_id, position)\n # Uncomment to eliminate single exon genes.\n #if locations.count > 1\n if gene_id\n # link to exons in join(exon1, exon2, ...)\n feature_type = { :id => \"obo:SO_0000147\", :term => \"exon\", :ft => \"Exon\" }\n else\n # [TODO] need to confirm that if there are any features having subparts other than exons\n feature_type = { :id => \"obo:SO_0000001\", :term => \"region\", :ft => \"Feature\" }\n end\n sub_parts, sub_ordered_parts = add_subparts(locations, feature_type)\n #puts triple(feature_id, \"obo:so_has_part\", \"(#{sub_parts.join(' ')})\") # rdf:List\n # exon URIs\n puts triple(feature_id, \"obo:so_has_part\", sub_parts.join(', '))\n # part URIs\n puts triple(feature_id, \"sio:SIO_000974\", sub_ordered_parts.join(', ')) + \" # sio:has-ordered-part\"\n #end\n end\n $stderr.puts \"Features: #{@feature_count.to_json}\"\n check.each do |k, v|\n $stderr.puts \"Warning: gene ID #{k} occured #{v} times\" if v > 1\n end\n end",
"def test_parse_valid\r\n array = @g.parse('abc:123', ':')\r\n assert_equal 2, array.size\r\n assert_equal \"abc\", array[0]\r\n end",
"def test_parse_invalid\r\n array = @g.parse('abc:123', '>')\r\n assert_equal 1, array.size\r\n assert_equal \"abc:123\", array[0]\r\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equal(120, test_songs[:no_tempo].tempo)\n assert_equal([:verse], test_songs[:no_tempo].flow)\n \n assert_equal(100, test_songs[:repeats_not_specified].tempo)\n assert_equal([:verse], test_songs[:repeats_not_specified].flow)\n \n # These two songs should be the same, except that one uses a kit in the song header\n # and the other doesn't.\n [:example_no_kit, :example_with_kit].each do |song_key|\n song = test_songs[song_key]\n assert_equal([:verse, :verse,\n :chorus, :chorus,\n :verse, :verse,\n :chorus, :chorus, :chorus, :chorus,\n :bridge,\n :chorus, :chorus, :chorus, :chorus],\n song.flow)\n assert_equal(99, song.tempo)\n assert_equal([\"bridge\", \"chorus\", \"verse\"], song.patterns.keys.map{|key| key.to_s}.sort)\n assert_equal(4, song.patterns[:verse].tracks.length)\n assert_equal(5, song.patterns[:chorus].tracks.length)\n assert_equal(1, song.patterns[:bridge].tracks.length)\n end\n \n song = test_songs[:example_with_empty_track]\n assert_equal(1, song.patterns.length)\n assert_equal(2, song.patterns[:verse].tracks.length)\n assert_equal(\"........\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/snare_mono_8.wav\"].rhythm)\n \n song = test_songs[:multiple_tracks_same_sound]\n assert_equal(2, song.patterns.length)\n assert_equal(7, song.patterns[:verse].tracks.length)\n assert_equal([\"agogo\", \"bass\", \"bass2\", \"bass3\", \"bass4\", \"hh_closed\", \"snare\"],\n song.patterns[:verse].tracks.keys.sort)\n assert_equal(\"X...............\", song.patterns[:verse].tracks[\"bass\"].rhythm)\n assert_equal(\"....X...........\", song.patterns[:verse].tracks[\"bass2\"].rhythm)\n assert_equal(\"........X.......\", song.patterns[:verse].tracks[\"bass3\"].rhythm)\n assert_equal(\"............X...\", song.patterns[:verse].tracks[\"bass4\"].rhythm)\n assert_equal(\"..............X.\", song.patterns[:verse].tracks[\"snare\"].rhythm)\n assert_equal(\"X.XXX.XXX.X.X.X.\", song.patterns[:verse].tracks[\"hh_closed\"].rhythm)\n assert_equal(\"..............XX\", song.patterns[:verse].tracks[\"agogo\"].rhythm)\n \n song = test_songs[:with_structure]\n assert_equal([:verse, :verse], song.flow)\n assert_equal(1, song.patterns.length)\n assert_equal(1, song.patterns[:verse].tracks.length)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n end",
"def initial_parse(binstr)\n return false unless binstr\n\n if binstr[0, 2] != self.class.const_get(:HEADER_ID)\n warn 'WARNING: weird extra field header ID. Skip parsing it.'\n return false\n end\n\n [binstr[2, 2].unpack1('v'), binstr[4..-1]]\n end",
"def hex_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 68 )\n\n\n\n type = HexLiteral\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 523:14: '0' ( 'x' | 'X' ) ( HexDigit )+\n match( 0x30 )\n if @input.peek(1) == 0x58 || @input.peek(1) == 0x78\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at file 523:28: ( HexDigit )+\n match_count_19 = 0\n while true\n alt_19 = 2\n look_19_0 = @input.peek( 1 )\n\n if ( look_19_0.between?( 0x30, 0x39 ) || look_19_0.between?( 0x41, 0x46 ) || look_19_0.between?( 0x61, 0x66 ) )\n alt_19 = 1\n\n end\n case alt_19\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x46 ) || @input.peek( 1 ).between?( 0x61, 0x66 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_19 > 0 and break\n eee = EarlyExit(19)\n\n\n raise eee\n end\n match_count_19 += 1\n end\n\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 68 )\n\n\n end",
"def test_program_a_has_correct_tokens\n @program_a.scan\n\n token_a = @program_a.tokens[0]\n token_b = @program_a.tokens[9]\n token_c = @program_a.tokens[10]\n token_d = @program_a.tokens[15]\n\n assert(token_a.type == :keyword, \"Expected :keyword at token 1\")\n assert(token_b.type == :number, \"Expected :number at token 9\")\n assert(token_c.type == :comma, \"Expected :comma at token 10\")\n assert(token_d.type == :number, \"Expected :number at token 15\")\n\n assert(token_a.value == \"VALL\", \"Expected value 'VALL' at token 1\")\n assert(token_b.value == \"1\", \"Expected value '1' at token 9\")\n assert(token_c.value == \",\", \"Expected value ',' at token 10\")\n assert(token_d.value == \"3\", \"Expected value '3' at token 15\")\n end",
"def liberal_parsing?() @liberal_parsing end",
"def ais\n p = full_dearmored_ais_payload\n ret = _payload_container(p[0, 6].to_i(2))\n ret.payload_bitstring = p\n ret.fill_bits = last_ais_fill_bits\n ret\n end",
"def test_setup\n assert_equal ExternalIndex, @cls\n \n assert_equal 0, index.pos\n assert_equal 5, index.length\n assert_equal 4, index.frame_size\n assert_equal 8 * 2**20, index.buffer_size\n assert_equal [0], index.nil_value\n assert_equal({:format => \"I\", :buffer_size => 8 * 2**20, :nil_value => [0]}, index.options)\n \n assert_equal [1,2,3,4,5].pack(\"I*\"), index.io.string\n end",
"def op_ari!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n\n\n type = OP_ARI\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x2a, 0x2b ) || @input.peek(1) == 0x2d || @input.peek(1) == 0x2f\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n\n end",
"def parse_atx_header; end",
"def test_program_a_has_correct_tokens\n @program_d.scan\n\n token_a = @program_d.tokens[0]\n token_b = @program_d.tokens[9]\n token_c = @program_d.tokens[10]\n token_d = @program_d.tokens[7]\n\n assert(token_a.type == :keyword, \"Expected :keyword at token 1\")\n assert(token_b.type == :number, \"Expected :number at token 10\")\n assert(token_c.type == :comma, \"Expected :comma at token 11\")\n assert(token_d.type == :char, \"Expected :char at token 8\")\n\n assert(token_a.value == \"VALL\", \"Expected value 'VALL' at token 1\")\n assert(token_b.value == \"2\", \"Expected value '2' at token 10\")\n assert(token_c.value == \",\", \"Expected value ',' at token 11\")\n assert(token_d.value == \"i\", \"Expected value 'i' at token 9\")\n end",
"def parse_bool() true end",
"def test_blanks\n filename = 'test.apetag'\n File.new(filename,'wb').close\n [0,1,63,64,65,127,128,129,191,192,193,8191,8192,8193].each do |x|\n [true, false].each do |check_id3|\n s = StringIO.new(' ' * x)\n item_test(s, check_id3)\n item_test(ApeTag.new(s, check_id3), check_id3)\n f = File.new(filename,'rb+')\n f.write(' ' * x)\n item_test(f, check_id3)\n item_test(ApeTag.new(f, check_id3), check_id3)\n f.close()\n item_test(filename, check_id3)\n item_test(ApeTag.new(filename, check_id3), check_id3)\n end\n end\n File.delete(filename)\n end",
"def output_numeric_arff(io)\n keys = features.first.keys\n io.puts \"@RELATION Data\"\n keys.each do |key|\n io.puts \"@ATTRIBUTE #{key} NUMERIC\" unless key == :class\n end\n io.puts \"@ATTRIBUTE class {false,true}\"\n io.puts \"@DATA\"\n features.each do |feature|\n io.puts keys.map { |k| k == :class ? feature[k].to_s : feature[k].to_f }.join(\",\")\n end\n end",
"def parse()\n #This is a stub, used for indexing\n end",
"def test_unescaped_search_compact\n assert_nothing_raised do\n @parser.parse_key_value(fixture('search_unescaped_compact.xml').read)\n end\n end",
"def is_pre_indexed_indirect_mem?(tok)\n str = String.new(tok)\n return nil if str[0] != 40 or str[-1] != 41\n \n str[0] = \"\"\n str[-1] = \"\"\n \n str = str.split(\",\")\n return nil if str.size != 2 or str[1].upcase != \"X\"\n \n ret = is_8bit_number?(str[0] )\n return [ IND_X, 1, :X, ret ] if ret\n \n return nil\n end",
"def test_decode_new_float()\n input = [131, 70, 1, 1, 1, 1, 1, 1, 1, 1]\n expected = 7.74860418548935e-304\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_in_delta(expected, actual, 0.00000000000001)\n end",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n\n type = FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 11:3: ( ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ ( EXPONENT )? | DECIMAL EXPONENT )\n alt_5 = 2\n alt_5 = @dfa5.predict(@input)\n case alt_5\n when 1\n # at line 11:5: ( '-' )? ( '0' .. '9' )+ '.' ( '0' .. '9' )+ ( EXPONENT )?\n # at line 11:5: ( '-' )?\n alt_1 = 2\n look_1_0 = @input.peek(1)\n\n if (look_1_0 == ?-) \n alt_1 = 1\n end\n case alt_1\n when 1\n # at line 11:5: '-'\n match(?-)\n\n end\n # at file 11:10: ( '0' .. '9' )+\n match_count_2 = 0\n loop do\n alt_2 = 2\n look_2_0 = @input.peek(1)\n\n if (look_2_0.between?(?0, ?9)) \n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 11:11: '0' .. '9'\n match_range(?0, ?9)\n\n else\n match_count_2 > 0 and break\n eee = EarlyExit(2)\n\n\n raise eee\n end\n match_count_2 += 1\n end\n\n match(?.)\n # at file 11:26: ( '0' .. '9' )+\n match_count_3 = 0\n loop do\n alt_3 = 2\n look_3_0 = @input.peek(1)\n\n if (look_3_0.between?(?0, ?9)) \n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 11:27: '0' .. '9'\n match_range(?0, ?9)\n\n else\n match_count_3 > 0 and break\n eee = EarlyExit(3)\n\n\n raise eee\n end\n match_count_3 += 1\n end\n\n # at line 11:38: ( EXPONENT )?\n alt_4 = 2\n look_4_0 = @input.peek(1)\n\n if (look_4_0 == ?E || look_4_0 == ?e) \n alt_4 = 1\n end\n case alt_4\n when 1\n # at line 11:38: EXPONENT\n exponent!\n\n end\n\n when 2\n # at line 12:5: DECIMAL EXPONENT\n decimal!\n exponent!\n\n end\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 2)\n\n end",
"def test_parse_hash_valid\n assert_equal 100000, parse_hash(\"186A0\")\n end",
"def test_parser_recognizer_success\n assert_equal '4', @parser.recognizer(VALID_DIGIT.lines.to_a[1..3].map{|l| l.chomp})\n end",
"def parse(m)\n false\n end",
"def test_optional_fields\n assert_nothing_raised do\n @parser.record_line :record,\n :fields => %w{one two three four},\n :optional => %w{three four},\n :absent => \"*\",\n :separator => \" \" # A single space\n end\n\n { \"a b c d\" => [],\n \"a b * d\" => [:three],\n \"a b * *\" => [:three, :four],\n \"a b c *\" => [:four]\n }.each do |line, absentees|\n record = nil\n assert_nothing_raised do\n record = @parser.parse_line(line)\n end\n\n # Absent field is :absent, not \"*\" inside the record\n absentees.each do |absentee|\n assert_equal(:absent, record[absentee])\n end\n\n # Now regenerate the line\n newline = nil\n assert_nothing_raised do\n newline = @parser.to_line(record)\n end\n\n # And make sure they're equal\n assert_equal(line, newline)\n end\n\n # Now make sure it pukes if we don't provide the required fields\n assert_raise(ArgumentError) do\n @parser.to_line(:record_type => :record, :one => \"yay\")\n end\n end",
"def test_introspects_properly\n i = Tracksperanto::Import::Syntheyes\n assert_equal 'Syntheyes \"Tracker 2-D paths\" file', i.human_name\n assert !i.autodetects_size?\n assert_not_nil i.known_snags\n assert !i.known_snags.empty?\n end",
"def test_decode_atom()\n input = [131, 100, 0, 9, 105, 108, 105, 97, 95, 97, 116, 111, 109]\n expected = Erlang::Atom.new('ilia_atom')\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def test_a\n fdl_test( %{\n feature test\n (not all(x,x:[word=nil]))\n <x.id>},\n false)\n end",
"def parse_bool() false end",
"def parse_bool() false end",
"def test_dfa_step_on_examples\n assert_equal(nil, @small_dfa.dfa_step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_step(s,e.symbol))\n end\n end\n end",
"def can_parse?(str)\n str =~ /^#{counter_tag}\\=[^\\x01]+\\x01/\n end",
"def test_validate_file\n file_list = [\n '0|0|SYSTEM>569274(100)|1553184699.650330000|288d',\n '1|288d|569274>735567(12):735567>561180(3):735567>689881(2):SYSTEM>532260(100)|1553184699.652449000|92a2',\n '2|92a2|569274>577469(9):735567>717802(1):577469>402207(2):SYSTEM>794343(100)|1553184699.658215000|4d25'\n ]\n assert validate_file file_list, [0, 0], '0'\n end",
"def test_from_flame_setup\n fixture = File.open(File.dirname(__FILE__) + '/Flame_Smk2013_SubpixSample.stabilizer')\n t = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a[0]\n first_kf = t[0]\n assert_in_delta 0.5, first_kf.abs_x, DELTA\n assert_in_delta 0.5, first_kf.abs_y, DELTA\n end",
"def sample1\n Anomalous.load('spec/sample_data/sample.mat', data_format: :matlab)\nend",
"def test_decode_float()\n input = [\n 131, 99, 49, 46, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,\n 48, 48, 48, 48, 56, 56, 56, 50, 101, 43, 48, 48, 0, 0, 0, 0, 0]\n expected = 1.1\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def read_segment\n consume_isa.flatmap do |rest|\n # The character after \"ISA\" is defined to be the element separator\n rest.read_character.flatmap do |char, aR|\n separators = Separators.new(nil, nil, char, nil)\n remaining = success(TokenReader.new(aR.input, separators))\n elements = []\n\n # Read 15 simple elements into an array. Consume/discard the element\n # separator that follows each one.\n 15.times do\n remaining =\n remaining.flatmap(&:read_simple_element).flatmap do |e, eR|\n elements << e\n\n # Throw away the following element separator\n eR.consume_prefix(separators.element)\n end\n end\n\n # We have to assume the last (16th) element is fixed-length because\n # it is not terminated by an element separator. The {read_character}\n # method defined by TokenReader skips past control characters.\n remaining.flatmap do |w|\n w.read_character.flatmap do |isa16, cR|\n elements << SimpleElementTok.build(isa16, w.input, cR.input)\n\n # The character after the last element is defined to be the\n # segment terminator. The {read_character} method here, defined\n # by StreamReader, does not skip past control character, so the\n # separator could be a control character.\n cR.stream.read_character.flatmap do |char_, dR|\n if char_ == separators.element\n failure(\"element separator and segment terminator must be distinct\", dR.input)\n else\n separators.segment = char_\n\n token = SegmentTok.build(:ISA, elements,\n rest.input.position, dR.input.position)\n\n result(token, TokenReader.new(dR.input, separators))\n end\n end\n end\n end\n end.or do |reason|\n # We read \"ISA\" but failed to tokenize the input that followed. This\n # was probably a random occurrence of the sequence \"ISA\", so we'll\n # skip past it and try again.\n #\n # @todo: We should log this as a warning, because we could otherwise\n # be silently discarding an entire interchange if the ISA segment\n # was bogus\n rest.read_segment\n end\n end\n end",
"def test_nonequality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7b7\")\n value2_ = ::Versionomy.parse(\"1.8.7a7\")\n refute_equal(value2_, value1_)\n refute_equal(value2_.hash, value1_.hash)\n end",
"def detect_ar(index, src, strip)\n return unless @ar.negative? && index > @tc\n keywords = %w[ar: actualresult: ar= [ar] actualresult]\n @ar = index if keywords.any? { |k| strip.start_with? k }\n @ar = index if keywords.any? { |k| src.include? k }\n end",
"def st!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n type = ST\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n d = nil\n\n\n \n # - - - - main rule block - - - -\n # at line 348:5: d= ( ( DIGIT )* ) '1' ( 'S' | 's' ) ( 'T' | 't' )\n # at line 348:7: ( ( DIGIT )* )\n # at line 348:8: ( DIGIT )*\n # at line 348:8: ( DIGIT )*\n while true # decision 1\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0 == 0x31 )\n look_1_1 = @input.peek( 2 )\n\n if ( look_1_1.between?( 0x30, 0x39 ) )\n alt_1 = 1\n\n end\n elsif ( look_1_0 == 0x30 || look_1_0.between?( 0x32, 0x39 ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 348:8: DIGIT\n digit!\n\n else\n break # out of loop for decision 1\n end\n end # loop for decision 1\n\n match( 0x31 )\n if @input.peek(1) == 0x53 || @input.peek(1) == 0x73\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n if @input.peek(1) == 0x54 || @input.peek(1) == 0x74\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n end",
"def test_from_flame2012\n fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/Flame_Stabilizer_2012.stabilizer')\n trackers = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a\n \n assert_equal 5, trackers.length\n assert_equal 61, trackers[0].length\n end",
"def test_special_float\n tokenizer = Tokenizer.new\n tokenizer.text = \"20.0 0.0\"\n tokenizer.tokenize\n tokens = tokenizer.tokens\n\n #test type of token\n assert_equal(\"FloatToken\", tokens.last.class.name)\n\n #test values\n assert_equal(\"20.0\", tokens.first.val)\n assert_equal(\"0.0\", tokens.last.val)\n\n #test position\n assert_equal(5, tokens.last.start_index)\n assert_equal(8, tokens.last.end_index)\n end",
"def test_non_canonical\n verify(\n 'f8f681900001000200030005076578616d706c6503636f6d0000010001c00c0001000100014f0c00045db8d822c00c002e000100014f0c00a20001080200015180580ec93f57f38df906a8076578616d706c6503636f6d006ae1882b1536a15c44f5813671af57bf9cae0366cff2ec085d6dedfddff0c469fa827ceec953de7cc1eee634f4cf695dc2caa2074f95199a5582e51e63b336d8f091d18c0c1a307ae3f5508ec650c4085a95e54e2c2451d9fc9ae04b4e62f3d1a1689e9507c3692fb84817a70afd3e9cdf066f73cc4ac11ed080a30d2af31510b457b5c04b0002000100014f0c001401620c69616e612d73657276657273036e657400c04b0002000100014f0c00040161c0e9c04b002e000100014f0c00a2000208020001518058109f4c57f56c1906a8076578616d706c6503636f6d006d8dd0fdbd0a0b0bfe7e4306a4a001bb7a13df2faedb1702a329243c326b915191335e99e16a236de99360547efa96ec6ee547a6dcfab94b57de6f7891bcaf99a2ef5d3c72d5bc18d1bf05ff4473f527bd8f2e6621489ab531dfb6a973e37e0f0be52740a362599058b204097a04c96492e527bfca6a22338eb865b51156c2ab0e6940c10700010001000004940004c72b8735c107001c00010001e209001020010500008f00000000000000000053c0e700010001000004940004c72b8535c0e7001c00010001e209001020010500008d000000000000000000530000291000000080000000')\n end",
"def test_format_empty_item\n fzf = FZF.new []\n item = ['', [[0, 0]]]\n line, offsets = item\n tokens = fzf.format line, 80, offsets\n assert_equal [], tokens\n end",
"def test_parse_float_string\n assert_equal 0.0, parse_float_string(\"\\x00\\x00\\x00\\x80\")\n assert_equal -100.0, parse_float_string(\"\\x00\\x00\\xc8\\xc2\").round(2)\n assert_equal -122.44, parse_float_string(\"\\x48\\xe1\\xf4\\xc2\").round(2)\n end",
"def test_parser_valid_data\n \n assert Yay::PARSER_TESTS.kind_of? Hash\n\n Yay::PARSER_TESTS.each_pair { |input, expected| \n assert input.kind_of? String\n assert expected.kind_of? Array\n }\n\n end",
"def test_parser_handles_unsupported_simple_content\n simple_content_assert nil, {}\n simple_content_assert nil, []\n end",
"def parse_atx_header_gfm_quirk\n text, id = parse_header_contents\n text.sub!(/[\\t ]#+\\z/, '') && text.rstrip!\n return false if text.empty?\n\n add_header(@src[\"level\"].length, text, id)\n true\n end",
"def test_parse_mdc_snp_data\n column_headings = []\n snp_data = []\n File.open(\"#{RAILS_ROOT}/test/mocks/#{@mdc_filename}\",\"r\") do |file|\n while (f = file.gets)\n\n next if f =~ /^#/ # ignore lines that start with a hash - comments\n f.strip! # remove any whitespace, linefeeds, etc.\n\n # if this line has the column headings, extract and do the next line\n if f =~ /^a1_External_ID/\n column_headings = f.split(/\\t/)\n next\n end\n\n # Split the mdc file based on tabs\n snp_data = f.split(/\\t/)\n\n # load_hapmap_snp_data(column_headings,snp_data)\n break # jump out after first line as we're just testing the parsing\n end # end of file_array.each loop\n\n # test that we're parsing the headings and the SNP data correctly\n assert_equal 235, snp_data.size\n assert_equal \"a2_RGSCv3.4_chr\",column_headings[1]\n assert_equal \"rat105_009_k11.p1ca_226\",snp_data[0]\n assert_equal \"2283252\",snp_data[2]\n assert_equal '6',snp_data[233] # penultimate entry\n assert_equal '6',snp_data[234] # last entry\n assert_equal nil,snp_data[235] # shouldnt exist\n end\n end",
"def parse; end",
"def parse; end",
"def parse; end",
"def test_search_compact\n transaction = @parser.parse_results(fixture('search_compact.xml').read, 'COMPACT')\n\n assert_equal true, transaction.success?, \"transaction should be successful\"\n assert_equal 0, transaction.reply_code.to_i\n assert_equal 'SUCCESS', transaction.reply_text\n assert_equal [], transaction.header\n\n assert_equal nil, transaction.metadata\n\n assert_equal ?\\t, transaction.delimiter\n assert_equal \"\\t\", transaction.ascii_delimiter\n assert_equal true, transaction.max_rows?\n\n assert_equal 2, transaction.response.length, 'response length should be 2'\n assert_equal \"Datum1\", transaction.response[0]['First']\n assert_equal \"Datum2\", transaction.response[0]['Second']\n assert_equal \"Datum3\", transaction.response[0]['Third']\n assert_equal \"Datum4\", transaction.response[1]['First']\n assert_equal \"Datum5\", transaction.response[1]['Second']\n assert_equal \"Datum6\", transaction.response[1]['Third']\n\n assert_equal nil, transaction.secondary_response\n end",
"def is_parser_for?(ical)\n ical =~ BINARY.to_whole_line\n end",
"def test_parse_line_empty\n assert_nil @grapher.parse_line_tokens('')\n end",
"def svalue!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 43 )\n\n type = SVALUE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 377:9: {...}? => ( '\\\"' (~ '\\\"' )* '\\\"' | '\\\\'' (~ '\\\\'' )* '\\\\'' )\n raise FailedPredicate( \"SVALUE\", \" @tagMode \" ) unless ( ( @tagMode ) )\n # at line 378:9: ( '\\\"' (~ '\\\"' )* '\\\"' | '\\\\'' (~ '\\\\'' )* '\\\\'' )\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == 0x22 )\n alt_5 = 1\n elsif ( look_5_0 == 0x27 )\n alt_5 = 2\n else\n raise NoViableAlternative( \"\", 5, 0 )\n end\n case alt_5\n when 1\n # at line 378:11: '\\\"' (~ '\\\"' )* '\\\"'\n match( 0x22 )\n # at line 378:15: (~ '\\\"' )*\n while true # decision 3\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( 0x0, 0x21 ) || look_3_0.between?( 0x23, 0xffff ) )\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 378:16: ~ '\\\"'\n if @input.peek( 1 ).between?( 0x0, 0x21 ) || @input.peek( 1 ).between?( 0x23, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 3\n end\n end # loop for decision 3\n match( 0x22 )\n\n when 2\n # at line 379:11: '\\\\'' (~ '\\\\'' )* '\\\\''\n match( 0x27 )\n # at line 379:16: (~ '\\\\'' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x0, 0x26 ) || look_4_0.between?( 0x28, 0xffff ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 379:17: ~ '\\\\''\n if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\n match( 0x27 )\n\n end\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 43 )\n\n end",
"def parse(data); end",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n \n # - - - - main rule block - - - -\n # at line 344:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )\n alt_12 = 3\n alt_12 = @dfa12.predict( @input )\n case alt_12\n when 1\n # at line 344:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )?\n # at file 344:9: ( '0' .. '9' )+\n match_count_6 = 0\n while true\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0.between?( 0x30, 0x39 ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 344:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_6 > 0 and break\n eee = EarlyExit(6)\n\n\n raise eee\n end\n match_count_6 += 1\n end\n\n match( 0x2e )\n # at line 344:25: ( '0' .. '9' )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0.between?( 0x30, 0x39 ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 344:26: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n # at line 344:37: ( EXPONENT )?\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == 0x45 || look_8_0 == 0x65 )\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 344:37: EXPONENT\n exponent!\n\n end\n\n when 2\n # at line 345:9: '.' ( '0' .. '9' )+ ( EXPONENT )?\n match( 0x2e )\n # at file 345:13: ( '0' .. '9' )+\n match_count_9 = 0\n while true\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0.between?( 0x30, 0x39 ) )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 345:14: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_9 > 0 and break\n eee = EarlyExit(9)\n\n\n raise eee\n end\n match_count_9 += 1\n end\n\n # at line 345:25: ( EXPONENT )?\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == 0x45 || look_10_0 == 0x65 )\n alt_10 = 1\n end\n case alt_10\n when 1\n # at line 345:25: EXPONENT\n exponent!\n\n end\n\n when 3\n # at line 346:9: ( '0' .. '9' )+ EXPONENT\n # at file 346:9: ( '0' .. '9' )+\n match_count_11 = 0\n while true\n alt_11 = 2\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0.between?( 0x30, 0x39 ) )\n alt_11 = 1\n\n end\n case alt_11\n when 1\n # at line 346:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_11 > 0 and break\n eee = EarlyExit(11)\n\n\n raise eee\n end\n match_count_11 += 1\n end\n\n exponent!\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"def dense?; return stype == :dense; end",
"def test_ape_item\n ai = ApeItem.new('BlaH', ['BlAh'])\n # Test valid defaults\n assert_equal ['BlAh'], ai\n assert_equal false, ai.read_only\n assert_equal 'utf8', ai.ape_type\n assert_equal 'BlaH', ai.key\n assert_equal 'BlAh', ai.string_value\n assert_equal \"\\04\\0\\0\\0\\0\\0\\0\\0BlaH\\0BlAh\", ai.raw\n assert_equal true, ai.valid?\n \n # Test valid read_only settings\n ai.read_only=true\n ai.read_only=false\n assert_raises(ApeTagError){ai.read_only=nil}\n assert_raises(ApeTagError){ai.read_only='Blah'}\n assert_equal true, ai.valid?\n \n # Test valid ape_type settings\n ApeItem::ITEM_TYPES.each{|type| ai.ape_type=type}\n assert_raises(ApeTagError){ai.ape_type='Blah'}\n \n # Test valid key settings\n (\n ((\"\\0\"..\"\\x1f\").to_a + (\"\\x80\"..\"\\xff\").to_a).collect{|x|\"#{x} \"} +\n [nil, 1, '', 'x', 'x'*256, 'id3', 'tag', 'oggs', 'mp+']\n ).each{|x|assert_raises(ApeTagError){ai.key=x}}\n (\n (\"\\x20\"..\"\\x7f\").to_a.collect{|x|\"#{x} \"} +\n ['id3', 'tag', 'oggs', 'mp+'].collect{|x|\"#{x} \"} +\n ['xx', 'x'*255]\n ).each{|x| ai.key=x}\n \n # Test valid raw and string value for different settings\n ai.key=\"BlaH\"\n assert_equal \"\\04\\0\\0\\0\\0\\0\\0\\06BlaH\\0BlAh\", ai.raw\n assert_equal 'BlAh', ai.string_value\n ai.read_only=true\n assert_equal \"\\04\\0\\0\\0\\0\\0\\0\\07BlaH\\0BlAh\", ai.raw\n assert_equal 'BlAh', ai.string_value\n ai << 'XYZ'\n assert_equal \"\\010\\0\\0\\0\\0\\0\\0\\07BlaH\\0BlAh\\0XYZ\", ai.raw\n assert_equal \"BlAh\\0XYZ\", ai.string_value\n\n if RUBY_VERSION >= '1.9'\n ai = ApeItem.new('BlaH', [\"\\x80\".force_encoding('BINARY')])\n assert_equal(false, ai.valid_value?)\n assert_raises(ApeTagError){ai.normalize_encodings}\n end\n end",
"def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end",
"def quickie_parsable?\n @quickie.present? && @parsed_quickie.present?\n end",
"def valid?\n @data && reader.valid_header? && metadata != :invalid\n end",
"def parse!(raw)\n\n return false if raw.size != ID3::ID3v1tagSize\n\n if (raw[ID3v1versionbyte] == 0) \n @version = \"1.0\"\n else\n @version = \"1.1\"\n end\n\n self.clear # remove all entries from Hash, we don't want left-overs..\n\n ID3::SUPPORTED_SYMBOLS[@version].each{ |key,val|\n if val.class == Range\n # self[key] = raw[val].squeeze(\" \\000\").chomp(\" \").chomp(\"\\000\")\n self[key] = raw[val].strip\n elsif val.class == Fixnum\n self[key] = raw[val].to_s\n else \n # this can't happen the way we defined the hash..\n # printf \"unknown key/val : #{key} / #{val} ; val-type: %s\\n\", val.class\n end \n }\n @raw = raw\n return true\n end",
"def parse_memory(data, encoding = T.unsafe(nil)); end",
"def read_full_matrix(str)\n data = []\n CSV.parse(str) do |row|\n data << row.map{|e|e.to_i}\n end\n data\n end",
"def test_initial_state_on_examples\n assert_equal(@small_dfa.ith_state(3), @small_dfa.initial_state())\n end",
"def initialize(string=nil,size=0)\n @default = 0.0\n if string.nil?\n @values = {}\n @size = 0\n else\n elements = string.split(\" \") \n raise ArgumentError.new(\"SparseVector.new expects a string of index-value pairs\") if not elements.size % 2 == 0\n @values = {}\n last_index = nil\n last_used_index = 0\n elements.each do |value|\n if last_index.nil?\n last_index = value.to_i\n else\n @values[last_index] = value.to_f\n last_used_index = last_index\n last_index = nil\n end\n end\n if last_used_index > size\n @size = last_used_index\n else\n @size = size\n end\n end\n end",
"def test_parsing_from_pftrack\n fixture = File.open(File.dirname(__FILE__) + '/julik_pftrack.txt')\n trackers = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 720, :height => 576).to_a\n \n bl_kf = trackers[0][0]\n assert_in_delta 0.5, bl_kf.abs_x, DELTA\n assert_in_delta 0.5, bl_kf.abs_y, DELTA\n \n tr_kf = trackers[1][0]\n assert_in_delta 715.5, tr_kf.abs_x, DELTA\n assert_in_delta 571.514, tr_kf.abs_y, DELTA\n end",
"def test_to_file\n @parser.text_line :comment, :match => /^#/\n @parser.text_line :blank, :match => /^\\s*$/\n @parser.record_line :record, :fields => %w{name one two}\n\n text = \"# This is a comment\n\njohnny one two\nbilly three four\\n\"\n\n# Just parse and generate, to make sure it's isomorphic.\nassert_nothing_raised do\n assert_equal(text, @parser.to_file(@parser.parse(text)),\n \"parsing was not isomorphic\")\n end\n end"
] | [
"0.63681835",
"0.58841234",
"0.55813587",
"0.54093826",
"0.52492565",
"0.5143739",
"0.5109253",
"0.51087564",
"0.5083014",
"0.5083014",
"0.5058494",
"0.50479925",
"0.50372946",
"0.5031179",
"0.5008505",
"0.49728936",
"0.49392366",
"0.49359176",
"0.49343103",
"0.49063396",
"0.49039936",
"0.48862165",
"0.48820984",
"0.48731217",
"0.48724276",
"0.48400292",
"0.48127925",
"0.47909153",
"0.47825727",
"0.47805843",
"0.47662142",
"0.4757807",
"0.4757807",
"0.47557077",
"0.47473863",
"0.47451118",
"0.4740312",
"0.47398973",
"0.47280085",
"0.4721271",
"0.47169277",
"0.47100735",
"0.46972755",
"0.46908328",
"0.46873063",
"0.46761733",
"0.46753487",
"0.46641368",
"0.4658436",
"0.46558055",
"0.46553117",
"0.46539974",
"0.464832",
"0.46480507",
"0.46452653",
"0.46421677",
"0.46252343",
"0.4623266",
"0.46218792",
"0.46218792",
"0.4621203",
"0.4619461",
"0.46194455",
"0.46161073",
"0.4613303",
"0.46114165",
"0.46107557",
"0.4608453",
"0.46075228",
"0.45978135",
"0.45949867",
"0.45921886",
"0.4576729",
"0.457132",
"0.45575744",
"0.455192",
"0.45468003",
"0.4545281",
"0.45435253",
"0.4542641",
"0.4542641",
"0.4542641",
"0.45415166",
"0.45407602",
"0.45403296",
"0.4534683",
"0.45335832",
"0.45306668",
"0.45282465",
"0.45133856",
"0.45090023",
"0.45079058",
"0.45056897",
"0.4497673",
"0.44964728",
"0.44953802",
"0.44947466",
"0.44913605",
"0.44891563",
"0.44848442"
] | 0.79872435 | 0 |
def time_of(field) fields.assoc(field).last / $clk_tck end | def summarize()
fields.each do |name, metric|
params = {}
params[:service] = "process;#{pid};#{name}"
params[:description] = name
params[:pname] = comm
if name == "State"
params[:state] = riemann_statemap(metric)
params[:value] = metric
# elsif name.end_with?("time")
# params[:metric] = time_of(name)
elsif metric.is_a?(Numeric)
params[:metric] = metric
else
params[:value] = metric
end
yield(params)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_field field = nil\n @time_field = field if field\n @time_field\n end",
"def total_time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def cstime(*) end",
"def cstime=(*) end",
"def get_time_required\n 1.0\n end",
"def time_class; end",
"def time\n @time\n end",
"def time\n return @time\n end",
"def sec_fraction() time[3] end",
"def tdd_fme_timestep(attribute)\n attribute * $game_map.screen.timestep\n end",
"def time\n @values['time']\n end",
"def time\n @time ||= Time.at( timestamp / 1_000_000.0 )\n end",
"def nanoseconds; end",
"def total_time=(_arg0); end",
"def ctime\n end",
"def accTime \n \"accTime\" \n end",
"def time_field(object_name, method, options = T.unsafe(nil)); end",
"def get_time\n\t\[email protected]\n\tend",
"def time\n Time.now.to_f\n end",
"def time # :nodoc:\n @time ||= day_fraction_to_time day_fraction\n end",
"def build_timing; end",
"def self_time\n self.measurement.self_time\n end",
"def last_time\n @last_time\n end",
"def time\r\n\t\t@usr_time\r\n\tend",
"def ctime() end",
"def ctime() end",
"def ctime() end",
"def sec() time[2] end",
"def get_time_simple()\n unless(@free_time.nil?)\n return @free_time\n else\n return @timelines[0].get_time()\n end\n end",
"def time\n @time ||= begin\n if Array === first # Distribution\n times.max\n else # Press\n sum\n end\n end\n end",
"def time_base\n self[:time_base].to_f\n end",
"def time\n (1 + Time.now.to_i/10).ceil * 10\n end",
"def timescale\n put('l^')\n get.strip.to_i\n end",
"def building_time\n @process.instance_variable_get(:@building_time).total\n end",
"def base(table, column, where='1=1')\n count = DB[\"SELECT COUNT(*) FROM #{table} WHERE #{column} IS NULL AND (#{where})\"].first[:count]\n $times[[table, column]] << [Time.now, count]\n t = $times[[table, column]]\n\n vel = 0\n time_remaining = 0\n interval = [10, t.size].min\n if t.size >= 2\n t0 = t[-interval]\n t1 = t[-1]\n vel = ((t1[1] - t0[1]).to_f / (t1[0] - t0[0]).to_f).abs\n time_remaining = count / vel if (vel > 0)\n end\n\n puts \"#{count} #{table}.#{column}, vel = %.2f, remaining: #{Time.at(time_remaining).gmtime.strftime('%U dias %R:%S')}\" % [vel]\n\nTime.at(7683).gmtime.strftime('%R:%S')\n\n\n return count\nend",
"def milliseconds() Float(self * (10 ** -3)) end",
"def time\n @robot.time\n end",
"def time\n\n end",
"def tv_sec() end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def time=(_arg0); end",
"def seconds\n _nudge[2]\n end",
"def table_time\n @table_time * 1000\n end",
"def get_time()\n return @noko.css(\"li.g:first-of-type table table\")[0].text\n end",
"def utime(*) end",
"def time_sec; Time.now.sec; end",
"def get_time_remaining\n\n end",
"def total_time\n self.measurement.total_time\n end",
"def now\n @clock\n end",
"def time\n params['time']\n end",
"def time\n end",
"def report_time time\n end",
"def tau\n [current_time - last_updated, 1].max\n end",
"def time label = nil\n @time = @time || Time.now\n label.to_s + ' (' + ( Time.now - @time ).to_s + ')'\n end",
"def deb_time(proc)\n cur_time = Time.now\n proc.call\n return Time.now-cur_time\nend",
"def last_operation_time\n last_operation['time'].to_i\n end",
"def current_otp_timestep\n Time.now.utc.to_i / otp.interval\n end",
"def microseconds() Float(self * (10 ** -6)) end",
"def time\n moment % 1\n end",
"def flight_time; end",
"def get_time_required\n 0 # number of minutes\n end",
"def cutime=(*) end",
"def time_remaining\n\n end",
"def base_time\n BASE_TIME\n end",
"def value_of(name)\n return Time.now.to_f if name == 'TI'\n\n @variables[name]\n end",
"def blocks_time\n @measurements[PATH_MEASURES].time if @measurements[PATH_MEASURES]\n end",
"def time\n start_time = Time.now.to_f\n yield\n end_time = Time.now.to_f\n return end_time - start_time\n end",
"def usec() end",
"def remain_time\n rem_time = $time - Time.new\n rem_time.to_i\nend",
"def current_time\n clock.now.to_f\n end",
"def time_base\n\t if @time_base.empty?\n\t\tTime.at(0)\n\t else\n\t\t@time_base.last[1] \n\t end\n\tend",
"def time\n end_time - start_time\n end",
"def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end",
"def lead_time\n 4\n end",
"def fetchSimulationTime()\n com = Sumo::Traci::Command_GetVariable.new(:sim, :timeStep, \"\") ;\n execCommands(com) ;\n time = com.responseValue() ;\n return time ;\n end",
"def time_for(record)\n return nil unless record\n case database_type\n when :mongo\n return Time.at(record['ts'].seconds)\n when :toku\n return record['ts']\n end\n end",
"def utime=(*) end",
"def start_time; end",
"def get_date()\n @time\n end",
"def current_time\n @definition.current_time\n end",
"def last_in_time\n In.last(:order => \"time ASC\").time rescue nil\n end",
"def pred_time\n @time = (@time - @delta).max(0)\n end",
"def last_time\n last = entries.order(Sequel.desc(:time)).first\n if last.nil?\n last_checked\n else\n last.time\n end\n end",
"def lead_time\n 1\n end",
"def elapsed_time\n @internal_data.elapsed_time\n end",
"def cooking_time\n end",
"def cpu_time_used\n domain_info[:cpuTime]\n end",
"def cpu_time_used\n domain_info[:cpuTime]\n end"
] | [
"0.6849097",
"0.66389394",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.65627354",
"0.6547542",
"0.6532159",
"0.63097024",
"0.63015753",
"0.62553525",
"0.62550867",
"0.6207529",
"0.6148193",
"0.61444145",
"0.6141291",
"0.61346674",
"0.61284715",
"0.612474",
"0.61005455",
"0.6097113",
"0.6051941",
"0.6046001",
"0.6035262",
"0.6023783",
"0.60152316",
"0.60138184",
"0.5994016",
"0.5989824",
"0.59895694",
"0.59895694",
"0.5988509",
"0.5962658",
"0.5959929",
"0.59596866",
"0.59583795",
"0.5957816",
"0.59447247",
"0.5937941",
"0.5931614",
"0.5921786",
"0.5921503",
"0.591859",
"0.5915913",
"0.5915913",
"0.5915913",
"0.5915913",
"0.5915913",
"0.5915913",
"0.5910459",
"0.5894482",
"0.5891073",
"0.5879513",
"0.5876078",
"0.58752185",
"0.5872614",
"0.5868992",
"0.5866073",
"0.58655804",
"0.5862067",
"0.5858752",
"0.58387613",
"0.58382636",
"0.5834019",
"0.5825031",
"0.5819578",
"0.58178896",
"0.5810589",
"0.57976276",
"0.5797474",
"0.5793324",
"0.5792808",
"0.57845044",
"0.5778477",
"0.5775338",
"0.577099",
"0.576382",
"0.5761915",
"0.5756569",
"0.5753761",
"0.57535946",
"0.5750811",
"0.5743666",
"0.5739269",
"0.5730556",
"0.57212037",
"0.57148194",
"0.5712653",
"0.5710199",
"0.57070476",
"0.5701861",
"0.5699652",
"0.5699293",
"0.56818926",
"0.567521",
"0.567521"
] | 0.0 | -1 |
GET /ratings/review GET /ratings/review.js | def review
learnables =
current_user
.rated_learnables
.for_review
.limit(MAX_NUMBER_OF_RATINGS_PER_REQUEST)
@status = status
@learnables_serializer =
ActiveModel::Serializer::CollectionSerializer.new(learnables, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t@review = Review.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend",
"def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end",
"def show\n @review = Review.find(params[:id])\n render json: @review\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 review(review, options = {})\n get(\"reviews/#{review}\", options).pop\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 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 show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def find_review\n Review.find(params[\"id\"])\n end",
"def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end",
"def review\n fetch('restaurant.review')\n end",
"def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\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 index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n render json: @review\n end",
"def show\n render json: @review\n end",
"def show\n render json: @review\n end",
"def rate\n clas = params[:rating_for_class]\n @rate = clas == \"discussion\" ? Discussion.find(params[:id]) : (clas == 'comment' ? Comment.find(params[:id]) : Picture.find(params[:id]))\n @rate.rate_it(params[:score], current_user)\n respond_to do |format|\n format.js\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n end",
"def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end",
"def ratings_index\n @ratings = Rating.all\n # puts(@ratings.to_json(:only => [:review_title]))\n end",
"def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end",
"def review\n\t\t@review = Review.where(:company_id => params[:id])\n\t\t@company_id = params[:id]\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def find_review\n @review = Review.find(params[:id])\n end",
"def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"def index\n @reviews_and_ratings = ReviewsAndRating.all\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def show\n\n respond_to do |format|\n format.html #show\n format.json { render json: @review }\n end\n end",
"def show\n authorize @workshop\n values = @workshop.ratings.pluck(:value)\n @average_rating = values.inject(&:+).to_f / values.size\n respond_to do |format|\n format.html\n format.json\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 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 render json: reviews\n end",
"def index\n reviews = Review.all\n render json: reviews\n end",
"def show\n @review = find_review\n end",
"def rate\n @route = Route.find(params[:id])\n @route.rate_all_dimensions(params[:rating], current_user)\n\n render :update do |page|\n page.hide \"rate\"\n page.replace \"rates\", :partial => \"shared/rates\", :locals => {:rated => @route}\n page.show \"rates\"\n page.visual_effect :highlight, \"rates\"\n page << javascript_rating(@route, params[:rating])\n end\n end",
"def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end",
"def rating\n review.rating if review\n end",
"def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def show\n @reviews = @dog.reviews\n @rating = Review.get_average_rating(@dog)\n end",
"def show\n RestaurantReview.find(params[:id])\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def index\n @ratings = Rating.all\n end",
"def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def find_review\n\t\t\t@review = Review.find(params[:id])\n\t\tend",
"def show\n @team_rating = TeamRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_rating }\n end\n end",
"def reviews(id, review_type='top_critic', page_limit='20', page='1', country='us')\n results = self.class.get(\"/movies/#{id}/reviews.json\", :query => {:review_type => review_type, :page_limit => page_limit, :page => page, :country => country}).parsed_response\n return results\n end",
"def show\n @review = @post.reviews.find(params[:id])\n respond_with @post, @review\n end",
"def show\n render_json content: @review\n end",
"def show\n #this is going to be the individual review page using no. in db row using params array of :id. make sure we now create view page\n @review = Review.find(params[:id])\n end",
"def show\n @review = reviewable.reviews.find(params[:id])\n\n respond_to do |format|\n format.html do\n if request.xhr?\n render \"show-xhr\", :layout => nil\n else\n render\n end\n end\n format.json { render json: @review }\n end\n end",
"def review\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 rate\n\t\t# retrieve user with specified ID and rate him/her \n @user = User.find(params[:id])\n @user.rate(params[:stars], current_user, params[:dimension])\n\n\t\t# automatically display the new rating\n render :update do |page|\n page.replace_html @user.wrapper_dom_id(params), ratings_for(@user, params.merge(:wrap => false))\n page.visual_effect :highlight, @user.wrapper_dom_id(params)\n end\n end",
"def welcome\n @reviews = Review.all\n render json: @reviews\n end",
"def index\n @reviews = Review.all\n \n end",
"def index\n @reviews = Review.find params[:id]\n\n @user = User.find(params[user:id])\n @review = Review.new\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def show\n @paragraph_rating = ParagraphRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paragraph_rating }\n end\n end",
"def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end",
"def set_reviews_and_rating\n @reviews_and_rating = ReviewsAndRating.find(params[:id])\n end",
"def overall_rating\n overall_rating = 0.0\n rparams = params[:review]\n if rparams # sometimes ajax calls come in before dom is ready, it seems\n rparams = review_params(params).reject{|key,val| [\"excerpts_attributes\"].include?(key)}\n # For mini-reviews, since we don't display the trust question, we cannot use\n # the source rating value in computing the overall rating!\n if rparams[:form_version] =~ /mini/ && params[:source_ratings]\n rparams[:source_review] = SourceReview.new(:rating_attributes => params[:source_ratings]) \n end\n temp_review = Review.new(rparams)\n new_processed_ratings = Ratings::process(temp_review, true, nil)\n overall_rating = new_processed_ratings[0]['overall'] || 0.0\n end\n render :inline => {:rating => (\"%.1f\" % overall_rating), :percent => ((overall_rating.to_f / 5) * 100).to_i}.to_json\n end",
"def show\n set_rating\n end",
"def review\n @t = T\n @t = @t.paginate :page => params[:page], :per_page => params[:per_page]\n @data = @t.meanings\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @t }\n end\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def set_rating\n @rating = Rating.find(params[:id])\n end",
"def show\n\t\t@review = Review.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend",
"def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def show\n find_review\n find_show\n respond_to do |f|\n f.html {render :show}\n f.json {render json: @review}\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.xml { render :xml => @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.xml { render :xml => @rating }\n end\n end",
"def show\n @tv_show = TvShow.find(params[:id])\n @IMDBrating = Rating.rating(\"TvShow\",\"tv_shows\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvShow\",\"tv_shows\",params[:id],'TVDB').to_a[0]\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n require 'open-uri'\n require 'uri'\n require 'json'\n result = JSON.parse(open(\"http://imdbapi.org/?title=\"+URI.escape(@tv_show.title.to_s)+\"&type=json&plot=simple&episode=0&limit=1&year=\"+@tv_show.year_released.try(:strftime, \"%Y\")+\"&yg=1&mt=TVS&lang=en-US&offset=&aka=simple&release=simple&business=0&tech=0\").read)\n\n if !result[0].nil?\n @poster = result[0][\"poster\"]\n @description = result[0][\"plot_simple\"]\n @IMDBurl = result[0][\"imdb_url\"].strip\n @actors = result[0][\"actors\"]\n end\n\n @reviews = TvShow.reviews(@tv_show.id)\n @seasonCount = TvSeason.where(:tv_show_id => @tv_show.id).count\n @epCount = 0\n @tv_show.tv_seasons.each do |s|\n @reviews = @reviews + s.reviews(s.id)\n s.tv_episodes.each do |e|\n @epCount = @epCount + 1\n @reviews = @reviews + e.reviews(e.id)\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_show }\n end\n end",
"def show\n @reviews = Review.where(tutor_profile_id: @tutor_profile.id).order(\"created_at DESC\")\n if @reviews.blank?\n avg_rating = 0 \n else\n @avg_rating = @reviews.average(:rating).round(2) \n end\n end",
"def index\n @reviews = current_user.reviews\n end",
"def index\n\t\tparams[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where(\"user_id = ?\", current_user.id)\n\t\t@reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @reviews }\n\t\t\tformat.js\n\t\tend \n\tend",
"def create\n\t\t@review = Review.new(review_params)\n\t\[email protected]_id = current_user.id\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:success]= 'review was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend",
"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 ratings_ranking(*args)\n @client.get \"#{@path}/ratings/ranking\", Hash[*args]\n end"
] | [
"0.70864373",
"0.70565295",
"0.6992418",
"0.6946423",
"0.6936426",
"0.6900358",
"0.6854574",
"0.6854574",
"0.6854574",
"0.6840133",
"0.6840133",
"0.6840133",
"0.6840133",
"0.6840133",
"0.68022764",
"0.6769466",
"0.6747345",
"0.6730223",
"0.6696571",
"0.6684836",
"0.6679735",
"0.6679735",
"0.6679735",
"0.66771936",
"0.66771936",
"0.66771936",
"0.6652935",
"0.6641023",
"0.66180295",
"0.65936255",
"0.65882057",
"0.65749645",
"0.6571829",
"0.65271693",
"0.652324",
"0.65054363",
"0.65054363",
"0.65054363",
"0.6493335",
"0.64890164",
"0.64732355",
"0.64732355",
"0.6399747",
"0.6399747",
"0.6377776",
"0.63765174",
"0.6375769",
"0.63704467",
"0.6363392",
"0.6361551",
"0.6360329",
"0.6353105",
"0.6353105",
"0.6353105",
"0.6341689",
"0.6340916",
"0.6322791",
"0.6312343",
"0.6311468",
"0.6308978",
"0.6293859",
"0.6287267",
"0.6274879",
"0.6270654",
"0.6270235",
"0.62566",
"0.6252484",
"0.62524664",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.6251713",
"0.624329",
"0.62334436",
"0.62254673",
"0.62049854",
"0.6201242",
"0.619975",
"0.6199581",
"0.6199581",
"0.6199581",
"0.61981773",
"0.61980015",
"0.61961234",
"0.61906576",
"0.6189631",
"0.61886907",
"0.61824554",
"0.6175173",
"0.61732817",
"0.6172145",
"0.6169109",
"0.61685884"
] | 0.0 | -1 |
Note: You'll need to update the subcollections separately. | def update(opts={})
on RequisitionPage do |page|
edit_fields opts, page, :description, :payment_request_positive_approval_required,
:delivery_phone_number, :requestor_phone, :vendor_notes, :delivery_instructions
end
update_options(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sub_collection\n @sub_collection = SubCollection.find(params[:id])\n end",
"def subcollections\n respond_to?(:collectionHasSubcollection) ? collectionHasSubcollection : []\n end",
"def rebuild_document_collection()\n end",
"def collection_updated(object, result)\n key = object.key\n if result\n parent_add(key, object)\n object.subscribe(self)\n else\n object.unsubscribe(self)\n parent_delete(object)\n end\n end",
"def update_collection(collection)\n # Take the name out of the list of keys so that all that remains are fields to\n # be updated\n name = collection.delete(:name)\n # Because the name may come in many forms we must use something like titlecase to help\n # account for variations\n name = name.last.titleize\n \n # Due to the way that batches are handled a collection may appear multiple times. Presume\n # that if it has already been processed it is safe to skip any duplicates\n if (@successful_updates.include?(name) or \n @failed_updates.include?(name))\n log_message(\"Skipping duplicate collection entry\")\n return\n end\n\n coll = Collection.where(title: name).first\n \n if (coll.present? and (coll.title == name))\n log_message(\"Processing #{coll.title}\")\n update_and_save_metadata(coll, collection) \n @successful_updates << name\n else\n log_message(\"Could not locate #{name}\", Logger::WARN)\n @failed_updates << name\n end\n end",
"def update!(**args)\n @collection = args[:collection] if args.key?(:collection)\n end",
"def index\n @sub_collections = SubCollection.all\n end",
"def collection(new_collection)\n self.collection_key = new_collection\n end",
"def create_collections\n self.collections.each do |c|\n self.add_collection(c)\n end\n end",
"def refresh_collections(valid_collections)\n collections.delete_all\n valid_collections.each do |collection|\n collection_to_add = Collection.find_or_create_by(druid: collection)\n collections << collection_to_add unless collections.include?(collection_to_add)\n end\n end",
"def inherit_collection(parent_collection)\n #collection is a sub-collection, parent has a project\n if (!parent_collection.projects.empty?)\n add_project_col(parent_collection.projects.first, @collection)\n #collection is a sub-collection, parent dose not have a project\n elsif (parent_collection.projects.empty?)\n @collection.projects.each do |project|\n @collection.projects.delete project\n \n @collection.descendants.each do |c|\n if !c.projects.empty?\n c.projects.delete project\n end\n end\n end\n end\n end",
"def attach_work_to_collection(work,collection)\n \n attached = true\n collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX\n begin\n work.member_of_collections << collection\n work.save!\n rescue StandardError => e\n attached = false\n end\n\n attached\n end",
"def updateSubDocument(collection, query, document)\n collection.find(query).update_one(document)\n end",
"def update\n unless params[:update_collection].nil?\n process_banner_input\n process_logo_input\n end\n\n process_member_changes\n @collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE unless @collection.discoverable?\n # we don't have to reindex the full graph when updating collection\n @collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX\n if @collection.update(collection_params.except(:members))\n # This is the reason for the monkey patch.\n redirect_to hyrax.dashboard_collection_path, notice: t('hyrax.dashboard.my.action.collection_update_success')\n else\n after_update_error\n end\n end",
"def member_subcollections\n verbose = true # || hyrax_collections_controller_behavior_debug_verbose\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if verbose\n results = collection_member_service.available_member_subcollections\n @subcollection_solr_response = results\n @subcollection_docs = ::Hyrax::CollectionHelper2.member_subcollections_docs( results )\n @subcollection_count = @presenter.nil? ? 0 : @subcollection_count = @presenter.subcollection_count = results.total\n end",
"def update_collections_for(user, collections, options = {})\n not_owned_collection = collections.find { |c| not c.owned_by?(user) }\n if not_owned_collection\n raise Exception.new(\"Tried to save listing to collection #{not_owned_collection.id}, which is not owned by user #{user.id}\")\n end\n already_saved_collections = self.collections_owned_by(user)\n to_save_collections = collections - already_saved_collections\n to_remove_collections = already_saved_collections - collections\n self.class.transaction do\n self.collections += to_save_collections\n self.collections -= to_remove_collections\n @saves_count = nil\n end\n end",
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end",
"def notify_collections *updates\n @collections.each {|coll| instance_variable_get(\"@#{coll}\").notify_members *updates }\n end",
"def collections\n return self.root_collection.subcollections\n end",
"def update_collection_parent\n old_parent = @collection.parent\n old_parent.delete_member_by_id(@collection.id)\n old_parent.save\n\n new_parent = find_new_parent\n new_parent.member_ids = [@collection.id] + new_parent.member_ids\n new_parent.save\n end",
"def restore_collections\n\t original_collections.each do |col, backup|\n\t\tcol.clear\n\t\tif col.kind_of?(Hash)\n\t\t col.merge! backup\n\t\telse\n backup.each do |obj|\n col << obj\n end\n\t\tend\n\t end\n original_collections.clear\n\tend",
"def reload_data\n reset_collection_data\n reload_collection_data\n end",
"def test_4\n f = Foo.new\n z = f.update_collection(\"device_worker\")\n assert_equal LOAD, z\n end",
"def remove_from_all_dil_collections\r\n self.collections.each do |collection|\r\n collection.members.remove_member_by_pid( self.pid )\r\n collection.save\r\n self.collections.delete(collection)\r\n end\r\n end",
"def call(change_set, collection_ids: [])\n change_set.member_of_collection_ids += collection_ids\n\n Success(change_set)\n end",
"def reindex\n collection = Collection.find(params[:id])\n EOL::Solr::CollectionItemsCoreRebuilder.reindex_collection(collection)\n collection.update_attribute(:collection_items_count,\n collection.collection_items.count)\n redirect_to collection, notice: I18n.t(:collection_redindexed)\n end",
"def rename_child_collection(old_name, name)\r\n #Verify that new name isn't already in database\r\n result = @db_interface.hash_value_exist?(@certain_coll_key, name)\r\n raise Transformer::MappingException, \"Collection with such a name already exist.\" if result\r\n result = @db_interface.hash_value_exist?(@certain_coll_key, old_name)\r\n raise Transformer::MappingException, \"Cannot rename, collection #{old_name} doesn't exist.\" unless result\r\n\r\n #Delete old enevironment\r\n old_id = get_child_collection_id(old_name)\r\n result = []\r\n result[0] = @db_interface.delete_from_hash(@certain_coll_key, [old_name])\r\n result[1] = @db_interface.add_to_hash_ne(@certain_coll_key, name, old_id)\r\n #Note: result may obtain some old return values from redis, we have to lookup at the end of result\r\n raise Transformer::MappingException, \"Cannot delete old collection's name, rename aborted.\" unless result[-1]\r\n raise Transformer::MappingException, \"Renaming failed.\" unless result[-2]\r\n end",
"def update_attributes\n return transform_attributes.except(:id) if klass == Collection\n if attributes[:collection].present?\n transform_attributes.except(:id).except(:collection).merge(member_of_collections_attributes: { 0 => { id: collection.id } })\n elsif attributes[:collections].present?\n collection_ids = attributes[:collections].each.with_index.each_with_object({}) do |(element, index), ids|\n ids[index] = element\n end\n transform_attributes.except(:id).except(:collections).merge(member_of_collections_attributes: collection_ids)\n else\n transform_attributes.except(:id)\n end\n end",
"def restore_collections\n original_collections.each do |col, backup|\n col.clear\n if col.kind_of?(Hash)\n col.merge! backup\n else\n backup.each do |obj|\n col << obj\n end\n end\n end\n original_collections.clear\n end",
"def update\n respond_to do |format|\n if @sub_collection.update(sub_collection_params)\n if not sub_collection_images_params[:sub_collection_images_attributes].nil?\n sub_collection_images_params[:sub_collection_images_attributes].each do |sci|\n @sub_collection.sub_collection_images.create(sub_collection_image: sci[:sub_collection_image])\n end\n end\n format.html { redirect_to @sub_collection, notice: 'Sub collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_collection }\n else\n @sub_collection.sub_collection_images.build\n format.html { render :edit }\n format.json { render json: @sub_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_primary_collection(collection)\n memberships = self.collection_item_memberships\n memberships.select{ |m| m.primary == true && m.collection_id != collection.id }.\n each{ |m| m.update!(primary: false) }\n primary_membership = memberships.find{ |m| m.collection_id == collection.id }\n if primary_membership\n primary_membership.update!(primary: true)\n else\n self.collection_item_memberships.build(collection: collection,\n primary: true)\n self.save!\n end\n end",
"def set_collection\n @collection = user_collections.detect{ |c| c.id.to_s == params[:id] }\n end",
"def fix_collection(db, coll_name, fixtype)\n case fixtype\n when :spuriousM\n db.collection('__METADATA__').remove('_id' => coll_name)\n when :INIT\n db.collection(coll_name).drop\n db.collection('__METADATA__').remove('_id' => coll_name)\n when :APPEND\n metadata = db.collection('__METADATA__').find_one('_id' => coll_name)\n bad_vcfs = metadata['last_inconsistency_reason'][1]\n\n first_bad_vcf = metadata['vcfs'].index(bad_vcfs[0])\n if first_bad_vcf == nil\n raise \"the metadata state is incoherent\"\n end\n bad_samples = []\n metadata['samples'].each do |s| \n if s['vcfid'] >= first_bad_vcf\n bad_samples << s['name']\n end\n end\n\n number_of_good_samples = metadata['samples'].length - bad_samples.length\n number_of_good_vcfs = metadata['vcfs'].length - bad_vcfs.length\n\n update_operation = {\n '$push' => {\n 'IDs' => {'$each' => [], '$slice'=> number_of_good_vcfs},\n 'QUALs' => {'$each' => [], '$slice'=> number_of_good_vcfs}, \n 'FILTERs' => {'$each' => [], '$slice'=> number_of_good_vcfs},\n 'INFOs' => {'$each' => [], '$slice'=> number_of_good_vcfs},\n 'samples' => {'$each' => [], '$slice'=> number_of_good_samples}\n }\n }\n\n db.collection(coll_name).update({}, update_operation, {:multi => true})\n\n metadata_update_operation = {\n '$set' => {'consistent' => true}, \n '$push' => {\n 'vcfs' => {'$each' => [], '$slice' => number_of_good_vcfs},\n 'headers' => {'$each' => [], '$slice' => number_of_good_vcfs},\n 'samples' => {'$each' => [], '$slice'=> number_of_good_samples}\n },\n }\n db.collection('__METADATA__').update({'_id' => coll_name}, metadata_update_operation)\n else\n raise \"unknown error state, fix_collection() doesn't know what to do\"\n end\n end",
"def add_collections_and_works(new_member_ids, valkyrie: false)\n ### TODO: Change to do this through Valkyrie. Right now using existing AF method to get multi-membership check.\n af_self = Wings::ActiveFedoraConverter.new(resource: self).convert\n af_ids = valkyrie ? Wings::IdConverterService.convert_to_active_fedora_ids(new_member_ids) : new_member_ids\n af_self.add_member_objects(af_ids)\n end",
"def move_collection_names\n @record.xpath('./datafield[@tag=\"710\"]/subfield[@code=\"5\"]').each do |subfield|\n collection = subfield.parent.at_xpath('./subfield[@code=\"a\"]').text\n\n Nokogiri::XML::Builder.with(@doc.at('record')) do |xml|\n xml.datafield('ind1' => '0', 'ind2' => '0', 'tag' => '773') do\n xml.subfield(collection, 'code' => 't')\n end\n end\n\n subfield.parent.remove\n end\n end",
"def set_root_collection\n @root_collection = RootCollection.find(params[:id])\n end",
"def update\n @collection = Collection.find(params[:id])\n \n #Parent collection stuff\n parent_child_violation = false\n access_violation = false\n if params.include?(\"collection\") and params[:collection].include?(\"parent_id\") and params[:collection][\"parent_id\"] != \"\"\n parent_collection = Collection.find(params[:collection][\"parent_id\"])\n \n if (parent_collection.user_id != @collection.user_id)\n access_violation = true\n \n else\n #if !collection_is_parent(@collection, parent_collection)\n if !parent_collection.ancestors.include?(@collection)\n @collection.parent_id = parent_collection.id\n \n #inherits project (and permissions) of parent by default\n inherit_collection(parent_collection)\n else\n parent_child_violation = true\n end\n end #if parent\n end #if params\n \n #Update\n #do this now, so the spawn doesn't PG:Error b/c spawned code has locked @colllection\n update_collection_attrs_suc = false\n if (not parent_child_violation and not access_violation)\n update_collection_attrs_suc = @collection.update_attributes(params[:collection])\n end\n\n #Validation\n if (params.include?(\"post\") and params[:post].include?(\"ifilter_id\") and params[:post][:ifilter_id] != \"\" )\n f = get_ifilter( params[:post][:ifilter_id].to_i )\n\n validate_collection_helper(@collection, f)\n end\n \n #Add metadata from a metaform\n if (params.include?(\"post\") and params[:post].include?(\"metaform_id\") and params[:post][:metaform_id] != \"\" )\n add_collection_metaform(@collection, params[:post][:metaform_id].to_i)\n end\n\n #Add to my project\n if (params.include?(\"proj\") and params[:proj].include?(\"id\") and params[:proj][:id] != \"\" )\n project = Project.find( params[:proj][:id] )\n add_project_col(project, @collection) #call to collection helper, adds collection to project\n end\n \n #Add selected upload as a note to the collection\n if (params.include?(\"note\") and params[\"note\"].include?(\"upload_id\") and (!params[\"note\"][\"upload_id\"].blank?) )\n add_note_collection( params[\"note\"][\"upload_id\"] )\n end\n\n if (params.include?(\"remove_ids\") and (!params[\"remove_ids\"].blank?) )\n remove_notes_collection( params[\"remove_ids\"] ) #Remove notes\n end\n\n=begin\n #Add to other project (as editor)\n if (params.include?(\"ed_proj\") and params[:ed_proj].include?(\"pro_id\") and params[:ed_proj][:pro_id] != \"\" )\n project = Project.find( params[:ed_proj][:pro_id] )\n add_project_col(project, @collection) #from collection helper\n end\n=end\n #Recursive remove from project\n if params.include?(\"remove_project\")\n params[\"remove_project\"].each do |k,v|\n if v.to_i == 1\n project = Project.find(k.to_i)\n @collection.projects.delete project\n @collection.descendants.each do |c|\n if !c.projects.empty?\n c.projects.delete project\n end\n end\n end\n end\n end\n\n respond_to do |format|\n if access_violation\n @collection.errors.add(:base, \"You are not authorized to do that.\")\n format.html { render action: \"edit\" }\n elsif parent_child_violation \n #flash[:error] = \"Warning: cannot set parent collection to a child.\"\n @collection.errors.add(:base, \"Cannot set parent collection to a child.\")\n format.html { render action: \"edit\" }\n elsif update_collection_attrs_suc\n format.html { redirect_to edit_collection_path(@collection), notice: 'Collection was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_from_collection(parentCollectionIDs)\n parentCollectionIDs.each do |id|\n c = CwrcCollection.find(id.strip)\n \n self.remove_relationship(:is_member_of_collection, c)\n \n c.remove_relationship(:has_collection_member, self)\n c.save\n end\n self.save\n end",
"def set_collection\n @collection = User.find(current_user.id).collections.find(params[:id])\n end",
"def save_collection(obj)\n\t original_collections << [obj, obj.dup]\n\tend",
"def collections\n with_caching({}, 'collections') do\n sibling_nodes_for('collection').map {|n| Collection.new(n, authentication_options) }\n end\n end",
"def merge_mongo_and_solr(collection, resp)\n\t\t\tsolr_objects = resp['response']['docs']\n\t\t\tmkey,skey = @mongo_match_by.split(\"::\")\n collection.each_with_index do |document,index|\n\t\t\t\tmid = document.fetch(\"#{mkey}\")\n sdoc = solr_objects.find {|sd| sd[\"#{skey}\"] == \"#{mid}\"}\n for pkey in @mongo_projection_keys.split(\",\")\n if document.has_key?(\"#{pkey}\")\n sdoc[\"#{pkey}\"] = document.fetch(\"#{pkey}\")\n end\n end\n end\n\t\t\tresp['response']['docs'] = solr_objects\n\t\t\treturn resp\n\t\tend",
"def update\n respond_to do |format|\n if @root_collection.update(root_collection_params)\n format.html { redirect_to @root_collection, notice: 'Root collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @root_collection }\n else\n format.html { render :edit }\n format.json { render json: @root_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mixins_in_coll(collection)\n return collection if collection.blank?\n return collection if collection.resources.blank? && collection.links.blank?\n\n model = OcciModel.get(backend_instance)\n collection.resources.to_a.each do |resource|\n next if resource.mixins.blank? && resource.links.blank?\n resource.mixins.to_a.each { |mxn| update_mixin_from_model(mxn, model) }\n\n resource.links.to_a.each do |link|\n next if link.mixins.blank?\n link.mixins.to_a.each { |lnk_mxn| update_mixin_from_model(lnk_mxn, model) }\n end\n end\n\n collection.links.to_a.each do |link|\n next if link.mixins.blank?\n link.mixins.to_a.each { |lnk_mxn| update_mixin_from_model(lnk_mxn, model) }\n end\n\n collection\n end",
"def collections; end",
"def object_doc_get_all(collection_name)\n logger.debug \"Get all documents from collection (#{collection_name})\"\n unique_object_doc_array = [] # [Array] to hold new/unique docs\n old_object_doc_array = [] # [Array] to hold old/duplicate docs\n\n # Get all docs from 'collection_name' Collection and sort Desc by 'version'\n collection_by_name(collection_name).find().sort(\"@version\",-1).each do\n # Iterate over each doc\n |object_doc_in_coll|\n\n flag = false # Set flag to false, if flag is true: doc is a duplicate\n\n # Iterate over our unique doc [Array]\n unique_object_doc_array.each do\n |existing_unique_object_doc|\n\n # If an existing unique doc matches the 'uuid' of a collection doc it is old\n if existing_unique_object_doc[\"@uuid\"] == object_doc_in_coll[\"@uuid\"]\n flag = true # duplicate found because it is already in our unique [Array]\n end\n end\n\n if flag\n # Flag = true means this is a duplicate. We add it to our old object doc array\n old_object_doc_array << object_doc_in_coll\n else\n # Flag = false means this is the first time we have seen this one. We add it to the unique object doc array\n unique_object_doc_array << object_doc_in_coll\n end\n end\n\n cleanup_old_docs(old_object_doc_array, collection_name) # we send old docs to get removed\n remove_mongo_keys(unique_object_doc_array) # we return our unique/new docs after removing mongo-related keys (_id, _timestamp)\n end",
"def on_collection_deleted(event)\n return unless event.payload.key?(:collection) # legacy callback\n return if event[:collection].is_a?(ActiveFedora::Base) # handled by legacy code\n\n Hyrax.custom_queries.find_members_of(collection: event[:collection]).each do |resource|\n resource.member_of_collection_ids -= [event[:collection].id]\n Hyrax.persister.save(resource: resource)\n Hyrax.publisher\n .publish('collection.membership.updated', collection: event[:collection], user: event[:user])\n rescue StandardError\n Hyrax.logger.warn \"Failed to remove collection reference from #{work.class}:#{work.id} \" \\\n \"during cleanup for collection: #{event[:collection]}. \"\n end\n end",
"def add_project_col(project, collection)\n #Add this collection to the project\n if !project.collections.collect {|pc| pc.id}.include?(collection.id)\n project.collections << collection\n #add_owner(project, collection) #not finished\n end\n\n #Add this collection's descendants to the project\n collection.descendants.each do |c|\n if !project.collections.collect {|pc| pc.id}.include?(c.id)\n project.collections << c\n end\n end\n\n project.save\n end",
"def touch_collection_date\n self.collection.updated_at = DateTime.now()\n self.collection.save\n end",
"def member_of_collections_attributes\n # A ChildWork will never be a direct member of a Collection\n return if ['ChildWork', 'Page'].include?(metadata[\"Object Type\"]) || !metadata['Parent ARK']\n arks_array = metadata['Parent ARK'].split('|~|')\n collection = []\n\n arks_array.each_with_index do |current_ark, index|\n ark_string = Ark.ensure_prefix(current_ark.strip)\n collection[index] = Collection.find_or_create_by_ark(ark_string)\n\n unless collection[index].recalculate_size == false\n collection[index].recalculate_size = false\n collection[index].save\n end\n end\n\n collection_return = {}\n collection.each_with_index do |current_collection, index|\n collection_return[index] = { id: current_collection.id }\n end\n\n collection_return\n end",
"def _find_or_update_or_build_collection!\n return _flexi_collection if _flexi_collection.present?\n\n # Find existing collection\n self._flexi_collection = COLLECTION.where(\n namespace: self.class.get_flexi_namespace,\n name: self.class.flexi_collection_name,\n partition_id: self.class.flexi_partition_id\n ).first\n\n # Update if schema changed\n if self._flexi_collection\n _update_schema\n else\n _build_collection\n end\n\n self._flexi_collection\n end",
"def mapToCollectionBasedOncertificateProgram\n setLogger(\"#{ENV['DSPACE_HOME']}/log/mapToCollectionBasedOncertificateProgram.log\")\n\n # colmap - maps shortened collection's name to collection pointers\n colmap = {}; DSpace.fromString($root).collections.each { |c| colmap[shortCollectionName(c)] = c}\n\n # go over all archived items with the given year_metadata_value equal to $year\n # and map to collections defined in pu.certificate metadata field\n nitems = 0\n narchived = 0\n nmapped = 0\n nerror = 0\n items = getClassYearItems\n items.each do |i|\n begin\n nitems += 1\n if i.archived?\n # add i to all collections indicated in its pu.department value IF collection is not already in that collection\n narchived += 1\n owners = i.getCollections\n $logger.debug \"#{i} in #{owners.collect { |o| o.getName}.inspect}\"\n i.getMetadata('pu', 'certificate', nil, '*').each do |val|\n map_to_col = colmap[val.value]\n if map_to_col\n if owners.include? map_to_col\n $logger.info(\"ITEM #{i.getHandle}: already in '#{map_to_col.getName}'\")\n else\n $logger.info(\"ITEM #{i.getHandle}: mapping to '#{map_to_col.getName}'\")\n map_to_col.addItem(i)\n DSpace.create(i).index(true)\n nmapped += 1\n end\n else\n $logger.error(\"ITEM #{i.getHandle}: could not find collection with name '#{val.value}'\")\n nerror += 1\n end\n end\n end\n rescue Exception => e\n $logger.error \"exception when processing item #{i}\"\n $logger.error e.inspect\n nerror += 1\n end\n end\n $logger.info(\"SUMMARY processed #{narchived} items out of #{nitems} items\")\n $logger.info(\"SUMMARY added #{nmapped} collection mappings\")\n $logger.info(\"SUMMARY encountered problems on #{nerror} items\")\nend",
"def wRestoreCollections()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore_coll.bat')\n end",
"def test_nested_collection_replace\n # Parent.children\n old_children = @parent.children\n\n data = [{ '_type' => 'Child', 'name' => 'newc1' },\n { '_type' => 'Child', 'name' => 'newc2' },]\n\n childcontroller = ChildController.new(params: {\n owner_viewmodel: 'parent',\n association_name: 'children',\n parent_id: @parent.id,\n data: data,\n })\n childcontroller.invoke(:replace)\n\n assert_equal(200, childcontroller.status, childcontroller.hash_response)\n\n @parent.reload\n\n assert_equal(%w[newc1 newc2], @parent.children.order(:position).pluck(:name))\n assert_predicate(Child.where(id: old_children.map(&:id)), :empty?)\n\n assert_all_hooks_nested_inside_parent_hook(childcontroller.hook_trace)\n end",
"def special_collections_copies\n special_collections? ? existing_copies : 0\n end",
"def set_access_to(collection_or_array)\n # Empty arrays do not seem to be passed in the request. Force value in this case\n list = collection_or_array.empty? ? [\"\"] : collection_or_array\n self.put(data: { set_access_to: list })\n self.reload\n self\n end",
"def create_collection\n return if collection\n\n google_session.root_collection.create_subcollection('riskcovry_uploads')\n end",
"def add_members_to_collection collection = nil\n collection ||= @collection\n collection.member_ids = batch.concat(collection.member_ids)\n collection.save\n batch.each do |id|\n begin\n member = ActiveFedora::Base.find(id)\n rescue\n end\n if collection.is_community?\n # \"target is a community, add to belongsToCommunity\"\n add_member_to_community(member, collection)\n if member.instance_of? Collection\n # \"member is a collection, make all children inherit belongsToCommunity\"\n member.materialized_members.each do |o|\n add_member_to_community(o, collection)\n end\n end\n end\n\n if member.respond_to? :hasCollection\n # \"member is a file, add the target collection id to hasCollection\"\n add_file_to_collection(member, collection)\n end\n\n if collection.belongsToCommunity?\n # \"if the target collection has community, the children added should inherit its belongsToCommunity\"\n belongsToCommunity = collection.belongsToCommunity + member.belongsToCommunity\n member.belongsToCommunity = belongsToCommunity\n member.save\n end\n end\n end",
"def update\n @collection = @current_user.collections.find(params[:id])\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to [@current_user, @collection],\n notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, \n status: :unprocessable_entity }\n end\n end\n end",
"def add_tag_for_collection_members(collection_id:, tags:)\n collection = Collection.find(collection_id)\n\n puts \"Checking #{collection.members.count} items in #{collection.title}\"\n collection.members.each do |member|\n if member.class == Collection\n add_tag_for_collection_members(collection_id: member.id, tags: tags)\n else\n member.tag += tags\n member.save!\n end\n end\nend",
"def update\n return_to = @collection.is_root? ? collections_path : collection_path\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to return_to, 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 set_collection(coll)\n set_collection_ivar(coll)\n end",
"def save_collection(obj)\n original_collections << [obj, obj.dup]\n end",
"def add_to_collections(new_collection_ids)\n return true unless new_collection_ids\n # remove from old collections\n # TODO: Implement in_collection_ids https://github.com/projecthydra-labs/hydra-pcdm/issues/157\n (curation_concern.in_collections.map(&:id) - new_collection_ids).each do |old_id|\n collection = Collection.find(old_id)\n collection.members.delete(curation_concern)\n collection.save\n end\n\n # add to new\n new_collection_ids.each do |coll_id|\n collection = Collection.find(coll_id)\n collection.members << curation_concern\n collection.save\n end\n true\n end",
"def update\n authorize! :update, @collection\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to collection_url(@collection), notice: \"Collection '#{@collection.title}' 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 make_undergraduate_paper_collection_structure(mapping_path, foxpath, user)\r\nputs \"running make_collection_structure\"\r\nmapping_file = mapping_path +\"ug_col_mapping.txt\"\r\n# make the top Theses level first, with a CurationConcerns (not dlibhydra) model.\r\n#array of lines including title\r\ntopmapping = []\r\n# we also need a pid:id hash so we can extract id via a pid key\r\nidmap ={}\r\ntoppid = \"york:808102\" #top level collection\r\ntopcol = Object::Collection.new\r\ntopcol.title = [\"Undergraduate essays and projects\"]\r\ntopcol.former_id = [toppid]\r\ntopcol = populate_collection(toppid, topcol, foxpath) \r\n#the top collection is visible to the general public but not the underlying records or collections\r\ntopcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"public\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\ntopcol.depositor = user\r\ntopcol.save!\r\ntopcol_id = topcol.id.to_s\r\nputs \"topcol.id was \" +topcol.id\r\nmappings_string = toppid + \",\" + + topcol.title[0].to_s + \",\" + topcol_id \r\n\ttopmapping.push(mappings_string) \r\n# write to file as permanent mapping that we can use when mapping theses against collections \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\nopen(mapping_file, \"a+\")do |mapfile|\r\nmapfile.puts(topmapping)\r\nend\r\n\r\n=begin\r\nnow we need to read from the list which I will create, splitting into appropriate parts and for each create an id and add it to the top level collection\r\n=end\r\n# hardcode second level file, but could pass in as param\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2SMALL.txt\")\r\nlevel2file = mapping_path + \"UGpaperCollsLevel2.txt\"\r\ncsv_text = File.read(level2file)\r\n# csv_text = File.read(\"/vagrant/files_to_test/thesescollectionsLevel2.txt\")\r\ncsv = CSV.parse(csv_text)\r\n# we also need a file we can write to, as a permanent mapping\r\nmappings_level2 = []\r\n\r\nputs \"starting second level(subjects)\"\r\ncsv.each do |line|\r\n puts line[0]\r\n\tcol = Object::Collection.new\r\n\t# col = Dlibhydra::Collection.new\r\n\t#col.title = [line[1]]\r\n\ttitle = line[1]\r\n\ttitle.gsub!(\"&\",\"&\")\r\n\tcol.title = [title]\r\n\tcol.former_id = [line[0].strip]\r\n\tcol = populate_collection(line[0].strip, col, foxpath)\r\n\tcol.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tcol.depositor = user\r\n\tcol.save!\r\n\tcol_id = col.id.to_s\r\n\tputs \"subject col id was\" + col_id\r\n\ttopcol.members << col\r\n\ttopcol.save!\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + col_id \r\n\tmappings_level2.push(mappings_string)\r\n\t# add to hash, old pid as key, new id as value\r\n\tkey = line[0]\t\r\n\tidmap[key] = col.id\r\nend\r\n\r\n# write to file as permanent mapping that we can use when mapping theses against collections\r\nopen(mapping_file, \"a+\")do |mapfile| \r\n# open(\"/vagrant/files_to_test/col_mapping.txt\", \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level2)\r\nend\r\n\r\n# but we still have our mappings array, so now use this to make third level collections\r\n\r\nsleep 5 # wait 5 seconds before moving on to allow 2nd level collections some time to index before the level3s start trying to find them\r\n\r\n# read in third level file\r\nmappings_level3 = []\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3SMALL.txt\")\r\nlevel3collsfile = mapping_path + \"UGpaperCollsLevel3.txt\"\r\ncsv_text3 = File.read(level3collsfile)\r\n# csv_text3 = File.read(\"/vagrant/files_to_test/thesescollectionsLevel3.txt\")\r\ncsv_level3 = CSV.parse(csv_text3)\r\n\r\nyearpidcount = 1\r\nputs \"starting third level (years)\"\r\ncsv_level3.each do |line|\r\nyearpidcount = yearpidcount +1\r\n puts \"starting number \" +yearpidcount.to_s+ \" in list\"\r\n puts line[0]\r\n\tyear_col = Object::Collection.new\r\n\tputs \"started new year collection\"\r\n\t# col = Dlibhydra::Collection.new extend cc collection instead\r\n\tyear_col_title = line[1].to_s \r\n\tyear_col_title.gsub!(\"&\", \"&\")\r\n\tputs \"got level 3 title which was \" + year_col_title\r\n\tyear_col.title = [year_col_title] #just in case\r\n\tyear_col.former_id = [line[0].strip]\r\n\tyear_col = populate_collection(line[0].strip, year_col, foxpath)\r\n\tyear_col.permissions = [Hydra::AccessControls::Permission.new({:name=> \"york\", :type=>\"group\", :access=>\"read\"}), Hydra::AccessControls::Permission.new({:name=>\"admin\", :type=> \"group\", :access => \"edit\"})]\r\n\tyear_col.depositor = user\r\n\tputs \"saved permissions and depositor for year collection\"\r\n\tyear_col.save!\r\n\tputs \"saved collection\"\r\n\tyear_col_id = year_col.id.to_s\r\n\tputs \"year col id was \" + year_col_id\r\n\t# need to find the right parent collection here\t\r\n\tparent_pid = line[2]# old parent pid, key to find new parent id\r\n\tputs \" subject col pid was \" + parent_pid\r\n\tmapped_parent_id = idmap[parent_pid]\t\r\n\tputs \"mapped parent id was \" + mapped_parent_id\r\n\tparent = Object::Collection.find(mapped_parent_id)\r\n\tparent.members << year_col\r\n\tputs \"parent id was\" + parent.id.to_s\r\n\tputs \"year collection id was\" + year_col.id.to_s\r\n\tparent.save!\r\n\tputs \"parent.members were\" + parent.members.to_s\r\n\tmappings_string = line[0] + \",\" + + line[1] + \",\" + year_col_id \r\n\tmappings_level3.push(mappings_string)\r\nend\r\n\r\n# and write to permanent mapping file - these can be all the same whether level 2 or 3 or 1\r\nopen(mapping_file, \"a+\")do |mapfile|\r\n\tmapfile.puts(mappings_level3)\r\nend\r\n\r\nputs \"done\"\r\n=begin\r\ninformation we need for each collection is the old pid as a key, plus its parent pid, plus the collection name and the new id once it is created\r\ntop level will be the top level theses ie current Masters Dissertations (york:18179). \r\nsecond level is discipline eg Archaeology, Education etc\r\nOPTIONAL third level is year eg 1973. Not all disciplines have this level\r\n=end\r\nend",
"def merge_mongo_and_solr(collection, resp)\n solr_objects = resp['response']['docs']\n mkey,skey = @mongo_match_by.split(\"::\")\n collection.each_with_index do |document,index|\n mid = document.fetch(\"#{mkey}\")\n sdoc = solr_objects.find {|sd| sd[\"#{skey}\"] == \"#{mid}\"}\n if sdoc.nil?\n log.warn \"Solr document with #{skey}: #{mid} not found\"\n else\n for pkey in @mongo_projection_keys.split(\",\")\n if document.has_key?(\"#{pkey}\")\n sdoc[\"#{pkey}\"] = document.fetch(\"#{pkey}\")\n end\n end\n end\n end\n resp['response']['docs'] = solr_objects\n return resp\n end",
"def populate_collections!\n # Only add ADDED/MODIFIED to the collectors so deleted objects will be removed\n notices.reject { |n| n.type == \"DELETED\" }.each do |notice|\n instance_variable_get(\"@#{notice.object.kind.tableize}\") << notice.object\n end\n end",
"def initialize\n @collection={}\n end",
"def delete_child_collection(name)\r\n #Delete collection = delete all documents in it and than delete field in envId:collections key\r\n coll_id = nil\r\n begin\r\n coll_id = get_child_collection_id(name)\r\n rescue Transformer::MappingException => ex\r\n ex.message\r\n return\r\n end\r\n collection = RedXmlApi::Collection.new(@env_id, coll_id)\r\n collection.delete_all_documents\r\n collection.delete_all_child_collections\r\n @db_interface.delete_from_hash @certain_coll_key, [name]\r\n #We have to delete all keys of collection, e.g. <info, <documents, <collections\r\n del_keys = [Transformer::KeyBuilder.collection_info(@env_id, coll_id), Transformer::KeyBuilder.documents_key(@env_id, coll_id), Transformer::KeyBuilder.child_collections_key(@env_id, coll_id)]\r\n @db_interface.delete_keys del_keys\r\n end",
"def populate_collection(args)\n\targs[:keys].each do |key|\n\t\tapi_url = \"#{@base_url}/#{args[:collection]}/#{key}\"\n\t\tputs do_the_put_call({ url: api_url, user: @user, json: args[:json][key] })\n\tend\nend",
"def assign_tree(tree)\n nodes = tree.sort_by { |e| e['weight'].to_i }\n new_collection_ids = nodes.map { |e| e['id'] }\n if ordered_subset?(new_collection_ids)\n removed_collection_ids = collection_member_ids - new_collection_ids\n self.member_ids = (member_ids.map(&:to_s) - removed_collection_ids) unless removed_collection_ids.empty?\n else\n self.member_ids = new_collection_ids + noncollection_member_ids\n end\n nodes.each do |node|\n b = ActiveFedora::Base.find(node['id'])\n b.assign_tree node['children']\n b.save! #TODO We could move this save into an after_save hook.\n end\n end",
"def set_collection\n @collection = current_user.collections.find_by(id: params[:id]) if current_user\n end",
"def member_collections\n collections\n end",
"def update\n if @collection.update(collection_params)\n render json: @collection, status: :ok#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end",
"def xRestoreCollections()\n puts \"Back up commencing...\"\n Dir.chdir('/Users/jeydurai')\n system('start_mongorestore_coll.bat')\n end",
"def resolve_collections\n @resolved_collections = resolved_associations_map.inject({}) do |hash, (k,v)|\n collection_records = []\n collection_associations = Array.wrap(v[:associations])\n collection_associations.each do |association|\n add_records_from_collection_association(relation, association, collection_records)\n end\n collection_records.flatten!\n collection_records.compact!\n collection_records.uniq!\n hash[k] = collection_records\n hash\n end\n end",
"def collection\n instance_variable_get(collection_name) || set_collection(find_collection)\n end",
"def set_collection\n @collection = Collection.friendly.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find_by_friendlier_id!(params[:id])\n end",
"def set_collection\n self._collection = Mongoid::Collection.new(self, self.collection_name)\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:collection_id])\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to collection_documents_path(@collection), notice: 'The 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 find_collections_with_read_access\n find_collections(:read)\n end",
"def find_collections_with_read_access\n find_collections(:read)\n end",
"def rename_collection(db, coll_name, new_name)\n collections = db.collection_names\n\n if new_name.include?('__')\n raise 'double underscores are resereved for internal usage'\n end\n\n if not collections.include? coll_name\n raise \"collection does not exist\"\n end\n if collections.include? new_name\n raise \"target collection already exists\"\n end\n\n db.collection(coll_name).rename(new_name)\n db.collection_names.keep_if{|c| c.start_with? coll_name + '__'}.each do |related_collection|\n db.collection(related_collection).rename(new_name + '__' + related_collection.split('__', 2)[1])\n end\n metadata = db.collection('__METADATA__').find_one('_id' => coll_name)\n metadata['_id'] = new_name\n db.collection('__METADATA__').insert(metadata)\n db.collection('__METADATA__').remove('_id' => coll_name)\n end",
"def sub_collection_params\n params.require(:sub_collection).permit(:name, :description, :collection, :collection_id)\n end",
"def update\n @category_collection = CategoryCollection.find(params[:id])\n @collection = @category_collection.collection\n\n respond_to do |format|\n if @category_collection.update_attributes(params[:category_collection])\n flash[:notice] = 'CategoryCollection was successfully updated.'\n format.html { redirect_to(@collection) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category_collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def collection_by_title(title)\n return self.root_collection.subcollection_by_title(title)\n end",
"def replicate_collection_association(assoc_name, replication)\n # destroy any children in dest obj that don't exist source obj\n src_child_ids = send(assoc_name).map(&:id)\n replication.dest_obj.send(assoc_name).each do |o|\n unless src_child_ids.include?(o.standard_id)\n Rails.logger.debug(\"DESTROYING CHILD\")\n replication.dest_obj.send(assoc_name).destroy(o)\n end\n end\n\n # replicate the existing children\n send(assoc_name).each{|o| replicate_child(o, assoc_name, replication)}\n end",
"def subfield_x_collections\n return unless cocina_object.respond_to?(:structural) && cocina_object.structural\n\n collections = cocina_object.structural.isMemberOf\n collection_info = []\n\n collections.each do |collection_druid|\n collection = CocinaObjectStore.find(collection_druid)\n next unless ReleaseTags.released_to_searchworks?(cocina_object: collection)\n\n catalog_link = collection.identification&.catalogLinks&.find { |link| link.catalog == catalog }\n collection_info << { code: 'x', value: \"collection:#{collection.externalIdentifier.sub('druid:', '')}:#{catalog_link&.catalogRecordId}:#{Cocina::Models::Builders::TitleBuilder.build(collection.description.title)}\" }\n end\n\n collection_info\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n end",
"def delete_all_child_collections()\r\n all_names = get_all_child_collections_names()\r\n all_names.each do |name|\r\n delete_child_collection(name)\r\n end\r\n end",
"def initialize\n @coll = self.class.collection\n end",
"def set_collection\n @collection = Collection.friendly.find params[:id]\n end"
] | [
"0.6812275",
"0.66981405",
"0.6618699",
"0.6447076",
"0.64146817",
"0.6362932",
"0.6354235",
"0.63188154",
"0.62588114",
"0.6258283",
"0.62110347",
"0.62103885",
"0.61770964",
"0.615962",
"0.6149062",
"0.61482984",
"0.61018896",
"0.6099695",
"0.60635835",
"0.6061285",
"0.6003745",
"0.5929383",
"0.59205836",
"0.5903281",
"0.5882732",
"0.5880518",
"0.5848804",
"0.5805352",
"0.58029425",
"0.5780213",
"0.5780156",
"0.5776541",
"0.5767249",
"0.5755948",
"0.5739764",
"0.5735289",
"0.57091296",
"0.57043314",
"0.5696371",
"0.56895006",
"0.56881964",
"0.5682021",
"0.56793386",
"0.5666851",
"0.5654939",
"0.5644227",
"0.5643723",
"0.5614691",
"0.561006",
"0.560792",
"0.5606795",
"0.56048936",
"0.5593028",
"0.5587974",
"0.5579686",
"0.5579411",
"0.5578418",
"0.5572588",
"0.5561542",
"0.5560387",
"0.5549755",
"0.5545278",
"0.5535854",
"0.55288756",
"0.5519247",
"0.5507681",
"0.5507437",
"0.5503749",
"0.55012286",
"0.55009127",
"0.5499474",
"0.5489596",
"0.5488925",
"0.54789823",
"0.54765743",
"0.5474896",
"0.5465661",
"0.54624456",
"0.5459815",
"0.5459011",
"0.545804",
"0.5447548",
"0.5447548",
"0.5447548",
"0.5441777",
"0.5440335",
"0.54363596",
"0.54363596",
"0.5429524",
"0.5426619",
"0.5422871",
"0.5412728",
"0.540816",
"0.5404512",
"0.53956735",
"0.53956735",
"0.53956735",
"0.53956735",
"0.5390827",
"0.53905636",
"0.5388503"
] | 0.0 | -1 |
Reverses a string in place in O(n) time and O(1) space. | def reverse_string(string)
string_array = string.split('')
i = 0
j = string_array.length-1
while i < j do
tmp = string_array[i]
string_array[i] = string_array[j]
string_array[j] = tmp
i += 1
j -= 1
end
return string_array.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_string(s)\n raise ArgumentError if s.empty?\n i = 0\n j = s.length - 1\n while( i < j)\n temp = s[j]\n s[j] = s[i]\n s[i] = temp\n i += 1\n j -= 1\n end\nend",
"def string_reverse(my_string)\r\n return nil if my_string.nil?\r\n n = my_string.length\r\n i = 0\r\n j = n-i-1\r\n\r\n while i < j do\r\n memo = my_string[i]\r\n my_string[i] = my_string[j]\r\n my_string[j] = memo\r\n i = i+1\r\n j = j-1\r\n end\r\nend",
"def reverse_string(string)\n i = 0\n n = string.length - 1\n\n while i <= n\n temp_value = string[i]\n string[i] = string[n]\n string[n] = temp_value\n i += 1\n n -= 1\n end\n return string\n end",
"def reverse_string(s)\n s.reverse!\nend",
"def reverse_a_string(string)\n reversed_string = \"\"\n index = string.length - 1\n\n while index >= 0\n reversed_string += string[index]\n index -= 1\n end\n\n reversed_string\nend",
"def reverse(string)\n \n string.reverse!\nend",
"def reverse!(str)\n\ti = 0\n\twhile i < str.length / 2\n\t\ttmp = str[i]\n\t\tstr[i] = str[str.length-1-i]\n\t\tstr[str.length-1-i] = tmp\n\t\ti += 1\n\t\t# puts str\n\tend\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def reverse(string)\n\tstring.reverse\nend",
"def string_reverse(my_string)\r\n if my_string == nil\r\n return nil\r\n end\r\n if my_string == \"\"\r\n return \"\"\r\n end\r\n n = 1\r\n str_length = my_string.length\r\n (str_length / 2).times do |i|\r\n temp = my_string[i]\r\n my_string[i] = my_string[str_length - n]\r\n my_string[str_length - n] = temp\r\n n += 1\r\n end\r\n return my_string\r\nend",
"def reverse_inplace(string)\n return _reverse(string, 0, string.length - 1)\nend",
"def reverse_string(s)\n result = ''\n i = s.length - 1\n\n i.downto(0).each do |idx|\n result << s[idx]\n end\n\n result\nend",
"def reverse_string(s)\n return s if s.length <= 1\n\n s = s.chars\n head = 0\n tail = s.length - 1\n\n while (head <= tail) do\n placeholder = s[tail]\n s[tail] = s[head]\n s[head] = placeholder\n\n head += 1\n tail -= 1\n end\n\n s.join\nend",
"def string_reverse(my_string)\r\n return nil if my_string == nil || my_string.length == 0\r\n\r\n i = 0\r\n j = my_string.length - 1\r\n\r\n while i < j\r\n temp = my_string[i]\r\n my_string[i] = my_string[j]\r\n my_string[j] = temp\r\n i += 1\r\n j -= 1\r\n end\r\n\r\n return # reversal is done in place so no new object is returned\r\nend",
"def reverse(string)\nend",
"def reverse(string)\n index = string.lenth - 1\n result = \"\"\n\n while index >= 0\n result += string[index]\n index -= 1\n end\n\n return result\nend",
"def reverse_a_string(string)\n split_string = string.split(\"\")\n reverse_string = []\n string.length.times { reverse_string << split_string.pop}\n reverse_string.join\nend",
"def reverse_in_place(str)\n idx = 0\n while idx < str.length / 2\n # swapped = str[str.length-1-idx]\n # str[str.length-1-idx] = str[idx]\n # str[idx] = swapped\n str[idx], str[str.length-1-idx] = str[str.length-1-idx], str[idx]\n idx += 1\n end\n str\nend",
"def reverse(str)\n return str.reverse()\nend",
"def reverse(str)\n return str.reverse()\nend",
"def reverse(s)\nend",
"def reverse_string(str)\n str.reverse\n end",
"def reverse_string_2(string)\n string = string.to_s\n result = ''\n for i in 1..string.length do\n result += string[-1 * i]\n end\n result\nend",
"def reverse(s)\n return \"\" if s == nil || s.length == 0\n return reverse(s[1..-1]) + s[0] #s[1..-1] is creating a new substring using a new memory address(diff object id)\nend",
"def reverse(str)\n half = str.length / 2\n half.times do |i|\n swap = str[i]\n str[i] = str[str.length - (i + 1)]\n str[str.length - (i + 1)] = swap\n end\n str\nend",
"def string_reverse(my_string)\r\n return my_string if my_string == nil\r\n\r\n i = 0\r\n j = my_string.length - 1\r\n\r\n while i < j\r\n b = my_string[i]\r\n my_string[i] = my_string[j]\r\n my_string[j] = b\r\n\r\n i += 1\r\n j -= 1\r\n end\r\n\r\n return my_string\r\nend",
"def reverse_string string\n\tstring.reverse\nend",
"def reversal(string)\n string.split.reverse.join(' ')\nend",
"def reverse_string str \n str.reverse\nend",
"def reverse(string)\n\tfi = 0\n\tli = string.length-1\n\twhile fi <= li\n\t\ttemp = string[fi]\n\t\tstring[fi] = string[li]\n\t\tstring[li] = temp\n\t\tfi += 1\n\t\tli -= 1\n\tend\n\treturn string\nend",
"def reverse(string)\n string.reverse\nend",
"def reverse(string)\n string.reverse\nend",
"def reverse!(string)\n length = string.length - 1\n (length / 2).times do |idx|\n string[idx], string[length - idx] = string[length - idx], string[idx]\n end\n string\nend",
"def reverse_string_2(s)\n swap(0,s.size-1, s)\nend",
"def string_reverse(my_string)\r\n if my_string == nil \r\n return nil\r\n elsif my_string != \"\"\r\n k = my_string.length / 2\r\n i = 0\r\n j = -1\r\n temp = \"\"\r\n k.times do\r\n temp = my_string[i]\r\n my_string[i] = my_string[j]\r\n my_string[j] = temp\r\n i += 1\r\n j -= 1\r\n end\r\n end\r\n return my_string \r\nend",
"def reverse_string input\n input.reverse\nend",
"def reverse_string_in_place(str)\n beginning_index = 0\n last_index = str.length - 1\n\n\n while beginning_index < last_index\n current_char = str[beginning_index]\n later_char = str[last_index]\n\n # swap them in str\n str[beginning_index] = later_char\n str[last_index] = current_char\n\n last_index = last_index - 1\n beginning_index = beginning_index + 1\n end\n\n p str\nend",
"def reverse_inplace(s)\n\treturn reverse_helper(s, 0, (s.length - 1))\nend",
"def reverse_string string \n\tstring.reverse\nend",
"def string_reverse(my_string)\r\n return my_string if my_string.length < 2\r\n\r\n i = 0\r\n\r\n while i < my_string.length/2\r\n swap_in_place(my_string, i, my_string.length-i-1)\r\n i +=1\r\n end\r\n\r\n return my_string\r\nend",
"def reverse_a_string(string)\n index = string.length - 1 \n split_string = string.split(\"\")\n\n p split_string[index]\n\n new_string = \"\" \n\n until index < 0 do \n new_string << split_string[index]\n index -= 1\n end \n return new_string\nend",
"def reverse_string(s)\n reversed_str = \"\"\n counter = -1\n\n while counter >= (s.length * -1)\n reversed_str << s[counter]\n counter += -1\n end\n\n reversed_str\nend",
"def reverse_inplace(s)\n return reverse_helper(s, 0, s.length-1)\nend",
"def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend",
"def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend",
"def reverse(s)\n return s.reverse\nend",
"def reverse(str)\n\tleft = 0\n\tright = str.length - 1\n\twhile left < right\n\t\ttemp = str[left]\n\t\tstr[left] = str[right]\n\t\tstr[right] = temp\n\t\tleft +=1\n\t\tright -=1\n\tend\n\treturn str\nend",
"def reverse(str)\n str.reverse\nend",
"def reverse_string(str)\n return str if str == ''\n str_copy = str.chars\n str_reversed = ''\n loop do \n popped_item = str_copy.pop\n str_reversed << popped_item\n break if str_copy.empty?\n end\n str_reversed\nend",
"def reverse_string(string)\n rev_string = \"\"\n string.length.times do |i|\n rev_string = string[i] + rev_string\n end\n\n puts rev_string\nend",
"def reverse_inplace(s)\n return reverse_helper(s, 0, s.length - 1)\nend",
"def reverse_string(string)\n answer = string.reverse\n return answer\nend",
"def reverse (string)\n\tchar = String.new(string)\n\n\ti = 0\n\twhile i < string.length do\n\t string[i] = char[string.length-1-i]\n\t i += 1\n\tend\n\n\tputs string\nend",
"def reverse_string(s)\n i = 0\n stack = []\n while i < s.length do\n stack.push(s[i])\n i += 1\n end\n\n rev_s = \"\"\n while stack.length > 0 do\n rev_s = stack.pop\n end\n\n rev_s\nend",
"def reverse_string string\n string.reverse\nend",
"def reverseString(string)\n\nend",
"def reverse_string(string)\n\treturn string.reverse\nend",
"def reverse(s)\n # raise NotImplementedError, \"Method not implemented\"\n return s.slice(-1) + reverse(s.slice(0, s.length - 1)) unless s.length.zero?\n return \"\" if s.length.zero?\nend",
"def reversed_string(string)\n i = string.length - 1\n result = \"\"\n while i >= 0\n result += string[i]\n i -= 1\n end\n return result\nend",
"def reverse_string(string)\r\n return string.reverse\r\nend",
"def reverse(s)\n s.reverse\nend",
"def reverse_a_string(string)\n reversed_string = []\n string = string.split('')\n string_length = string.length\n\n string_length.times do\n last_element = string.last\n reversed_string << last_element\n string.delete(last_element)\n end\n\n reversed_string.join\nend",
"def reverse(string)\n # Create an empty String\n reversed_string = ''\n \n # Create counter\n i = 0\n \n # Loop through the lenght of the string, and build out the new reversed string\n while i < string.length\n reversed_string = string[i] + reversed_string\n # Incremnent by 1 to end loop\n i += 1\n end\n \n # Return our new string\n return reversed_string\n end",
"def string_reverse(my_string)\n if my_string == \"\"\n return my_string\n elsif my_string.nil?\n return nil\n else\n\n length = my_string.length\n count = length / 2\n count.times do |i|\n temp = my_string[i]\n my_string[i] = my_string[length - i - 1]\n my_string[length - i - 1] = temp\n end\n end\n return my_string\nend",
"def reverse(str)\n result = \"\"\n str.chars.reverse_each { |item| result << item }\n result\nend",
"def reverse_inplace(str)\n (0..(str.length/2)-1).each do |i|\n str[i], str[-i-1] = str[-i-1], str[i]\n end\n return str\nend",
"def reverseString(string)\n splitString = string.split(' ')\n splitString.each do |word|\n word.reverse!\n end\n puts splitString.join(' ')\nend",
"def string_reverse (my_string, s_index, e_index)\n i = s_index\n j = e_index\n\n while i < j\n temp = my_string[i]\n my_string[i] = my_string[j]\n my_string[j] = temp\n\n i += 1\n j -= 1\n end\n return\nend",
"def reverse_in_place (string_to_reverse)\n\n\tcount_down = string_to_reverse.length-1\n\tfor l in (0...string_to_reverse.length/2)\n\t\ttemp_var = string_to_reverse[l]\n\t\tstring_to_reverse[l] = string_to_reverse[count_down]\n\t\tstring_to_reverse[count_down] = temp_var\n\t\tputs string_to_reverse\n\t\tcount_down -= 1\n\n\tend\n\n\t string_to_reverse\n\nend",
"def reverse(string)\n if string == ''\n return ''\n end\n\n string.chars.pop + reverse((string.chars - [string.chars.pop]).join)\nend",
"def reverse(string)\n i = string.length - 2 # -2 (instead of -1) since we do not want to include the null terminating character\n reversed_string = \"\"\n while i >= 0\n reversed_string += string[i]\n i -= 1\n end\n reversed_string\nend",
"def string_reverse(my_string)\r\n if my_string != nil\r\n a = 0\r\n b = my_string.length - 1\r\n temp = nil\r\n while a < b\r\n temp = my_string[a]\r\n my_string[a] = my_string[b]\r\n my_string[b] = temp\r\n a += 1\r\n b -= 1\r\n end\r\n end\r\nend",
"def my_reverse(string)\n\t\ta = string.length - 1\n\t\t@new_string = \"\"\n\t\ta.downto(0) { |i| @new_string << string[i] }\n\t\tprint @new_string\n\tend",
"def reverse_string(string)\n reverse = string.reverse\n return reverse\nend",
"def reverse!(str)\n left_index, right_index = 0, (str.length - 1)\n\n while left_index < right_index\n\n str[left_index], str[right_index] = str[right_index], str[left_index]\n\n left_index += 1\n right_index -= 1\n\n end\n\nend",
"def string_reverse(str)\n output = \"\"\n str.each_char.with_index do |element, index|\n output.concat(str[-1-index])\n end\n output\nend",
"def Reverse(str)\n return str.reverse! # Okay, completely useless\nend",
"def reverse_string(str)\nend",
"def reverse_string_4(string)\n string = string.to_s\n result = ''\n index = 0\n while index < string.length\n result = string[index] + result\n index += 1\n end\n result\nend",
"def reverse(str)\n str.chars.inject([], &:unshift).join\nend",
"def reverse_string(string)\n #time complexity and space compexity O(n), there are 2 loops but they are not nested\n #each loop is O(n)\n return nil if string.class != String #check if input os correct\n local_stack = Stack.new() #create new Stack instance\n string.each_char do |char| #insert all character from string into stack\n local_stack.push(char)\n end\n string.length.times do |i| #reassign characters with stack values (FILO)\n string[i] = local_stack.pop()\n end\n string\nend",
"def reverse_string(s)\n left = 0\n right = s.length - 1\n\n while left < right\n s[left], s[right] = s[right], s[left]\n left += 1\n right -= 1\n end\n\n s\nend",
"def reverse_string_in_place(str)\n last_index = str.length # start off as one more than last index\n\n (0...str.length).each do |i|\n last_index = last_index - 1 # keep track of corresponding later char\n current_char = str[i]\n later_char = str[last_index]\n\n next if i == last_index || i < last_index\n\n # swap them in str\n str[i] = later_char\n str[last_index] = current_char\n end\n\n p str\nend",
"def reverse_string s1\n s1.reverse\nend",
"def reverse_string text\n for i in 0...text.length/2\n if i == (text.length-1)/2 && text.length%2 == 0 \n next\n else\n temp = text[i]\n text[i] = text[text.length-1-i]\n text[text.length-1-i] = temp\n end\n end\n text\nend",
"def reverse(string)\n words = string.split(' ')\n words.reverse!\n return words.join(' ')\nend",
"def reverse_str(str)\n # puts str.reverse\n w = ''\n chrs = str.each_char.to_a\n chrs.size.times {\n w << chrs.pop\n }\n puts \"Reverse of String: #{w}\"\nend",
"def reverse_a_string(string)\n new_string = \"\"\n array = string.split(\"\")\n p array\n x = array.length-1\n while x >= 0 do\n new_string += array[x]\n x-=1\n end\np new_string\nend",
"def reverse_string(s)\n left = 0\n right = s.length - 1\n while left < right\n s[left], s[right] = s[right], s[left]\n left += 1\n right -= 1\n end\n s\nend",
"def reverse_string(string)\n\treversed_string = ''\n\tcharacters = string.chars.to_a\n\tcharacters.length.times { reversed_string << characters.pop}\n\treversed_string\nend",
"def reverse(string)\n return \"\" if string.length == 0\n\n string[-1] + reverse(string[0...-1])\nend",
"def string_reverse(my_string, start_index, end_index)\n i = start_index\n j = end_index\n while i < j\n #flipflop characters using holding variable as a place to put one character while the other goes in its place.\n holding = my_string[i]\n my_string[i] = my_string[j]\n my_string[j] = holding\n\n #move up and move down the string.\n i += 1\n j -= 1\n end\n return my_string\nend",
"def reverse (string)\n # Your code here\nend",
"def reverse_s(string)\r\n puts string.reverse\r\nend",
"def string_reverse(my_string)\r\n return my_string if my_string.nil? || my_string == \"\"\r\n\r\n middle = my_string.length / 2\r\n i = 0\r\n j = my_string.length - 1\r\n\r\n while i < middle\r\n placeholder = my_string[i]\r\n my_string[i] = my_string[j]\r\n my_string[j] = placeholder\r\n i += 1\r\n j -= 1\r\n end\r\n return my_string\r\nend",
"def reverse_inplace(s)\n return s if s.length == 0\n return s if s.length == 1\n\n reverse_helper(s, 0, s.length - 1)\n return s\nend",
"def reverse_inplace(s)\n # Input validation\n return nil if s == nil\n return '' if s.length == 0 \n i = 0\n j = s.length-1\n reverse_helper(s, i, j)\n return s \nend",
"def reverse_inplace(s)\n return reverse_helper(s, 0 , s.length - 1) \nend",
"def reverse_inplace(s)\n return s if s.length <= 1\n return s[-1] + reverse(s[0...-1])\n end"
] | [
"0.80685633",
"0.798248",
"0.793213",
"0.78694314",
"0.7826339",
"0.7820272",
"0.77312744",
"0.77225614",
"0.77225614",
"0.77225614",
"0.771341",
"0.7688909",
"0.7663564",
"0.7663519",
"0.76568234",
"0.7647296",
"0.7639554",
"0.76348966",
"0.76328516",
"0.7617348",
"0.7590769",
"0.758209",
"0.75744516",
"0.75733894",
"0.7573175",
"0.7569327",
"0.7568787",
"0.75665396",
"0.7561501",
"0.75529456",
"0.75348604",
"0.75339746",
"0.75339746",
"0.752881",
"0.7526293",
"0.7508554",
"0.7506893",
"0.7506417",
"0.75037557",
"0.7497678",
"0.7494065",
"0.748799",
"0.7473257",
"0.7463902",
"0.746012",
"0.746012",
"0.7457964",
"0.7457608",
"0.7449681",
"0.7435625",
"0.74289984",
"0.74250245",
"0.74204123",
"0.74106187",
"0.7407514",
"0.7399786",
"0.73987806",
"0.7396543",
"0.73934686",
"0.738365",
"0.73793805",
"0.7377984",
"0.7374735",
"0.737371",
"0.7368897",
"0.7367587",
"0.73655087",
"0.7361918",
"0.73606825",
"0.73482984",
"0.73441416",
"0.7343225",
"0.7341668",
"0.73321205",
"0.73276407",
"0.73273546",
"0.73237526",
"0.7323535",
"0.7317768",
"0.73133385",
"0.73123324",
"0.73106927",
"0.7295462",
"0.7292009",
"0.72914493",
"0.7285575",
"0.72789675",
"0.72739977",
"0.7264283",
"0.72619075",
"0.72592074",
"0.7258861",
"0.72573364",
"0.72520924",
"0.7248933",
"0.72473705",
"0.7242547",
"0.7241993",
"0.7239012",
"0.72377974"
] | 0.7584498 | 21 |
Overrides the as_json function to include a type keyvalue. | def as_json(options)
super().merge!(type: "subject")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options=nil)\n json = super\n json.merge({\"type\"=>self.type.to_s})\n end",
"def as_json(options={})\n super(methods: :type)\n end",
"def as_json(options={})\n super(options.merge({:methods => :type}))\n end",
"def as_json(options={})\n super(options.merge({:methods => :type}))\n end",
"def as_json(options={})\n super(options.merge({:methods => :type}))\n end",
"def to_json(options = nil)\n serializable_hash(include: :_type, methods: :_type).to_json(options)\n end",
"def as_json(_options = {})\n super include: %i[sample_type object_type]\n end",
"def to_json(*a)\n result = {}\n self.type_mappings.keys.each { |key| result[key] = self.send(key).to_json }\n {\n 'json_class' => self.class.name,\n 'data' => result\n }.to_json(*a)\n end",
"def as_json(**options)\n value\n end",
"def as_json(*args)\n {\n :id => id,\n :type => type,\n :data => data\n }\n end",
"def as_json(*args)\n { EXTENDED_JSON_KEY => to_s }\n end",
"def apply_json_trait(value); end",
"def json_value(name, type)\n type, optional = check_type(type)\n\n if type == \"bytes\"\n #return \"NSData()/*TODO: Fixme*/\"\n end\n\n cast = json_cast(type, optional)\n value = if cast\n \"json[\\\"#{name}\\\"]#{cast}\"\n else\n \"#{type}.fromJSON(json[\\\"#{name}\\\"])\"\n end\n\n if @enums.include?(type)\n value = \"#{type}(rawValue: #{value})!\"\n end\n\n if type.kind_of?(Hash) && type[\"type\"] == \"array\"\n value = \"#{model_name(type[\"items\"])}.fromJSONArray(#{value})\"\n end\n\n value\nend",
"def as_json(_options = {})\n {:custom => to_hash}\n end",
"def as_json(_opts={})\n raise NotImplementedError\n end",
"def as_json\n value_as_json = case data_type\n when :set\n value.to_a\n when :boolean\n value == 'true'\n when :integer\n value.to_i\n else\n value\n end\n\n {\n 'key' => gate.key.to_s,\n 'name' => gate.name.to_s,\n 'value' => value_as_json,\n }\n end",
"def serializable_hash(options=nil)\n super.merge 'type' => type\n end",
"def serializable_hash(options=nil)\n super.merge 'type' => type\n end",
"def serializable_hash(options=nil)\n super.merge \"type\" => type\n end",
"def serializable_hash options=nil\n super.merge \"type\" => type\n end",
"def typecast_value_json(value)\n case value\n when JSONObject\n value\n when String\n if typecast_json_strings\n JSONString.new(value)\n else\n _wrap_json(_parse_json(value))\n end\n when *JSON_WRAP_CLASSES\n JSONDatabaseMethods.json_primitive_wrapper(value).new(value)\n when JSONBObject\n value = value.__getobj__\n JSONDatabaseMethods.json_primitive_wrapper(value).new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for json: #{value.inspect}\"\n end\n end",
"def as_json(value)\n check_for_circular_references(value) do\n value.as_json(options_for(value))\n end\n end",
"def as_json(*_args)\n as_extended_json\n end",
"def serialize(value)\n return super unless value.is_a?(Hash) || implements_model?(value.class)\n\n ActiveSupport::JSON.encode(value, serialize_unknown_attributes: true)\n end",
"def as_json(options={})\n super.merge({\n :fta_vehicle_type_id => self.fta_vehicle_type.present? ? self.fta_vehicle_type.to_s : nil\n })\n end",
"def to_json\n {\n :json_class => self.class.name,\n :display_name => self.display_name,\n :name => self.name,\n :types => self.types,\n :uuid => self.uuid\n }.to_json\n end",
"def as_json\n value_as_json =\n case data_type\n when :set\n value.to_a # json doesn't like sets\n else\n value\n end\n\n {\n 'key' => gate.key.to_s,\n 'name' => gate.name.to_s,\n 'value' => value_as_json,\n }\n end",
"def as_json(*args)\n to_hash.as_json(*args)\n end",
"def as_json(*)\n {\n JSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def type\n @json['type']\n end",
"def as_json(options = {})\r\n\t\tsuper\r\n\t\t {type: type,\r\n\t\t \t Title: Title,\r\n\t\t \t Authors: authors,\r\n\t\t \t With: with,\r\n\t\t \t Details: details,\r\n\t\t \t Year: year\r\n\t\t \t }\r\n\tend",
"def to_json(*args)\n {\n 'json_class' => self.class.name,\n 'data' => to_s\n }.to_json(*args)\n end",
"def to_json arg\n as_json.to_json\n end",
"def as_json(_opts = {})\n {}.tap do |root|\n root[TYPE_KEY] = type\n root[ID_KEY] = object_identifier\n root[ATTRIBUTES_KEY] = generate_attributes\n append_relationships(root)\n append_meta(root)\n append_includes(root)\n end\n end",
"def as_json(*args)\n {}.as_json\n end",
"def as_json(*args)\n to_h.as_json(*args)\n end",
"def as_json_type9\n as_json({\n only: [\n :id,\n :key,\n :name,\n :permit_tag_list,\n :name_input_at,\n ],\n include: {\n emotions: Actb::Emotion.json_type13,\n },\n methods: [\n :avatar_path,\n :rating,\n :skill_key,\n :description,\n :twitter_key,\n :actb_created_after_days,\n :session_lock_token,\n ],\n })\n end",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'a' => to_a,\n }\n end",
"def as_json(*)\n to_h\n end",
"def serializable_hash options=nil\n \t\tsuper.merge \"type\" => type\n\tend",
"def serializable_hash options=nil\n \t\tsuper.merge \"type\" => type\n\tend",
"def as_json(*)\n {\n FunJSON.create_id => self.class.name,\n 'b' => _dump,\n }\n end",
"def as_json options={}\n super options.merge(:methods=>[:type,:id,:digest])\n end",
"def as_json *args\n return hash.as_json(*args) if hash.respond_to? :as_json\n to_hash\n end",
"def as_json(options = {})\n as_decorated_json(options)\n end",
"def to_json(*options)\n as_json.to_json(*options)\n end",
"def as_json(*)\n klass = self.class.name\n klass.to_s.empty? and raise FunJSON::JSONError, \"Only named structs are supported!\"\n {\n FunJSON.create_id => klass,\n 'v' => values,\n }\n end",
"def as_json(*args)\n {}.update(self)\n end",
"def to_json *args\n as_json.to_json *args\n end",
"def as_extended_json(**options)\n subtype = @raw_type.each_byte.map { |c| c.to_s(16) }.join\n subtype = \"0#{subtype}\" if subtype.length == 1\n\n value = Base64.encode64(data).strip\n\n if options[:mode] == :legacy\n { '$binary' => value, '$type' => subtype }\n else\n { '$binary' => { 'base64' => value, 'subType' => subtype } }\n end\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json(*options)\n as_json(*options).to_json(*options)\n \tend",
"def to_json(*args)\n as_json.to_json(*args)\n end",
"def to_json(json_type: MANIFEST_TYPE_STORAGE)\n return to_json_fixity if json_type == MANIFEST_TYPE_FIXITY\n\n return to_json_ingest if json_type == MANIFEST_TYPE_INGEST\n\n to_json_storage\n end",
"def generate_json_from_value(value)\n if value.is_a? Hash\n %({ #{generate_json_from_hash value} })\n elsif value.is_a? Array\n %([ #{generate_json_from_array value} ])\n elsif value.respond_to?(:js_code) && value.js_code?\n value\n else\n value.to_json\n end\n end",
"def as_json(value, use_options = true)\n check_for_circular_references(value) do\n use_options ? value.as_json(options_for(value)) : value.as_json\n end\n end",
"def thrift_type_to_json_type(value, field)\n type = Thrift.type_name(field[:type])\n raise Thrift::TypeError.new(\"Type for #{field.inspect} not found.\") unless type\n type.sub!('Types::', '')\n result = value\n type = 'UNION' if type == 'STRUCT' && field[:class].ancestors.any?{|x| x == Thrift::Union}\n if type == 'STRUCT'\n result = thrift_struct_to_json_map(value, field[:class])\n # field[:class].const_get('FIELDS').each do |(_, struct_field)|\n # name = struct_field[:name]\n # val = value.send(name)\n # result[name] = thrift_type_to_json_type(val, struct_field) if val\n # end\n elsif type == 'LIST' || type == 'SET'\n result = value.map {|val| thrift_type_to_json_type val, field[:element]}\n elsif type == 'MAP'\n result = value.map do |key, val|\n [thrift_type_to_json_type(key, field[:key]), thrift_type_to_json_type(val, field[:value])]\n end\n elsif enum = field[:enum_class]\n result = enum.const_get('VALUE_MAP')[value] || value\n elsif type == 'UNION'\n result = thrift_union_to_json_map(value, field[:class])\n end\n result\n end",
"def as_json(options={})\n super.merge(\n {\n :fta_vehicle_type_id => self.fta_vehicle_type.present? ? self.fta_vehicle_type.to_s : nil,\n :seating_capacity => self.seating_capacity,\n :standing_capacity => self.standing_capacity,\n :wheelchair_capacity => self.wheelchair_capacity,\n :vehicle_length => self.vehicle_length,\n :vehicle_features => self.vehicle_features\n })\n end",
"def json_format_value(val)\n case val\n when Array\n val.map { |v| json_format_value(v) }\n when Hash\n val.reduce({}) { |h, (k, v)| h.merge({k => json_format_value(v)}) }\n when String\n val.encode!('UTF-8', {invalid: :replace, undef: :replace})\n when Time\n val.utc.iso8601\n else\n val\n end\n end",
"def json_format_value(val)\n case val\n when Array\n val.map { |v| json_format_value(v) }\n when Hash\n val.reduce({}) { |h, (k, v)| h.merge({k => json_format_value(v)}) }\n when String\n val.encode!('UTF-8', {invalid: :replace, undef: :replace})\n when Time\n val.utc.iso8601\n else\n val\n end\n end",
"def to_json(*args)\n as_json.to_json(*args)\n end",
"def to_json(*args)\n as_json.to_json(*args)\n end",
"def to_json(*args)\n as_json.to_json(*args)\n end",
"def to_json(*args)\n as_json.to_json(*args)\n end",
"def as_json_options(klass)\n {}\n end",
"def to_json(*options)\n\t\tas_json(*options).to_json(*options)\n\tend",
"def as_json(_options = {})\n {:http_response => to_hash}\n end",
"def to_json(*)\n to_hash.to_json\n end",
"def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end",
"def as_json(_options = {})\n {\n resource_owner_id: resource_owner_id,\n scope: scopes,\n expires_in: expires_in_seconds,\n application: { uid: application.try(:uid) },\n created_at: created_at.to_i,\n }.tap do |json|\n if Doorkeeper.configuration.polymorphic_resource_owner?\n json[:resource_owner_type] = resource_owner_type\n end\n end\n end",
"def as_json(options={})\n super.merge(\n {\n :title_number => self.title_number,\n :title_owner_organization_id => self.title_owner.present? ? self.title_owner.to_s : nil,\n :expected_useful_miles => self.expected_useful_miles,\n :rebuild_year => self.rebuild_year,\n :vehicle_storage_method_type_id => self.vehicle_storage_method_type.present? ? self.vehicle_storage_method_type.to_s : nil,\n :fuel_type_id => self.fuel_type.present? ? self.fuel_type.to_s : nil\n })\n end",
"def as_json(options = nil)\n json_data = {}\n json_data[\"pickup\"] = self.pickup.as_json if self.pickup\n json_data[\"dropoff\"] = self.dropoff.as_json if self.dropoff\n json_data[\"load\"] = self.load if self.load\n json_data[\"type\"] = self.type if self.type\n json_data\n end",
"def as_json(options={})\n super.merge(\n {\n :facility_capacity => self.facility_capacity_type.present? ? self.facility_capacity_type.to_s : nil\n })\n end",
"def as_json(_options = {})\n {:http_client_request => to_hash}\n end",
"def as_json(options={})\n options[:include] = {\n :organisation => {},\n :locations => { \n methods: :geometry,\n include: :accessibilities\n },\n :taxonomies => { methods: :slug },\n :meta => {},\n :contacts => {},\n :local_offer => {},\n :send_needs => {},\n :suitabilities => {},\n :cost_options => {},\n :regular_schedules => {},\n :links => {}\n }\n super\n end",
"def as_json(options = {})\n options ||= {}\n options[:except] = [:id, :age_group_type_id, :created_at, :updated_at, :wheel_size_id]\n options[:methods] = [:wheel_size_name]\n super(options)\n end",
"def json_serialize\n end",
"def to_json(*args)\n to_hash.to_json\n end",
"def as_json(_options = nil)\n to_h\n end",
"def to_json(**opts)\n JSON.generate as_json, **opts\n end",
"def to_json(_context = nil)\n to_h.to_json\n end",
"def to_json(val = nil)\n self.to_hash.to_json\n end",
"def to_json\n hash = to_h\n\n hash.each do |k, v|\n hash[k] = self.class.convert(v, k, :to_json)\n end\n\n Oj.dump(hash, omit_nil: true)\n end",
"def as_json(*args)\n super.merge({\n \"id\" => self.obj_key,\n \"obj_key\" => self.obj_key,\n \"link_path\" => self.public_path,\n \"to_title\" => self.to_title,\n \"edit_path\" => self.admin_edit_path\n }).merge(self.json.stringify_keys!)\n end",
"def json(obj)\n content_type :json\n obj.to_json\n end",
"def as_json(options={})\n super.merge(\n {\n :reported_mileage => self.reported_mileage,\n :last_maintenance_date => self.last_maintenance_date,\n :license_plate => self.license_plate,\n :serial_number => self.serial_number,\n :gross_vehicle_weight => self.gross_vehicle_weight,\n :vehicle_usage_codes => self.vehicle_usage_codes,\n :vehicle_rebuild_type_id => self.vehicle_rebuild_type.present? ? self.vehicle_rebuild_type.to_s : nil\n })\n end",
"def as_json(options = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n serialize_unknown_attributes = if options.key?(:serialize_unknown_attributes)\n options[:serialize_unknown_attributes]\n else\n StoreModel.config.serialize_unknown_attributes\n end\n\n serialize_enums_using_as_json = if options.key?(:serialize_enums_using_as_json)\n options[:serialize_enums_using_as_json]\n else\n StoreModel.config.serialize_enums_using_as_json\n end\n\n result = @attributes.keys.each_with_object({}) do |key, values|\n values[key] = serialized_attribute(key)\n end.with_indifferent_access\n\n result.merge!(unknown_attributes) if serialize_unknown_attributes\n result.as_json(options).tap do |json|\n serialize_enums!(json) if serialize_enums_using_as_json\n end\n end",
"def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end",
"def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end",
"def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end",
"def as_json(options={})\n #options[:include] = []\n options[:except] = EXCLUDED_JSON_ATTRIBUTES\n\n super(options)\n end",
"def as_json(options=nil)\n super(include: [:size, :packs, :stocks])\n end",
"def to_json(*args); end",
"def encoded_value\n case value_type\n when \"Array\", \"Hash\" then value.to_json\n when \"Boolean\" then value.to_s == \"true\" ? \"true\" : \"false\"\n else value.to_s\n end\n end",
"def as_json(opts={})\n super(opts.merge(:include => :places))\n end",
"def as_json(options={})\n options[:except] ||= EXCLUDED_JSON_ATTRIBUTES\n #options[:include] ||= []\n #options[:methods] = []\n #options[:methods] << :profile_image\n json = super(options)\n Hash[*json.map{|k, v| [k, v || \"\"]}.flatten]\n end",
"def to_json(*options)\n to_hash.to_json(*options)\n end",
"def to_json\r\n to_hash.to_json\r\n end",
"def json_format_value(val)\n case val\n when Array\n val.map { |v| json_format_value(v) }\n when Hash\n val.reduce({}) { |h, (k, v)| h.merge({k => json_format_value(v)}) }\n when BigDecimal\n # val.to_s('F')\n val.to_f\n when String\n val.encode!('UTF-8', {invalid: :replace, undef: :replace})\n when Time\n val.utc.iso8601\n else\n val\n end\n end"
] | [
"0.8155591",
"0.7754095",
"0.7529929",
"0.7529929",
"0.7529929",
"0.7407277",
"0.71669644",
"0.70282674",
"0.69277054",
"0.6874024",
"0.68116117",
"0.680964",
"0.67633367",
"0.6738264",
"0.6573845",
"0.65496486",
"0.6534308",
"0.6534308",
"0.6530293",
"0.6512795",
"0.6496342",
"0.6483787",
"0.6397349",
"0.63847095",
"0.63712823",
"0.6328913",
"0.6324072",
"0.63228744",
"0.6318004",
"0.6301502",
"0.62966067",
"0.6293615",
"0.629051",
"0.6270143",
"0.62602603",
"0.6257254",
"0.6253751",
"0.6246265",
"0.6225784",
"0.62193954",
"0.62193954",
"0.62042737",
"0.61779237",
"0.6154476",
"0.61487997",
"0.6144261",
"0.6132215",
"0.6100956",
"0.6079691",
"0.60714525",
"0.6064415",
"0.6064415",
"0.6061299",
"0.60502577",
"0.6028305",
"0.60218257",
"0.60172987",
"0.6009888",
"0.60093045",
"0.6007434",
"0.6007434",
"0.5987709",
"0.5987709",
"0.5987709",
"0.5987709",
"0.5971729",
"0.5960918",
"0.59527016",
"0.5926631",
"0.59224707",
"0.59154034",
"0.5912312",
"0.59086347",
"0.5897704",
"0.58928597",
"0.58881927",
"0.58828914",
"0.58667743",
"0.58656365",
"0.5861318",
"0.5855909",
"0.58459026",
"0.58398324",
"0.5838744",
"0.5830958",
"0.5818646",
"0.58154553",
"0.5802504",
"0.5801404",
"0.5801179",
"0.5801179",
"0.5801179",
"0.57984465",
"0.57947814",
"0.5789319",
"0.57879466",
"0.5786254",
"0.57814103",
"0.5776584",
"0.57740927"
] | 0.59730107 | 65 |
1.0 , add a list of namespaces to the node the namespaces formal parameter is a hash with "prefix" and "prefix_uri" as key, value pairs prefix for the default namespace is "default" | def add_namespaces( node, namespaces )
#pass nil as the prefix to create a default node
default = namespaces.delete( "default" )
node.namespaces.namespace = XML::Namespace.new( node, nil, default )
namespaces.each do |prefix, prefix_uri|
XML::Namespace.new( node, prefix, prefix_uri )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_namespaces node\n raw.root.namespace_definitions.each do |ns|\n node.add_namespace_definition ns.prefix, ns.href if ns.href != NS\n end\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def register_namespace(name_and_href)\n (@default_namespaces ||= []) <<name_and_href\n end",
"def register_namespaces(namespaces); end",
"def register_namespaces(namespaces); end",
"def add_namespace(ns, prefix = \"unknown#{rand 65536}\")\n return nil if ns.nil? || ns.empty?\n unless namespaces.key? ns\n namespaces[ns] = prefix\n return prefix\n end\n end",
"def get_namespace(node, prefix); end",
"def default_namespace(url)\n @namespaces[''] = url\n end",
"def sfa_add_namespace(prefix, urn)\n @@sfa_namespaces[prefix] = urn\n end",
"def namespace=(value)\n self.namespaces = [value]\n end",
"def prefix_for(ns_href)\n namespaces[ns_href] || add_namespace(ns_href)\n end",
"def register_default_namespace(name)\n self.namespaces.each do |n|\n if n.prefix == nil\n register_namespace(\"#{name}:#{n.href}\")\n return\n end\n end\n raise \"No default namespace found\"\n end",
"def xml_namespace(node, name, uri, namespaces = {})\n XML::Namespace.new(node, name, uri)\n end",
"def namespace=(ns); end",
"def namespace=(ns); end",
"def add_namespace(namespace) \n @namespaces[namespace.name] = namespace\n end",
"def add_namespaces_and_attributes_to_node(attrs, node) \n (attrs.size / 2).times do |i|\n name, value = attrs[2 * i], attrs[2 * i + 1]\n if name =~ /xmlns/\n node.add_namespace(name, value)\n else\n node.set_attribute name, value\n end\n end\n end",
"def namespaces\n ns = {}\n ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'}\n ns[:content] = {key:'ns1', value: 'http://tempuri.org/'}\n ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'}\n ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'}\n ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'}\n ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'}\n ns\n end",
"def node_namespace name:\n label = make_label name\n attrs = { name: name }\n\n add_node :Namespace, label, attrs\n end",
"def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end",
"def namespaces\n root ? root.namespaces : {}\n end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def start_element_namespace(name, attrs = T.unsafe(nil), prefix = T.unsafe(nil), uri = T.unsafe(nil), ns = T.unsafe(nil)); end",
"def namespaces; end",
"def namespaces; end",
"def namespaces; end",
"def namespaces; end",
"def set_namespace(ns = '')\n settings['namespace'] = ns\n end",
"def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend",
"def add_namespace(source_ns_key, output_namespace, *args, &block)\n # raise 'expected arg1 not be empty string or an integer' if source_ns_key.empty? || source_ns_key.is_a?(Integer)\n # raise 'expected arg2 not be empty string or an integer' if output_namespace.empty? || output_namespace.is_a?(Integer)\n # raise 'expected arg3 not be empty' if args.empty?\n\n map = Map.new((source_ns + [source_ns_key]).join('.'),\n output_namespace,\n nil,\n :add_namespace)\n map.properties = args\n @mappings[map.container_key] = map\n\n map = self.class.new((source_ns + [source_ns_key]),\n output_namespace.to_s.split('.'),\n :add_namespace,\n args)\n\n map.instance_exec(&block) if block_given?\n @mappings.merge!(map.mappings)\n end",
"def register_namespaces_with_builder(builder)\n return unless self.class.instance_variable_get(:@registered_namespaces)\n\n self.class.instance_variable_get(:@registered_namespaces).sort.each do |name, href|\n name = nil if name == \"xmlns\"\n builder.doc.root.add_namespace(name, href)\n end\n end",
"def register_default_namespace(name)\n self.namespace.each do |n|\n if n.to_s == nil\n register_namespace(\"#{name}:#{n.href}\")\n return\n end\n end\n raise \"No default namespace found\"\n end",
"def namespace(ns)\n ns.blank? ? \"nil\" : %|\"#{ns.prefix}\"|\nend",
"def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end",
"def set_default_namespace(value = nil, &block)\n define_attr_method :default_namespace, value, &block\n end",
"def default_namespace=(url); end",
"def default_namespace=(url); end",
"def setNamespace(prefix, uri) \n @obj.setNamespace(prefix, uri)\n end",
"def namespace_prefix(target_node, namespace, desired_prefix = nil)\n ns = target_node.namespaces.key(namespace)\n if ns\n ns.match(/(?:xmlns:)?(.*)/) && Regexp.last_match(1)\n elsif desired_prefix\n target_node.add_namespace_definition(desired_prefix, namespace)\n desired_prefix\n end\n end",
"def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end",
"def default_prefix=(prefix)\r\n # Find default prefix\r\n ns = find_by_prefix(nil)\r\n raise(ArgumentError, \"No default namespace was found\") unless ns\r\n Namespace.new(self.node, prefix, ns.href)\r\n end",
"def namespace(name = nil, url = nil)\n @namespaces[name.to_s] = url\n end",
"def namespace(options={}, &block)\n model = Caracal::Core::Models::NamespaceModel.new(options, &block)\n if model.valid?\n ns = register_namespace(model)\n else\n raise Caracal::Errors::InvalidModelError, 'namespace must specify the :prefix and :href attributes.'\n end\n ns\n end",
"def namespaces\n ns = {}\n\n JSON.parse(raw_namespaces)[\"results\"][\"bindings\"].each {|x|\n ns[x[\"prefix\"][\"value\"]] = x[\"namespace\"][\"value\"]\n }\n ns\n end",
"def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end",
"def namespace(value = nil)\n if value\n @namespace = value\n else\n @namespace\n end\n end",
"def namespaces=(hash = {})\n hash = {} unless hash.is_a? Hash\n\n @namespaces ||= {}\n @namespaces.merge!(hash)\n end",
"def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n 'owl' => RDF::Vocab::OWL.to_uri.to_s,\n 'foaf' => RDF::Vocab::FOAF.to_uri.to_s,\n 'sioc' => RDF::Vocab::SIOC.to_uri.to_s\n }\n end",
"def namespace(name, href)\n @resource.add_namespace(name, href)\n end",
"def register_namespace(name, href)\n @registered_namespaces.merge!(name => href)\n end",
"def default_namespace=(url)\n add_namespace_definition(nil, url)\n end",
"def namespace=(ns) @namespace = @store.namespace = ns; end",
"def namespace_hash\n opt = {}\n namespaces.each do |type, attrs|\n key = \"xmlns:#{attrs[:key]}\"\n opt[key] = attrs[:value]\n end\n opt\n end",
"def namespace=(value)\n @namespace = value\n end",
"def namespace=(value)\n @namespace = value\n end",
"def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }\n send(:define_method, :namespaces) { self.class.namespaces }\n end\n end",
"def namespace(value)\n merge(namespace: value.to_s)\n end",
"def namespaces_by_uri\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.href]=ns; m })\n end",
"def namespace(prefix = T.unsafe(nil)); end",
"def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end",
"def find_or_new_namespace(name, uri)\n namespace = @namespaces.find { |n| n.namespace == name } || (@namespaces << Restfulie::Common::Builder::Rules::Namespace.new(name, uri)).last\n namespace.uri = uri unless uri.nil?\n namespace\n end",
"def test_namespace\n N::Namespace.shortcut(:test_namespace, \"http://test_namespace/\")\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/\").namespace)\n assert_equal(:test_namespace, N::URI.new(\"http://test_namespace/else\").namespace)\n assert_equal(nil, N::URI.new(\"http://test_namespace/else/other\").namespace)\n end",
"def namespaces\n root ? root.collect_namespaces : {}\n end",
"def start_element_namespace(name, attrs_ary = [], prefix = nil, uri = nil, ns = [])\n @text = nil\n node = Node.new(uri, name, attrs_ary.inject({}) { |hsh, a| hsh[a.localname] = a.value; hsh }, '')\n path << node\n\n # call delegate\n delegate.start_element(path, self, node) if delegate.respond_to?(:start_element)\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def ns(*words)\n jn(@namespace, words)\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end",
"def namespace(path, options = T.unsafe(nil)); end",
"def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end",
"def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end",
"def add_ns2_prefix(content)\n %w{ actuate arcrole entityref from href id linktype parent role show target title to xpointer }.each do | xa |\n content.gsub!(/ #{xa}=/) {|match| \" ns2:#{match.strip}\"} if content =~ / #{xa}=/\n end\n content\n end",
"def node_ns_definition(node, ns)\n prefix = ns.is_a?(Nokogiri::XML::Namespace) ? ns.prefix : ns\n node.namespace_definitions.find { |n| n.prefix == prefix }\n end",
"def declare_namespaces\n foaf = Namespace.new(\"http://xmlns.com/foaf/0.1/\", \"foaf\")\n rdf = Namespace.new(\"http://www.w3.org/1999/02/22-rdf-syntax-ns\", \"rdf\", true)\n rdfs = Namespace.new(\"http://www.w3.org/2000/01/rdf-schema\", 'rdfs', true)\n xsd = Namespace.new('http://www.w3.org/2001/XMLSchema', 'xsd', true)\n owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true)\n end",
"def namespace=(v); end",
"def namespaces\n @opts[:namespace]\n end",
"def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\nend",
"def namespace(name, create_empty = true)\n namespaces[name] = Namespace.new(self, name) if not(namespaces.has_key?(name)) and create_empty\n namespaces[name]\n end",
"def xml_ns\r\n { \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\r\n \"rss\" => \"http://purl.org/rss/1.0/\",\r\n \"prism\"=>\"http://prismstandard.org/namespaces/1.2/basic/\",\r\n \"dc\"=>\"http://purl.org/dc/elements/1.1/\",\r\n \"mn\"=>\"http://usefulinc.com/rss/manifest/\",\r\n \"content\"=>\"http://purl.org/rss/1.0/modules/content/\"\r\n }\r\n end",
"def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def update!(**args)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def namespace(namespace = nil, options = {})\n return @namespace unless namespace\n\n @namespace = namespace.to_sym if namespace\n @base_namespace = options[:base].to_sym if options[:base]\n end",
"def namespace_declarations(ctx); end",
"def namespace_declarations(ctx); end",
"def namespaces=(raw_namespaces)\n @namespaces = NamespaceSet.new(raw_namespaces)\n end",
"def namespaces(name = nil)\n if name\n namespaces.find(:name => name)\n else\n @namespaces.flatten\n end\n end",
"def namespace(namespace = nil)\n @namespace = namespace if namespace\n @namespace\n end",
"def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end",
"def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end",
"def get_namespaces\n raise NotImplementedError\n end",
"def add_namespaces_and_attributes_to_current_node(attrs) \n # Namespaces\n attrs.select {|k| k.is_a? Array}.each do |pair|\n set_namespace(pair[0], pair[1])\n # set_normal_attribute(pair[0], pair[1])\n end\n # Attributes\n attrs.select {|k| k.is_a? String}.in_groups_of(2) do |pair|\n set_normal_attribute(pair[0], pair[1])\n end\n end",
"def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end",
"def _sfa_add_ns(name, opts = {})\n if prefix = opts[:namespace]\n unless @@sfa_namespaces[prefix]\n raise \"Unknown namespace '#{prefix}'\"\n end\n name = \"#{prefix}:#{name}\"\n end\n name\n end",
"def set_namespace\n @namespace = Namespace.find(params[:namespace_id])\n end"
] | [
"0.8027203",
"0.75288486",
"0.75288486",
"0.72623944",
"0.72623944",
"0.7260259",
"0.72384226",
"0.70586175",
"0.6968521",
"0.69241494",
"0.69057626",
"0.681566",
"0.67876494",
"0.67321074",
"0.67321074",
"0.6718111",
"0.6698467",
"0.66770726",
"0.6654058",
"0.6616366",
"0.658141",
"0.65758795",
"0.65758795",
"0.6574447",
"0.6574447",
"0.6574447",
"0.6574447",
"0.6569309",
"0.6560205",
"0.65276307",
"0.6526482",
"0.6519471",
"0.65022075",
"0.64922684",
"0.64922106",
"0.64889544",
"0.64889544",
"0.6488743",
"0.6483498",
"0.6481696",
"0.64577234",
"0.6446909",
"0.6420758",
"0.64184004",
"0.63946086",
"0.6380774",
"0.6370131",
"0.6345809",
"0.6341839",
"0.63328093",
"0.63030565",
"0.6293132",
"0.6289507",
"0.6273864",
"0.6273864",
"0.626711",
"0.6264132",
"0.6250202",
"0.6246031",
"0.6242422",
"0.6208791",
"0.6206434",
"0.6186112",
"0.6180764",
"0.61787623",
"0.617834",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61773646",
"0.61758196",
"0.61740667",
"0.61740667",
"0.6168436",
"0.61524075",
"0.61448956",
"0.6132064",
"0.6107046",
"0.6099579",
"0.60838455",
"0.60832596",
"0.60814416",
"0.60814416",
"0.60801756",
"0.60765207",
"0.60765207",
"0.60417694",
"0.60131854",
"0.60043496",
"0.59828764",
"0.59828764",
"0.5977862",
"0.59708154",
"0.59658253",
"0.5961753",
"0.5960008"
] | 0.84406596 | 0 |
add a list of attributes to the node the attributes formal parameter is a hash with "name" and "value" as key, value pairs | def add_propertys( node, attributes )
attributes.each do |name, value|
XML::Attr.new( node, name, value )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_attributes(node, attributes)\n attributes.each do |attribute|\n node.attributes[attribute[0]] = attribute[1]\n end\n\n node\n end",
"def add_attributes(attributes)\n Attributes.parse(attributes) { | n, v | add_attribute(n, v) }\n end",
"def add_attribute(name, &block); end",
"def transfer_node_attributes(nodes, attributes); end",
"def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end",
"def transfer_node_attributes(nodes, attributes)\n nodes.each do |child|\n # update all attributes\n merge_attributes(child, attributes)\n\n # set attributes specific to list items\n if @definition\n child['pStyle'] = @definition.style\n child['numId'] = @definition.numid\n end\n child['ilvl'] = child.ancestors(\".//#{@list_tag}\").length - 1\n end\n end",
"def add_node_attribute(key, value, options)\n @node_attributes << { key: key, value: value, options: options }\n end",
"def insert_attribute m\n @attributes.add m\n end",
"def add_attributes(attributes = [])\n attributes.each{ |attribute| attribute.is_a?(Array) ? add_attribute(attribute[0], attribute[1], attribute[2]) : add_attribute(attribute)}\n end",
"def add_attrs! attrs\n raise \"InvalidAttributesFormat\" unless attrs.is_a?(Hash)\n self.attributes.merge!attrs\n end",
"def add_attributes(attr_hash)\n return unless attr_hash\n attr_hash.each_pair{ |k,v| self.add_attribute(k, v) }\n end",
"def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end",
"def add_attributes(out, attrs, well_known_map)\n if attrs.include?(:name)\n wk = well_known_map[attrs[:name]]\n raise RuntimeError, \"unknown name: #{attrs[:name]}\" unless wk\n attrs = attrs.merge(wk)\n end\n attrs.each {|attr, val| out << ' %s=\"%s\"' % [attr, val] if attr.is_a?(String)}\nend",
"def attribute(opts)\n raise ArgumentError unless opts.is_a?(Hash)\n @attributes << Attribute.new(opts)\n end",
"def attribute_list(el); end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each do |attr, value| #from the hash get each attribute and value\n self.send(\"#{attr}=\", value) #send the studen tthe new attribute/value key pair\n end #end the each-do\n self #call self\n end",
"def attributes\n @attributes = Hash[attrs.map { |a| [a.to_sym, send(\"#{a}\")] }]\n end",
"def add_attributes(record, attrs)\n if attrs.is_a?(Array)\n attrs.each { |attr| self.add_attribute(record, attr) }\n elsif attrs.is_a?(Hash)\n attrs.each do |attr_name, value|\n self.add_attribute(record, attr_name, value)\n end\n else\n self.add_attribute(record, attrs)\n end\n end",
"def add_attrs(h)\n @app.log << \"add_attrs #{h.inspect[1..-2]}\"\n @app.add_attrs(h)\nend",
"def add_namespaces_and_attributes_to_current_node(attrs) \n # Namespaces\n attrs.select {|k| k.is_a? Array}.each do |pair|\n set_namespace(pair[0], pair[1])\n # set_normal_attribute(pair[0], pair[1])\n end\n # Attributes\n attrs.select {|k| k.is_a? String}.in_groups_of(2) do |pair|\n set_normal_attribute(pair[0], pair[1])\n end\n end",
"def + (name, value = nil, &block) add_attribute name, value, &block end",
"def appendAttr(k,v)\n\t\told = @attributes[k]\n\t\tif old && @multiple.include?(k)\n\t\t\tv = \"#{old} #{v}\"\n\t\tend\n\t\t@attributes[k] = v\n\t\tself\n\tend",
"def assign_tag_attrs(attributes)\n # support default data, class, and aria attribute names\n data_attr(attributes.delete(:data)) if attributes[:data]\n aria_attr(attributes.delete(:aria)) if attributes[:aria]\n add_class(*attributes.delete(:class)) if attributes[:class]\n root_attr(attributes.delete(:splat)) if attributes[:splat]\n end",
"def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end",
"def emit(attributes, node)\n attributes.each do |k,v|\n child_node = REXML::Element.new(k.to_s, node)\n (v.respond_to? 'each_key') ? emit(v, child_node) : child_node.add_text(v.to_s)\n end\n end",
"def enumerate_attrs\n @node_attrs.keys.each_with_object({}) { |node, h|\n h[node] = enumerate_attrs_by_node(node)\n }\n end",
"def lively_attributes(*args)\n self._active_attributes += args.collect(&:to_s)\n end",
"def update_attributes(attrs)\n difference = attrs.keys - ASSIGNABLE\n if difference.empty?\n attributes.merge!(attrs)\n else\n raise \"unexpected attributes #{difference} for #{@node.path}\"\n end\n end",
"def add_attr attr_name\n return false if (attrs.nil? || attrs.include?(attr_name))\n attrs << attr_name\n items.each do |item| \n item[:data] << nil\n item[:ori_data] << nil if item.has_key?(:ori_data)\n end\n true\n end",
"def serialize_attributes(graph, set_uri, feature_uri, attributes)\n attributes.each_pair { |tag, list|\n if tag == 'Parent' then\n list.each { |parent_id|\n graph.insert(RDF::Statement.new(feature_uri, @base.parent, RDF::URI.new(\"#{set_uri.to_s}/feature/#{parent_id}\")))\n }\n else\n list.each_index { |index|\n value = list[index]\n attribute_uri = RDF::URI.new(\"#{feature_uri.to_s}/attribute/#{tag}\") if list.size == 1\n attribute_uri = RDF::URI.new(\"#{feature_uri.to_s}/attribute/#{tag}-#{index + 1}\") unless list.size == 1\n graph.insert(RDF::Statement.new(feature_uri, @base.attributes, attribute_uri))\n graph.insert(RDF::Statement.new(attribute_uri, RDF.type, @base.Attribute))\n graph.insert(RDF::Statement.new(attribute_uri, @base.tag, RDF::Literal.new(\"#{tag}\")))\n graph.insert(RDF::Statement.new(attribute_uri, RDF.value, RDF::Literal.new(value)))\n }\n end\n }\n end",
"def xmlAttr\r\n a = Array.new\r\n a << ['id', id]\r\n a << ['isVisible', @visible]\r\n a << ['labelText', @labelText]\r\n a << ['labelTextColor', @labelTextColor]\r\n a << ['x', @position != nil ? @position.x : nil]\r\n a << ['y', @position != nil ? @position.y : nil]\r\n a << ['a', @alpha]\r\n end",
"def enumerate_attrs\n @node_attrs.keys.each_with_object({}) do |node, h|\n h[node] = enumerate_attrs_by_node(node)\n end\n end",
"def attributes(*args)\n args.each { |attr| attribute(attr) }\n end",
"def add_attrs\n yield self\n end",
"def attributes(attributes)\n @attributes = attributes.to_a.map do |k, v|\n { :name => k,\n :type => v,\n :length => Tem::Abi.send(:\"#{v}_length\") \n }\n end\n end",
"def update_attributes(attribs = {})\n attribs.each { |name, value| write_attribute(name, value) }\n end",
"def add_student_attributes(attributes_hash)\n # Iterate over the given hash and use meta-programming to\n # dynamically assign student attr per the key/value pairs\n \n attributes_hash.each { |key, value| self.send((\"#{key.to_s}=\"), value)}\n \n end",
"def attributes=(args = {})\n ATTRS.each do |attr_name|\n if args.has_key?(attr_name)\n self.send(:\"#{attr_name}=\", args[attr_name])\n elsif args.has_key?(attr_name.to_s)\n self.send(:\"#{attr_name}=\", args[attr_name.to_s])\n end\n end\n end",
"def each\n attribute_nodes.each { |node|\n yield [node.node_name, node.value]\n }\n end",
"def attributes\n attrs = Hash.new\n attribute_list.each do |attribute|\n value = self.send(attribute)\n attrs[attribute] = value unless value.nil?\n end\n attrs\n end",
"def attributes(*names)\n names.each { |n| attribute n }\n @attributes + @qualified_attributes.keys\n end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each {|key,value| self.send((\"#{key}=\"),value)}\n end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n end",
"def append_attribute(key_, value_)\n attribute(key_, value_, :append)\n end",
"def attributes(value)\n @attributes = value\n self\n end",
"def initialize attributes = {}\n @attributes = {}\n attributes.each { |attribute, value| set attribute, value }\n end",
"def attributes=(new_attributes)\n acceptable_attributes = [:ID, :Name, :Note, :Alias, :Parent]\n @attributes = if new_attributes.is_a?(Hash)\n # Symbolify the keys in the hash\n symbolized_attributes = Hash[new_attributes.map { |(attribute, value)| [attribute.to_sym, value] }]\n \n # Pull out the acceptable attributes\n detected_attributes = {}\n acceptable_attributes.each do |attribute|\n detected_attributes[attribute] = symbolized_attributes[attribute] if symbolized_attributes[attribute]\n end\n \n detected_attributes\n else\n Feature.parse_attributes(new_attributes, only: acceptable_attributes)\n end\n end",
"def attributes(*attrs)\n if attrs.size > 0\n attrs.each{|attr| attribute attr}\n end\n @attributes ||= []\n end",
"def attributes(*args)\n args.each do |attr|\n attribute(attr)\n end\n end",
"def add_attr(name, value)\n attr_name = ActiveSupport::Inflector.underscore(name).to_sym\n\n if @attrs.key?(attr_name)\n if @attrs[attr_name].is_a?(Array)\n # An existing array value means just push the new value onto\n # the array.\n @attrs[attr_name].push(value)\n else\n # An existing, non-array value means we must convert the existing\n # value into an array and then push the new value onto it.\n existing_scalar_value = @attrs[attr_name]\n @attrs[attr_name] = [existing_scalar_value, value]\n end\n else\n # If no existing value, then just set the value.\n @attrs[attr_name] = value\n end\n end",
"def xmlAttr()\r\n a = super()\r\n a << ['width', @width]\r\n a << ['height', @height]\r\n a << ['depth', @depth]\r\n @fillColor.xmlAttr.each { |ac|\r\n a << ac\r\n }\r\n a\r\n end",
"def add_attribute(attrib_str)\n kv = attrib_str.split(\"=\")\n if kv.length != 2\n puts \"Invalid attribute format: #{attrib_str} Must be <key>=<value>\"\n exit 1\n end\n\n @args[:attributes] ||= {}\n @args[:attributes][kv[0]] = kv[1]\n end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each do |k, v|\n self.send((\"#{k}=\"), v)\n end\n end",
"def add_child_node_and_reparent_attrs(node); end",
"def add_child_node_and_reparent_attrs(node); end",
"def attributes(hash)\n hash.keys.inject(\"\") { |attrs, key| attrs + %{#{key}=\"#{hash[key]}\" } }\n end",
"def attributes=(attributes)\n @attributes = {}\n\n attributes.each do |key, value|\n writer = :\"#{key}=\"\n\n if respond_to?(writer)\n send(writer, value)\n end\n end\n end",
"def add_student_attributes(attributes_hash)\n attributes_hash.each {|key, value| self.send((\"#{key}=\"), value)\n }\n end",
"def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend",
"def add_namespaces_and_attributes_to_node(attrs, node) \n (attrs.size / 2).times do |i|\n name, value = attrs[2 * i], attrs[2 * i + 1]\n if name =~ /xmlns/\n node.add_namespace(name, value)\n else\n node.set_attribute name, value\n end\n end\n end",
"def attributes(options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes if @attributes\n\t\t\t@attributes = {}\n\t\t\[email protected] do |value|\n\t\t\t\t@attributes[value[:name]] = value.evaluate(@node, :attrs => true)\n\t\t\t\t@attributes[value[:name]].strip! if options[:strip]\n\t\t\t\t@attributes[value[:name]] = nil if @attributes[value[:name]].blank? && options[:null_if_blank]\n\t\t\tend\n\t\t\t@attributes\n\t\tend",
"def addCustomAttrib(doc, name, value, datatype=\"string\")\r\n\tputs \"adding custom-attribute #{name}\"\r\n\tnode = Nokogiri::XML::Node.new \"custom-attribute\", doc\r\n\tnode[\"name\"] = name\t\r\n\tnode[\"dt:dt\"] = datatype\r\n\tif value.kind_of?(Array)\r\n\t\tvalue.each do |val|\r\n\t\t\tnode << \"<value>#{val}</value>\"\r\n\t\tend\r\n\telse\r\n\t\tnode.content = value\r\n\tend\r\n\treturn node\r\nend",
"def set_attributes(attrs = {})\n attrs.each do |key, value|\n set_attribute(key, value)\n end\n end",
"def _insert_attributes(attrs, order=[])\n #log!(:ins_attr, attrs)\n return if attrs.nil?\n order.each do |k|\n v = attrs[k]\n #log!(:seta, k, v)\n @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} if v\n end\n attrs.each do |k, v|\n #log!(:setb, k, v)\n @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} unless order.member?(k) # \" WART\n #log!(:setb_targ, @target, _attr_value(v))\n end\n end",
"def ul_attrs(node)\n { anchor: node[\"id\"],\n empty: node[\"nobullet\"],\n spacing: node[\"spacing\"] }\n end",
"def attributes=(params)\n end",
"def update_attributes(atts)\n atts.each { |att, val| send(:\"#{att}=\", val) }\n end",
"def add_attributes(xml_translation, df_data, ng_element)\n xml_translation['attrs']&.each do |attr_key, attr_val|\n next unless render?(attr_val['render_if'], df_data)\n\n val = generate_field_val(attr_val, df_data)\n val = val.strip if val.respond_to?(:strip)\n\n next if val.blank?\n\n if attr_key.start_with?('xmlns')\n # Do not treat xmlns attribute additions like other attribute additions. Add namespace definition instead.\n ng_element.add_namespace_definition(attr_key.gsub(/^xmlns:/, ''), val)\n else\n processed_val = value_with_substitutions(val, df_data)\n ng_element.set_attribute(attr_key, processed_val) if processed_val.present?\n end\n end\n end",
"def json_attributes\n attributes.merge(\n node_from_id: from_character_id, \n node_to_id: to_character_id,\n strengh: force.abs,\n label: title)\n end",
"def write_extended_attributes(attrs)\n attrs.each do |k, val|\n self.send((k.to_s + \"=\").to_sym, val) if is_flex_attribute?(k)\n end\n self\n end",
"def attribute=(name, value)\n @attributes ||= {}\n @attributes[name] = value\n end",
"def attributes\n @attributes ||= attribute_names.inject({}) do |hash, name|\n attribute_values = saml.xpath(\"//saml:Attribute[@Name='#{name}']/saml:AttributeValue/text()\")\n hash[name] = attribute_values.length > 1 ? attribute_values.collect(&:to_s) : attribute_values.to_s\n hash\n end\n end",
"def add_attribute!(ndx_attributes, array_form_path_x, val, ext_ref)\n # strip of first element which is module\n array_form_path = array_form_path_x[1..array_form_path_x.size - 1]\n extra_info = {}\n ndx = array_form_path.first\n unless ndx_attributes.key?(ndx)\n extra_info =\n case ext_ref[:type]\n when 'puppet_attribute'\n { 'type' => 'attribute' }\n when 'puppet_imported_collection'\n { 'type' => 'imported_collection',\n 'resource_type' => ext_ref[:resource_type] }\n else\n fail Error.new(\"unexpected attribute type (#{ext_ref[:type]})\")\n end\n end\n size = array_form_path.size\n if size == 1\n ndx_attributes[ndx] = { 'name' => ndx, 'value' => val }.merge(extra_info)\n else\n p = ndx_attributes[ndx] ||= { 'name' => ndx, 'value' => {} }.merge(extra_info)\n add_attribute_aux!(p['value'], array_form_path[1..size - 1], val)\n end\n end",
"def parse_attrlist\n tok = readbyte\n list = []\n currentname = nil\n currentvalue = \"\"\n while tok != END_T\n if tok == SWITCH_PAGE\n @attr_codepage = readbyte\n elsif tok == STR_I\n currentvalue += readntstring\n elsif tok == STR_T\n currentvalue += @stringtable[parse_mbint]\n elsif tok == ENTITY\n currentvalue << readmbstr\n elsif tok == OPAQUE\n currentvalue << readstring # TODO: What should we do for opaque in an attribute?\n elsif tok == EXT_0\n currentvalue << \"&wbxml_#{@attr_codepage.to_s 16}_ext0;\"\n elsif tok == EXT_1\n currentvalue << \"&wbxml_#{@attr_codepage.to_s 16}_ext1;\"\n elsif tok == EXT_2\n currentvalue << \"&wbxml_#{@attr_codepage.to_s 16}_ext2;\"\n # TODO: Deal with extension tokens that have a string payload\n elsif tok == LITERAL\n if currentname\n list << [currentname, currentvalue]\n end\n currentname = @stringtable[parse_mbint]\n currentvalue = \"\"\n elsif tok < 128 # ATTRSTART\n if currentname\n list << [currentname, currentvalue]\n end\n currentname, currentvalue = get_attr_start(tok)\n elsif tok > 128 # ATTRVALUE\n currentvalue += get_attr_value(tok)\n end\n tok = readbyte\n end\n if currentname\n list << [currentname, currentvale]\n end\n list\n end",
"def attribute(*args)\n @attributes = attributes\n @attributes += args\n @attributes.uniq!\n end",
"def attributes=(_arg0); end",
"def convert_attr_hash(attrs = [])\n h = {}\n attrs.each do |v|\n # v is Nokogiri::XML::SAX::Parser::Attribute\n # see http://nokogiri.org/Nokogiri/XML/SAX/Parser/Attribute.html\n key = v.prefix ? v.prefix + ':' : ''\n key += v.localname\n\n h[key.to_sym] = v.value\n end\n h\n end",
"def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end",
"def additional_attributes=(input)\n @additional_attributes = Array(input).map do |attribute_name|\n ADDITIONAL_ATTRIBUTE_MAP.fetch(attribute_name)\n end\n end",
"def attributes(*attrs)\n\n self._attributes = _attributes.dup\n\n attrs.each do |attr|\n if Hash === attr\n attr.each {|attr_real, key| attribute attr_real, :key => key }\n else\n attribute attr\n end\n end\n end",
"def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end",
"def attributes=(attributes)\n attributes.each_pair do |attribute, value|\n __send__(:\"#{attribute}=\", value)\n end\n end",
"def attributes(*attrs)\n attrs.each { |attr_name| @_attributes[attr_name.to_sym] = attr_name.to_sym }\n end",
"def attr_list\n\t\ta_list \n\tend",
"def register_attributes\n []\n end",
"def add_attribute(name, opts = {})\n name = name.to_sym\n\n raise \"Attribute `#{name}` defined more than once\" if @attributes[name]\n raise \"`:xpath` not specified for `#{name}`\" unless opts[:xpath]\n\n @attributes[name] = {\n xpath: opts[:xpath],\n type: opts[:type],\n }\n end",
"def initialize_attributes(attributes); end",
"def attrs(*names)\n names.each { |name| attr(name) }\n end",
"def associate_attributes(attributes)\n return attributes.each_with_object({}) do |pair, hash|\n hash[pair[0]] = pair[1]\n end\n end",
"def attributes(*attrs, **args)\n attrs.each { |attr| attribute(attr, **args) }\n end",
"def attributes=(attrs)\n attrs.each_pair do |attr, value|\n if respond_to?(\"#{attr}=\")\n public_send(\"#{attr}=\", value)\n else\n attributes[attr.to_s] = value\n end\n end\n end",
"def attribute(*args)\n if args.first.is_a?(Hash)\n args.first.each_pair { |k,v| self.attribute(k, :as => v) }\n else # array of attributes\n options = args.extract_options!\n @_options[:attributes] ||= {}\n args.each { |name| @_options[:attributes][name] = options[:as] || name }\n end\n end",
"def add_attribute(key, value = T.unsafe(nil)); end",
"def attributes\n @attributes ||= @args.collect do |attribute|\n Neo4jrGen::GeneratedAttribute.new(*attribute.split(\":\"))\n end\n end",
"def new_attributes(args)\n stats = default_attributes\n update_stats(stats, args)\n end",
"def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end",
"def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end",
"def method_missing (name, *args, &block)\n add_attribute(name, *args, &block)\n end",
"def add_attribute(name, definition)\n @attributes << Attribute.new(name, definition)\n end"
] | [
"0.7717851",
"0.72665393",
"0.70054674",
"0.698003",
"0.69797015",
"0.68010086",
"0.6765293",
"0.6571196",
"0.6564921",
"0.65453833",
"0.6489338",
"0.6483273",
"0.644604",
"0.6387318",
"0.6353431",
"0.6322972",
"0.63118976",
"0.63079107",
"0.6294074",
"0.6254452",
"0.62484944",
"0.62420374",
"0.6193597",
"0.61895555",
"0.6189487",
"0.6182118",
"0.61819774",
"0.61764526",
"0.6156142",
"0.61488247",
"0.6127294",
"0.61242306",
"0.6113209",
"0.61112773",
"0.6084712",
"0.60825294",
"0.6072759",
"0.6064638",
"0.60607594",
"0.6057985",
"0.60501647",
"0.6038407",
"0.6027126",
"0.60244995",
"0.60210055",
"0.6011306",
"0.6005368",
"0.599974",
"0.59975255",
"0.59973717",
"0.59944534",
"0.59937",
"0.5991213",
"0.59860355",
"0.59785783",
"0.59785783",
"0.5976642",
"0.59585136",
"0.595089",
"0.59416145",
"0.5939943",
"0.59389114",
"0.5930585",
"0.5927681",
"0.59249765",
"0.5891872",
"0.58896595",
"0.5888298",
"0.58837533",
"0.5875245",
"0.5871604",
"0.5871135",
"0.5863403",
"0.5858287",
"0.58571225",
"0.5852454",
"0.58453757",
"0.58434033",
"0.5833176",
"0.58289117",
"0.5822932",
"0.5813005",
"0.5810657",
"0.5809443",
"0.5802238",
"0.5801045",
"0.5772974",
"0.57718813",
"0.5764012",
"0.57634544",
"0.5760352",
"0.57553625",
"0.5755077",
"0.57515585",
"0.5745116",
"0.57440203",
"0.5739778",
"0.5739778",
"0.5739778",
"0.5735178"
] | 0.76575625 | 1 |
create a node with name and a hash of namespaces or attributes passed to options | def create_node( name, options )
node = XML::Node.new( name )
namespaces = options.delete( :namespaces )
add_namespaces( node, namespaces ) if namespaces
attributes = options.delete( :attributes )
add_propertys( node, attributes ) if attributes
node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_node(node, tag=nil)\n end",
"def initialize(node_name, options)\n @node_name = node_name\n @options = options\n end",
"def to_node(options={})\n options[:doc] ||= Nokogiri::XML::Document.new\n\n tag_name = options[:binding] && options[:binding].from\n root_tag = options[:wrap] || tag_name || representation_wrap\n\n create_representation_with(Nokogiri::XML::Node.new(root_tag.to_s, options[:doc]), options, PropertyBinding)\n end",
"def add_node_attribute(key, value, options)\n @node_attributes << { key: key, value: value, options: options }\n end",
"def initialize_node(options={})\n raise NotImplementedError\n end",
"def create(name, **args)\n args[:parent] = self\n Node.new(name.to_s, **args)\n end",
"def node element, attributes = {}\n Nokogiri::XML::Node.new(element, Nokogiri::HTML::Document.new).tap do |node|\n attributes.each do |name, value|\n node[name] = value\n end\n end\n end",
"def create_node(type, properties = {})\n {:node => type}.merge!(properties)\n end",
"def create_node(name, content = nil)\n return create_nodes(name) if content.nil? && name.is_a?(Hash) # Handle accidentally passing in a full hash\n \n element = self.class.elements.detect{|e| e.method_name.to_sym == name}\n raise Exceptions::InvalidElement.new(\"No known element named '#{name}'\") unless element || self.respond_to?(\"#{name}=\")\n \n case name\n when Hash then create_nodes(name)\n when Array then create_empty_nodes(name)\n else\n value = if content.nil?\n make_object?(element) ? element.type.new : ''\n elsif content.is_a?(Array) && (element && !element.options[:single])\n # If elements expects multiple instances, instantiate them all (e.g. StreetAddresses)\n # Note that this assumes the object (only known case is Trufina::Elements::StreetAddress) has a :name element\n out = content.collect do |local_content|\n make_object?(element) ? element.type.new(:name => local_content) : local_content\n end\n else\n make_object?(element) ? element.type.new(content) : content\n end\n \n self.send(\"#{name}=\", value)\n end\n end",
"def create_node_with_props data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n post_request 'node', data, headers\n end",
"def create_node(type, properties = T.unsafe(nil)); end",
"def add_node(name, parent, content: nil, attribute: false)\n unless String === name\n name = name.attributes['name'].value\n end\n\n node = BuildNode.new(name, parent: parent, attribute: attribute)\n\n if content\n node.contents << content\n end\n\n parent.children << node\n\n node\n end",
"def epp_node(name, value = nil, namespaces = {})\n value, namespaces = nil, value if value.kind_of?(Hash)\n\n node = xml_node(name, value)\n node.namespaces.namespace = epp_namespace(node, nil, namespaces)\n node\n end",
"def create_node(node, token)\n raise NotImplementedError\n end",
"def node(name, shape, *args, &block)\n attrs = args.last.is_a?(Hash) ? args.pop : {}\n attrs = shape_attrs(shape).merge(attrs)\n args << attrs\n @builder.__send__(name, *args, &block)\n end",
"def node(name, shape, *args, &block)\n attrs = args.last.is_a?(Hash) ? args.pop : {}\n attrs = shape_attrs(shape).merge(attrs)\n args << attrs\n @builder.__send__(name, *args, &block)\n end",
"def new_node(*args)\n add_node(build_node(*args))\n end",
"def make_stub(opt)\n # Rails.logger.debug \"--> creating stub element for #{self.name}, arguments: #{opt.inspect}\"\n if opt.nil?\n raise CreationError, \"Tried to create document without opt parameter\"\n end\n root_tag_name = self.name.downcase\n doc = ActiveXML::Node.new(\"<#{root_tag_name}/>\")\n doc.set_attribute('name', opt[:name])\n doc.set_attribute('created', opt[:created_at]) if opt[:created_at]\n doc.set_attribute('updated', opt[:updated_at]) if opt[:updated_at]\n doc.add_element 'title'\n doc.add_element 'description'\n doc\n end",
"def build_ship_param_node(node_name, person, location, options={})\n node = XmlNode.new(node_name) do |node|\n node << XmlNode.new('Name', person[:person_name])\n if person[:phone_number]\n node << XmlNode.new('Phone') do |phone|\n phone << XmlNode.new('Number', person[:phone_number].gsub(/[^\\d]/, ''))\n phone << XmlNode.new('Extension', person[:phone_number_ext].gsub(/[^\\d]/, '')) if person[:phone_number_ext]\n end\n end\n node << XmlNode.new('ShipperNumber', person[:shipper_number]) if node_name == 'Shipper' and person[:shipper_number]\n node << XmlNode.new('FaxNumber', person[:shipper_fax_number]) if node_name == 'Shipper' and person[:shipper_fax_number]\n node << XmlNode.new('EMailAddress', person[:email]) if person[:email]\n node << build_address_node(location)\n\n end \n end",
"def create_node(xml, node_name, attrs, text)\n return if text.nil? || text.empty?\n\n xml.send(node_name, clean_attrs(attrs)) do\n xml.text text\n end\n end",
"def create\n Souffle::Log.info \"#{@node.log_prefix} Creating a new node...\"\n provider.create_node(@node)\n end",
"def node_namespace name:\n label = make_label name\n attrs = { name: name }\n\n add_node :Namespace, label, attrs\n end",
"def build_node(member)\n node = Atom::XML::Node.new('apps:property')\n node.attributes['name'] = 'memberId'\n node.attributes['value'] = member\n\n node\n end",
"def create_new_node_group_model(options={})\n # name, classes, parent are the only required keys\n name = options['name'] || RandomString.generate\n classes = options['classes'] || {}\n parent = options['parent'] || Rootuuid\n rule = options['rule']\n id = options['id']\n environment = options['environment']\n variables = options['variables']\n description = options['description']\n environment_trumps = options['environment_trumps']\n\n hash = { \"name\" => name,\n \"parent\" => parent,\n \"classes\" => classes }\n\n if environment_trumps\n hash['environment_trumps'] = environment_trumps\n end\n if rule\n hash['rule'] = rule\n end\n if environment\n hash['environment'] = environment\n end\n if variables\n hash['variables'] = variables\n end\n if description\n hash['description'] = description\n end\n if id\n hash['id'] = id\n end\n\n create_node_group(hash).env.body\n end",
"def initialize(node = nil, options = nil)\n super()\n\n self.node = node\n self.options = options\n end",
"def xml_node(name, value = nil)\n XML::Node.new(name, value)\n end",
"def create_element(name, *contents_or_attrs, &block); end",
"def create_node(t)\n raise NotImplementedError\n end",
"def initialize(name, opts={}, terminology=nil)\n opts = {:ancestors=>[], :children=>{}}.merge(opts)\n [:children, :ancestors,:path, :index_as, :required, :variant_of, :path, :attributes, :default_content_path, :namespace_prefix].each do |accessor_name|\n instance_variable_set(\"@#{accessor_name}\", opts.fetch(accessor_name, nil) )\n end\n\n self.type = opts[:type] || :string\n\n unless terminology.nil?\n if opts[:namespace_prefix].nil?\n unless terminology.namespaces[\"xmlns\"].nil?\n @namespace_prefix = \"oxns\"\n end\n end\n end\n @name = name\n if @path.nil? || @path.empty?\n @path = name.to_s\n end\n end",
"def node name\n node_context = Bocuse::NodeContext.new(name, @context)\n configuration = Bocuse::Configuration.new\n\n unit = Bocuse::Unit.new(Proc.new, @project)\n unit.call(configuration, node_context)\n\n @project.register_node name, configuration\n \n return configuration\n end",
"def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end",
"def options\n @_node.getOptions.map { |node| Node.new(node) }\n end",
"def make_node(type, *args)\n elem = type.new self, *args\n @nodes << elem\n self.core_node ||= elem.id\n elem.expand\n elem\n end",
"def node_set(ns, opts)\n if opts.key?(:attributes) && (opts.key?(:required) || opts.key?(:optional))\n raise 'must not set both :attributes and any of :required, :optional'\n end\n if opts.key?(:size) && (Range === opts[:size] && opts[:size].last > 1 || Integer === opts[:size] && opts[:size] > 1) && opts.key?(:index) && !opts.key?(:xml)\n raise 'must set :xml if the maximum :size is greater than 1 and :index is set'\n end\n\n assert opts.fetch(:size) === ns.size, \"expected #{opts[:size]}, got #{ns.size} elements: #{ns}\"\n\n if opts[:xml]\n opts[:xml].each do |k, v|\n assert_equal ns[k].to_xml, v\n end\n end\n\n if opts.key?(:index)\n node(ns[opts[:index]], opts)\n else\n ns.each do |n|\n node(n, opts)\n end\n end\n\n ns\n end",
"def initialize(node, attrs={})\n @node = node\n\n @attributes = {tag: node.name}\n ATTRIBUTES.each do |k|\n if node.key?(k.to_s)\n attributes[k] = node[k]\n end\n end\n update_attributes(attrs)\n end",
"def create_node(value)\n node = Node.new(value)\n end",
"def build_options(node)\n options = {}\n node.elements.each(\"option\") do |option|\n options[attr(option, :name)] = attr(option, :value)\n end\n options\n end",
"def build_node(*args)\n node_class.new(*args)\n end",
"def create(options = {})\n options[:name] ||= SecureRandom.hex\n\n create_options = { p: port }\n create_options[:c] = options[:name] if options[:name]\n create_options[:d] = options[:dir] if options[:dir]\n exec(\"create\", create_options)\n\n options[:name]\n end",
"def root_options(options)\n @options = options\n return unless options.key?(:name)\n\n @root = @root.dup\n @root.name = options[:name]\n end",
"def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end",
"def enter(n, depth, opts)\n opts.delete(:enter)\n reference = opts.key?(:reference) && opts[:reference].split(':', 2).last # remove namespace\n if reference && reference == n['name']\n tree.last.merge(n, opts, except: %i(reference))\n elsif n.name == 'attribute' && n['name'] == 'CTYPE'\n tree.last.merge(n, opts, except: %i(reference tag name) + [key_for_depth(depth)])\n else\n tree << TreeNode.new(n, opts)\n end\n end",
"def create_node(p_node_text, p_node_type, p_node_color = nil)\n return {\"color\" => \"#{p_node_color}\", \"created\" => Time.now.to_i, \"id\" => SecureRandom.uuid.gsub(/-/,''), \"modified\" => Time.now.to_i, \"text\" => p_node_text, \"type\" => p_node_type, \"nodes\" => []}\n end",
"def new_node(element)\n Node.new(element)\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def initialize(name, opts={}, terminology=nil)\n opts = {:ancestors=>[], :children=>{}}.merge(opts)\n [:children, :ancestors,:path, :index_as, :required, :variant_of, :path, :attributes, :default_content_path, :namespace_prefix].each do |accessor_name|\n instance_variable_set(\"@#{accessor_name}\", opts.fetch(accessor_name, nil) )\n end\n\n self.type = opts[:type] || :string\n\n unless terminology.nil?\n if opts[:namespace_prefix].nil?\n unless terminology.namespaces[\"xmlns\"].nil?\n @namespace_prefix = \"oxns\"\n end\n end\n end\n @name = name\n if @path.nil? || @path.empty?\n @path = name.to_s\n end\n end",
"def newNode(nodeName, nodeValue, nodeAttributes)\n\n\n hmToReturn = Hash.new #Create a new Hashtable this represents the Node\n hmToReturn[\"nodeName\"] = nodeName #This is the Node Name ie(<nodeName></nodeName>)\n hmToReturn[\"nodeValue\"] = nodeValue #This is the Node Value ie(<nodeName>NodeValue</nodeName>)\n hmToReturn[\"nodeAttributes\"] = nodeAttributes #These are the Node attributesie(<nodeName nodeAttribute=\"value\"></nodeName>)\n hmToReturn[\"childCount\"] = 0 #Amount of children Nodes\n\n #puts \"Hash forNewNode:#{hmToReturn}\"\n #setAddHeader(false);\n # try{\n # String toCreateXML = new String(parseHashtableToXML(hmToReturn,true).getBytes(),xmlEncoding);\n # //System.out.println(\"Parsed Hash:\"+toCreateXML);\n # hmToReturn = createHashtableFromString(toCreateXML);\n # return hmToReturn;\n # }catch(Exception e){}\n # return null;\n return hmToReturn\n end",
"def create_node(value)\n Node.new(value)\n end",
"def initialize(name)\n @children={}\n if name.kind_of? String\n\t\t\t\t@node_name=name.to_sym\n\t\t\telse\n\t\t\t\t@node_name=name\n\t\t\tend\n end",
"def initialize(options={}) \n options = Knodes.options.merge(options)\n Configuration::VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", options[key])\n end\n end",
"def create(config_node_name)\n @call_params[:config_node_name] = config_node_name\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def new\n puts \"xxxxxxx NodesC a:new xxxxxxx\"\n # @node = Node.new # orig \n \n @node = Node.new\n #@node.build ==> this does not work as there is m\n #@node.node_attrbs.build\n #byebug\n end",
"def create_taxonomy_node\n Taxonomite::Species.new(name: self.name)\n end",
"def to_node(node_config, options = {})\n module_key = node_config[:type].to_sym\n mod = IO::Module.find_by_key(module_key)\n mod.new_from_config(node_config, :log => options[:log])\n end",
"def build_node(node, text)\n\t\t#node.type = :BasicNode\n\n\t\twhitespace = text.partition(\".\").first\n\t\tpure_text = text.partition(\".\").last\n\t\tnode.depth = (whitespace.length)/3 #+2?\n\n\t\t#get the category string, use it to pull a category id\n\t\tif pure_text.include?(\",\") #split by the comma if there is one\n\t\t\tcategory_name = pure_text.partition(\",\").first\n\t\t\ttitle = pure_text.partition(\",\").last\n\t\telse #default to no category\n\t\t#\tcategory_name = pure_text.partition(\" \").first\n\t\t\ttitle = pure_text\n\t\t\tcategory_name = \"\"\n\t\tend\n\n\t\t#need to make these only the categories that belong to the user\n\t\tcategory = self.categories.find_by name: category_name.downcase\n\t\tif category == nil\n\t\t\tcategory = self.categories.create(name: category_name.downcase)\n\t\tend\n\t\tnode.category = category\n\t\ttitle = title.strip\t\n\t\t\n\t\tnode.title = title\n\t\tnode.work_id = self.id\n\t\treturn node\n\tend",
"def set_node_name!(n)\n n[:name] ||= \"#{n[:host]}:#{n[:port]}\"\n n\n end",
"def method_missing(method_name, *args)\r\n get_or_create_node(method_name.to_s, true)\r\n end",
"def create_node(options={})\n (raise CloudLB::Exception::MissingArgument, \"Must provide a node IP address\") if options[:address].to_s.empty?\n (raise CloudLB::Exception::MissingArgument, \"Must provide a node TCP port\") if options[:port].to_s.empty?\n options[:condition] ||= \"ENABLED\"\n body = {:nodes => [options]}.to_json\n response = @connection.lbreq(\"POST\", @lbmgmthost, \"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes\",@lbmgmtport,@lbmgmtscheme,{},body)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n body = JSON.parse(response.body)['nodes'][0]\n return get_node(body[\"id\"])\n end",
"def node_name(name)\n self.__add_string('node_name', name)\n end",
"def make_node_params(node, box_params)\n box_params.transform_keys(&:to_sym).merge(\n {\n name: node[0].to_s,\n host: node[1]['hostname'].to_s\n }\n )\n end",
"def add_node(node); end",
"def build_node_class_hash(class_hash)\n # First, create a hash with the following structure:\n #\n # - key: The name of the class to be added to the Node Group\n # - value: The parameters to be assigned to the class (generally an empty hash)\n #\n # Example: { 'pe_repo::platform::el_7_x86_64' => {} }\n class_parameters_hash = Hash.new\n class_parameters_hash[class_hash['name']] = class_hash['parameters']\n\n # Now, create a node that defines a new class association with a node group.\n # This hash will have the following structure:\n #\n # - key: 'classes' (Each node group has a 'classes' key, which contains a has for each class associated with that node group)\n # - value: class_parameters_hash (The hash created above, which defines the class name and parameters to add to the node group)\n #\n # Example: { 'classes' => { 'pe_repo::platform::el_7_x86_64' => {} } }\n node_class_hash = Hash.new\n node_class_hash['classes'] = class_parameters_hash\n\n # Return the newly constructed hash\n node_class_hash\nend",
"def initialize( nodename, name ) \n @nodename = nodename\n @name = name\n end",
"def create_node(class_name, parent)\n Tree.const_get(class_name.to_s + 'Node')\n .new(parent)\n end",
"def init! options = {}\n verify_empty!\n copy_template options[:node] ? :node : :default\n vendorize_with_symlink if options.include? :symlink\n vendorize_with_copy if options.include? :freeze\n create_helper_symlink\n replace_root\n end",
"def node(name, ref, *args, &block); end",
"def initialize( xml_file, *options )\n @node_name = \"00000\"\n\t @show_text = true\n\t @show_attributes = true\n\n if options and options[0]\n options[0].each do |xKey, xValue|\n case xKey.to_s\n when \"text\"\n @show_text = xValue\n\t\t options[0].delete( xKey )\n when \"attrs\"\n @show_attributes = xValue\n\t\t options[0].delete( xKey )\n end\n end\n end\n\n @rexml_document = REXML::Document::new( File::new( xml_file ) )\n @graph = GraphViz::new( \"XML\", *options )\n parse_xml_node( @rexml_document.root() )\n end",
"def node_entry\n \"node #{name}\"\n end",
"def create_attribute options\n attributes = options[ :attributes ]\n attr_value = options[ :value ]\n attributes.each do | attr_name |\n self.class.class_eval do\n define_method attr_name do\n instance_variable_get \"@#{ attr_name }\"\n end\n define_method \"#{ attr_name }=\" do | value |\n instance_variable_set( \"@#{ attr_name }\", value )\n end\n end\n self.public_send( \"#{ attr_name }=\", attr_value )\n end\n end",
"def add_node kind, label, attrs\n @node_buffer << Node.new(\n kind: kind,\n label: label,\n attrs: attrs\n )\n end",
"def addCustomAttrib(doc, name, value, datatype=\"string\")\r\n\tputs \"adding custom-attribute #{name}\"\r\n\tnode = Nokogiri::XML::Node.new \"custom-attribute\", doc\r\n\tnode[\"name\"] = name\t\r\n\tnode[\"dt:dt\"] = datatype\r\n\tif value.kind_of?(Array)\r\n\t\tvalue.each do |val|\r\n\t\t\tnode << \"<value>#{val}</value>\"\r\n\t\tend\r\n\telse\r\n\t\tnode.content = value\r\n\tend\r\n\treturn node\r\nend",
"def node=(_arg0); end",
"def create_node_manifest(manifest_path, master_certname, node_def_name='default')\n manifest = File.read(manifest_path)\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\nnode default {\n\n#{manifest}\n}\nMANIFEST\n\n return site_pp\nend",
"def node(n, opts)\n assert_in n.name, opts.fetch(:names), 'tag name', n\n\n if !opts[:name_only]\n if opts.key?(:required) || opts.key?(:optional)\n allowed_attributes(n, opts.slice(:required, :optional))\n else\n allowed_attributes(n, required: opts.fetch(:attributes, []))\n end\n end\n\n if !opts[:name_only]\n assert !opts.key?(:children) && n.children.none? ||\n opts[:children] == 'text' && n.element_children.none? ||\n opts[:children] == true && n.children.any? ||\n opts[:children] == 'any', \"expected #{opts[:children].inspect} children\", n\n end\n end",
"def [](name)\r\n get_or_create_node(name.to_s, false)\r\n end",
"def add_node(name, node)\n language.nodes[name] = node if name\n node\n end",
"def to_xml(options = {})\n doc = super\n ns = self.class.ns\n\n if ns and ns.size == 2 # prefix and name\n doc.add_namespace_definition(*ns)\n doc.name = \"#{ns.first}:#{doc.name}\"\n end\n\n doc\n end",
"def add_node(node)\n if node.respond_to?(:to_sym)\n node = Woodhouse::Layout::Node.new(node.to_sym) \n end\n expect_arg :node, Woodhouse::Layout::Node, node\n @nodes << node\n node\n end",
"def node(path, name)\n RubyAem::Resources::Node.new(@client, path, name)\n end",
"def initialize(options = {})\n # { url: 'http://some.domain/path/' }\n @url = options[:url]\n # { username: 'abc' }\n @username = options[:username]\n # { password: 'abc' }\n @password = options[:password]\n # basic namespaces required at least, to begin with\n @namespaces = {\n 'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',\n 'xmlns:cor' => 'http://webservices.micros.com/og/4.3/Core/'\n }\n # merge any additional given namespaces\n @namespaces.merge!(options[:namespaces] || {})\n end",
"def node(*args)\n Node.new(self, *args)\n end",
"def node(*args)\n Node.new(self, *args)\n end",
"def namespace(path, options = T.unsafe(nil)); end",
"def init_node\n end",
"def init_node\n end",
"def initialize(root, options); end",
"def from_node(node); end",
"def create_text_node(string, &block); end",
"def create_text_node(string, &block); end",
"def create_fake_network_node(vapp_networks, network_name)\n parent_section = vapp_networks.css('NetworkConfigSection').first\n new_network = Nokogiri::XML::Node.new \"NetworkConfig\", parent_section\n new_network['networkName'] = network_name\n placeholder = Nokogiri::XML::Node.new \"PLACEHOLDER\", new_network\n new_network.add_child placeholder\n parent_section.add_child(new_network)\n vapp_networks\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def node_create(node, node_class=Deployment::Node)\n if node_present? node\n node = node_get node\n elsif node.is_a? Deployment::Node\n node = node_add node\n else\n node = node_class.new node, self\n node = node_add node unless node_present? node\n end\n node\n end",
"def add(*arguments)\n if arguments[0].is_a?(Node)\n if arguments[1]\n fail ArgumentError, 'The second argument must not be specified, when passing a VObject Node'\n end\n arguments[0].parent = self\n new_node = arguments[0]\n elsif arguments[0].is_a?(String)\n new_node = @root.create(*arguments)\n else\n fail ArgumentError, 'The first argument must either be a Node or a string'\n end\n\n name = new_node.name\n if @children.key?(name)\n @children[name] << new_node\n else\n @children[name] = [new_node]\n end\n\n new_node\n end",
"def create_path(path, options = {})\n unless @zk.exists?(path)\n @zk.create(path,\n options[:initial_value],\n :ephemeral => options.fetch(:ephemeral, false))\n logger.info(\"Created ZK node #{path}\")\n end\n rescue ZK::Exceptions::NodeExists\n # best effort\n end",
"def initialize(name = 'ROOT')\n @root = Node::Root.new(name, config)\n end",
"def create_node(params)\n node = @tinkit_class.new(params)\n node.__save\n node\n #TODO: What if params includes attachments?\n end",
"def create_node(node, host, &block)\n pubsub.create_with_configuration(node, PUBSUB_CONFIGURE, host, &callback_logging(__method__, node, &block))\n end",
"def node(type, content)\n return { \"type\" => type, \"content\" => content }\n end",
"def __node(name, params = {}, &block)\n require_relative './node'\n @__nodes << Node.new(name, params, __depth + 1, &block)\n end"
] | [
"0.66677094",
"0.6436466",
"0.6430052",
"0.63782036",
"0.63421035",
"0.6243989",
"0.61664647",
"0.61263067",
"0.6099774",
"0.6086351",
"0.6076297",
"0.6011779",
"0.5970208",
"0.5960545",
"0.5935067",
"0.5935067",
"0.5929265",
"0.5926563",
"0.59115535",
"0.5883397",
"0.5859406",
"0.58583724",
"0.5845414",
"0.58419853",
"0.5796807",
"0.57873976",
"0.57797545",
"0.5772408",
"0.5745448",
"0.57428765",
"0.5732068",
"0.5711804",
"0.5700302",
"0.56925",
"0.56690717",
"0.5662122",
"0.5648884",
"0.5644949",
"0.5644417",
"0.5626904",
"0.5620564",
"0.56184405",
"0.5611157",
"0.55911356",
"0.55901045",
"0.5582746",
"0.5582305",
"0.5581824",
"0.5579197",
"0.55769986",
"0.5568694",
"0.55204046",
"0.55062234",
"0.55057234",
"0.5497766",
"0.549472",
"0.54941565",
"0.5491703",
"0.54875493",
"0.5474504",
"0.54715645",
"0.5471261",
"0.54696",
"0.5466824",
"0.54661757",
"0.5450959",
"0.54377764",
"0.5434373",
"0.5419667",
"0.54151344",
"0.5412703",
"0.5408098",
"0.5401328",
"0.539938",
"0.5396677",
"0.53891695",
"0.53802544",
"0.5379438",
"0.5367135",
"0.536591",
"0.5353827",
"0.5353827",
"0.53484756",
"0.5346187",
"0.5346187",
"0.53320605",
"0.5327343",
"0.5324898",
"0.5324898",
"0.53183824",
"0.53175646",
"0.53175646",
"0.5305304",
"0.5301981",
"0.5294164",
"0.52851176",
"0.5283528",
"0.5265716",
"0.5261651",
"0.5256954"
] | 0.8262067 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_panel_project
@panel_project = ::Project.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def 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 panel_project_params
params.fetch(:project, {}).permit(:author, :name, :human_name, :identity,
:status, :source_code, :description, :today_recommend, :given_name,
:category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Set the basic collection to sessions from browsers. | def basic_collection
::Gricer.config.session_model.browsers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sessions=(value)\n @sessions = value\n end",
"def all_sessions\n self.test_sessions\n end",
"def set_session\n \n end",
"def sessions\n Thread.current[:sessions] ||= {}\n end",
"def setup\n @current_session = new_session\n end",
"def sessions\n Thread.current[:sessions] ||= {}\n end",
"def set_session\n @session = current_session\n end",
"def index\n @sessions = BatchConnect::Session.all\n @sessions.each(&:update_cache_completed!)\n\n set_app_groups\n set_my_quotas\n end",
"def setup\n @env = { Rack::Session::Abstract::ENV_SESSION_KEY => '123456', Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY => Rack::Session::Abstract::ID::DEFAULT_OPTIONS}\n SmartSessionApp.test_proc = nil\n end",
"def session=(val)\n @@session ||= []\n @@session[self.id] = val\n end",
"def configure(opts={})\n @config.deep_merge!(opts).each do |k, v|\n case k\n when :collection then @config[:collection] = v.to_s.constantize\n else $LOG.warn \"session_store: unknown option #{k}=#{v}\"\n end\n end\n end",
"def session_stores\n @session_stores ||= {}\n end",
"def sessions!\n @sessions = search_sessions(xml_doc!)\n end",
"def session_options; end",
"def session_options; end",
"def sessions\n SockJS.debug \"Refreshing sessions\"\n\n if @sessions\n @sessions.delete_if do |_, session|\n unless session.alive?\n SockJS.debug \"Removing closed session #{_}\"\n end\n\n !session.alive?\n end\n else\n @sessions = {}\n end\n end",
"def sessions\n @@session_set ||= ActiveRecord::SessionStore::Session.all.select{|s| s.data.has_key?(\"user_credentials_id\")}\n @@session_set.select{|s| s.data[\"user_credentials_id\"] == self.id}\n end",
"def initialize\n\t\t\t\tcgi = CGI.new('html4')\n\n\t\t\t\t# We make sure to delete an old session if one exists,\n\t\t\t\t# not just to free resources, but to prevent the session\n\t\t\t\t# from being maliciously hijacked later on.\n\t\t\t\tbegin\n\t\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => false)\n\t\t\t\t\[email protected]\n\t\t\t\trescue ArgumentError # if no old session\n\t\t\t\tend\n\t\t\t\t@session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::PStore, 'new_session' => true)\n\t\t\t\t@session['datastore'] = {}\n\t\t\tend",
"def group_sessions\n\t\n\tend",
"def initialize_session\n session[:cart] ||= []\n end",
"def initialize_session\n session[:cart] ||= []\n end",
"def set_api_cookie!\n return unless @session_object\n\n @session_object.to_hash.each { |k, v| session[k] = v }\n end",
"def sessions\n @sessions\n end",
"def session; end",
"def session; end",
"def session; end",
"def session; end",
"def sessions_reset\n self.sessions_flush\n @sessions = {}\n end",
"def initialize\n @collection={}\n end",
"def expose_session_to_models\n $_SESSION = session\n end",
"def setup\n open_session\n end",
"def session\n raise Sinatra::Unit::SessionsDisabledError unless test_sessions_enabled?\n env['rack.session'] ||= {}\n end",
"def initialize(sessions)\n @sessions = sessions\n end",
"def attachment_sessions=(value)\n @attachment_sessions = value\n end",
"def set_user_session\n @user_session = UserSession.find\n end",
"def session\n Thread.current['clients_manager'].client('Website').session\n end",
"def set_collection(coll)\n set_collection_ivar(coll)\n end",
"def set_session\n @session = session[:user_id]\n end",
"def sessions\n return @sessions\n end",
"def copy_session_variables!; end",
"def session; @session; end",
"def session; @session; end",
"def session; @session; end",
"def connect!\n sessions\n self\n end",
"def session() request.session end",
"def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end",
"def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end",
"def setup_default_session(cfg)\n setup_config_defaults!(cfg)\n\n return if !cfg.sessions.empty?\n\n cfg.sessions << {type: cfg.session_type, path: cfg.session_path, options: cfg.session_options.merge(default: true)}\n end",
"def initialize\n @collection = []\n end",
"def setup\n session[:user_id]=1\n end",
"def session\n end",
"def set_show_session\n session[:cheese_order] = nil\n session[:current_page] = nil\n end",
"def auto_track_sessions\n @auto_capture_sessions\n end",
"def index\n @lift_sessions = LiftSession.all\n end",
"def set_collection\n @collection = Collection.find(params[:collection_id])\n redirect_to :back, alert: 'Not authorized' unless @collection.available?(@current_user)\n end",
"def set_session(env, sid)\n raise '#set_session needs to be implemented.'\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def index\n @sessions = Session.all\n end",
"def setup_config_defaults!(cfg)\n cfg.session_type ||= default_session_type\n cfg.session_path ||= default_session_path\n cfg.session_options ||= {}\n cfg.sessions ||= []\n end",
"def initialize(session); end",
"def reset_session\n if current_subdomain\n copier = lambda { |sess, (key, val)| sess[key] = val unless key == current_subdomain_symbol; sess }\n new_session = request.session.inject({}, &copier)\n super\n new_session.inject(request.session, &copier)\n else\n super\n end\n end",
"def set_collection\n self._collection = Mongoid::Collection.new(self, self.collection_name)\n end",
"def set_session\n unless logged_in?\n create_new_user\n clear_old_sessions if $USE_SQL_SESSION_MANAGEMENT\n # expire home page fragment caches after specified internal to keep it fresh\n if $CACHE_CLEARED_LAST.advance(:hours => $CACHE_CLEAR_IN_HOURS) < Time.now\n expire_cache('home')\n $CACHE_CLEARED_LAST = Time.now()\n end\n end\n end",
"def session_store\n ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager]\n end",
"def init_session\n init_language\n set_page_cache_directory\n init_views\n init_votes\n init_cookies\n end",
"def content_sharing_sessions=(value)\n @content_sharing_sessions = value\n end",
"def session\n @session ||= {}\n end",
"def basic_collection\n ::Gricer.config.request_model.browsers\n end",
"def sessions\n threads = servers.map { |server| Thread.new { server.session(true) } if server.session.nil? }\n threads.each { |thread| thread.join if thread }\n servers.map { |server| server.session }.compact\n end",
"def collection_proxies\n @collection_proxies ||= {}\n end",
"def sessions\n @sessions.each_key.to_a\n end",
"def initialize(hash)\n @sessions = []\n @users = []\n\t@users = hash\n end",
"def collections\n with_caching({}, 'collections') do\n sibling_nodes_for('collection').map {|n| Collection.new(n, authentication_options) }\n end\n end",
"def index\n\t\t@class_sessions = ClassSession.all\n\tend",
"def set_session_filters(filters)\n reset_property_filters\n filters = DEFAULTS.merge(filters)\n\n filters.each do |filter, value|\n session[filter] = value\n end\n end",
"def session_options=(_arg0); end",
"def session_options=(_arg0); end",
"def sessions\n\n key = \"000000:#{TransamController::ACTIVE_SESSION_LIST_CACHE_VAR}\"\n @sessions = Rails.cache.fetch(key)\n @sessions.delete_if { |key, value| value[:expire_time] < Time.now }\n @sessions ||= {}\n\n end",
"def collection\n @collection ||= database.collection Crocoduck::Store.server_collection\n end",
"def session\r\n @session ||= {}\r\n end",
"def populate_session(aPlayer)\n\t\tsession[:email] = @player.email\n\t\tsession[:player_id] = @player.id \n\t\tsession[:admin] = @player.admin\n\t\tsession[:login_time] = Time.now.to_i \n\tend",
"def session_controls=(value)\n @session_controls = value\n end",
"def initialize_session\n # When setting a value, using ||= sets the default value\n # EX:// cart ||= 0 will initialize the variable and default to zero\n # if no value exists for cart\n session[:user_cart] ||= []\n session[:item_quantity] ||= {}\n end",
"def initialize(session = :default)\n self.session = Mongoid::Sessions.with_name(session)\n rescue => e\n # client/session not configured\n end",
"def set_initial_cookies\n @initial_cookies = {}\n request.cookies.each {|k,v|\n @initial_cookies[k] = v\n }\n end",
"def set_session\n @session = BatchConnect::Session.find(params[:id])\n end",
"def session\n self\n end",
"def reset_session!\n raw_session.clear\n end",
"def set_collection\n @collection = current_user.collections.find_by(id: params[:id]) if current_user\n end",
"def save_session\n\t\tsession[:todos] = @todos.all_todos.to_json\n\tend",
"def init_session\n if session\n if session.updated_at < Time.now - ::Gricer.config.max_session_duration\n self.session = Session.create previous_session: session, ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n else\n self.session.touch\n end\n else\n self.is_first_in_session = true\n self.session = Session.create ip_address: @ip_address, agent: agent, requested_locale: @request_locale\n self.session.touch\n end\n \n session\n end",
"def set_shared_collection\n @shared_collection = SharedCollection.find(params[:id])\n end",
"def active_session=(mod)\n\t\tdriver.active_session = mod\n\tend",
"def session\n @session_proxy ||= Class.new do\n attr_reader :session\n\n def initialize session = {}\n @session = session\n end\n\n def [] key\n session[key]\n end\n\n def []= key, val\n return if readonly?\n session[key] = val\n end\n\n def delete key\n return if readonly?\n session.delete key\n end\n\n # makes sessions readonly\n #\n # @example prohibit writing for all actions\n # before do\n # session.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # session.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n session.send *args\n end\n\n end.new @ctrl.env['rack.session']\n end",
"def set_users_collection\n @users_collection = Users::Collection.find(params[:id])\n end",
"def initialize_session\n puts 'initializing session with client'\n end",
"def save_session()\n @store\n end",
"def session\n env['rack.session'] ||= {}\n end"
] | [
"0.64168805",
"0.6180096",
"0.60936016",
"0.6048786",
"0.6019108",
"0.59429014",
"0.58194256",
"0.58005023",
"0.5774661",
"0.5726785",
"0.5722286",
"0.57192034",
"0.5696373",
"0.5685883",
"0.5685883",
"0.56427616",
"0.5636192",
"0.56148326",
"0.5599852",
"0.5596372",
"0.5596372",
"0.5593582",
"0.55710316",
"0.55669326",
"0.55669326",
"0.55669326",
"0.55669326",
"0.55483955",
"0.554782",
"0.55478096",
"0.55434597",
"0.55433804",
"0.55391437",
"0.5537199",
"0.5528209",
"0.5519815",
"0.55046695",
"0.55042124",
"0.5500363",
"0.5488105",
"0.54790056",
"0.54790056",
"0.54790056",
"0.5474946",
"0.54718727",
"0.54406774",
"0.54317456",
"0.5424115",
"0.54029715",
"0.54016304",
"0.5398207",
"0.5395008",
"0.53896326",
"0.53869015",
"0.5381171",
"0.53651285",
"0.5364852",
"0.5364852",
"0.5364852",
"0.5364852",
"0.53566253",
"0.5345462",
"0.5337255",
"0.53359306",
"0.5308093",
"0.5307549",
"0.5306075",
"0.53013206",
"0.5298035",
"0.52930415",
"0.5291966",
"0.5290348",
"0.5273584",
"0.52694017",
"0.526804",
"0.5267411",
"0.5267178",
"0.5265936",
"0.5265936",
"0.5262631",
"0.5249046",
"0.52435935",
"0.5240106",
"0.5237837",
"0.5236883",
"0.52354985",
"0.5232499",
"0.5227049",
"0.52233714",
"0.52214706",
"0.5218996",
"0.5216589",
"0.5213703",
"0.5213084",
"0.521033",
"0.520723",
"0.5206354",
"0.5206118",
"0.5191389",
"0.519128"
] | 0.6951001 | 0 |
Offer links to further details on some attributes | def further_details
{
'agent.name' => 'agent.major_version',
'agent.os' => 'agent.name',
'agent.major_version' => 'agent.full_version',
'agent.engine_name' => 'agent.engine_version',
'silverlight_major_version' => 'silverlight_version',
'flash_major_version' => 'flash_version',
'country' => 'city',
'requested_locale_major' => 'requested_locale_minor',
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_all_links_attributes\n # Interface method\n end",
"def display_link_attributes(link)\n # Interface method\n end",
"def link_attributes\n [:accesskey, :charset, :coords, :hreflang, :id, :lang, :name, :onblur,\n :onclick, :ondblclick, :onfocus, :onkeydown, :onkeypress, :onkeyup,\n :onmousedown, :onmousemove, :onmouseout, :onmouseover, :onmouseup,\n :rel, :rev, :shape, :style, :tabindex, :target, :title, :type]\n end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def attributes; end",
"def detail\n attributes.fetch(:detail)\n end",
"def detail\n attributes.fetch(:detail)\n end",
"def attributes\n end",
"def attributes\n end",
"def relationship_related_link(attribute_name); end",
"def additional_details\n\n end",
"def details; end",
"def print_attribute(*) end",
"def attr_info; end",
"def attribute_survey\n heading = proc { |str| %{\\n\\nh3. <a name=\"#{str}\">#{str}</a>\\n\\n} }\n subheading = proc { |str| \"\\n\\nh4. #{str}\\n\\n\" }\n pre = proc { |str| \"<pre>\\n#{str}\\n</pre>\\n\" }\n para = proc { |str| str.gsub(/\\n/, \"\\n\\n\") }\n toclink = \"\\n<em>Goto #{_link('toc', 'Table of Contents')}</em>\"\n ATTRIBUTES.sort_by { |a| a['name'] }.each do |a|\n a = OpenStruct.new(a)\n puts \"\\n----\\n\"\n puts heading[a.name]\n puts _metadata(a)\n puts subheading['Description']\n puts _resolve_links(a.description)\n puts subheading['Usage']\n puts pre[a.usage.strip.gsub(/^/, ' ')]\n if a.notes\n puts subheading['Notes']\n puts _resolve_links(para[a.notes.strip])\n end\n puts toclink\n end\nend",
"def details\n @attributes[:details]\n end",
"def attributes\n attrs = sort_members(@context.attributes).find_all{|a| @options.show_all || a.visibility == :public || a.visibility == :protected}\n attrs.collect{|a| {:name=>a.name, :visibility=>a.visibility, :rw=>a.rw, :description=>markup(a.comment, true)}}\n end",
"def show\n\t\t@attrib_keys = [\"desc\", \"higher_level\", \"range\", \"components\", \"material\", \"ritual\", \"duration\", \"concentration\", \"casting_time\", \"level\", \"school\", \"class_names\", \"archetype\", \"domains\", \"oaths\", \"circles\", \"patrons\"]\n\tend",
"def show_page_attributes\n attributes\n end",
"def related_information\n attributes.fetch(:relatedInformation)\n end",
"def details\n end",
"def href\n attributes[:href]\n end",
"def important_toc(*attributes)\n puts attributes.collect { |a| _link(a) }.join(SEPSTRING)\nend",
"def display_book_attributes\n [@title, @type, @author, @price]\n end",
"def detail_attributes\n @detail_attributes ||= {}\n end",
"def details\n\n end",
"def inspect_attributes\n %i[uuid name type slug status email]\n end",
"def scrape_detail\n self.doc = Scrapable::Helpers.parse detail_url\n self.class.attributes.each do |attribute,id|\n if id['anchor'] # substring\n self[attribute] = doc.at_css('#' + id).andand[:href]\n else\n self[attribute] = doc.at_css('#' + id).andand.text.andand.sub(/\\A[[:space:]]+\\z/, '')\n end\n end\n end",
"def attributes\n scraper.attributes.keys + uri_response_attributes + [:feed]\n end",
"def links; end",
"def links; end",
"def show_request_access_link\n @attributes[:show_request_access_link]\n end",
"def list_attractions\n RhodyAttractions::Attraction.all.each do |attraction|\n attraction.print_description(\"short\")\n puts \"\"\n end\n end",
"def show\n author_attributes\n end",
"def details_for(**options)\n\t\t\t\t\toptions[:details]\n\t\t\t\tend",
"def attributes\n @attributes\n end",
"def list_attributes\n list = \"Age: #{@age} Earth years old\\nSize: #{@size}\\nVisitor Count: #{@visitor_count}\\nInhabitants: #{@inhabitants}\\n\"\n return list\n end",
"def attributes\n super.merge('url' => url, 'display_url' => display_url)\n end",
"def html_attributes(attr); end",
"def href; end",
"def request_attributes(opts = {})\n { resource: self, uri: link, params: {} }.merge(opts)\n end",
"def attributes\n @attributes\n end",
"def describe(conj = \"\\n\")\n parts = [ ]\n\n self.attrs.each do |attr|\n if (attr[:title].downcase == 'link')\n if (attr[:value][0] == '/')\n uri = URI.parse(self.source.attrs['url'])\n parts.push(\"#{attr[:title]}: #{uri.scheme}://#{uri.host}#{attr[:value]}\")\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n else\n parts.push(\"#{attr[:title]}: #{attr[:value]}\")\n end\n end\n\n return parts.join(conj)\n end",
"def fetch_details(attr)\n url = attr['href'].text\n if args = url.match('https?://github.com/([^\\/]+)/([^\\/]+)')\n data = @api[\"/repos/#{args[1]}/#{args[2]}\"].get\n github = Yajl::Parser.parse(data.body)\n\n tags = DeliciousLetter.build_tags(attr)\n\n template = Tilt.new('templates/github.haml')\n html = template.render(self, github: github, url: url, tags: tags)\n text = \"#{github['name']}:\\n#{github['description']}\\n#{url}\\n\\n\"\n\n {'text' => text, 'html' => html}\n end\n end",
"def attributes\n data[:attributes]\n end",
"def show\n @bread_menu = {m1: '属性管理', m2: '属性管理', m2_url: '/auction/attributes', m3: '属性详情'}\n end",
"def description; attributes[:description] || attributes[:desc] end",
"def attributes\n @attrs\n end",
"def extract_link_attributes(hash)\n select_link_attributes(hash).map do |attribute, value|\n \" #{attribute}=\\\"#{value}\\\"\"\n end\n end",
"def description\n attributes.fetch(:description)\n end",
"def list_item_attribute attribute, value, url=nil, url_options={}\n unless url.nil?\n value = link_to value, url, url_options\n end\n return \"<p class=\\\"list_item_attribute\\\"><b>#{attribute}</b>: #{value}</p>\"\n end",
"def exposed_attributes\n [ :id, :curriculum_core_id, :subject_id, :curriculum_grade_id, :curriculum_area_id,\n :standard, :description1, :description2]\n end",
"def link_address_props\n if link\n link.address_props\n end\n end",
"def metadata\n {:definitions => representer_attrs.grep(Definition).map {|definition| definition.name},\n :links => representer_attrs.grep(Link).map {|link| link.options[:as] ? {link.rel => {'as' => link.options[:as]}} : link.rel}\n }\n end",
"def attr; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribs\n\t\t@attributes\n\tend",
"def attributes\n data = super\n data[:edit_url] = edit_article_url(object,host: 'localhost:3000') if scope.email.include? 'sm'\n data\n end",
"def attributes; Common.attributes(@handle); end",
"def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.underscore.downcase,\n :name => name,\n :title => title,\n :bio => bio,\n :twitter_screen_name => twitter_screen_name,\n :permalink => permalink,\n :photo => portrait.url\n }\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def description\n @link.Description\n end",
"def related_attrs\n relationship = flex_options[:relationship_name]\n send relationship\n end",
"def attributes\n @context[:attributes]\n end",
"def contact_info(object, attr)\n if %w(phone fax).include?(attr)\n content_tag :span, phone_number(object.__send__(attr))\n elsif %w(email website).include?(attr)\n auto_link(object.__send__(attr).to_s).html_safe\n else\n object.__send__(attr).to_s\n end\n end",
"def label_details\n attributes.fetch(:labelDetails)\n end",
"def attributes\n ATTRIBUTES\n end",
"def attributes\n @_attributes\n end",
"def attrs\n @attrs\n end",
"def link_name\n title\n end",
"def link_fields\n self.class._module.link_fields\n end",
"def attrs\n @attrs\n end",
"def link_text\n name\n end",
"def api_attributes\n {\n :id => id.to_s,\n :type => self.class.name.downcase,\n :name => name,\n :title => title,\n :about => about,\n :portrait => portrait,\n :sort => sort,\n }\n end",
"def trail\n attribute_get(:linkname)\n end",
"def details=(_); end",
"def attributes\n hash = {\n \"author\" => @author,\n \"title\" => @title,\n \"summary\" => @summary,\n \"images\" => @images,\n \"source\" => @source,\n \"date\" => @date\n }\n end",
"def full_details\n data = self.class\n .data_keys\n .map { |k| [k, send(\"#{k}\")] }\n .to_h\n { id: id,\n url: url }.merge(data)\n end",
"def url\n @attributes[:url]\n end",
"def url\n @attributes[:url]\n end",
"def data_attributes\n end",
"def attributes\n { \"id\" => id, \"title\" => title }\n end",
"def attributes\n @attributes ||= {}\n @attributes\n end",
"def link\n object[\"link\"]\n end"
] | [
"0.7560308",
"0.7477011",
"0.69372046",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6813861",
"0.6753768",
"0.6753768",
"0.6645861",
"0.66313994",
"0.6492452",
"0.643893",
"0.64353955",
"0.64262706",
"0.63956445",
"0.6377181",
"0.63646454",
"0.63344276",
"0.6310528",
"0.6238467",
"0.62226",
"0.62175703",
"0.61959535",
"0.6171038",
"0.6137908",
"0.6121166",
"0.61017126",
"0.6100981",
"0.6099503",
"0.60916686",
"0.6084323",
"0.6084323",
"0.6077544",
"0.6069659",
"0.60589814",
"0.60574114",
"0.6044674",
"0.6010972",
"0.60051715",
"0.6001763",
"0.5970459",
"0.59700805",
"0.595793",
"0.59422725",
"0.59364897",
"0.5916987",
"0.5916071",
"0.5915531",
"0.59139115",
"0.5904574",
"0.59043896",
"0.5886674",
"0.5884046",
"0.58806133",
"0.58744687",
"0.587184",
"0.5868471",
"0.5868471",
"0.5868471",
"0.5868471",
"0.5868471",
"0.5868471",
"0.5868471",
"0.58213377",
"0.5817821",
"0.5816361",
"0.58137864",
"0.58114475",
"0.58114475",
"0.58114475",
"0.5806006",
"0.5803501",
"0.58032936",
"0.5797602",
"0.5788821",
"0.5784706",
"0.57823193",
"0.57674116",
"0.57644546",
"0.57513916",
"0.57488996",
"0.57480997",
"0.5738149",
"0.57347083",
"0.5730291",
"0.57258046",
"0.57202494",
"0.5716477",
"0.5716477",
"0.5716199",
"0.57111394",
"0.5709793",
"0.5708768"
] | 0.0 | -1 |
POST /recalls POST /recalls.json | def create
@recall = Recall.new(params[:recall])
respond_to do |format|
if @recall.save
format.html { redirect_to edit_admin_recall_path(@recall), notice: 'Отзыв успешно добавлен.' }
format.json { render json: @recall, status: :created, location: @recall }
else
format.html { render action: "edit" }
format.json { render json: @recall.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_recurring_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::REBILL_FREQUENCY, options[:rebill_frequency])\r\n request.Set(RocketGate::GatewayRequest::REBILL_AMOUNT, options[:rebill_amount])\r\n request.Set(RocketGate::GatewayRequest::REBILL_START, options[:rebill_start])\r\n end",
"def referral\n time_key = Time.now.strftime \"%Y-%m-%dT%H\"\n $redis.sadd \"rfr:#{@account}:days\", Date.today\n $redis.incr \"rfr:#{@account}:#{@client}:#{Date.today}\"\n $redis.incr \"rfr:#{@account}:#{Date.today}\"\n $redis.incr \"rfr:#{@account}:#{@client}:#{time_key}\"\n $redis.expire \"rfr:#{@account}:#{time_key}\", 3.weeks.to_i\n\n render :json => { :status => \"Success\" }\n end",
"def create\n authorize! :create, :repost\n @fun.repost_by current_user\n Stat.recount @fun.user, :reposts\n render json: { success: true }\n end",
"def create\n @recruiter = Recruiter.new(recruiter_params)\n\n if @recruiter.save\n render_json_message({:success => t('.success')}, 201, {id: @recruiter.id})\n else\n render_json_message({:errors => @recruiter.errors.messages}, 422)\n end\n\n end",
"def reminderCall\n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n call = @client.account.calls.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :url => 'https://clockairos.herokuapp.com/twilio/call',\n :method => 'POST',\n :fallback_method => 'GET',\n :status_callback_method => 'GET',\n :if_machine => 'Hangup',\n :timeout => '30',\n :record => 'false'\n )\n puts call.to\n end",
"def post_calls(calls, opts = {})\n post_calls_with_http_info(calls, opts)\n nil\n end",
"def runTokenRenewalPost\n msg = Thread.current.to_s\n renew = Stopwatch.new(msg)\n renew.start\n payload = \"grant_type=#{@grant_type}&scope=#{@scope}&client_id=#{@key}&client_secret=#{@secret}\"\n response = RestClient.post @token_server,\n payload,\n {\n :content_type => \"application/x-www-form-urlencoded\"\n }\n ensure\n # make sure to print the elapsed time for the renewal.\n renew.stop\n logger.info(\"WAPI: renew token post: stopwatch: \"+renew.pretty_summary)\n end",
"def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end",
"def list_recurring_details(shopper_reference:, merchant_account: @merchant_account, contract: \"RECURRING\")\n postJSON(\"/Recurring/v12/listRecurringDetails\",\n shopperReference: shopper_reference,\n recurring: { contract: contract },\n merchantAccount: merchant_account\n )\n end",
"def repost\n success = @report.repost_by!(auth_user, params[:report] )\n respond_to do|format|\n format.json { render json: { report: @report, success: success } }\n format.html { redirect_back(action: 'index') }\n end\n end",
"def create\n @rehearsal_call = RehearsalCall.new(rehearsal_call_params)\n\n respond_to do |format|\n if @rehearsal_call.save\n format.html { redirect_to @rehearsal_call, notice: 'Rehearsal call was successfully created.' }\n format.json { render :show, status: :created, location: @rehearsal_call }\n else\n format.html { render :new }\n format.json { render json: @rehearsal_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_recurrence = EventRecurrence.new(event_recurrence_params)\n @call = Call.new(call_params)\n @call.event_recurrence = @event_recurrence \n\n respond_to do |format|\n if @call.save && @event_recurrence.save\n format.html { redirect_to @call, notice: 'Call was successfully created.' }\n format.json { render :show, status: :created, location: @call }\n else\n format.html { render :new }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_view_rankings(date, expires_in: 1.minute)\n request(\"#{reportbooru_server}/post_views/rank?date=#{date}\", expires_in)\n end",
"def create\n @user_replay_rate = UserReplayRate.new(user_replay_rate_params)\n\n respond_to do |format|\n if @user_replay_rate.save\n format.html { redirect_to @user_replay_rate, notice: 'User replay rate was successfully created.' }\n format.json { render :show, status: :created, location: @user_replay_rate }\n else\n format.html { render :new }\n format.json { render json: @user_replay_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_redemption_request(account_slug, \r\n redemption_request_form)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts/{account_slug}/redemption-requests'\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'account_slug' => account_slug\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.post _query_url, headers: _headers, parameters: redemption_request_form.to_json\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end",
"def recurring(money, creditcard, options = {})\r\n requires!(options, :rebill_frequency)\r\n\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n service = RocketGate::GatewayService.new\r\n if test? # Test transaction?\r\n service.SetTestMode(true) # Set internal test mode\r\n end\r\n\r\n#\r\n#\tAdd the details of the transaction to the request.\r\n#\r\n add_merchant_data(request, options) # Add merchant information\r\n add_customer_data(request, options) # Add customer information\r\n add_invoice_data(request, money, options)\r\n add_recurring_data(request, options)\r\n add_creditcard(request, creditcard) # Add credit card data\r\n add_address(request, options[:billing_address])\r\n add_business_rules_data(request, options)\r\n\r\n#\r\n#\tPeform the transaction and return a response.\r\n#\r\n service.PerformPurchase(request, response)\r\n return create_response(response)\r\n end",
"def create\n @raffle = Raffle.new(raffle_params)\n @raffle.update(user_id: current_user.id)\n respond_to do |format|\n if @raffle.save\n status = 'Participa en la rifa ' + @raffle.name + '. Para visitarla ingresa a https://rifapp-web.herokuapp.com/raffles/' + @raffle.id.to_s\n access_token = prepare_access_token(ENV[\"TWITTER_ACCESS_TOKEN\"], ENV[\"TWITTER_ACCESS_TOKEN_SECRET\"])\n url = '/1.1/statuses/update.json?status=' + URI::escape(status)\n response = access_token.post(url)\n puts response\n #url = 'graph.facebook.com/v2.9/100019068038209/feed?message=' + URI::escape(status) + '&access_token=' + ENV[\"FB_ACCESS_TOKEN\"]\n #RestClient.post url, {}\n format.html { redirect_to created_user_path(current_user.id), notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rehearsal_call_params\n params.require(:rehearsal_call).permit(:rehearsal_id, :user_id)\n end",
"def renew_call_params\n params.require(:renew_call).permit(:description, :call_id)\n end",
"def create\n @recur = Recur.new(recur_params)\n\n respond_to do |format|\n if @recur.save\n format.html { redirect_to @recur, notice: 'Recur was successfully created.' }\n format.json { render :show, status: :created, location: @recur }\n else\n format.html { render :new }\n format.json { render json: @recur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recount_money\n @team = Team.find(params[:id])\n @money = get_money_array(@team, params[:amount].to_f, params[:fromDate], params[:toDate])\n \n respond_to do |format|\n format.json {\n render json: @money\n }\n end\n end",
"def tel_recharge(params={})\n login if @@cookie.blank?\n\n number = params[:number]\n number = \"#{number[0,3]} #{number[3,4]} #{number[7,4]}\"\n\n _params = {'case.internal.step' => '2', 'case.hidden.always' => 'OPERATOR_LOG_ID', 'OPERATOR_LOG_ID' =>'139506759904711',\n 'case.hidden.always' => 'case.menuid', 'case.menuid' => '050116', 'flagone'=> 0, 'flagtwo' => 1,\n 'rateofexchange' => 100, 'ratejs' => 2, 'hp_no' => '371603042', 'number_limit' => 11, 'sys_max_rech' => '999999999',\n 'trans_evType' => 2, 'trans_evBalancetype' => 0, 'WHERE_EV_DL_MASTER_MESSAGE' => 0,'trans_pin' => '148874',\n 'minbase' => 1, 'pin_min_len' => 4, 'pin_max_len' => 30, 'save_trans_msisdn' =>number, 'trans_msisdn' => number,\n 'tip_hpone' => params[:number], 'trans_money' => params[:total]}\n\n uri = URI(TEL_RECHARGE)\n p _params\n uri.query = URI.encode_www_form(_params)\n req = Net::HTTP::Post.new(uri.request_uri,{'Cookie' => @@cookie})\n res = @https.request(req)\n result = res.body.force_encoding(\"gb2312\").encode!('utf-8')\n p result\n result\n end",
"def set_renew_call\n @renew_call = RenewCall.find(params[:id])\n end",
"def post_request\n\t\turl = request.fullpath.gsub(\"/api\", \"\")\n\t\t@rr = Rr.where(\"url = ?\", url).first\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => rr.response}\n\t\t\tformat.xml { render :xml => @rr.response}\n\t\t\tformat.js { render :js => @rr.response}\n\t\tend\n\tend",
"def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_retry_test method_name, instructions\n retry_test_uri = HOST + \"retry_test\"\n uri = URI.parse retry_test_uri\n headers = {\"Content-Type\" => \"application/json\"}\n data = {\"instructions\" => {method_name => instructions.to_a}}.to_json\n http = Net::HTTP.new uri.host, uri.port\n request = Net::HTTP::Post.new uri.request_uri, headers\n request.body = data\n http.request request\n end",
"def create\n if params[:user_id] && params[:recruiter_id] && params[:review]\n user = User.find(params[:user_id])\n # puts user\n recruiter = Recruiter.find(params[:recruiter_id])\n # puts recruiter\n ################################\n params[\"got_interview\"] ? got_interview = params[\"got_interview\"] : got_interview = false\n params[\"got_job\"] ? got_job = params[\"got_job\"] : got_job = false\n got_job ? got_interview = true : \"null\" #if got job then must have had interview\n params[\"rating\"] ? rating = params[\"rating\"] : rating = 0 #0 means not rated\n params[\"recommended\"] ? recommended = params[\"recommended\"] : recommended = false\n params[\"ghoster\"] ? ghoster = params[\"ghoster\"] : ghoster = false\n # puts \"*********$\"\n # puts params\n # puts recommended\n # puts params[:recommended]\n # puts \"***************$\"\n review = Review.new(\n user_id: user.id,\n recruiter_id: recruiter.id,\n review: params[\"review\"],\n got_interview: got_interview,\n got_job: got_job,\n rating: rating,\n recommended: recommended,\n ghoster: ghoster\n ) #Review.new\n\n if review.save\n render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"ERROR SAVE POSTED REVIEW\"}\n end\n ################################\n # render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"no user_id or recruiter_id or review\"}\n end # if params[:user_id]\n end",
"def create\n @raffle = Raffle.new(raffle_params)\n @raffle.collected_money = 0\n respond_to do |format|\n if @raffle.save\n for follower in @raffle.user.followers\n notification = Notification.new()\n notification.content = \"#{@raffle.user.name} just released the raffle #{@raffle.name}\"\n notification.user_id = follower.id\n notification.raffle_id = @raffle.id\n notification.save\n end\n format.html { redirect_to @raffle, notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recruiter\n recruiter = Recruiter.find(params[:recruiter_id])\n job_application.update!(recruiter_id: recruiter.id)\n job_application.matched!\n render json: job_application\n end",
"def create\n @call = Call.new(params[:call])\n \n respond_to do |format|\n if @call.save\n \n result = OutgoingCallerId.find(:last)\n twcall = @twilio_client.account.calls.create(\n from: result.phone_number,\n to: @call.to, \n url: \"#{url_for(@call)}/twiml.xml\")\n \n @call.update_attribute :sid, twcall.sid\n format.html { redirect_to @call, notice: \"Call was successfully created.#{url_for(@call)}\" }\n format.json { render json: @call, status: :created, location: @call }\n else\n format.html { render action: \"new\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publish_rest_method(record, rest_method_name)\n subscribers = Hyperloop.redis_instance.hgetall(\"HRPS__#{record.class}__#{record.id}__rest_method__#{rest_method_name}\")\n time_now = Time.now.to_f\n scrub_time = time_now - 24.hours.to_f\n message = {\n record_type: record.class.to_s,\n id: record.id,\n rest_method: rest_method_name\n }\n subscribers.each_slice(10) do |slice|\n channel_array = []\n slice.each do |session_id, last_requested|\n if last_requested.to_f < scrub_time\n Hyperloop.redis_instance.hdel(\"HRPS__#{record.class}__#{record.id}__rest_method__#{rest_method_name}\", session_id)\n next\n end\n channel_array << \"hyper-record-update-channel-#{session_id}\"\n end\n if Hyperloop.resource_transport == :pusher\n _pusher_client.trigger_async(channel_array, 'update', message)\n elsif Hyperloop.resource_transport == :action_cable\n channel_array.each do |channel|\n ActionCable.server.broadcast(channel, message)\n end\n end\n end\n end",
"def create\n @remixer = Remixer.new(remixer_params)\n\n respond_to do |format|\n if @remixer.save\n format.html { redirect_to @remixer, notice: 'Remixer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @remixer }\n else\n format.html { render action: 'new' }\n format.json { render json: @remixer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n call = params[:call]\n call[:vote] = parse_vote(call[:vote])\n @call = Call.new(call)\n \n respond_to do |format|\n if @call.save\n format.html { redirect_to(@call, :notice => 'Call was successfully created.') }\n format.xml { render :xml => @call, :status => :created, :location => @call }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @call.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_search_rankings(date, expires_in: 1.minute)\n request(\"#{reportbooru_server}/post_searches/rank?date=#{date}\", expires_in)\n end",
"def answer\n RecallTest.create(recalled_correctly: params[:answer_correct],\n chunk_id: params[:chunk_id], recall_date: Time.now)\n render nothing: true\n end",
"def again(post, receiver)\n if post.is_a?(Repost)\n 5\n else\n 10\n end\n end",
"def patch_redemption_request(account_slug, \r\n redemption_request_id)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts/{account_slug}/redemption-requests/{redemption_request_id}/redemption'\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'account_slug' => account_slug,\r\n 'redemption_request_id' => redemption_request_id\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.patch _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n end",
"def place_call\n client = Twilio::REST::Client.new(Settings.twilio.account_sid, Settings.twilio.auth_token)\n params = {\n from: call.caller_id,\n to: call.member_phone_number,\n url: call_start_url(call),\n status_callback: member_call_event_url(call),\n status_callback_method: 'POST',\n status_callback_event: %w[initiated ringing answered completed]\n }\n client.calls.create params\n rescue Twilio::REST::RestError => e\n # 13223: Dial: Invalid phone number format\n # 13224: Dial: Invalid phone number\n # 13225: Dial: Forbidden phone number\n # 13226: Dial: Invalid country code\n # 21211: Invalid 'To' Phone Number\n # 21214: 'To' phone number cannot be reached\n call.action.destroy!\n call.update!(twilio_error_code: e.code, status: 'failed', action_id: nil)\n if (e.code >= 13_223 && e.code <= 13_226) || [21_211, 21_214].include?(e.code)\n add_error(:member_phone_number, I18n.t('call_tool.errors.phone_number.cant_connect'))\n else\n Rails.logger.error(\"Twilio Error: API responded with code #{e.code} for #{call.attributes.inspect}\")\n add_error(:base, I18n.t('call_tool.errors.unknown'))\n end\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def subscribe_rest_method(record, rest_method_name)\n return unless session.id\n time_now = Time.now.to_f.to_s\n session_id = session.id.to_s\n Hyperloop.redis_instance.hset(\"HRPS__#{record.class}__#{record.id}__rest_method__#{rest_method_name}\", session_id, time_now)\n end",
"def a_recruiter__init_linkedin_tokens(re_auth_actions, get_auth_url = false)\n \n \n # -- PROCESS\n # 1. Check session object for 'user' and 'user_connector' -> get the LinkedIn keys\n # 2. [found] attempt to make a basic call (validate the tokens and permissions)\n # [successful] Redirect to funnel step (either publish job or job publishing home)\n # [unsuccessful] Redirect to callback_url\n # 3. [not found]\n # Redirect to callbak_url (authorization)\n \n \n callback_url = linkedin_auth_accept_url\n \n \n # -- Construct the 'accept' and 'cancel' based on the 're_auth_action's parameter\n \n re_auth_querys = \"\"\n \n if re_auth_actions && (re_auth_actions[:accept] || re_auth_actions[:cancel])\n re_auth_querys = re_auth_querys + \"?\"\n if re_auth_actions[:accept]\n re_auth_querys = re_auth_querys + \"ra_a=\" + re_auth_actions[:accept]\n re_auth_querys = re_auth_querys + \"&\" if re_auth_actions[:cancel]\n end\n re_auth_querys = re_auth_querys + \"ra_c=\" + re_auth_actions[:cancel] if re_auth_actions[:cancel]\n end\n \n \n # -- Addition for the 'a_recruiter' implementation\n # callback_url = callback_url + re_auth_querys\n callback_url = callback_url + \"?a_recruiter=true\"\n \n \n # -- Create the REQUEST TOKEN\n \n # session[:request_token] = get_linkedin_consumer().get_request_token({:oauth_callback => callback_url})\n \n \n # -- 1. Get a FRESH request token from the LinkedIn consumer\n # Store it in SESSION\n session[:request_token] = get_linkedin_consumer(3).get_request_token({:oauth_callback => callback_url})\n \n # -- 2. Set the SESSION - TOKEN and SECRET attributes\n if session[:request_token]\n session[:access_token] = session[:request_token].token\n session[:access_secret] = session[:request_token].secret\n end\n \n \n # -- Try and perform a basic linkedin_call to verify if the right permissions exist\n \n # @my_profile = a_recruiter__do_linkedin(\"my_groups\", nil, nil, {:access_token => session[:access_token], :access_secret => session[:access_secret]})\n \n \n # -- Return the 'auth_url' if the method's 'get_aurh_url' flag is set to 'true'\n \n session[:request_token].authorize_url if get_auth_url\n \n end",
"def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend",
"def post(request_configuration=nil)\n request_info = self.to_post_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::AccessReviewHistoryInstance.create_from_discriminator_value(pn) }, error_mapping)\n end",
"def create\n @call = Call.new(call_params)\n\n respond_to do |format|\n if @call.save\n format.html { redirect_to :back, notice: 'Call was successfully created.' }\n format.json { render action: 'show', status: :created, location: @call }\n else\n format.html { render action: 'new' }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end",
"def set_rehearsal_call\n @rehearsal_call = RehearsalCall.find(params[:id])\n end",
"def call_api(req, rtype, data=nil)\n msg(\"#{rtype} REQ: #{req}\")\n res_hash = {:status => true, :response => \"\"}\n begin\n if rtype == 'POST'\n get_response = @client.send_post(req, data)\n else\n get_response = @client.send_get(req)\n end\n rescue Exception => e\n puts \"Raised Exception: #{e.message}.\"\n res_hash[:status] = false\n res_hash[:response] = e.message\n else\n res_hash[:status] = true\n res_hash[:response] = get_response\n end\n msg(\"RESPONSE: #{res_hash}\")\n return res_hash\n end",
"def create\n @call = Call.new(call_params)\n\n respond_to do |format|\n if @call.save\n record_call_activity\n format.html { redirect_to @call, notice: 'Call was successfully created.' }\n format.json { render :show, status: :created, location: @call }\n else\n format.html { render :new }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_new_receiver\n \n @receiver_added = Receiver.last\n $receivers << @receiver_added\n respond_to do |format|\n format.html\n format.json {render json: $receivers}\n end\n end",
"def create\n @call = Call.new(call_params)\n @call.client = ClientPhone.find_by(phone: @call.phone).try(:client)\n @call.internal = Internal.find(params[:call][:internal_id])\n @call.call_type = CallType.find(params[:call][:call_type_id])\n\n respond_to do |format|\n if @call.save\n format.html { redirect_to @call, notice: 'Call was successfully created.' }\n format.json { render status: :ok, json: @call }\n else\n format.html { render :new }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rreply = Rreply.new(rreply_params)\n\n respond_to do |format|\n if @rreply.save\n format.html { redirect_to @rreply, notice: 'Rreply was successfully created.' }\n format.json { render :show, status: :created, location: @rreply }\n else\n format.html { render :new }\n format.json { render json: @rreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recitator = Recitator.new(recitator_params)\n\n respond_to do |format|\n if @recitator.save\n format.html { redirect_to @recitator, notice: 'Recitator was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recitator }\n else\n format.html { render action: 'new' }\n format.json { render json: @recitator.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_calls_with_http_info(calls, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CallsApi.post_calls ...'\n end\n # verify the required parameter 'calls' is set\n if @api_client.config.client_side_validation && calls.nil?\n fail ArgumentError, \"Missing the required parameter 'calls' when calling CallsApi.post_calls\"\n end\n # resource path\n local_var_path = '/calls'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(calls) \n\n # return_type\n return_type = opts[:return_type] \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CallsApi#post_calls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def subscriber_add(statuspage_id, method, address, silent = '1', granular = '')\n data = {}\n data['statuspage_id'] = statuspage_id\n data['method'] = method\n data['address'] = address\n data['silent'] = silent\n data['granular'] = granular\n\n request :method => :post,\n :url => @url + 'subscriber/add',\n :payload => data\n end",
"def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end",
"def new\n @call_history = CallHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @call_history }\n end\n end",
"def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end",
"def create_account_and_subscribe_single_call account_name\n contact = {\n address1: '1051 E Hillsdale Blvd',\n city: 'Foster City',\n country: 'United States',\n firstName: 'John',\n lastName: 'Smith',\n zipCode: '94404',\n state: 'CA'\n }\n #get the rate plans for the product\n product_rate_plan = get_product_rate_plans_for_product 'Medium Monthly Plan'\n myDate = DateTime.now + 10.days;\n #create an account and subscribe to a rate plan at the same time\n subscribe(\n account_name,\n contact,\n DateTime.now.strftime(\"%Y-%m-%d\"),\n myDate.strftime(\"%Y-%m-%d\"),\n product_rate_plan['id']\n )\nend",
"def create\n @rum = Rum.new(params[:rum])\n\n respond_to do |format|\n if @rum.save\n format.html { redirect_to @rum, notice: 'Rum was successfully created.' }\n format.json { render json: @rum, status: :created, location: @rum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@votereply = current_user.votereplies.build(params[:reply_id])\n @votereply = Votereply.find(params[:reply_id])\n if (!@votereply)\n @votereply = current_user.votereplies.build(params[:votereply])\n end\n @votereply.rcount = @votereply.rcount + 1\n @votereply.update_attributes(params[:rcount])\n\n respond_to do |format|\n if @votereply.save\n format.html { redirect_to(@votereply, :notice => 'Votereply was successfully created.') }\n format.xml { render :xml => @votereply, :status => :created, :location => @votereply }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @votereply.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def webhook_response\n # if get request, checks if it is the subscription call\n # if it is, echoes back the hub.challenge token\n if request.get?\n params = request.query_parameters\n\n if params['hub.mode'] == 'subscribe' && params['hub.verify_token'] == ENV['VERIFICATION_TOKEN']\n render json: { 'hub.challenge': params['hub.challenge'] }, status: :ok\n else\n raise 'Bad Request'\n end\n\n # if post request, checks if it is an activity creation post\n elsif request.post?\n params = request.request_parameters\n\n if params['object_type'] == 'activity' && params['aspect_type'] == 'create'\n # potentially should make it only change if the name is one of the default ones, so custom names won't be overriden\n this_user = User.find(params['owner_id'])\n this_user.update_user_token!(@client)\n\n user_client = this_user.generate_user_client\n\n updated_activity = user_client.update_activity(\n id: params['object_id'],\n name: Quote.order(\"RANDOM()\").first.format_quote\n )\n render json: {}, status: :ok\n else\n render json: {}, status: :ok\n end\n else\n raise 'Bad Request'\n end\n end",
"def set_user_view_count(email, count)\n\n response = rest_post_call($LR_FIXTURES_URL + '/set-user-view-count', {'user_view_email' => email, 'view_count' => count.to_s, 'submit' => 'Set view count'})\n\n if (response.code != '302') then\n raise \"Could not set view count: \" + response.body\n end\n\nend",
"def redo!\n send_request\n end",
"def confirm_follow\n req = Net::HTTP::Post.new(@uri, initheader = {'Content-Type' => 'application/json'})\n req.body = {'queue': 'USER', 'method': 'confirm_follow', 'user_id': '2', '_id': ''}.to_json\n res = Net::HTTP.start(@uri.hostname, @uri.port) do |http|\n http.request(req)\n end\n return res.body\nend",
"def add_recurring_fields(rebill_first_date, rebill_expr, reb_cycles, reb_amount)\n @PARAM_HASH['REBILLING'] = '1'\n @PARAM_HASH['REB_FIRST_DATE'] = rebill_first_date\n @PARAM_HASH['REB_EXPR'] = rebill_expr\n @PARAM_HASH['REB_CYCLES'] = reb_cycles\n @PARAM_HASH['REB_AMOUNT'] = reb_amount\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @call_history = CallHistory.new(params[:call_history])\n\n respond_to do |format|\n if @call_history.save\n format.html { redirect_to(@call_history, :notice => 'Call history was successfully created.') }\n format.json { render :json => @call_history, :status => :created, :location => @call_history }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @call_history.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def retry_change_requests=(retri); end",
"def hangup_all_calls()\n path = @version + '/Call/Hangup/All/'\n method = 'POST'\n return request(path, method)\n end",
"def create\n @friend = User.find(params[:friend_id])\n if @friend.super_user?\n redirect_to(root_url)\n return\n end\n current_user.require_friend(@friend)\n msg = { resource: current_user.name+\" has just sent you a request friend\" ,\n friend_id: params[:friend_id],\n user_id: current_user.id\n } \n $redis.publish 'rt-change', msg.to_json\n redirect_to request.referrer\n \n end",
"def send_digits(params)\n path = @version + '/Call/SendDigits/'\n method = 'POST'\n return request(path, method, params)\n end",
"def friend_request(type, options)\n options = options.clone\n\n if options[:subreddit]\n options[:r] = options[:subreddit]\n options.delete :subreddit\n end\n\n post(\"api/#{type}\", options)\n end",
"def cancel_recurring_subscription(subscriber_id, merchant_account)\n fetch_route = find_route(__method__.to_s)\n requested_path = fetch_route[:path]\n\n client.post(\n requested_path,\n fetch_route[:api],\n {\n 'contract' => 'RECURRING',\n 'shopperReference' => subscriber_id,\n 'merchantAccount' => merchant_account\n }\n )\n end",
"def create\n @recruiter = Recruiter.new(params[:recruiter])\n\n respond_to do |format|\n if @recruiter.save\n user_session.loginRecruiter(@recruiter.id)\n format.html { redirect_to @recruiter, notice: 'Recruiter was successfully created.' }\n format.json { render json: @recruiter, status: :created, location: @recruiter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rescan_wallet\n client.make_request('/rescan-wallet', 'post', params: {})\n end",
"def create\n @repurchase = Repurchase.new(params[:repurchase])\n\n respond_to do |format|\n if @repurchase.save\n format.html { redirect_to @repurchase, notice: 'Repurchase was successfully created.' }\n format.json { render json: @repurchase, status: :created, location: @repurchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repurchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_call(to, path, call_back_path)\n from = '+18015131966'\n req_params = {\n from: from,\n to: to,\n url: \"#{ENV['CALL_SERVICE_URL']}#{path}\",\n if_machine: \"Hangup\",\n status_callback: \"#{ENV['CALL_SERVICE_URL']}#{call_back_path}\",\n timeout: 10\n\n }\n\n if Rails.env == \"development\"\n url = \"http://127.0.0.1:4567/make_call\"\n RestClient.post url, req_params\n else\n client = Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_TOKEN\"])\n account = client.account\n call = account.calls.create(req_params)\n end\n end",
"def roar(payload)\n https = Net::HTTP.new(@request[:uri].host, @request[:uri].port)\n https.use_ssl = @request[:ssl]\n https.post(@request[:uri].path, cage(payload), { 'pnthr' => @request[:id] })\n end",
"def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end",
"def makecall\n \n client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])\n @call = client.account.calls.create(\n :from => TWILIO_CONFIG['from'], # From your Twilio number\n :to => '+19493228496', # To any number\n # Fetch instructions from this URL when the call connects\n :url => 'http://snipit.herokuapp.com/voicein'\n )\n end",
"def create\n @call = Call.new(call_params)\n \n # put your own credentials here \n \n respond_to do |format|\n if @call.save\n format.html { redirect_to @call, notice: 'Call was successfully created.' }\n format.json { render :show, status: :created, location: @call }\n else\n format.html { render :new }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @call = Call.new(params[:call]) \n\n respond_to do |format|\n if @call.save\n format.html { redirect_to @call, notice: 'Call was successfully created.' }\n format.json { render json: @call, status: :created, location: @call }\n\n # Schedule call \n #IRON_CLIENT.schedules.create('CallTrigger', {id: @call.id}, {start_at: @call.time})\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @call_history = CallHistory.new(call_history_params)\n\n respond_to do |format|\n if @call_history.save\n format.html { redirect_to @call_history, notice: 'Call history was successfully created.' }\n format.json { render :show, status: :created, location: @call_history }\n else\n format.html { render :new }\n format.json { render json: @call_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rewards_data\r\n BnetApi.make_request('/sc2/data/rewards')\r\n end",
"def create\n megam_rest.post_subscriptions(to_hash)\n end",
"def update_rebill(params = {})\r\n @PARAM_HASH['TRANS_TYPE'] = \"SET\"\r\n @PARAM_HASH['REBILL_ID'] = params[:rebill_id]\r\n @PARAM_HASH['NEXT_DATE'] = params[:next_date] || ''\r\n @PARAM_HASH['REB_EXPR'] = params[:reb_expr] || ''\r\n @PARAM_HASH['REB_CYCLES'] = params[:reb_cycles] || ''\r\n @PARAM_HASH['REB_AMOUNT'] = params[:reb_amount] || ''\r\n @PARAM_HASH['NEXT_AMOUNT'] = params[:next_amount] || ''\r\n @PARAM_HASH[\"TEMPLATE_ID\"] = params[:template_id] || ''\r\n @api = \"bp20rebadmin\"\r\n end",
"def update_rebill(params = {})\r\n @PARAM_HASH['TRANS_TYPE'] = \"SET\"\r\n @PARAM_HASH['REBILL_ID'] = params[:rebill_id]\r\n @PARAM_HASH['NEXT_DATE'] = params[:next_date] || ''\r\n @PARAM_HASH['REB_EXPR'] = params[:reb_expr] || ''\r\n @PARAM_HASH['REB_CYCLES'] = params[:reb_cycles] || ''\r\n @PARAM_HASH['REB_AMOUNT'] = params[:reb_amount] || ''\r\n @PARAM_HASH['NEXT_AMOUNT'] = params[:next_amount] || ''\r\n @PARAM_HASH[\"TEMPLATE_ID\"] = params[:template_id] || ''\r\n @api = \"bp20rebadmin\"\r\n end",
"def rest_post(base_uri,json_payload,params)\n begin\n puts base_uri,json_payload\n @response = RestClient.post(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def callback\n twilio_id = params[:CallSid]\n call = Call.where('twilio_id = ?', twilio_id).first\n call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])\n render :json => 'callback success'\n end",
"def get_redemption_requests(account_slug, \r\n page = 1, \r\n limit = 10, \r\n filter = nil, \r\n sort = nil)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts/{account_slug}/redemption-requests'\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'account_slug' => account_slug\r\n }\r\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\r\n 'page' => page,\r\n 'limit' => limit,\r\n 'filter' => filter,\r\n 'sort' => sort\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end",
"def create\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new(params[:billed_call])\n\n respond_to do |format|\n if @billed_call.save\n @bill.billed_taxes.each do |billed_tax|\n billed_tax.recalculate\n end\n #We have to save the flag here, other wise it woun't reflect when the landing page is loaded\n @bill.pending_flag = true\n @bill.save\n call_rake :regenerate_bill, :bill_id => params[:bill_id]\n flash[:notice] = 'Bill is being re-generated.'\n format.html { redirect_to(billing_session_bills_url(@bill.billing_session) + \"?page=\" + params[:page].to_s) }\n format.xml { render :xml => @billed_call, :status => :created, :location => @billed_call }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billed_call.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_request(client, post_information_hash, additional_hash = nil)\n new_hash = {:content_type => \"application/json\"}\n additional_hash ||= {} \n new_hash.merge!(additional_hash)\n\n begin\n client.post(JSON.generate(post_information_hash, {:max_nesting => 100}), new_hash)\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end",
"def new\n @recruiter = Recruiter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recruiter }\n end\n end",
"def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end",
"def re_record_prompt\n active_recording = active_call.recordings.create!(duration: params['RecordingDuration'], recording_url: params['RecordingUrl'])\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Thank you.'\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n r.Gather(\n action: ivr_recordings_new_recording_url,\n method: 'get',\n 'numDigits' => 1,\n 'finishOnKey' => ''\n ) do |gather|\n r.Play(active_recording.recording_url)\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n end\n play_audio(r, 'goodbye')\n r.Hangup\n end\n\n render_twiml response\n end",
"def receive\n # I chose to store the whole webhook response, as well as breaking out\n # certain pieces of it into columns on the Webhooks model. IMO, it makes\n # things a bit more easy to read and work with.\n\n # Storing the whole webhook might not be the best solution here, but in\n # the future, if something from the original webhook was needed, we have\n # record of it and can find/work with it.\n data = JSON.parse(request.body.read)\n event = data['payload']['event']\n event_name = data['payload']['event_type']['name']\n start_time = event['start_time']\n end_time = event['end_time']\n\n canceled = event['canceled']\n canceler = event['canceler_name']\n cancel_reason = event['cancel_reason']\n canceled_at = event['canceled_at']\n\n invitee = data['payload']['invitee']\n invitee_name = invitee['name']\n invitee_email = invitee['email']\n\n Webhook.create(\n data: data.as_json, \n canceled: canceled,\n event_name: event_name,\n start_time: start_time,\n end_time: end_time,\n canceler: canceler,\n cancel_reason: cancel_reason,\n canceled_at: canceled_at,\n invitee_name: invitee_name,\n invitee_email: invitee_email)\n end",
"def call_rest(action, url, headers, ref, body = nil)\n begin\n # change url based on if we have a ref or not\n if ref.nil?\n url = url\n else\n url = url + \"/\" + ref\n end\n\n # set params for api call\n params = {\n :method => action,\n :url => url,\n :verify_ssl => false,\n :headers => headers\n }\n\n # generate payload data\n params[:payload] = body if body\n log(:info, \"call_rest: Request URL: #{url}\")\n log(:info, \"call_rest: Request Action: #{action}\")\n log(:info, \"call_rest: Request Headers: #{headers.inspect}\")\n log(:info, \"call_rest: Request Payload: #{params[:payload]}\")\n\n # execute the request\n RestClient::Request.new(params).execute\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"call_rest: #{err}. Returning nil.\")\n return nil\n end\nend",
"def post(data = {})\n call data, method: :post\n end",
"def create\n @phone_call = PhoneCall.new(phone_call_params)\n\n respond_to do |format|\n if @phone_call.save\n format.html { redirect_to @phone_call, flash: { success: \"Phone call was successfully created.\" } }\n format.json { render action: 'show', status: :created, location: @phone_call }\n else\n format.html { render action: 'new' }\n format.json { render json: @phone_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recycle\n authorize @address\n\n respond_to do |format|\n if @address.save\n flash[:success] = \"Address was successfully recycled.\"\n format.html { head :no_content }\n format.json { render json: {locale: I18n.locale,\n user_id: @user.id} }\n else\n flash[:danger] = \"There was a problem recycling the address.\"\n format.html { head :no_content }\n format.json { render json: @address.errors,\n status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.567116",
"0.5559898",
"0.5416588",
"0.5378289",
"0.5366476",
"0.53353304",
"0.53180367",
"0.53179556",
"0.5256255",
"0.5251056",
"0.5249315",
"0.52386236",
"0.52283096",
"0.5218163",
"0.52126366",
"0.5175188",
"0.5168212",
"0.51576376",
"0.5143518",
"0.5136228",
"0.5133309",
"0.51302266",
"0.50894195",
"0.50419015",
"0.5021997",
"0.5019478",
"0.50159466",
"0.49987563",
"0.4949005",
"0.49465987",
"0.49105453",
"0.4903796",
"0.48940983",
"0.48814493",
"0.48812228",
"0.4850075",
"0.48415452",
"0.48209938",
"0.48108488",
"0.4809677",
"0.48082727",
"0.48079592",
"0.48070797",
"0.48006505",
"0.47997734",
"0.4772122",
"0.47623864",
"0.47572377",
"0.4756866",
"0.47471514",
"0.474686",
"0.4741814",
"0.47410572",
"0.4738744",
"0.4735603",
"0.47287738",
"0.4724438",
"0.47229984",
"0.47213766",
"0.47199658",
"0.4717907",
"0.47171104",
"0.4705304",
"0.4691049",
"0.46895367",
"0.46888846",
"0.46883506",
"0.46882647",
"0.46875274",
"0.46852466",
"0.46837193",
"0.46828693",
"0.4679573",
"0.46795395",
"0.4676116",
"0.4672271",
"0.46693859",
"0.46649945",
"0.4659923",
"0.46588412",
"0.4654331",
"0.4652729",
"0.46521202",
"0.4648868",
"0.46487746",
"0.4646226",
"0.4646226",
"0.463347",
"0.46331984",
"0.4621227",
"0.46198443",
"0.4619296",
"0.46188068",
"0.46132258",
"0.4607452",
"0.46023232",
"0.46004522",
"0.4596184",
"0.45937276",
"0.45933568"
] | 0.47937158 | 45 |
PUT /recalls/1 PUT /recalls/1.json | def update
@recall = Recall.find(params[:id])
respond_to do |format|
if @recall.update_attributes(params[:recall])
format.html { redirect_to [:edit,:admin,@recall], notice: 'Отзыв успешно обновлен.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @recall.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @call.client = ClientPhone.find_by(phone: @call.phone).client\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n if @request_call.update_attributes(params[:request_call])\n format.html { redirect_to @request_call, notice: 'Request call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update number, routes\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 << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\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\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_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.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def update\n @call = current_user.calls.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to @call, :notice => 'Call was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def set_renew_call\n @renew_call = RenewCall.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @rehearsal_call.update(rehearsal_call_params)\n format.html { redirect_to @rehearsal_call, notice: 'Rehearsal call was successfully updated.' }\n format.json { render :show, status: :ok, location: @rehearsal_call }\n else\n format.html { render :edit }\n format.json { render json: @rehearsal_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @call.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 @number_call = NumberCall.find(params[:id])\n\n respond_to do |format|\n if @number_call.update_attributes(params[:number_call])\n format.html { redirect_to @number_call, notice: 'Number call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @number_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n record_call_activity\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: CALL_UPDATED }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: \"Call was successfully updated.\" }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call = Call.find(params[:id])\n\n respond_to do |format|\n if @call.update_attributes(params[:call])\n format.html { redirect_to(@call, :notice => 'Call was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @call.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roll_call.update(roll_call_params)\n format.html { redirect_to @roll_call, notice: 'Roll call was successfully updated.' }\n format.json { render :show, status: :ok, location: @roll_call }\n else\n format.html { render :edit }\n format.json { render json: @roll_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roll_call.update(roll_call_params)\n format.html { redirect_to @roll_call, notice: 'Roll call was successfully updated.' }\n format.json { render :show, status: :ok, location: @roll_call }\n else\n format.html { render :edit }\n format.json { render json: @roll_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to @call, notice: 'Chamada alterada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @recruiter.update(recruiter_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @recruiter.errors.messages}, 422)\n end\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update\n @call = Call.find(params[:id])\n @call.update_attributes(params[:call])\n respond_to do |format|\n format.html\n format.json { render :json => @call.to_json(:include => [ :user ]) }\n format.js\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @call = Call.find(params[:id])\n respond_to do |format|\n if @call.update_attributes(time: DateTime.strptime(params[:call][:time], '%m/%d/%Y %H:%M'))\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @phone.update(valid_params)\n json_response(@phone)\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n respond_to do |format|\n if @phone_call.update(phone_call_params)\n format.html { redirect_to @phone_call, flash: { success: \"Phone call was successfully updated.\" } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phone_call.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 @test_call.update(test_call_params)\n format.html { redirect_to @test_call, notice: 'Test call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call_history = CallHistory.find(params[:id])\n\n respond_to do |format|\n if @call_history.update_attributes(params[:call_history])\n format.html { redirect_to(@call_history, :notice => 'Call history was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @call_history.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @api_call = ApiCall.find(params[:id])\n\n respond_to do |format|\n if @api_call.update_attributes(params[:api_call])\n format.html { redirect_to @api_call, notice: 'Api call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n @address = Address.find_by(id: @caller.address_id)\n\n if @address.update(address_params)\n @address.save\n end\n if @caller.update(caller_params)\n @caller.phones.destroy_all\n phone_count = phone_params[\"type_ids\"].count\n\n phone_count.times do |index|\n unless phone_params[\"numbers\"][index] == \"\"\n @caller.phones.create(type_id: phone_params[\"type_ids\"][index], number: phone_params[\"numbers\"][index], extension: phone_params[\"extensions\"][index])\n end\n end\n\n format.html { redirect_to job_caller_path(@job, @caller), notice: 'Caller was successfully updated.' }\n format.json { render :show, status: :ok, location: @caller }\n else\n format.html { render :edit }\n format.json { render json: @caller.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @caller = Caller.find(params[:id])\n \n respond_to do |format|\n if @caller.update_attributes(params[:caller])\n format.html { redirect_to @caller, notice: 'Caller was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caller.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @call_status.update(call_status_params)\n format.html { redirect_to @call_status, notice: 'Call status was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_status }\n else\n format.html { render :edit }\n format.json { render json: @call_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_user.phone = params['phone']\n current_user.save()\n\n render :nothing => true, :status => 204\n end",
"def put!\n request! :put\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update\n respond_to do |format|\n if @call_type.update(call_type_params)\n format.html { redirect_to @call_type, notice: 'Call type was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_type }\n else\n format.html { render :edit }\n format.json { render json: @call_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def renew_call_params\n params.require(:renew_call).permit(:description, :call_id)\n end",
"def update\n @call_num = CallNum.find(params[:id])\n\n respond_to do |format|\n if @call_num.update_attributes(params[:call_num])\n flash[:success] = 'Call number was successfully updated.'\n format.html { redirect_to add_details_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @call_num.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end",
"def update\n respond_to do |format|\n if @recur.update(recur_params)\n format.html { redirect_to @recur, notice: 'Recur was successfully updated.' }\n format.json { render :show, status: :ok, location: @recur }\n else\n format.html { render :edit }\n format.json { render json: @recur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ride.update(offer_1_ride_params)\n\t\t\t\[email protected]_routes\n\t\t\t\[email protected]_return_date_and_recurring_weeks\n\t\t\t\tformat.html { redirect_to \"/#{@ride.id}/offer-seats/2\" }\n\t\t\t\tformat.json { render :show, status: :created, location: @ride }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ride.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @call_detail.update(call_detail_params)\n format.html { redirect_to @call_detail, notice: 'Call detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_detail }\n else\n format.html { render :edit }\n format.json { render json: @call_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n if @recruiter.update_attributes(params[:recruiter])\n format.html { redirect_to @recruiter, notice: 'Recruiter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n if @call_list_owner.update_attributes(params[:call_list_owner])\n format.html { redirect_to @call_list_owner, :notice => 'Call list owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @call_list_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_rehearsal_call\n @rehearsal_call = RehearsalCall.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @call_history.update(call_history_params)\n format.html { redirect_to @call_history, notice: 'Call history was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_history }\n else\n format.html { render :edit }\n format.json { render json: @call_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @calldetail.update(calldetail_params)\n format.html { redirect_to @calldetail, notice: 'Calldetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @calldetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"[email protected]\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n respond_to do |format|\n if @call.update(call_params)\n format.html { redirect_to \"/call/show_atendimento/#{@call.id}\", notice: 'Pergunta editada com sucesso' }\n format.json { render :show, status: :ok, location: @call }\n else\n format.html { render :edit }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n\n respond_to do |format|\n if @detailed_retrofit.update_attributes(params[:detailed_retrofit])\n format.html { redirect_to(@detailed_retrofit, :notice => 'Detailed retrofit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @detailed_retrofit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n status_key = STATUS[rand(STATUS.length)]\n\n n = Spooge.update_all_on_redis(:touch_date, DateTime.now)\n n = Spooge.update_all_on_redis(:status, status_key)\n resp = {:updated => n, :status_key => status_key}\n render :json => resp\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def update\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n if @rum.update_attributes(params[:rum])\n format.html { redirect_to @rum, notice: 'Rum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @api_method_name = args[:api_method_name] if args.key?(:api_method_name)\n @counter = args[:counter] if args.key?(:counter)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @calllog.update(calllog_params)\n format.html { redirect_to @calllog, notice: 'Calllog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @calllog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_rip.update(first_rip_params)\n format.html { redirect_to @first_rip, notice: 'First rip was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_rip }\n else\n format.html { render :edit }\n format.json { render json: @first_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rephone\n @rephone = Rephone.find(params[:id])\n end",
"def update\n @phonecall = Phonecall.find(params[:id])\n\n respond_to do |format|\n if @phonecall.update_attributes(params[:phonecall])\n flash[:notice] = 'Phonecall was successfully updated.'\n format.html { redirect_to(@phonecall) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @phonecall.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource @ride, ride_params\n end",
"def rest_call(call,base_uri,json_payload,access_token)\n params =\n {\"Authorization\" => \"Bearer #{access_token}\",\n :content_type => 'application/json',\n :accept => 'application/json',\n :verify => false}\n case call\n when \"get\"\n response = rest_get(base_uri,params)\n when \"post\"\n response = rest_post(base_uri,json_payload,params)\n when \"patch\"\n response = rest_patch(base_uri,json_payload,params)\n end\n return response\n end",
"def update\n respond_to do |format|\n if @callplan.update(callplan_params)\n format.html { redirect_to @callplan, notice: 'Callplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n #@phone = Phone.find(params[:id])\n end",
"def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end",
"def set_user_view_count(email, count)\n\n response = rest_post_call($LR_FIXTURES_URL + '/set-user-view-count', {'user_view_email' => email, 'view_count' => count.to_s, 'submit' => 'Set view count'})\n\n if (response.code != '302') then\n raise \"Could not set view count: \" + response.body\n end\n\nend",
"def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n if @rate_watcher.update_attributes(params[:rate_watcher])\n format.html { redirect_to @rate_watcher, notice: 'Rate watcher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rate_watcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def set_api_v1_reward\n @api_v1_reward = Api::V1::Reward.find(params[:id])\n end"
] | [
"0.60012275",
"0.5945652",
"0.5886734",
"0.58492035",
"0.58492035",
"0.58139426",
"0.5797379",
"0.5741457",
"0.5696734",
"0.5659583",
"0.56432074",
"0.5630631",
"0.56258947",
"0.5621301",
"0.5606647",
"0.5606647",
"0.559038",
"0.5585387",
"0.5549207",
"0.5549207",
"0.552842",
"0.5521087",
"0.5519583",
"0.5518788",
"0.54956293",
"0.5453113",
"0.5453113",
"0.5452983",
"0.5440494",
"0.5435688",
"0.5431825",
"0.5428364",
"0.5427238",
"0.5421865",
"0.5415473",
"0.5410104",
"0.5379884",
"0.53793913",
"0.53659713",
"0.5356774",
"0.5351341",
"0.5348068",
"0.5343312",
"0.5343312",
"0.5343312",
"0.5343312",
"0.533384",
"0.5326834",
"0.5316029",
"0.53071594",
"0.52916706",
"0.5291556",
"0.52836114",
"0.52690136",
"0.526754",
"0.5264858",
"0.5253638",
"0.52513254",
"0.52446556",
"0.5238669",
"0.52327806",
"0.52324086",
"0.5229624",
"0.5225256",
"0.52207524",
"0.5218751",
"0.521569",
"0.5208936",
"0.52055866",
"0.5205019",
"0.51983297",
"0.51983297",
"0.51983297",
"0.5183872",
"0.5182309",
"0.5172276",
"0.5169413",
"0.5163824",
"0.516173",
"0.51583356",
"0.51566696",
"0.51537937",
"0.5153264",
"0.51518315",
"0.51488674",
"0.51414716",
"0.5140339",
"0.5139895",
"0.5133094",
"0.5132679",
"0.51258636",
"0.51246387",
"0.51217985",
"0.5120952",
"0.5114007",
"0.5112968",
"0.51058",
"0.51051223",
"0.5104826",
"0.5102667",
"0.5097508"
] | 0.0 | -1 |
DELETE /recalls/1 DELETE /recalls/1.json | def destroy
@recall = Recall.find(params[:id])
@recall.destroy
respond_to do |format|
format.html { redirect_to [:admin,:recalls], notice: 'Отзыв удален.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rehearsal_call.destroy\n respond_to do |format|\n format.html { redirect_to rehearsal_calls_url, notice: 'Rehearsal call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @call = current_user.calls.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to calls_url }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: CALL_DESTROYED }\n format.json { head :no_content }\n end\n end",
"def test_del\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 id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @phone_call.destroy\n respond_to do |format|\n format.html { redirect_to phone_calls_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to(calls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @call = Call.find(params[:id])\n @call.destroy\n\n respond_to do |format|\n format.html { redirect_to(calls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calllog.destroy\n respond_to do |format|\n format.html { redirect_to calllogs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_call.destroy\n respond_to do |format|\n format.html { redirect_to test_calls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: 'Call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: 'Call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: 'Call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: 'Call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: \"Call was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @call_history = CallHistory.find(params[:id])\n @call_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(call_histories_url) }\n format.json { head :ok }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @number_call = NumberCall.find(params[:id])\n @number_call.destroy\n\n respond_to do |format|\n format.html { redirect_to number_calls_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @roll_call.destroy\n respond_to do |format|\n format.html { redirect_to roll_calls_url, notice: 'Roll call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roll_call.destroy\n respond_to do |format|\n format.html { redirect_to roll_calls_url, notice: 'Roll call was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def deleteRequest\n\n end",
"def destroy\n @caller = Caller.find(params[:id])\n @caller.destroy\n \n respond_to do |format|\n format.html { redirect_to callers_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @recruiter = Recruiter.find(params[:id])\n @recruiter.destroy\n\n respond_to do |format|\n format.html { redirect_to recruiters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @calldetail.destroy\n respond_to do |format|\n format.html { redirect_to calldetails_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @rebate = Rebate.find(params[:id])\n @rebate.destroy\n\n respond_to do |format|\n format.html { redirect_to rebates_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_history.destroy\n respond_to do |format|\n format.html { redirect_to call_histories_url, notice: 'Call history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_status.destroy\n respond_to do |format|\n format.html { redirect_to call_statuses_url, notice: 'Call status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borrow_request = BorrowRequest.find(params[:id])\n @borrow_request.destroy\n\n respond_to do |format|\n format.html { redirect_to borrow_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prayer_request = PrayerRequest.find(params[:id])\n @prayer_request.destroy\n\n respond_to do |format|\n format.html { redirect_to prayer_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_prayer_request = PrayerRequest.find(params[:id])\n @my_prayer_request.destroy\n\n respond_to do |format|\n format.html { redirect_to my_prayer_requests_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def destroy\n @call_detail.destroy\n respond_to do |format|\n format.html { redirect_to call_details_url, notice: 'Call detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @call_log = CallLog.find(params[:id])\n @call_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(call_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to replays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @callplan.destroy\n respond_to do |format|\n format.html { redirect_to callplans_url }\n format.json { head :no_content }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @call.destroy\n respond_to do |format|\n format.html { redirect_to calls_url, notice: 'Pergunta excluida com sucesso' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate_watcher = RateWatcher.find(params[:id])\n @rate_watcher.destroy\n\n respond_to do |format|\n format.html { redirect_to rate_watchers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detailed_retrofit = DetailedRetrofit.find(params[:id])\n @detailed_retrofit.destroy\n\n respond_to do |format|\n format.html { redirect_to(detailed_retrofits_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def deleted_request\n r = {}\n render json: r,\n root: :data,\n status: :no_content\n end",
"def destroy\n @call_type.destroy\n respond_to do |format|\n format.html { redirect_to call_types_url, notice: 'Call type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recur.destroy\n respond_to do |format|\n format.html { redirect_to recurs_url, notice: 'Recur was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def destroy\n @recinto = Recinto.find(params[:id])\n @recinto.destroy\n\n respond_to do |format|\n format.html { redirect_to recintos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_rip.destroy\n respond_to do |format|\n format.html { redirect_to first_rips_url, notice: 'First rip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n if @recruiter.destroy\n render_json_message({:success => t('.success')}, 200)\n else\n render_json_message({:errors => @recruiter.errors.messages}, 422)\n end\n end",
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_call = ApiCall.find(params[:id])\n @api_call.destroy\n\n respond_to do |format|\n format.html { redirect_to api_calls_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end"
] | [
"0.69294906",
"0.6786529",
"0.6786529",
"0.6786529",
"0.67413723",
"0.6641622",
"0.6641622",
"0.66406643",
"0.66374695",
"0.66075647",
"0.6605652",
"0.6561484",
"0.6560089",
"0.649253",
"0.64900935",
"0.6485749",
"0.6485749",
"0.64713156",
"0.646889",
"0.6465443",
"0.6465443",
"0.6465443",
"0.6465443",
"0.64609057",
"0.6431734",
"0.6421322",
"0.64165777",
"0.64165777",
"0.64093816",
"0.6391825",
"0.63861614",
"0.6378347",
"0.6378347",
"0.63723767",
"0.6352619",
"0.6348876",
"0.63456094",
"0.6329825",
"0.6323848",
"0.63214636",
"0.62962186",
"0.62910265",
"0.62910265",
"0.62910265",
"0.62910265",
"0.62752026",
"0.6274768",
"0.62416315",
"0.6238039",
"0.6235415",
"0.6231945",
"0.6230152",
"0.6227127",
"0.62145805",
"0.62112164",
"0.6210554",
"0.6210554",
"0.6207617",
"0.620622",
"0.6172808",
"0.61701214",
"0.6157304",
"0.6149498",
"0.61428297",
"0.6142562",
"0.61397445",
"0.61348534",
"0.6133672",
"0.6131141",
"0.61282563",
"0.6119923",
"0.61186117",
"0.6117573",
"0.61172783",
"0.6115969",
"0.61125046",
"0.61100423",
"0.60967815",
"0.60961795",
"0.6094976",
"0.60828114",
"0.6082555",
"0.6079634",
"0.60787946",
"0.6076176",
"0.60757023",
"0.6075459",
"0.6068866",
"0.6061922",
"0.605703",
"0.60569733",
"0.60513747",
"0.6044171",
"0.60436285",
"0.6041459",
"0.60405326",
"0.603945",
"0.6038502",
"0.6036005",
"0.60350424"
] | 0.66035855 | 11 |
Create a new comment in the issue rendering an external template. | def respond_external_template(template_file, locals={})
respond render_external_template(template_file, locals)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n load_issue\n @comment = @issue.comments.build(params[:comment]) do |c|\n c.user = current_user\n end\n @comment.save\n respond_with(@comment) do |format|\n format.pjax { render @comment }\n end\n end",
"def create_comment\n\t\tcomment = Comment.new\n\t\tcomment.body = @string = CGI.unescape(params[:comment][:body]).gsub(/\\n/,\"<br />\")\n\t\tcomment.project_id = params[:project_id]\n\t\tcomment.account_id = params[:account_id]\n\t\tcomment.save\n\n\t\tflash[:notice] = \"Your comment has been created\"\n\t\tredirect_to :controller => :projects, :action => :comments_show, :id => params[:project_id]\n\tend",
"def create_comment(content)\n DOM(`#@native.createComment(#{content})`)\n end",
"def create_issue_comment(repo, issue_number, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"#{Repository.path repo}/issues/#{issue_number}/comments\", opts\n end",
"def add_comment_to_issue(issue_name, comment_text)\n\tissue = @client.Issue.find(issue_name)\n\tcomment = issue.comments.build\n\tcomment.save!(:body => comment_text)\nend",
"def new_comment\n get_item\n @pcp_subject = @pcp_item.pcp_subject\n @pcp_step = @pcp_subject.current_step\n if @pcp_step.status_closed?\n render_bad_logic t( 'pcp_items.msg.subj_closed' )\n return\n end\n unless user_has_permission?( :to_update )\n render_no_permission\n return\n end\n parent_breadcrumb( :pcp_subject, pcp_subject_path( @pcp_subject ))\n set_breadcrumb_path( pcp_subject_pcp_items_path( @pcp_subject ))\n @pcp_comment = PcpComment.new do |c|\n c.pcp_item = @pcp_item\n c.author = current_user.account_info\n c.pcp_step = @pcp_step\n c.assessment = @pcp_item.new_assmt\n c.is_public = false\n c.description = t( 'pcp_items.msg.item_closed' ) if @pcp_item.closed?\n end\n @pcp_comments_show = @pcp_item.pcp_comments\n end",
"def new_comment comment, line_no = nil\n c = RDoc::Comment.new comment, @top_level, :ruby\n c.line = line_no\n c.format = @markup\n c\n end",
"def create\n repo = Repository.by_name(session[:repository_id])\n patch = repo.patch(params[:comment][:commit_sha])\n\n @comment = Comment.new(params[:comment])\n @comment.commit_diff = CommitDiff.create_or_find(patch)\n @comment.user = @user\n\n respond_to do |wants|\n if @comment.save\n expire_fullsite_caches\n create_notifications(params[:comment])\n\n wants.html { render :action => \"show\" }\n wants.js { render :action => \"show\", :layout => false}\n wants.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_comment(note,comment_text)\n Comment.create(:commentable_type=>note.class.name,:commentable_id=>note.id,:created_by_user_id=>current_user.id,\n :comment=>comment_text,:company_id=>note.company_id,:title=>note.class.name)\n end",
"def create\n @comment = @commentable.comments.new(params[:comment])\n @comment.user = current_user\n @community = @commentable.community\n \n @comment.save ? (@comment = @commentable.comments.new() and flash[:notice] = \"Comment added\") : flash[:error] = \"Enter comment to add it\"\n\n render :update do |page|\n page.replace_html :comments_id,\n :partial=>\"#{@commentable.class.to_s.downcase}s/comments\",\n :locals=>{:commentable => @commentable, :comment => @comment}\n \n end\n end",
"def comment\n Comment.new(@params[\"lf_comment_id\"], conversation,\n :body => @params[\"body_text\"],\n :user => user,\n :parent_id => @params[\"lf_parent_comment_id\"],\n :author_ip => @params[\"author_ip\"],\n :state => @params[\"state\"]\n )\n end",
"def create_comment(string, &block); end",
"def create_comment(string, &block); end",
"def comment_new\n\t cur_emp = get_logged_employee\n\t\t@comment = Comment.new\n\t\tif params[:comment].present?\n\t\t comment = \"COMMENTED: \" + \"\" + params[:comment] + \".\"\n\t\tend\n\t\tif params[:type].present?\n\t\t ctype = params[:type]\n\t\telse\n\t \tctype = \"INTERNAL\"\n\t\tend\n\t\tif params[:id].present?\n\t\t resume_id = params[:id]\n\t\tend\n\t\[email protected]_comment( comment, resume_id, cur_emp.eid, ctype )\n if ctype == \"USER\"\n respond_to do |format|\n format.html \n \t end\n end\n end",
"def create\n @comment = Comment.new\n @comment.content_id = params[:id]\n if ensure_project_access(@comment.content.project.id)\n @comment.comment = params[:comment][:comment]\n @comment.user_id = current_user.id\n if @comment.save\n redirect_to project_path(@comment.content.project, :tab=>'1'), flash: {project_success: I18n.t('comment.create_success')}\n else\n redirect_to project_path(@comment.content.project, :tab=>'1'), flash: {project_error: I18n.t('comment.error_create')}\n end\n end\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create_comments\n end",
"def create\n @comment = @issue.comments.new(comment_params)\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @issue_path, notice: 'Comment is succesfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_review_comment(repo, pull_number, body, commit_id, path, options = {})\n opts = options.dup\n opts[:body] = body\n opts[:commit_id] = commit_id\n opts[:path] = path\n post \"#{Repository.path repo}/pulls/#{pull_number}/comments\", opts\n end",
"def create\n @comment = Comment.new :body => params[:comment][:body],\n :issue => false\n @comment.polycomment_type = params[:polycomment_type]\n @comment.polycomment_id = params[:polycomment_id]\n @comment.user_id = current_user.id \n if @comment.save\n #flash[:notice] = 'Your comment was posted!'\n redirect_to :back\n else\n flash[:alert] = 'Something went wrong, try reposting your comment.'\n end\n end",
"def new_comment(comment)\n @greeting = \"Hi!\"\n @id = comment.workout.id\n @title = comment.workout.title\n @user = comment.user\n mail to: comment.workout.user.email\n end",
"def comment(text)\n comments.create!(user_id: current_user.id,\n content: text)\n end",
"def new_comment(rep, c_u, content)\n @current_user = c_u\n @content = content\n @rep = rep\n mail to: rep.user.email, subject: \"Ripetizione per '#{rep.course.name}'\"\n end",
"def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"def create_comment(post_id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/create_comment\", :comment => comment.merge(:post_id => post_id),\n :attachments => attachments\n end",
"def create\n authenticate_user!\n @comment = @experiment.comments.create(params[:comment])\n\[email protected]_id = current_user\n\[email protected]\n\tredirect_to experiment_path(@experiment)\n end",
"def create_pull_request_comment(repo, pull_id, body, commit_id, path, position, options = {})\n options.merge!({\n :body => body,\n :commit_id => commit_id,\n :path => path,\n :position => position\n })\n post \"#{Repository.path repo}/pulls/#{pull_id}/comments\", options\n end",
"def create\n issue = current_user.issues.create(issue_params.merge(translation: @translation))\n issues = @translation.issues.includes(:user, comments: :user).references(:comments).order_default_with_comments\n render template: 'issues/create.js.erb', locals: {project: @project, key: @key, translation: @translation, issues: issues, issue: issue.errors.present? ? issue : Issue.new_with_defaults, created_issue: issue.errors.present? ? nil : issue }\n end",
"def add_comment\n return client.add_comment(repository, pr_id, report_urls.comment_body) unless comment\n\n client.update_comment(repository, comment[:id], report_urls.comment_body(comment[:body]))\n end",
"def add_comment(comment); end",
"def new_comment\n Notifications.new_comment\n end",
"def create\n\n t = Tripod::Persistence::Transaction.new\n\n @comment = Comment.new\n @comment.content = params[:content]\n @comment.creator = current_user\n comment_success = @comment.save(:transaction => t)\n\n if comment_success\n @report.add_comment(@comment)\n if params[:commit] == \"Comment And Close\" && can?(:update, @report)\n @report.close!\n @closed = true\n end\n report_success = @report.save(:transaction => t)\n end\n\n @success = comment_success && report_success\n\n if @success\n t.commit\n flash[:notice] = 'comment added'\n flash[:notice] += ' and report closed' if @closed\n redirect_to report_url(@report)\n else\n t.abort\n flash.now[:alert] = 'Something went wrong adding your comment.'\n @comments = @report.comments\n render 'reports/show'\n end\n\n end",
"def create\n # params = {content: \"gfgf\", assignment_id: 123}\n #redirect_to @comment, notice: 'Comment was successfully created.'\n end",
"def new\n layout = get_application_layout\n @comment = Comment.new\n @comment.ip_remote = request.env['REMOTE_ADDR']\n @comment.user = user\n \n @send_code = random_string(5)\n mk_tmp_file(@send_code)\n \n if params[:posting]\n @comment.posting = Posting.find(params[:posting].to_i)\n end\n if params[:event]\n @comment.event = Event.find(params[:event].to_i)\n end\n respond_to do |format|\n format.html { render :layout => layout}\n format.xml { render :xml => @comment }\n end\n end",
"def new_comment(comment)\n @comment = comment\n type = @comment.commentable_type.classify\n @commented = type.constantize.find(@comment.commentable_id)\n @recipient = commented.first.user\n\n mail(to: @recipient.email, subject: \"You have a new comment\")\n end",
"def create_comment(resource_id, params)\n http.post(comment_endpoint(resource_id), body: params) do |response|\n Rexpense::Entities::Comment.new response.parsed_body\n end\n end",
"def make_comment(content, user)\n return if content.blank?\n comment = PublicEarth::Db::Comment.new(PublicEarth::Db::Discussion.one.comment(self.id, user.id, content))\n @comments << comment\n comment\n end",
"def create_comment(name, slide_index, dto, shape_index = nil, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = create_comment_with_http_info(name, slide_index, dto, shape_index, password, folder, storage)\n data\n end",
"def comment(text, options = {})\n requires :identity\n\n options[:public] = true if options[:public].nil?\n\n comment = Zendesk2.stringify_keys(options).merge('body' => text)\n\n cistern.ticket_comments.new(\n cistern.update_ticket(\n 'ticket' => {\n 'id' => identity,\n 'comment' => comment,\n }\n ).body['audit']['events'].first\n )\n end",
"def create\n hash = params[:comment].merge(user_variables)\n @comment = Comment.new(hash)\n @comment.commentable = Post.find(params[:post_id]) if params[:post_id]\n @commentable = @comment.commentable\n case @commentable.class.name\n when 'Post'\n @goto_url = @commentable.url\n when 'Organization'\n @goto_url = organization_url(@commentable)\n end\n\n # TODO: make this a user-defined variable in a global settings table\n @comment.approved_at = Time.now.utc\n\n respond_to do |format|\n if @comment.save!\n flash[:notice] = 'Comment was successfully created.'\n format.html { redirect }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def issue_comment(owner, repo, issue_number, comment)\n Issues.post(\n \"/repos/#{owner}/#{repo}/issues/#{issue_number}/comments\",\n :headers => @auth,\n :body => { :body => comment }.to_json\n )\n end",
"def create\n\t\t@comment = Comment.new(comment_params)\n\t\t@majorpost = Majorpost.find(params[:comment][:majorpost_id])\n\t\t#Detect language\n\t\tif language = CLD.detect_language(@comment.content)\n\t\t\[email protected] = language[:code]\n\t\tend\t\t\n\t\tif @comment.update(\n\t\t\tuser_id: current_user.id, \n\t\t\tcampaign_id: @majorpost.campaign_id,\n\t\t\tmajorpost_user_id: @majorpost.user_id,\n\t\t\texcerpt: ActionView::Base.full_sanitizer.sanitize(@comment.content).squish.truncate(140)\n\t\t)\n\t\t\t@majorpost = Majorpost.find(@comment.majorpost_id)\n\t\t\t#Update activity\n\t\t\tif @activity = PublicActivity::Activity.find_by_trackable_id_and_trackable_type(@comment.id,'Comment')\n\t\t\t\[email protected]_columns(majorpost_id: @comment.majorpost_id)\n\t\t\tend\n\t\t\t#Create notification\n\t\t\tunless @comment.user == @majorpost.user\n\t\t\t\tif @comment.main_comment\n\t\t\t\t\tNotification.create(\n\t\t\t\t\t\tuser_id: @comment.main_comment.user_id,\n\t\t\t\t\t\ttrackable_id: @comment.id,\n\t\t\t\t\t\ttrackable_type: \"Comment\",\n\t\t\t\t\t\tnotification_type: \"reply_create\"\n\t\t\t\t\t)\n\t\t\t\t\tunless @majorpost.user_id == @comment.main_comment.user_id\n\t\t\t\t\t\tNotification.create(\n\t\t\t\t\t\t\tuser_id: @majorpost.user_id,\n\t\t\t\t\t\t\ttrackable_id: @comment.id,\n\t\t\t\t\t\t\ttrackable_type: \"Comment\",\n\t\t\t\t\t\t\tnotification_type: \"comment_create\"\n\t\t\t\t\t\t)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tNotification.create(\n\t\t\t\t\t\tuser_id: @majorpost.user_id,\n\t\t\t\t\t\ttrackable_id: @comment.id,\n\t\t\t\t\t\ttrackable_type: \"Comment\",\n\t\t\t\t\t\tnotification_type: \"comment_create\"\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@new_comment = Comment.new\n\t\t#Create a popover random class for js unique refresh\n\t\t@popoverclass = SecureRandom.hex(16)\t\t\n\t\t#Add score\n\t\tadd_score(@comment.majorpost.user, @comment.user)\t\t\n\tend",
"def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"def create\n user = cookies[\"user_id\"]\n the_project = cookies[\"current_project\"]\n # the_project_id = Project.find_by(\"id\" => the_project)\n Comment.create(\"summary\" => params[\"summary\"], \"project_id\" => the_project, \"user_id\" => user)\n redirect_to \"/projects\", :notice => \"Comment Added\"\n end",
"def create\n @bug_comment = BugComment.new(params[:bug_comment])\n\n respond_to do |format|\n if @bug_comment.save\n format.html { redirect_to project_bug_list_bug_post_path(params[:project_id], params[:bug_list_id], params[:bug_post_id]), notice: 'Bug comment was successfully created.' }\n format.json { render json: @bug_comment, status: :created, location: @bug_comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bug_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end",
"def create(user_name, repo_name, issue_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of issue_id\n\n normalize! params\n # _merge_mime_type(:issue_comment, params)\n filter! VALID_ISSUE_COMMENT_PARAM_NAME, params\n assert_required_keys(%w[ content ], params)\n\n post_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/#{issue_id}/comments/\", params)\n end",
"def create_comment_for_pull(id, comment)\n uri = URI(uri_comment_on_pull(id))\n execute_http_request(:post, uri, comment)\n end",
"def new\r\n @comment = @commentable.comments.new\r\n end",
"def create_issue_comment(user_name, repo_name, issue_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of issue_id\n\n _normalize_params_keys(params)\n _merge_mime_type(:issue_comment, params)\n _filter_params_keys(VALID_ISSUE_COMMENT_PARAM_NAME, params)\n\n post(\"/repos/#{user}/#{repo}/issues/#{issue_id}/comments\", params)\n end",
"def create_comment\n if file?\n puts \"| --- file\"\n files.each do |file|\n comment = Gif.where(github_type: \"file\").detect { |gif| file[:filename].downcase.include? gif.keyword.downcase }\n create_pull_request_comment(comment.image, file.filename, 1) if comment.present?\n end\n end\n\n if comment?\n puts \"| --- comment\"\n testies = Gif.where(github_type: \"comment\").detect { |gif| comment.downcase.include? gif.keyword.downcase }\n if testies.present?\n add_comment(testies.image) if issue_comment?\n create_pull_request_comment_reply(testies.image) if pull_request_review_comment?\n end\n end\n\n if branch?\n puts \"| --- branch\"\n comment = Gif.where(github_type: \"branch\").detect { |gif| head_branch.downcase.include? gif.keyword.downcase }\n unless comment\n comment = Gif.find_by(github_type: \"merge\") if merged?\n comment = Gif.find_by(github_type: \"squerge\") if squerged?\n end\n add_comment(comment.image) if comment.present?\n end\n end",
"def create\n commentable = commentable_type.constantize.find(commentable_id)\n @comment = Comment.build_from(commentable, current_user.id, body)\n @petition = Petition.find(@comment.commentable_id)\n @new_comment = Comment.build_from(@petition, current_user.id, \"\")\n @current_user = current_user\n respond_to do |format|\n if @comment.save\n make_child_comment\n # TODO: make AJAX request instead of reloading page\n format.html { redirect_to(:back, notice: 'Comment was successfully added') }\n format.js { render :template => \"comments/comment\"}\n else\n # TODO: If the comment fails to save, pop up a notification\n format.html { redirect_to(:back) }\n end\n end\n end",
"def edit_comment\n verify_ajax_request\n verify_post_request\n require_parameters :key, :text\n\n text = Api::Utils.read_post_request_param(params[:text])\n comment = Internal.issues.editComment(params[:key], text)\n\n @issue_results = Api.issues.find(comment.issueKey)\n render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}\n end",
"def create\n comment = Comment.new(:content => params[:content],\n :user_id => current_user.id,\n :image => avatar_url(current_user),\n :commentable => list,\n :cid => params[:cid])\n status = comment.save ? 201 : 400\n\n unless current_user == list.user\n Notification.new_comment(list.user, current_user, list)\n mentions = get_mentions(params[:content])\n Notification.new_mention(mentions, current_user, list) unless mentions.empty?\n end\n\n head status\n end",
"def comment\n\n client = user_client\n comment = params[:comment]\n mixpanel_tab_event(\"View Item\", \"Post Comment\")\n\n if (comment != \"\")\n # get file and add comment\n file = client.file_from_id(session[:fileId])\n client.add_comment_to_file(file, message: comment)\n end\n\n redirect_to view_doc_path(session[:fileId])\n end",
"def new\n @comment = @commentable.comments.new\n end",
"def new\n\t\t@comment = Comment.new()\n\tend",
"def createComment(data)\n ret = Comment.new(data)\n ret.ownerDocument = self\n ret\n end",
"def create\n\t\t\tsuper\n\t\t\tprintComments\n\t\tend",
"def create\n commentable = commentable_type.constantize.find(commentable_id)\n @comment = Comment.build_from(commentable, current_user.id, body)\n\n respond_to do |format|\n if @comment.save\n make_child_comment\n\n format.html { redirect_to(:back, :notice => 'Comment was successfully added.') }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_comment(issue_key, comment)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}/comment\"\n post = {\"body\" => comment}\n options = [@login_options, {\"data\" => post}].inject(:merge)\n result = rest_call(url, \"post\", options)\n log result.inspect\n result\n end",
"def create\n\t\t@comment = Comment.new( params[:comment] )\n\t\[email protected] = current_user_get\n\t\t\n\t\trespond_to do |format|\n\t\t\tif not @comment.commentable.class.comments_extension.can_comment?( @comment.commentable, @comment.parent, self.current_user_get )\n\t\t\t\tflash[:notice] = 'You cann\\'t create comment'\n\t\t\t\tformat.html { redirect_to comment_url(@comment) }\n\t\t\t\tformat.xml { head :err }\n\t\t\t\tformat.js\t{ render :update do |page| page.alert \"You cann't create this comment\" end }\n\t\t\telsif @comment.save\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend",
"def create_comment\n find_user\n if [email protected]?\n @req=Requirement.find(params[:id])\n if !current_user.nil? and [email protected]?\n @[email protected](:title=>params[:comment], :user_id=>@user.id)\n elsif !current_member.nil? and [email protected]?\n @[email protected](:title=>params[:comment], :user_id=>@user.user_id, :member_id=>@user.id)\n end\n\n\n end\n respond_to do |format|\n format.js\n end\n\n end",
"def new\n\n @comment = Comment.new\n @comment.commit_sha = session[:patch_id]\n @comment.block = params[:block]\n @comment.line = params[:line]\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.js { render \"new.html\", :layout => false }\n wants.xml { render :xml => @comment }\n end\n\n end",
"def create_gist_comment(gist_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"gists/#{Gist.new gist_id}/comments\", opts\n end",
"def add_comment(issue_id_or_key, content, params = {})\n params[:content] = content\n post(\"issues/#{issue_id_or_key}/comments\", params)\n end",
"def create_comment(comment)\n post_params = {\n :body => comment.post_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n\n response = Logan::Client.post \"/projects/#{@project_id}/todos/#{@id}/comments.json\", post_params\n Logan::Comment.new response\n end",
"def add_comment(card_id, text, options = {})\n options.update text: text\n create_card_resource card_id, \"actions\", \"comments\", options\n end",
"def create\n @comment = @snippet.comments.build(comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n unless @comment.snippet.user == current_user\n Resque.enqueue(CommentMailerWorker, @comment.id)\n end\n format.html { redirect_to @comment.snippet, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render @comment.snippet }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @current_comment = current_idea.comments.new(comment_params)\n @current_comment.user = current_user\n\n respond_to do |format|\n if current_comment.save\n format.html { redirect_to current_comment.idea, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: current_comment.idea }\n else\n format.html { render :new }\n format.json { render json: current_comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comment message\n @instructions << Comment.new(message)\n self\n end",
"def create_and_notify\n comment = build\n\n begin\n send_email_notification(comment)\n rescue => e\n puts \"#{e} was raised while attempting to send notification \" +\n \"on #{commentable.class} #{commentable.id} to User #{commentable.user.id}\"\n end\n\n comment\n end",
"def create\n @comment = Comment.new(params[:comment])\n\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_created') }\n format.json { render :json => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def process_or_create_comment(issue_id, repo, settings, comments=nil)\n bot_comment = get_comment_with_prefix(issue_id, repo, settings['test_prefix'], comments)\n\n unless bot_comment\n # In the process of evaluating a pull request, we could have called this method\n # previously and, since we're not updating our internal cache of comments, the\n # comments array, we could have stale data in that cache, so we want to force\n # get_comment_with_prefix to fetch a new list of comments to make sure we find\n # a bot comment if it exists but we don't have it cached\n bot_comment = get_comment_with_prefix(issue_id, repo, settings['test_prefix'])\n unless bot_comment\n # No comment found, create a new one and yield to it\n $stderr.puts \" Creating placeholder comment\"\n evaluating_comment = compose_bot_comment(settings['test_prefix'], :state => :evaluating)\n bot_comment = add_comment(issue_id, repo, evaluating_comment)\n end\n end\n\n yield bot_comment['id'], bot_comment['body'], Time.parse(bot_comment['updated_at'])\n end",
"def ensure_issue_comment(owner, repo, issue_id, comment_id, pull_req_id = nil)\n issue = if pull_req_id.nil?\n ensure_issue(owner, repo, issue_id, false, false, false)\n else\n db[:issues].first(:pull_request_id => pull_req_id)\n end\n\n if issue.nil?\n warn \"Could not find issue #{owner}/#{repo} -> #{issue_id} for retrieving comment #{comment_id}\"\n return\n end\n\n issue_comment_str = \"#{owner}/#{repo} -> #{issue_id}/#{comment_id}\"\n\n curcomment = db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => comment_id)\n if curcomment.nil?\n\n retrieved = retrieve_issue_comment(owner, repo, issue_id, comment_id)\n\n if retrieved.nil?\n warn \"Could not retrieve issue_comment #{issue_comment_str}\"\n return\n end\n\n user = ensure_user(retrieved['user']['login'], false, false)\n\n db[:issue_comments].insert(\n :comment_id => comment_id,\n :issue_id => issue[:id],\n :user_id => unless user.nil? then user[:id] end,\n :created_at => date(retrieved['created_at'])\n )\n\n info \"Added issue_comment #{issue_comment_str}\"\n db[:issue_comments].first(:issue_id => issue[:id],\n :comment_id => comment_id)\n else\n debug \"Issue comment #{issue_comment_str} exists\"\n curcomment\n end\n end",
"def create\n begin\n @phrase = Phrase.find(params[:id]) # コメント対象のフレーズ\n rescue Exception => e\n flash[:error] = 'コメントを書き込めませんでした。'\n redirect_to root_url\n return\n end\n \n @new_comment = @phrase.comments.new\n @new_comment.content = params[:comment][:content]\n @new_comment.user_id = current_user.id # コメント者のidをセット\n\n respond_to do |format|\n if @new_comment.save\n format.html { redirect_to @phrase, notice: 'コメントを投稿しました。' }\n\n # 「コメントされた」旨のお知らせメール送信(メール配信フラグfalseの人には送られない)\n CommentMailer.notice_mail(@phrase,@new_comment,request.url).deliver if @phrase.user.mail_flg\n else\n format.html { render action: \"show\" }\n end\n end\n end",
"def create_comment\n @article.create_random_comment\n redirect_to article_path(@article)\n end",
"def add_comment(text: required(\"text\"), options: {}, **data)\n with_params = data.merge(text: text).reject { |_,v| v.nil? || Array(v).empty? }\n Story.new(parse(client.post(\"/tasks/#{gid}/stories\", body: with_params, options: options)).first, client: client)\n end",
"def create\n # Used in notifications.rb Kind of an ugly hack, but it's fast and\n # direct.\n $SITE_DOMAIN = request.domain\n\n @comment = Comment.new(params[:comment])\n @page = Page.find(params[:page])\n @comment.page = @page\n @comment.user = current_user\n @comment.parent_id = params[:parent]\n @parent_id = @comment.parent_id\n @comment_indent = params[:indent].to_i\n if @comment.save\n flash[:notice] = \"Comment added\"\n else\n flash[:notice] = \"Error creating new comment\"\n end\n end",
"def new_comment(name, discussion_id)\n response = self.class.post(\n @@base_uri + @@comments_uri,\n body: {\"comment\":{\"body\":name,\"discussion_id\":discussion_id,\"document_ids\":[]}}.to_json,\n headers: @headers\n )\n return response\n end",
"def create_comment\n unless user_signed_in?\n render status: 403, json: { message: 'Please sign in to add a comment.' }\n end\n\n comment_params = params.permit(:content, :id)\n new_comment = Comment.create!(\n content: comment_params.require(:content),\n post_id: comment_params.require(:id),\n user_id: current_user.id\n )\n render status: :created, json: new_comment\n end",
"def create\n @comment = @item.comments.new(params[:comment])\n \n if logged_in?\n @comment.user = current_user\n else\n @comment.byline = \"Anonieme Bangerd\" if @comment.byline.empty?\n @comment.content = @comment.content.gsub(/((<a\\s+.*?href.+?\\\".*?\\\")([^\\>]*?)>)/, '\\2 rel=\"nofollow\" \\3>')\n \n unless verify_recaptcha\n @item.errors.add(\"Word\")\n flash.now[:notice] = \"Je reactie kon niet geplaatst worden. Scroll naar beneden, corrigeer en probeer het opnieuw. Heb je de CAPTCHA correct overgetikt?\"\n render :template => 'items/show'\n return\n end\n end \n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Reactie is succesvol geplaatst.'\n format.html { redirect_to(@comment.item) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n flash.now[:notice] = \"Je reactie kon niet geplaatst worden. Scroll naar beneden, corrigeer en probeer het opnieuw.\"\n format.html { render :template => 'items/show' }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_comment(comment)\n if comment.commentable.instance_of?(User)\n user_email = comment.commentable.email\n @followlink = profile_url\n elsif comment.commentable.instance_of?(Message)\n user_email = comment.commentable.user.email\n @followlink = message_url(comment.commentable)\n end\n\n @username = comment.user.email\n\n mail :to => user_email, :subject => \"New comment\"\n end",
"def create\n @comment = @parent.comments.build(comment_params_with_user)\n authorize @comment\n\n if @comment.save\n CommentCreatedMailJob.perform_later(@comment)\n render json: @comment, serializer: CommentSerializer, status: :created\n else\n render_error :unprocessable_entity, @comment.errors\n end\n end",
"def create_comment(sender, options={})\n comment = nil\n if allows_comment?(sender)\n comment = self.comments.create(comment_options(sender, options))\n comment.activate! if comment.valid?\n end\n comment\n end",
"def create_gist_comment(id, comment)\n post \"/gists/#{id}/comments\", :body => { :body => comment }\n end",
"def comment comment\n end",
"def add_comments_to_issue message, hash, issue, user, cookies, http\n\t# Remove issue# from commit message and parse\n\tmessage_text = message.sub $remove_issue_regex, ''\n\tputs message_text\n\t# First, login to youtrack given above credentials\n\tcomment_url = \"/youtrack/rest/issue/#{issue}/execute\"\n\trequest = Net::HTTP::Post.new(comment_url)\n\trequest.body = \"comment=[#{$repo}.git] #{message_text}&runAs=#{user}\"\n\trequest['Cookie'] = cookies\n http.request(request)\nend",
"def add_comment(id, comment=\"\", _private=false, work_time=nil)\n comment = {'id' => id, 'comment' => comment}\n comment.store('private', _private) if _private\n comment.store('work_time', work_time) unless work_time.nil?\n return call('Bug.add_comment', comment)\n end",
"def add_pr_comment(pull_comments_url,comment_body)\n url = pull_comments_url\n payload = {\n body: \"#{comment_body}\"\n }\n RestClient.post(\n url,\n payload.to_json,\n @git_headers\n )\n end",
"def create_random_comment\n comments.create(name: Faker::Name.name, body: Faker::Hacker.say_something_smart)\n end",
"def create_comment(sender, options={})\n comment = self.comments.create(comment_options(sender, options))\n comment.activate! if comment.valid?\n comment\n end",
"def create_comment\n @user=find_user\n @use=UseCase.find_by_id(params[:id])\n if !current_user.nil? and [email protected]?\n @[email protected](:title=>params[:comment], :user_id=>@user.id)\n elsif !current_member.nil? and [email protected]?\n @[email protected](:title=>params[:comment], :user_id=>@user.user_id, :member_id=>@user.id)\n end\n\n respond_to do |format|\n format.js\n end\n end",
"def trigger_comment(comment) end",
"def addComment( text )\n\t\t\tloadComments if @comments.length == 0\n\t\t\[email protected]( TicketComment.new( text ) )\n\t\tend",
"def create\n # we only get here if this comment is being manually entered.\n @comment = Comment.new(comment_params)\n\n c_max = current_rulemaking.comments.maximum(:order_in_list)\n next_order_in_list = (c_max.nil? ? 0 : c_max) + 1\n @comment.order_in_list = next_order_in_list\n\n @comment.rulemaking = current_rulemaking\n @comment.manually_entered = true\n\n respond_to do |format|\n if @comment.save\n suggested_change_change_hash = save_suggested_changes\n save_change_log(current_user,{comment: @comment, suggested_change_changes: suggested_change_change_hash, action_type: 'create'})\n format.html { redirect_to edit_comment_path(@comment), notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n set_select_options\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @comment = Comment.new\n end",
"def new\n @comment = Comment.new\n end",
"def create_comment(string, &block)\n Nokogiri::XML::Comment.new(self, string.to_s, &block)\n end",
"def comment!(travel, content)\n comments.create!(\n travel_id: travel.id,\n content: content\n )\n end"
] | [
"0.66911435",
"0.66892725",
"0.65592194",
"0.65112907",
"0.64636856",
"0.64276665",
"0.64146155",
"0.63820684",
"0.63687205",
"0.636255",
"0.6335078",
"0.6306947",
"0.6306947",
"0.62925935",
"0.625692",
"0.6249786",
"0.6249786",
"0.6249786",
"0.6236276",
"0.62303686",
"0.6181738",
"0.6173359",
"0.6170074",
"0.61626685",
"0.6145942",
"0.6137737",
"0.61320573",
"0.61268187",
"0.61175954",
"0.6101415",
"0.6096378",
"0.60917795",
"0.6052516",
"0.604986",
"0.6045516",
"0.603142",
"0.600272",
"0.5984663",
"0.5966601",
"0.5965147",
"0.5959788",
"0.5943636",
"0.5924083",
"0.59225863",
"0.5921306",
"0.5913655",
"0.5910332",
"0.59011245",
"0.58989304",
"0.5893261",
"0.588531",
"0.58837205",
"0.5875705",
"0.5875316",
"0.58748484",
"0.5874115",
"0.58716863",
"0.58623594",
"0.5860705",
"0.58488035",
"0.58435374",
"0.5843071",
"0.584178",
"0.5840709",
"0.5838202",
"0.5837855",
"0.5834386",
"0.5824959",
"0.58247954",
"0.58246803",
"0.5818947",
"0.581663",
"0.58159816",
"0.5815516",
"0.58089906",
"0.5802849",
"0.5794361",
"0.57896453",
"0.5780753",
"0.57703876",
"0.5768025",
"0.5763395",
"0.5761218",
"0.5760155",
"0.5753461",
"0.5749414",
"0.57470584",
"0.5744633",
"0.57441187",
"0.5722359",
"0.571938",
"0.5711879",
"0.57110196",
"0.5709927",
"0.57045984",
"0.57041526",
"0.5703399",
"0.5699785",
"0.5699785",
"0.5698423",
"0.56981355"
] | 0.0 | -1 |
Renders an external template using the passed locals | def render_external_template(template_file, locals={})
template = URI.parse(template_url(template_file)).read
apply_hash_to_template(template, locals)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render_template(view, template, layout_name, locals); end",
"def render_template(context, options); end",
"def render_template_with_locals(abs_name, locals = {})\r\n template = File.read(File.join( abs_name) )\r\n ERB.new(template, nil, \"-\").result(OpenStruct.new(locals).send(:binding))\r\nend",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil)); end",
"def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def _render_template(options); end",
"def _render_template(options); end",
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def respond_external_template(template_file, locals={})\n respond render_external_template(template_file, locals)\n end",
"def render_template(*args)\n options = args.extract_options!\n filename, content = *args\n render_tilt(filename, content, options) || render_static(filename)\n end",
"def render(scope, locals = {})\n @_template.render(scope.dup, locals)\n end",
"def render(locals = {})\n liquify(wrap_in_layout(string), (options[:locals] || {}).merge(locals))\n end",
"def render( args )\n template_name\n end",
"def render_with_layout(template, locals = {}, additional_js = [], additional_css = [])\n script_tags = \"\"\n css_tags = \"\"\n additional_js.each { |fileName| script_tags << \"<script src='/js/#{fileName}'></script>\" }\n additional_css.each do |fileName|\n css_tags << \"<link rel='stylesheet' type='text/css' href='/css/#{fileName}'/>\"\n end\n erb :base, :locals => locals.merge({ :template => template, :user => @user,\n :script_tags => script_tags, :css_tags => css_tags })\n end",
"def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval {binding})\n end",
"def render(options = {})\n template.render options\n end",
"def template\n template_name = params[:template_name]\n\n render \"templates/#{template_name}\", locals: { }, :layout => nil\n end",
"def template(filename, locals={})\n b = binding\n to_display = locals\n load_from = File.expand_path(\"../views/#{filename}.erb\", __FILE__)\n content = File.read(load_from)\n ERB.new(content).result(b)\n end",
"def render(state, format, local_variables = {})\n view.template_format = format\n render_opts = { :file => find_template(state), :locals => local_variables }\n render_opts[:layout] = find_template(layout) if layout\n view.render(render_opts)\n end",
"def render_template(file, locals = {})\n ERB.new(File.read(file)).result OpenStruct.new(locals).instance_eval{ binding }\n end",
"def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end",
"def render(file_path, local_variables = {})\n absolute_path = File.expand_path file_path, base_path\n absolute_path += FILE_EXTENSION unless absolute_path.end_with?(FILE_EXTENSION)\n file_content = File.read absolute_path\n erb = ERB.new file_content\n erb.result create_binding(base_path, local_variables)\n end",
"def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end",
"def render!\n render :file => template_path\n end",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def render(options = nil, scope = Object.new)\n options ||= @act\n format = nil\n template_path = nil\n case options\n when Hash\n format = options[:format].to_s.empty? ? 'html' : options[:format]\n if options[:partial]\n template_path = compute_template_path(\"_#{options[:partial]}\", format)\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n elsif options[:action]\n template_path = compute_template_path(options[:action], format)\n template_source = ERB.new(File.read(template_path),\n nil, '-', '@_out_buf').src\n elsif options[:file]\n template_path = File.join(config.template_root, options[:file])\n template_source = ERB.new(File.read(options), nil, '-', '@_out_buf').src\n elsif options[:text]\n output = ERB::Util.h(options[:text])\n elsif options[:html]\n output = options[:html]\n elsif options[:inline]\n template_path = \"#{request_method} #{@act}\"\n template_source = ERB.new(options[:inline].to_s, nil, '-', '@_out_buf').src\n end\n when Symbol\n format = 'html'\n template_path = compute_template_path(options, 'html')\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n when String\n format = 'html'\n template_path = File.join(config.template_root, options)\n template_source = ERB.new(File.read(template_path), nil, '-', '@_out_buf').src\n end\n \n unless output\n # ヘルパの準備\n ([Mizinco::Helper, ERB::Util] | self.class.helpers).each{ |helper| scope.extend helper }\n # インスタンス変数のコピー\n scope.instance_variable_set('@app', self)\n instance_variables.collect do |var|\n scope.instance_variable_set(var, instance_variable_get(var))\n end\n \n # スクリプト実行\n original_out_buf =\n scope.instance_variables.any? { |var| var.to_sym == :@_out_buf } &&\n scope.instance_variable_get(:@_out_buf)\n scope.instance_eval template_source, template_path, 0\n output = scope.instance_variable_get(:@_out_buf)\n scope.instance_variable_set(:@_out_buf, original_out_buf)\n end\n \n res.write output if !options.is_a?(Hash) || options[:partial].to_s.empty?\n\n output\n end",
"def render(partial_relative_path, vars=nil)\n pathname = partial_pathname(partial_relative_path)\n\n if vars.is_a?(Hash)\n context = Context.new(self, (variables || {}).merge(vars))\n else\n context = nil\n end\n\n template_result(pathname.read, context)\n end",
"def view template, opts={}, &block\n content_type(opts.delete(:content_type)) if opts[:content_type]\n\n scope = opts[:scope] || self\n locals = opts[:locals] || {}\n\n template = template_path(template)\n v_template = @app.template_for template, opts[:engine]\n raise Gin::TemplateMissing, \"No such template `#{template}'\" unless v_template\n\n if opts[:layout] != false\n r_layout = template_path((opts[:layout] || layout), true)\n r_template = @app.template_for r_layout, opts[:layout_engine] if r_layout\n end\n\n if !@response[CNT_TYPE]\n mime_type = v_template.class.default_mime_type ||\n r_template && r_template.class.default_mime_type\n content_type(mime_type) if mime_type\n end\n\n @env[GIN_TEMPLATES] ||= []\n\n if r_template\n @env[GIN_TEMPLATES] << r_template.file << v_template.file\n r_template.render(scope, locals){\n v_template.render(scope, locals, &block) }\n else\n @env[GIN_TEMPLATES] << v_template.file\n v_template.render(scope, locals, &block)\n end\n end",
"def render template, options={}\n put_on_a_hat\n\n if options.has_key? :dir\n template = :\"#{options[:dir]}/#{template}\" if options[:dir]\n\n elsif view_dir\n template = :\"#{view_dir}/#{template}\"\n end\n\n return erubis template, options\n end",
"def render(template_path, locals = {})\n old_locals = @locals\n @locals = locals.with_indifferent_access\n erb = VizBuilder.erb_new(template_path)\n ret = erb.result(binding)\n @locals = old_locals\n ret\n end",
"def render_template(options)\n @assigns_added = nil\n template, layout, partial = options.values_at(:_template, :_layout, :_partial)\n _render_template(template, layout, options, partial)\n end",
"def erb(template) render template end",
"def render\n ERB.new(load_resource(template)).result(bound.get_binding)\n end",
"def render(template_name, view_handler, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def render_custom(template, params)\n if (template != nil)\n blank = Liquid::Template.parse(template)\n blank.render(params)\n end\n end",
"def render_template(template_name, locals={})\n parse_file_as_erb(\"#{Rails.root}/lib/tasks/templates/#{template_name}.erb\", locals)\nend",
"def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end",
"def render(*args)\n options = {}\n if args.length == 1 && args[0].class == String\n # render partial\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Hash\n # render :partial => 'partial', :locals => {:var1 => value1, :var2 => value2}\n options = args[0]\n elsif args.length == 2 && args[0].class == String && args[1].class == Hash\n # render 'partial', :var1 => value1, :var2 => value2\n options[:locals] = args[1]\n options[:partial] = args[0]\n elsif args.length == 1 && args[0].class == Array\n # render ['xpartials','ypartials']\n raise PartialError, \"render array not yet implemented\"\n else\n raise PartialError, \"unsupported arguments\"\n end\n partial = options[:partial] || nil\n raise PartialError, \"partial not specified\" unless partial\n prawn = options[:prawn] || pdf\n @locals_stack ||= []\n @locals_stack.push @locals\n @locals = options[:locals]\n @pdf_stack ||= []\n @pdf_stack.push @pdf\n @pdf = prawn\n instance_eval(partial_source(partial), __FILE__, __LINE__)\n @pdf = @pdf_stack.pop\n @locals = @locals_stack.pop\n end",
"def view\n render partial: params[:template]\n end",
"def render_partial(template, types, context)\n templates.get(template, types).render(context)\n end",
"def render(template, local_assigns={})\n @view.instance_eval do\n evaluate_assigns\n end\n\n options = @@options.dup\n locals = options[:locals] || {}\n locals.merge! local_assigns\n options[:locals] = locals\n\n if @view.haml_inline\n engine = Haml::Engine.new(template, options)\n else\n options[:filename] ||= template\n engine = Haml::Engine.new(File.read(template), options)\n end\n\n yield_proc = @view.instance_eval do\n proc { |*name| instance_variable_get(\"@content_for_#{name.first || 'layout'}\") }\n end\n\n engine.to_html(@view) { |*args| yield_proc.call(*args) }\n\n end",
"def render_template(name, is_user_template, render_params)\n template_params, haml = load(name, is_user_template)\n renderer.render(\n inline: haml,\n type: :haml,\n locals: render_params.merge(@@locals))\n end",
"def render file_name\n template_file = @template_dir + file_name\n\n template = template_for template_file, false, RDoc::ERBPartial\n\n template.filename = template_file.to_s\n\n template.result @context\n end",
"def render(opts={})\n update(opts)\n render_template\n end",
"def render(template_name)\n template = ERB.new( \n File.read( full_template_path( template_name ) )\n )\n render_content( template.result( binding ), 'text/html' )\n end",
"def render_to_string(template, locals = {})\n read_template(lookup_template(template), locals)\n end",
"def render(name, opts={}, &block)\n \n # render @link\n if name.respond_to?(:created_by)\n path = Template.last_template_path.split('/')[1]\n eval \"@#{name.class.name.tableize.singularize} = name\"\n name = \"#{path}/#{name.class.name.tableize}/_#{name.class.name.downcase}\"\n else\n name = name.to_s\n name = \"#{Template.last_template_path}/#{name}\" unless name.index('/')\n end\n\n if block_given?\n name = \"#{name}/layout\" unless name.index('/')\n local_data = capture(&block)\n Template.new(name).part(instance_variables_hash) do\n local_data\n end\n else\n Template.new(name).part(instance_variables_hash.merge(opts))\n end\n end",
"def partial(template, locals = {})\n erb(template, layout: false, locals: locals)\n end",
"def render(context)\n file = render_variable(context) || @file # use parsed variable filename unless passed explicit filename\n validate_file_name(file)\n path = locate_include_file(context, file, true) # ensure file exists in safe path\n return unless path\n # # ???????\n # add_include_to_dependency(site, path, context)\n #\n # Load the partial if it's identical to one we've already loaded ???\n partial = File.read(path) # reads the template file\n partial = Liquid::Template.parse(partial) # compiles template\n # setup and perform render\n context.stack do\n # create a hash object for any passed k/v pair args\n # by parsing passed parameters using the parent file's scope\n context[\"include\"] = parse_params(context) if @params\n begin # render the include for output\n partial.render!(context)\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def render(*args)\n tpls_file = (@__caller_info__ || __caller_info__).first.first\n self._template_parser.load(tpls_file).parse.each do |template_name, raw_content|\n # no controller name if absolute view path\n ctrl_name = template_name.match(/^\\//) ? nil : self.controller_name\n path = Merb.dir_for(:view) / self._template_location(template_name.gsub(/^\\//,''), nil, ctrl_name)\n file = VirtualFile.new(raw_content, path)\n TEMPLATES[path.to_s] = file\n end\n super\n end",
"def render_template(name, variables = {}, engine_options = {}, &blk)\n path = settings[:views] || './views'\n full_name = File.expand_path(File.join(path, name))\n\n # load and cache template\n @@cached_templates ||= {}\n t = @@cached_templates[full_name] =\n (Happy.env.production? && @@cached_templates[full_name]) || begin\n engine_options = {\n :default_encoding => 'utf-8',\n :outvar => \"@output_buffer\" # for erb\n }.merge(engine_options)\n Tilt.new(full_name, engine_options)\n end\n\n # render template\n t.render(self, variables, &blk)\n end",
"def render(*names)\n v = @response.template\n v.assigns(:x => :y)\n v.render_file\n v.template_format\n v.view_paths\n v.pick_template_extension\n names.each do |name|\n v.file_exists?(name)\n end\n end",
"def render_template klass, *args\t\t\n\t\t\tbegin\n\t\t\t\tparams = args[0] || {}\n\t\t\t\t\n\t\t\t\tresource = params[:resource] || TEMPLATE_EXTENSION\n\t\t\t\t\n\t\t\t\tinput = if custom_template\n\t\t\t\t\tcustom_template.call(klass, resource) || klass[resource]\n\t\t\t\telse\n\t\t\t\t\tklass[resource]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Preprocessing\n\t\t\t\tif params[:preprocessing]\n\t\t\t\t\tinput.gsub!(/\\$\\{.+?\\}/) do |term| \n\t\t\t\t\t\tidentifier = term.slice(2 .. term.size-2)\n \"<%= #{identifier}.to_html if #{identifier}%>\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Binding\n\t\t\t\tbind = params[:binding] || binding\n\t\t\t\t\n\t\t\t\t# Process Template\n\t\t\t\thtml = WGUIERuby.new(input).result(bind)\n\t\t\t\t\n\t\t\t\tvalidate(html, klass) if $debug\n\t\t\t\t\n\t\t\t\treturn html \n\t\t\trescue Exception => e\n\t\t\t\tlog.error \"Error by rendering template '#{resource}' for '#{klass.name}' Class!\"\n\t\t\t\traise e\n\t\t\tend\n\t\tend",
"def render(template_name)\n template_content = File.read(template_path(template_name))\n template = ERB.new(template_content)\n response_body = template.result(get_binding)\n render_content(response_body, 'text/html')\n end",
"def render_template(path)\n render(path)\n exit\n end",
"def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval { binding })\n (view == 'document' || view == 'embedded') ? output.gsub(BLANK_LINES_PATTERN, '').gsub(LINE_FEED_ENTITY, \"\\n\") : output\n end",
"def render_template(name)\n locals = { :task => @task, :node => @node, :repo => @repo }\n content_type 'text/plain'\n template, opts = @task.find_template(name)\n erb template, opts.merge(locals: locals, layout: false)\n end",
"def render(*names)\n v = ActionView::Base.new\n v.assigns(:x => :y)\n v.template_format\n v.view_paths\n v.pick_template_extension\n names.each do |name|\n v.file_exists?(name)\n end\n v.render_file(names.last, nil, nil)\n end",
"def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end",
"def render(name, object = nil)\n binding = get_binding\n\n if object.respond_to?(:get_binding)\n binding = object.get_binding\n end\n\n content = File.read(File.join(TEMPLATE_PATH, name))\n ERB.new(content).result(binding)\n end",
"def template(name,locals={})\n Tilt.new(Dir.glob(\"#{settings.service.templates_dir}/#{name}.*\").first)\n .render(self,locals)\n end",
"def render(path, hash={})\n @template.class.new(path, localized_look_in).render(@hash.merge(hash)).strip\n end",
"def evaluate(scope, locals, &block)\n @scope = scope\n template = hb_render_template locals, &block\n \"#{hb_template_var} = #{hb_template_js template};\\n\".tap do |text|\n text += \"#{self.class.template_partial_method}('#{hb_partial_path}', #{hb_template_var});\" if hb_partial?\n end\n end",
"def render(context, options); end",
"def render_template(template, env)\n templates_dir = \"lib/search_engine/views\"\n template = \"#{template}.slim\" unless template.end_with? \".slim\"\n template_path = \"#{templates_dir}/#{template}\"\n content = File.read(template_path)\n Slim::Template.new { content }.render(env)\nend",
"def render(options = {})\n options.merge! :vendor_lua => @vendor_lua if @vendor_lua\n #debugger\n #puts \">> LAMINATE RENDER START. Disabling gc.\"\n #GC.disable\n # Compile template if needed\n name = @name.dup\n prepare_template(name)\n lua = @loader.load_compiled(name).dup\n\n @errors = []\n error_proc = Proc.new {|err| handle_error(err, lua, options)}\n\n State.new(options).run(error_proc) do |state|\n state.logger = logger\n state.eval(lua)\n # Included template functions. The trick is that we don't return to Ruby and eval the included template, because the\n # Lua binding doesn't like re-entering eval. So instead we bind a function '_load_template' which returns the template\n # code, and then we eval it inside Lua itself using 'loadstring'. Thus the template 'include' function is actually\n # a native Lua function.\n state.function '_load_template' do |template_name|\n prepare_template(template_name)\n load_template_innerds(template_name)\n end\n\n state.eval(\"return #{@compiler.lua_template_function(name)}()\")\n end\n end",
"def render(template_name)\n # \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # format view path\n controller_name = self.class.to_s.underscore\n view_path = \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # read in contents of view file and interpret embedded ruby\n view_content = File.read(view_path)\n template_content = ERB.new(view_content).result(binding) # binding gives erb access to ivars\n\n # html/text downloads output???\n render_content(template_content, \"text/html\")\n end",
"def render_view(template, params={})\n params[:controller] = self\n template = \"#{template}.rhtml\" if template.is_a? Symbol\n content = @@erb_template.new(template, params, plugin_name()).string\n @response[:html] << content\n @response[:script] << params[:script] if params[:script]\n end",
"def render\n ERB.new(File.read(TEMPLATE), 0, \">\").result(binding)\n end",
"def render( template, scope )\n\t\treturn ''\n\tend",
"def render(template_name, context=Context.new, layout=true)\n #context = Context.new(context) if context.is_a?(Hash)\n context = hook_context(context)\n while true\n template = get_template(template_name, context) # context is passed only for preprocessor\n _buf = context._buf\n output = template.render(context)\n context._buf = _buf\n unless context._layout.nil?\n layout = context._layout\n context._layout = nil\n end\n layout = @layout if layout == true or layout.nil?\n break unless layout\n template_name = layout\n layout = false\n context.instance_variable_set('@_content', output)\n end\n return output\n end",
"def render(template)\n b = binding\n code = ERB.new template\n code.result b\n end",
"def render(*args); end",
"def render(*args); end",
"def render_ruby(engine, template, options={}, locals={}, &block)\n options, template = template, nil if template.is_a?(Hash)\n template = Proc.new { block } if template.nil?\n render engine, template, options, locals\n end",
"def render_mktg( options )\n logger.debug( [ 'render_mktg', options ] )\n\n options[:file] = mktg_template_filename( options )\n if options[:check_existance]\n notfound unless File.exists?(Rails.root.join('app','views',options[:file]))\n end\n partial=options.delete(:partial)\n options.delete(:path)\n\n if partial\n render_to_string options.merge(:layout => false)\n else\n render options.reverse_merge(:layout => true)\n end\n end",
"def render(*args) \n return '' if @root.nil? \n \n context = case args.first\n when Liquor::Context\n args.first\n when Hash\n Context.new([args.first, assigns], instance_assigns, registers, @rethrow_errors)\n when nil\n Context.new(assigns, instance_assigns, registers, @rethrow_errors)\n else\n raise ArgumentError, \"Expect Hash or Liquor::Context as parameter\"\n end\n \n options = nil\n case args.last\n when Hash\n options = args.last\n \n if options[:registers].is_a?(Hash)\n self.registers.merge!(options[:registers]) \n end\n\n if options[:filters]\n context.add_filters(options[:filters])\n end\n \n if options[:layout]\n raise ArgumentError, \"Expected Liquor::Template as layout argument\" unless options[:layout].is_a? Liquor::Template\n end \n \n when Module\n context.add_filters(args.last) \n when Array\n context.add_filters(args.last) \n end\n \n begin \n # render the nodelist.\n # for performance reasons we get a array back here. join will make a string out of it\n res = @root.render(context).join\n \n if options && options[:layout]\n content_for_assigns = (context.has_key?(\"content_for\") ? context[\"content_for\"] : {})\n content_for_assigns = content_for_assigns.merge({ \"_rendered_template_\" => res })\n \n case args.first\n when Liquor::Context\n args.first[\"content_for\"] = content_for_assigns\n when Hash\n args.first.merge!({ \"content_for\" => content_for_assigns })\n end \n \n layout_template = args.last.delete(:layout)\n \n # Here we execute render method of the Liquor::Template object (we execute _this_ method)\n # It is not the @root.render method. It is a result of the @root.render(context).join\n # so we don't need to call join here.\n res = layout_template.render(*args)\n end\n \n res\n ensure\n @errors = context.errors\n end\n end",
"def render_template(options={})\n # puts \"ActionController#render_template(start), options = #{options}\"\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n #Timer.time_stamp(\"render_template (begin)\")\n content_fors = options.delete(:content_for) || {}\n partial = options[:partial]\n\n # renderer = ActionView::Renderer.new(self, path: render_path)\n # puts \"renderer = #{@renderer.inspect}\"\n if partial\n # puts \"ActionController#render_template (partial)\"\n top_view_html = @renderer.render(options)\n else\n # puts \"ActionController#render_template (file)\"\n top_view_html = @renderer.render(file: render_path, options: {locals: @__locals})\n end\n\n content_for_htmls = {}\n content_fors.each do |key, selector|\n content_for_html = @renderer.content_fors[key]\n #puts \"content for #{key} = #{content_for_html}\"\n content_for_htmls[selector] = content_for_html\n end\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n [top_view_html, content_for_htmls]\n end",
"def render_template(file, variables)\n template = load_template(file) or raise \"template not found: #{path}\"\n template.render(variables)\n end",
"def render(template_name, template_vars = {})\n template_file = File.join(File.dirname(__FILE__), 'fixtures', 'requests', \"#{template_name}.xml\")\n raise TrufinaException.new(\"Unable to find fixture file: #{template_file}\") unless File.exists?(template_file)\n \n template_binding_object = OpenStruct.new(template_vars)\n\n template = ERB.new(File.read(template_file))\n template.result(template_binding_object.get_binding)\nend",
"def render!(*args); end",
"def erb(template, options = {}, locals = {})\n template = template.to_sym\n options[:layout] = options[:layout].present? ? options[:layout] : !request.xhr?\n \n super\n end",
"def render(template_name)\n controller_name = self.class.to_s.underscore\n\n string = File.read(\"./views/#{controller_name}/#{template_name}.html.erb\")\n #\"./\" for project root dir\n\n template = ERB.new(string)\n capture = template.result(binding) #evaluate and bind\n\n render_content(capture, \"text/html\")\n end",
"def render\n ERB.new(@template, nil, '-').result(binding)\n end",
"def render(path, options={})\n # render template\n template = File.read(path)\n\n # assign locals to the render binding\n # this almost surely may be optimized...\n locals = options[:locals]\n binding = empty_binding\n\n locals.each_pair do |key, value|\n @assignment_value = value\n eval(\"#{key} = remove_instance_variable(:@assignment_value)\", binding)\n end if locals\n\n erb = ERB.new(template, nil, \"<>\")\n erb.filename = path\n erb.result(binding)\n end",
"def template(relative_source, relative_destination, template_options = {})\n create_file(relative_source, relative_destination, template_options) do |file|\n # Evaluate any assignments in a temporary, throwaway binding.\n vars = template_options[:assigns] || {}\n b = template_options[:binding] || binding\n vars.each { |k,v| eval \"#{k} = vars[:#{k}] || vars['#{k}']\", b }\n\n # Render the source file with the temporary binding.\n ERB.new(file.read, nil, '-').result(b)\n end\n end",
"def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end",
"def render(context = Erubis::Context.new)\n # Read template data\n template_filename = \"#{@template}.rhtml\"\n begin\n template = File.read(template_filename)\n rescue Errno::ENOENT\n raise ScriptError.new(\"Template #{template_filename} does not exist!\")\n end\n\n # Prepare template and variables\n eruby = Erubis::Eruby.new template\n \n # Perform templating\n begin\n result = eruby.evaluate context\n rescue\n raise TemplateError.new(\"Encountered error processing template #{template_filename}.\", $!)\n end\n\n # Output result\n output result \n end",
"def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end",
"def render_for( short_name, options = {})\n template = template_for(short_name)\n render options.merge(template.to_params)\n end",
"def render(template_name)\n #Open template, put content into string-content\n cntrl_name = self.class.to_s.underscore\n\n erb_temp = File.read(\"views/#{cntrl_name}/#{template_name}.html.erb\")\n content = ERB.new(erb_temp).result(binding)\n\n render_content(content , 'text/html')\n end",
"def render_plain\n template_content\n end",
"def render_ruby(engine, template, options = {}, locals = {}, &block)\n options, template = template, nil if template.is_a?(Hash)\n template = Proc.new { block } if template.nil?\n\n render engine, template, options, locals\n end",
"def use_template(name)\n call \"_#{name}\"\n end",
"def do_render\n Mustache.render(template, self)\n end",
"def render view, options\n options.format! view\n path_store.cached options do\n options.file = template_path view, options\n view.render_with options\n end\n end",
"def render_variable(context); end"
] | [
"0.7993013",
"0.78877896",
"0.7568692",
"0.7486668",
"0.74562806",
"0.7332819",
"0.72803456",
"0.72803456",
"0.7265462",
"0.72120565",
"0.71934414",
"0.7192736",
"0.7023708",
"0.7020327",
"0.6989674",
"0.6969035",
"0.69488275",
"0.693119",
"0.68661773",
"0.68589234",
"0.68481594",
"0.68319243",
"0.6827859",
"0.68263835",
"0.6803415",
"0.6741961",
"0.67233795",
"0.6677273",
"0.6674499",
"0.6672355",
"0.6660214",
"0.6655034",
"0.6655023",
"0.66427666",
"0.66397965",
"0.6634601",
"0.6634601",
"0.6616024",
"0.6613104",
"0.6611156",
"0.6604094",
"0.66038114",
"0.6601048",
"0.6594212",
"0.65880597",
"0.65793145",
"0.65463275",
"0.65414363",
"0.6530328",
"0.65253866",
"0.6525327",
"0.6521803",
"0.6521717",
"0.65199226",
"0.6509735",
"0.65004504",
"0.6487227",
"0.64812833",
"0.64749426",
"0.64410037",
"0.6439271",
"0.6434775",
"0.64273983",
"0.6426223",
"0.64220023",
"0.6419012",
"0.6418056",
"0.6410827",
"0.6402695",
"0.6389919",
"0.6379568",
"0.63681847",
"0.6365151",
"0.6359342",
"0.63584304",
"0.634944",
"0.634944",
"0.63479435",
"0.63403696",
"0.6337122",
"0.6335493",
"0.63302743",
"0.63280594",
"0.63270986",
"0.6326709",
"0.6314112",
"0.6313923",
"0.6298308",
"0.6289214",
"0.62760437",
"0.6272814",
"0.6268515",
"0.625885",
"0.6257784",
"0.62541485",
"0.62492365",
"0.6238896",
"0.623852",
"0.6233344",
"0.62310356"
] | 0.7670935 | 2 |
Where the templates are located. | def template_path
@template_path ||= @env[:templates_path] || default_settings[:templates_path]
Pathname.new @template_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates_path\n File.join(root, TEMPLATES)\n end",
"def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end",
"def templates_path\n File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def templates_dir\n return File.join(File.dirname(__FILE__), 'server/templates')\n end",
"def templates_dir\n \"#{RdocInfo.config[:templates_dir]}\"\n end",
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def templates_path\n @templates_path\n end",
"def templates\n @template_paths ||= Tilt.mappings.map do |ext, engines|\n Dir.glob(@root+\"/**/*.#{ext}\") if engines.map(&:default_mime_type).include?('text/html')\n end.flatten.compact\n end",
"def template_dir\n Templates.path_for(template_dir_name)\n end",
"def template_dir\n @template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))\n end",
"def template_dir_for template\n template_path = File.join 'rdoc', 'generator', 'template', template\n\n $LOAD_PATH.map do |path|\n File.join File.expand_path(path), template_path\n end.find do |dir|\n File.directory? dir\n end\n end",
"def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end",
"def pathTemplates\n \"./templates/\"\nend",
"def template_dir\n 'app/views/'\n end",
"def template_path\n File.join path, 'templates'\n end",
"def doc_templates_dir\n return File.absolute_path(File.join(@root_dir, 'doc_templates'))\n end",
"def template_paths\n paths = Engines.plugins.by_precedence.map { |p| \"#{p.directory}/app/views/#{mailer_name}\" }\n paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading\n paths\n end",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def templates\n file_list '{templates,puppet}/**/*.{erb,epp}'\n end",
"def template_paths\n paths = Rails.plugins.by_precedence.map { |p| \"#{p.root}/app/views/#{mailer_name}\" }\n paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading\n paths\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def templates\n Dir.glob(File.join(gem_path, 'templates', '*'))\n end",
"def template_dir\n self.class.name.underscore\n end",
"def templates\n @templates ||= TemplateFinder.new(path, types)\n end",
"def templates() = templates_path.glob('**/*.erb')",
"def templatepath(environment = nil)\n dirs = Puppet.settings.value(:templatedir, environment).split(File::PATH_SEPARATOR)\n dirs.select do |p|\n File::directory?(p)\n end\n end",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def template_base_path\n @template_base_path ||= Inkblot.vendor_path('templates')\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 templates\n Dir.glob(::Webby.path('examples') / '*').sort\n end",
"def tpl_dir; return @@tpl_dir; end",
"def templates; end",
"def _folders\r\n Dir.glob(File.join(\"templates\", \"**/\"))\r\n end",
"def template_files\r\n \t[].concat(@templates)\r\n end",
"def available_page_templates\n dirname = Rails.root.join('app/' + Option.theme_full_dir)\n templates = []\n Dir.foreach(dirname) do |filename|\n if filename.length > 19 + 1 && filename.slice(0, 9) == 'template_' && filename.slice(-10, 10) == '.html.haml'\n templates << filename.slice(9, filename.length - 19)\n end\n end\n templates\n end",
"def templates_path\n expanded_path_for('/generators')\nend",
"def get_templates(type)\n Dir[get_template_location << type << '/*']\n end",
"def template_path\n @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')\n # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')\n end",
"def template_files path\n exts = template_engines.keys.map{|e| \".\" << e if e }.join(\",\")\n Dir[\"#{path}{#{exts}}\"]\n end",
"def templates\n @templates ||= (\n list = []\n list.concat templates_from_project\n list.concat templates_from_remotes\n list.concat templates_from_plugins\n list.sort_by{ |t| t.name }\n )\n end",
"def template_path\n exact_path = File.join(root, request.path)\n with_erb = File.join(root, \"#{request.path}.html.erb\")\n with_index = File.join(root, File.dirname(request.path), 'index.html.erb')\n\n [ exact_path, with_erb, with_index ].find { |f| File.file?(f) }\n end",
"def template_dir\n File.join(PREFIX, 'share', 'oswitch', 'context')\n end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def templates_from_project\n list = []\n dirs = Dir.glob(File.join(output, LOCAL_DIRECTORY, '*/'))\n dirs = dirs.uniq.map{ |d| d.chomp('/') }\n dirs.each do |dir|\n name = dir.sub(File.join(output, LOCAL_DIRECTORY)+'/', '')\n list << Template.new(name, dir, :type=>:project)\n end\n list\n end",
"def template_files\n Pathname.glob(staged_root.join(\"**\", \"*.erb\")).select(&:file?)\n end",
"def templates\n wayfinder.decorated_templates\n end",
"def template_load_path\n @template_load_path ||= File.expand_path(File.dirname(self.filename))\n end",
"def template_path( *fns )\n TDP.application.add_template_path(files: fns, freeze: false)\n end",
"def copy_or_fetch\n filename_pattern = File.join self.class.source_root, \"*\" #/*.html.#{template_engine}\"\n Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|\n directory f.to_s, \"app/views/#{f}\"\n end\n end",
"def built_in_template_for(template_name)\n File.join( File.dirname(__FILE__), 'templates', template_name )\n end",
"def index_path\n return templates_path\n end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def copy_common_templates\n %w[\n .gitignore .rspec Gemfile MIT-LICENSE Rakefile\n ].each do |tpl|\n template(\"../common/#{tpl}\", \"#{extension_name}/#{tpl}\")\n end\n end",
"def template_path(template)\n File.join(@root, 'templates', self.class::FILES[template])\n end",
"def configure_views\n helpers do\n def find_template(views, name, engine, &block)\n _, dir = views.detect { |k,v| engine == Tilt[k] }\n dir ||= views[:default]\n super(dir, name, engine, &block)\n end\n end\n end",
"def full_template_path\n template_root.join(\"#{@template}.erb\").to_s.squeeze(\"/\")\n end",
"def templates_from_plugins\n list = []\n dirs = ::Find.data_path(File.join('quarry', '*/'))\n dirs = dirs.uniq.map{ |d| d.chomp('/') }\n dirs.each do |dir|\n i = dir.rindex('quarry/')\n name = dir[i+7..-1]\n list << Template.new(name, dir, :type=>:plugin)\n end\n list\n end",
"def templates_for(file); end",
"def template_paths(name)\r\n \[email protected]([]) do |list, path|\r\n \t\tfile_name = File.basename(path)\r\n \t\tfile_name[0, name.length] == name.to_s ? list << path : list\r\n \tend\r\n end",
"def find_template(name)\n \n # Search in theme path\n template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{name}.erb\",'template','ui') \n \n # Search in the project\n if not template_path\n path = app.get_path(name) #File.expand_path(File.join(File.dirname(__FILE__), '..', 'views', \"#{name}-fieldset-render.erb\")) \n template_path = path if File.exist?(path)\n end\n \n template_path\n \n end",
"def template_path\n File.join(File.dirname(__FILE__), 'templates', 'type', \"#{@format}.erb\")\n end",
"def all_template_files\n files = super\n files + Dir.glob(\"#{JenkinsJob.flavor_dir}/templates/**.xml.erb\")\n end",
"def all_template_files\n files = super\n files + Dir.glob(\"#{JenkinsJob.flavor_dir}/templates/**.xml.erb\")\n end",
"def template_path(template)\n modulepath.each do | path|\n return path if File.exists?(\"#{path}/easy_type/templates/#{template}\")\n end\n fail \"Template #{template} not found in modulepath #{modulepath}\"\n end",
"def templates\n # Some cheap memoiziation\n @templates ||= begin\n files = Dir.glob(template_glob)\n # Check to see what mode we are in, that'll define how we parse the file names\n if Gluttonberg.localized? or Gluttonberg.translated?\n # Figure out what regex we need\n matcher, mode = if Gluttonberg.localized?\n [/\\/#{filename}.(\\w+).([a-z-]+).(\\w+).(erb|mab|haml)/, :localized]\n elsif Gluttonberg.translated?\n [/\\/#{filename}.([a-z-]+).(\\w+).(erb|mab|haml)/, :translated]\n end\n files.inject({}) do |memo, file|\n match = file.match(matcher)\n extract_template_details(memo, mode, match) if match\n memo\n end\n else\n # For the non-localized/dialect mode, just collect the various formats\n files.inject([]) do |memo, file|\n match = file.match(/#{filename}.(\\w+).(erb|mab|haml)/)\n memo << match[1] if match\n memo\n end\n end\n end\n end",
"def files\n templates.map(&:filename)\n end",
"def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end",
"def scan_templates\r\n @templates = Dir.glob(File.join(path, \"*\")).inject([]) do |list, file_path|\r\n log.debug \"Checking if #{file_path} is a recognised template file.\"\r\n if File.file?(file_path)\r\n file_name = File.basename(file_path)\r\n log.debug \"#{file_path} is a template file.\" if !(Tilt[file_name]).nil?\r\n list << file_path if !(Tilt[file_name]).nil?\r\n end\r\n list\r\n end\r\n end",
"def template_glob\n Templates.path_for(self.class.template_dir_name) / \"#{filename}.*\"\n end",
"def shared_templates\n manifest[:shared_templates]\n end",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def template_path\n @options[:template_path]\n end",
"def template_path\n File.expand_path(File.join('..', '..', '..', 'templates', \"#{template_name}.erb\"), __FILE__)\n end",
"def template_files\n generator_job_templates_path = File.join(self.class.source_root, \"jobs/%job_name%_#{purpose}\")\n directory \"jobs/%job_name%_#{purpose}\", \"jobs/#{job_name}\"\n\n # build a hash of { 'bin/webapp_ctl.erb' => 'bin/webapp_ctl', ...} used in spec\n @template_files = {}\n FileUtils.chdir(File.join(generator_job_templates_path, \"templates\")) do\n `ls */*`.split(\"\\n\").each do |template_file|\n # clean up thor name convention\n template_file.gsub!(\"%job_name%\", job_name)\n template_file.gsub!(\".tt\", \"\")\n # strip erb from target file\n target_template_file = template_file.gsub(/.erb/, '')\n\n @template_files[template_file] = target_template_file\n end\n end\n end",
"def create_templates\n files = %w(_filter _form index admin edit show new)\n files.each do |file|\n template \"assets/templates/#{file}.html.haml.erb\", \"app/assets/templates/#{class_name.tableize}/#{file}.html.haml\"\n end\n end",
"def scaffold_template_dir\n @scaffold_template_dir ||= TEMPLATE_DIR\n end",
"def template_folder_for clazz\n # Search the potential matches in reverse order\n # because subclasses have registered AFTER their\n # superclasses and superclasses match the ===\n # check...\n generator_paths.reverse.each do |options|\n if options[:class] === clazz\n return options[:templates]\n end\n end\n nil\n end",
"def source_paths() = [views_path]",
"def find_templates(path)\n templates = []\n Find.find(path) do |path|\n templates << path if template?(path)\n end\n templates\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def template_path(name)\n File.join(__dir__, 'config', \"#{name}.yml.erb\")\n end",
"def view_paths\n _view_paths\n end",
"def view_paths\n _view_paths\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def full_path\n \"templates/#{filename}\"\n end",
"def template_path(extension)\n File.expand_path('../../../views/renderers/' + @dirname + '/' + @placeholder + '.' + extension, __FILE__)\n end",
"def promethee_partial_sources\n [Rails.root, Promethee.root].map { |source| source + 'app/views' }\n end",
"def template_path\n \n custom_path = File.expand_path(\"./config/deploy/templates/unicorn.service.erb\")\n original_path = File.expand_path(\"../templates/unicorn.service.erb\", __FILE__)\n \n File.exist?(custom_path) ? custom_path : original_path\n end",
"def templates\n @conn.templates\n end",
"def site_files\n exclude = %r/tmp$|bak$|~$|CVS|\\.svn/o\n\n rgxp = %r/\\A#{template}\\/?/\n paths = Hash.new {|h,k| h[k] = []}\n\n Find.find(template) do |p|\n next if exclude =~ p\n\n if test(?d, p)\n paths[p.sub(rgxp, '')]\n next\n end\n dir = ::File.dirname(p).sub(rgxp, '')\n paths[dir] << p.sub(rgxp, '')\n end\n\n paths\n end",
"def template_types_for_view\n\t\ttt = {}\n\t\tif File.exists?(theme_template_path + '/skin.liquid')\n\t\t\ttt[:rooms] = 'Rooms-Templates'\n\t\tend\n\t\tif File.exists?(theme_template_path + '/tickets')\n\t\t\ttt[:events] = 'Events-Templates'\n\t\tend\n\t\tif File.exists?(theme_template_path + '/vouchers')\n tt[:vouchers] = 'Voucher-Templates'\n end\n\t\treturn tt\n\tend",
"def template\n possible_templates.find {|t| File.exists? \"#{t}.html\"}\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"def template_path(name, template_engine:nil) #current_template_engine)\n template_engine ||= '*'\n #puts \"TEMPLATE_path searching with name: #{name}, template_engine: #{template_engine}\"\n ([Vue::Helpers.views_path].flatten.uniq.compact || Dir.getwd).each do |start_path|\n #puts \"TEMPLATE_path searching views-path: #{start_path}\"\n Dir.breadth_first(\"*\", base:start_path) do |path|\n #puts \"TEMPLATE_path inspecting file: #{path}\"\n return path if File.fnmatch(File.join('*', \"#{name}.vue.#{template_engine}\"), path)\n return path if File.fnmatch(File.join('*', \"#{name}.vue\"), path)\n return path if File.fnmatch(File.join('*', name.to_s), path)\n end\n end\n\n return nil\n end",
"def template_path\n File.join gem_root, 'spec', 'fixtures', 'application'\n end",
"def add_jader_views_to_path\n path = Rails.root.join('app','assets','javascripts','apps', @platform, 'templates')\n prepend_view_path path\n end",
"def templates_path=(path)\n @templates_path = path\n end"
] | [
"0.8190866",
"0.8016456",
"0.7964577",
"0.79030913",
"0.79030913",
"0.78334534",
"0.7812023",
"0.77700865",
"0.76474524",
"0.7588749",
"0.7524065",
"0.7512357",
"0.74945134",
"0.74911255",
"0.7487216",
"0.73903006",
"0.7385762",
"0.7365441",
"0.73364806",
"0.72795737",
"0.72705173",
"0.7220367",
"0.7201064",
"0.71482307",
"0.7118594",
"0.70929354",
"0.70886487",
"0.7087143",
"0.70867664",
"0.7032758",
"0.70233744",
"0.70192814",
"0.6953433",
"0.69215304",
"0.6893099",
"0.6892542",
"0.68749493",
"0.68600583",
"0.68258214",
"0.6823405",
"0.6810527",
"0.68052185",
"0.6804052",
"0.6750821",
"0.6713246",
"0.6673777",
"0.6655061",
"0.662318",
"0.662257",
"0.6568091",
"0.6559149",
"0.6550561",
"0.65258396",
"0.6514605",
"0.65136147",
"0.6511419",
"0.6505391",
"0.65053463",
"0.6498521",
"0.6469467",
"0.6448673",
"0.64470893",
"0.64362115",
"0.64162636",
"0.64162636",
"0.6413488",
"0.6411999",
"0.6411002",
"0.6400813",
"0.6397745",
"0.63950646",
"0.63925195",
"0.638715",
"0.63835377",
"0.63832647",
"0.6382658",
"0.6368335",
"0.63613284",
"0.6351063",
"0.6331397",
"0.63256806",
"0.6313029",
"0.6310004",
"0.6290099",
"0.6290099",
"0.62881476",
"0.6284245",
"0.6279044",
"0.62775224",
"0.6276607",
"0.626116",
"0.62445956",
"0.6243162",
"0.6240914",
"0.6226518",
"0.6224336",
"0.62119436",
"0.6210511",
"0.61968553",
"0.6187347"
] | 0.65910167 | 49 |
=> Load details from external services using custom API/gems. | def fetch_details
self.send("fetch_details_from_#{self.provider.downcase}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_services(extension, arg)\n extension += \"/#{arg}\"\n uri = URI.parse(API_URL + extension)\n response = connect(uri)\n puts response.body\n end",
"def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end",
"def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend",
"def fetch\n service = Diplomat::Service.get('resources')\n url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # if Rails.env.production?\n # service = Diplomat::Service.get('resources')\n # url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # else\n # url = 'http://localhost:3001/'\n # end\n conn = Faraday.new(url: url) do |faraday|\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n self.send(\"fetch_#{self.type}\", conn)\n end",
"def fetch\n response = RestClient.get \"http://pokeapi.co/#{resource_uri}\"\n update(resource_data: JSON.parse(response))\n end",
"def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def api\n self.well_info.api\n end",
"def external_lookup\n # look up catalog ID (passed as a parameter) in external metadata source,\n # getting back a Bibl object with the values from the external source\n begin\n # Note: The Bibl object (variable \"bibl\") here is just a convenient\n # carrier for the metadata values gleaned from the external metadata\n # record; it is a new Bibl object that never gets saved to the database.\n # (If the user chooses to save the new values to the database, the user\n # clicks the Update button in the GUI.)\n @bibl = Virgo.external_lookup(params[:catalog_key], params[:barcode])\n end\n \n respond_to do |format|\n format.js \n end\n end",
"def read_linked_data_api(entry)\n ld_api.call(entry.url) { |response, data| return response.body, data }\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end",
"def load_query_response\n load_file('sample_query_response.json')\nend",
"def fetch_details\n self.send(\"fetch_details_from_#{self.provider.downcase}\")\n end",
"def fetch_details\n self.send(\"fetch_details_from_#{self.provider.downcase}\")\n end",
"def load_api_service\n @api_service = ApiService.new\n end",
"def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"def api_v2_afc_serviceinfo_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LookupsApi.api_v2_afc_serviceinfo_get ...'\n end\n # resource path\n local_var_path = '/api/v2/afc/serviceinfo'\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(['text/plain', 'application/json', 'text/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ServiceInfo' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic']\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: LookupsApi#api_v2_afc_serviceinfo_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_get ...'\n end\n # resource path\n local_var_path = '/providers'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20020')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend",
"def access_api(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n file = File.open('bin/key.rb')\n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-host\"] = 'skyscanner-skyscanner-flight-search-v1.p.rapidapi.com'\n request[\"x-rapidapi-key\"] = file.read\n\n response = http.request(request).read_body\n response_hash = JSON.parse(response) \nend",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def load_poke url\n output = JSON.parse(RestClient.get(url))\n if Poke.find_by(id: output['id'])\n Poke.update(output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n else\n Poke.create(id: output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n end\n print 'p' + output['id'].to_s + ' ' if VERBOSE==1\nend",
"def make_api_call (api_path)\n uri = URI.parse(GPS_CLIENT_SETTINGS[\"url\"] + api_path)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme==\"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request = Net::HTTP::Get.new(uri.request_uri)\n request['API-SECRET'] = client_secret\n response = http.request(request) \n make_adapter_response(response)\n end",
"def find_service(id)\n self.class.get(\"/services/#{id}.json?apikey=#{apikey}\")\n end",
"def data_service\n DataServicesApi::Service.new(url: api_service_url)\n end",
"def get_events_from_api(name)\n #make the web request\n name1 = name\n performer_link = \"https://app.ticketmaster.com/discovery/v2/events.json?keyword=#{name1}&countrycode=US&apikey=ShI4Sd340EJ32f1k6rUgkYPocLSO2qTq\"\n response_string = RestClient.get(performer_link)\n response_hash = JSON.parse(response_string)\nend",
"def load_library\n\t\t#wget some url\n\tend",
"def get_data_from_references(resource_name)\n puts \"fetching #{resource_name}...\"\n mauth_config = MAuth::ConfigEnv.load\n references_host = ENV.fetch('REFERENCES_HOST', 'https://references-innovate.imedidata.com')\n begin\n connection = Faraday::Connection.new(url: references_host) do |builder|\n builder.use MAuth::Faraday::RequestSigner, mauth_config\n builder.adapter Faraday.default_adapter\n end\n\n # get the data\n response = connection.get \"/v1/#{resource_name}\"\n puts \"HTTP #{response.status}\"\n\n # return the user info\n if response.status == 200\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\n else\n puts response.body\n nil\n end\n rescue JSON::ParserError => e\n puts \"Error parsing data from references: #{e.inspect}\"\n puts e.backtrace.join(\"\\n\")\n end\nend",
"def sale_get_with_http_info(api_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SaleApi.sale_get ...\"\n end\n # verify the required parameter 'api_key' is set\n if @api_client.config.client_side_validation && api_key.nil?\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling SaleApi.sale_get\"\n end\n # resource path\n local_var_path = \"/api/Sale\"\n\n # query parameters\n query_params = {}\n query_params[:'saleId'] = opts[:'sale_id'] if !opts[:'sale_id'].nil?\n query_params[:'maxRecords'] = opts[:'max_records'] if !opts[:'max_records'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].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', 'text/json', 'application/xml', 'text/xml'])\n header_params[:'ApiKey'] = api_key\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<SwiftPOSVenue>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SaleApi#sale_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def omdb_pull(search_key, search_val)\n\n result = Typhoeus.get(\"http://www.omdbapi.com/\", :params => {search_key => search_val})\n result = JSON.parse(result.body)\n result\n\nend",
"def apicall(params)\n output = @filer.invoke(params)\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output\n end\n end",
"def data_providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataProvidersApi.data_providers_get ...'\n end\n # resource path\n local_var_path = '/data_providers'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<DataProvider>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataProvidersApi#data_providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end",
"def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end",
"def service_knowledge_base_articles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: KnowledgeBaseArticlesApi.service_knowledge_base_articles_get ...\"\n end\n # resource path\n local_var_path = \"/service/knowledgeBaseArticles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'conditions'] = opts[:'conditions'] if !opts[:'conditions'].nil?\n query_params[:'orderBy'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<KnowledgeBaseArticle>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KnowledgeBaseArticlesApi#service_knowledge_base_articles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def probe(api_map); end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def retrieve_metadata\n conn = Faraday.new(url: @reference.endpoint)\n conn.get\n rescue Faraday::Error::ConnectionFailed => error\n Geoblacklight.logger.error error.inspect\n nil\n rescue Faraday::Error::TimeoutError => error\n Geoblacklight.logger.error error.inspect\n nil\n end",
"def apis; end",
"def load_sale_info(catalog_id=@catalog_id)\n begin\n @sale_json = BGCAuctionSaleService.retrieve(catalog_id)\n @sale_number = @sale_json[\"saleNumber\"]\n @auction_house_sale_id = @sale_json[\"intSaleID\"]\n @auction_house_sale_url = @sale_json[\"saleURL\"]\n rescue BGCService::UnknownIdentifierException => e\n logger.warn e.message\n @sale_number = \"sale number unknown\"\n @auction_house_sale_id = \"sale ID unknown\"\n @auction_house_sale_url = \"\"\n end\n end",
"def call_api(options = {})\n option_params = []\n options.each_pair { |k, v| option_params << \"#{ k }=#{ v }\" }\n\n self.data = self.class.get \"#{ BASE_URL }/#{ organisation_name }/#{ place_name }/#{ name }\" + '?' + option_params.join('&')\n end",
"def weather_info(zipcode)\nclient = Weatherman::Client.new\n#this is our response \nweather = client.lookup_by_location(zipcode)\nend",
"def service_require\n ruby_file_path @api, service_name_full\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def fetchInstallations(token)\n url = URI(\"https://api.acceptance.hertekconnect.nl/api/v1/installations\")\n\n http = Net::HTTP.new(url.host, url.port);\n http.use_ssl = true\n request = Net::HTTP::Get.new(url)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{token}\"\n\n response = http.request(request)\n puts response.read_body\nend",
"def fetch(resource,identifier,params={})\n uri = '/api/' + resource.to_s + '/' + identifier\n http_get(uri,params)\n end",
"def get_services_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PricesApi.get_services ...'\n end\n # resource path\n local_var_path = '/v1/services'\n\n # query parameters\n query_params = {}\n query_params[:'provider_id'] = opts[:'provider_id'] if !opts[:'provider_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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 => 'Services')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PricesApi#get_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def service_list\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end",
"def lws_api_get(path)\n options = {headers: solr_headers}\n response = HTTParty.get(\"#{FlareConfig.lws_api_url}#{path}\", options)\n Rails.logger.info(\"RESPONSE CODE: #{response.code}\")\n if response.code == 200\n result = JSON.parse(response.body)\n else\n nil\n end\n end",
"def stub_api_init(source_types:, tenants:, application_types: nil, applications:, topology_sources:)\n stub_api_source_types_get(:response => source_types)\n stub_api_applications_get(:response => applications)\n stub_api_application_types_get(:response => application_types) if application_types\n stub_api_tenants_get(tenants)\n stub_api_topology_sources_get(:response => topology_sources)\n end",
"def get_by_id_with_http_info(import_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CoreApi.get_by_id ...'\n end\n # verify the required parameter 'import_id' is set\n if @api_client.config.client_side_validation && import_id.nil?\n fail ArgumentError, \"Missing the required parameter 'import_id' when calling CoreApi.get_by_id\"\n end\n # resource path\n local_var_path = '/crm/v3/imports/{importId}'.sub('{' + 'importId' + '}', CGI.escape(import_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] || 'PublicImportResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"CoreApi.get_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: CoreApi#get_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def call_company_service\n ch_api = CompaniesHouseApi.new\n response = ch_api.company company_number\n parse_response response\n end",
"def http_get(end_point)\n uri= URI.parse \"#{@main_url}#{end_point}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend",
"def parse_api\n\t\t@api_data_on_electeds[\"results\"].map do |info|\n\t\t\tfirst_name = info[\"first_name\"]\n\t\t\tlast_name = info[\"last_name\"]\n\t\t\temail = info[\"oc_email\"]\n\t\t\tphone = info[\"phone\"]\n\t\t\ttwitter = info[\"twitter_id\"]\n\t\tputs \"Your elected official is #{first_name} #{last_name}. Their email is #{email} and you can call them at #{phone}. Also send them a tweet at @#{twitter}!\"\n\tend\nend",
"def getinfo\n @api.request 'getinfo'\n end",
"def get_external_entities(external_entity_name, last_synchronization = nil)\n Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, \"Fetching #{Maestrano::Connector::Rails::External.external_name} #{external_entity_name.pluralize}\")\n entities = @external_client.find(external_entity_name)\n Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, \"Received data: Source=#{Maestrano::Connector::Rails::External.external_name}, Entity=#{external_entity_name}, Response=#{entities}\")\n entities\n end",
"def samsara_fleet_info\n #making a get request using Faraday and then parsing the data and setting it to @data\n url = \"https://api.samsara.com/v1/fleet/locations?access_token=#{Rails.application.credentials.secret_key}\"\n samsara_get(url)\n end",
"def load_catalog_info(catalog_id=@catalog_id, extra_blacklight_controller_params={})\n begin\n @catalog_solr_response, @catalog_solr_doc = get_solr_response_for_doc_id(catalog_id, extra_blacklight_controller_params)\n rescue Blacklight::SolrHelper::InvalidSolrID => e\n logger.warn \"Warning:\" + e.message + \" when searching for #{catalog_id}\"\n end\n return [@catalog_solr_response, @catalog_solr_doc]\n end",
"def set_api\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n # converts response to a Ruby hash \n @lookup_crypto = JSON.parse(@response)\n @gain_loss = 0\n end",
"def api\n @api ||= PrismicService.init_api\n end",
"def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end",
"def load_resource(path, args=nil)\n service.get(path, args)\n end",
"def info(url)\n rest = RestClient::Request.execute(\n method: :get,\n url: url,\n user: ENV['USER'],\n password: ENV['KEY'],\n headers: {\"Content-Type\" => \"application/json\"}\n )\n JSON.parse(rest, :symbolize_names => true)\n rescue RestClient::Exception\n \"Sorry something went wrong with the API\"\n end",
"def getHttpService()\r\n @currentlyDisplayedItem.getHttpService\r\n end",
"def external_dep;\treturn @json_data['external_dep'];\tend",
"def fetchServerConfig()\n #Construct the URL for the request\n url = \"http://api.themoviedb.org/3/configuration?api_key=#{$apiKey}\"\n #Preform a restful reqeust for the data\n data = RestClient.get(url)\n #Parse the returned JSON and return it as a hash\n return JSON.parse(data)\nend",
"def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end",
"def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end",
"def get_service_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_service ...\"\n end\n # resource path\n local_var_path = \"/service_information\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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 => 'ServiceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_service\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def services_web_application_name_servers_web_server_name_load_balancing_get_with_http_info(authorization, web_application_name, web_server_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get ...\"\n end\n # verify the required parameter 'authorization' is set\n if @api_client.config.client_side_validation && authorization.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # verify the required parameter 'web_application_name' is set\n if @api_client.config.client_side_validation && web_application_name.nil?\n fail ArgumentError, \"Missing the required parameter 'web_application_name' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # verify the required parameter 'web_server_name' is set\n if @api_client.config.client_side_validation && web_server_name.nil?\n fail ArgumentError, \"Missing the required parameter 'web_server_name' when calling LoadBalancingApi.services_web_application_name_servers_web_server_name_load_balancing_get\"\n end\n # resource path\n local_var_path = \"/services/{Web Application Name}/servers/{Web Server Name}/load-balancing\".sub('{' + 'Web Application Name' + '}', web_application_name.to_s).sub('{' + 'Web Server Name' + '}', web_server_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].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 header_params[:'Authorization'] = authorization\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LoadBalancingApi#services_web_application_name_servers_web_server_name_load_balancing_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def http_get(endpoint)\n uri= URI.parse \"#{@main_url}#{endpoint}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend",
"def service_description\n resp = http.resource(service_descriptor_href).get(:accept => 'application/vnd.absolute-performance.sysshep+json')\n JSON.parse(resp.body)\n end",
"def search_techcrunch\n response_string = RestClient.get\"https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=45aee5b7c7584064ac1b1de6297f5137\"\n response_hash = JSON.parse(response_string.body)\n end",
"def init_api(aws_final_url)\n\tbegin\n\t\tconn = Faraday.new(aws_final_url, :ssl => {:verify => false})\n\t\tresponse = conn.get do |aws|\n\t\t\taws.headers['Content-Type'] = 'application/json' \n\t\tend\n\t\tif response.status == 200\n\t\t\tregions(aws_final_url)\n\t\t\toffercode(aws_final_url)\n\t\t\t@json_res = JSON.parse(response.body)\n\t\t\tsave_pricing\n\t\telse\n\t\t\traise \"Could not get the response\"\n\t\tend\n\trescue Exception => e\n\t\tputs e\n\tend\nend",
"def fetch_metadata\n uri = SCALEWAY_METADATA_URL.to_s\n response = http_client.get(uri)\n case response.code\n when \"200\"\n parser = FFI_Yajl::Parser.new\n parser.parse(response.body)\n when \"404\"\n logger.trace(\"Mixin ScalewayMetadata: Encountered 404 response retrieving Scaleway metadata: #{uri} ; continuing.\")\n {}\n else\n raise \"Mixin ScalewayMetadata: Encountered error retrieving Scaleway metadata (#{uri} returned #{response.code} response)\"\n end\n end",
"def solr_core_api(host_name,port,params,path=\"/solr/admin/cores\")\n path = \"#{path}?\".concat(params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\" }.join('&'))+\"&wt=json\"\n Chef::Log.info(\" HostName = \" + host_name + \", Port = \" + port + \", Path = \" + path)\n http = Net::HTTP.new(host_name, port)\n req = Net::HTTP::Get.new(path)\n unless !SolrAuth::AuthUtils.auth_enabled?\n admin_creds = SolrAuth::AuthUtils.get_solr_admin_credentials\n req.basic_auth(admin_creds['username'], admin_creds['password'])\n end\n response = http.request(req)\n if response != nil then\n return JSON.parse(response.body())\n end\n raise StandardError, \"empty response\"\n end",
"def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end",
"def catalog_info_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.catalog_info ...\"\n end\n # resource path\n local_var_path = \"/v2/catalog/info\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2018-07-12\"\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 => 'CatalogInfoResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#catalog_info\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_api(path)\n with_http_error_handling do\n res = RestClient.get(endpoint + path)\n h = Hash.from_xml(res.body)\n h[\"response\"]\n end\n end",
"def fetch(options = {})\n\n url = build_url(options)\n\n puts \"this is the url #{url}\"\n puts \"these are the options #{options}\"\n\n json = get_response(url)\n\n puts json.to_yaml\n\n data = JSON.parse(json)\n\n #puts \"dump data after parse: #{data.to_yaml}\"\n\n # Check to see if the api returned an error\n raise ApiError.new(data['details'],url) if data.has_key?('problem')\n\n\n if !options[:id]\n\n puts \"in options\"\n\n collection = RMeetup::Collection.build(data)\n\n #puts \"value of collection:#{collection.to_yaml}\"\n\n # Format each result in the collection and return it\n collection.map!{|result| format_result(result)}\n\n return collection\n else\n puts \"not in options\"\n return data\n\n end\n\n\n end",
"def run\n super\n\n # Replace bad characters\n #\n # For future, consider:\n # http://stackoverflow.com/questions/20650681/ruby-gsub-multiple-characters-in-string\n phone_number = _get_entity_attribute(\"name\").gsub(\".\",\"\").gsub(\" \",\"\").gsub(\"-\",\"\").gsub(\"(\",\"\").gsub(\")\",\"\")\n\n # get the API key\n api_key = _get_global_config \"carrierlookup_api_key\"\n\n lookup_uri = \"http://www.carrierlookup.com/index.php/api/lookup?key=#{api_key}&number=#{phone_number}\"\n\n begin\n response = http_get_body lookup_uri\n attributes = JSON.parse response if response\n\n if attributes[\"Response\"][\"error\"]\n _log_error \"Error querying API #{attributes[\"Response\"][\"error\"]}\"\n return\n end\n\n _log \"You have #{attributes[\"Response\"][\"creditBalance\"]} credits remaining.\"\n\n # Edit the phone number entity\n @entity.details[\"carrier_type\"] = attributes[\"Response\"][\"carrier_type\"]\n @entity.details[\"carrier\"] = attributes[\"Response\"][\"carrier\"]\n @entity.save\n\n _log \"Carrier Type: #{@entity.details[\"carrier_type\"]}\"\n _log \"Carrier: #{@entity.details[\"carrier\"]}\"\n\n # Add an info entity_ids\n #{}_create_entity \"Info\", attributes.merge({\"name\" => \"Carrier Lookup for #{phone_number}: #{attributes}\"})\n\n rescue JSON::ParserError\n _log_error \"Unable to retrieve provider info\"\n end\n\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def inst_list(inst_id)\n uri = URI.parse(@url + '/' + inst_id) \n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth user, passwd\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end",
"def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end",
"def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend",
"def get_details\n return self if detailed?\n res = client.get(path_base).to_h\n update(res)\n res\n end",
"def fb_load_api\n\n\n end",
"def fetch_external\n object.controlled_properties.each do |property|\n object[property].each do |value|\n resource = value.respond_to?(:resource) ? value.resource : value\n next unless resource.is_a?(ActiveTriples::Resource)\n next if value.is_a?(ActiveFedora::Base)\n fetch_with_persistence(resource)\n end\n end\n end"
] | [
"0.65115446",
"0.63180023",
"0.61884654",
"0.60842127",
"0.6069616",
"0.6025443",
"0.59824175",
"0.59347755",
"0.590021",
"0.5885379",
"0.5833225",
"0.5820102",
"0.5788335",
"0.5760007",
"0.57578176",
"0.57538146",
"0.5749544",
"0.57312435",
"0.57312435",
"0.5730841",
"0.5720247",
"0.5716906",
"0.5711984",
"0.57050896",
"0.5659962",
"0.5642984",
"0.5642983",
"0.56339055",
"0.56308734",
"0.5629116",
"0.5611718",
"0.5608304",
"0.5606973",
"0.5604715",
"0.5603709",
"0.559726",
"0.55832094",
"0.5569117",
"0.556772",
"0.5564067",
"0.5560763",
"0.55551034",
"0.55536413",
"0.5548453",
"0.5545411",
"0.55349684",
"0.5530249",
"0.5530249",
"0.55229765",
"0.55219907",
"0.5510901",
"0.5500876",
"0.54959553",
"0.54900986",
"0.5480957",
"0.5477818",
"0.5477549",
"0.5469768",
"0.5464143",
"0.5461739",
"0.5459921",
"0.54553723",
"0.54417163",
"0.5437163",
"0.5432564",
"0.54325354",
"0.5429336",
"0.5416957",
"0.5416825",
"0.54143965",
"0.5404889",
"0.5392653",
"0.5391643",
"0.5389969",
"0.5387541",
"0.5386983",
"0.53810835",
"0.5376375",
"0.53689134",
"0.5361562",
"0.5354753",
"0.5354211",
"0.5345949",
"0.53458226",
"0.5344976",
"0.53375196",
"0.5333298",
"0.5332559",
"0.53313595",
"0.53255403",
"0.5322039",
"0.5319263",
"0.531782",
"0.5313005",
"0.53116673",
"0.5311064",
"0.5308429",
"0.53053546",
"0.53038496",
"0.5300887"
] | 0.5804918 | 12 |
=> Load user details from Facebook | def fetch_details_from_facebook
# graph = Koala::Facebook::API.new(self.token)
# facebook_data = graph.get_object("me")
# self.username = facebook_data['username']
# self.save
# self.user.username = facebook_data['username'] if self.user.username.blank?
# self.user.image = "http://graph.facebook.com/" + self.username + "/picture?type=large" if self.user.image.blank?
# self.user.location = facebook_data['location'] if self.user.location.blank?
# self.user.save
self.user.has_facebook = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end",
"def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end",
"def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end",
"def parse_facebook_user_data\n access_token = facebook_client.web_server.access_token(params[:code],\n :redirect_uri => Settings.authentication.facebook.callback_url)\n JSON.parse(access_token.get('/me'))\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def get_facebook_user(facebook_id)\n @graph = Koala::Facebook::API.new(fb_access_token) if !fb_access_token.blank?\n @graph ? @graph.get_object(\"me\") : nil\n end",
"def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend",
"def index\n @graph = Koala::Facebook::API.new(session[:fb_access_token])\n profile = @graph.get_object(\"me\")\n puts profile\n end",
"def get_user_informations(user_id)\n url = \"#{GRAPH_URL}/#{user_id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.get url\n if data.empty?\n puts \"MessengerBot - Unable to get user_informations (User has not already send a message or has revoked platform permissions on Facebook)\"\n nil\n else\n puts \"MessengerBot - Get user information with user_id : #{user_id}\"\n JSON.parse(data)\n end\n end",
"def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end",
"def show()\n @authentication = Authentication.find(params[:id])\n\n if @authentication.provider == \"facebook\"\n me = FbGraph::User.me(@authentication.token).fetch\n current_user.fname = me.name.split.first\n current_user.lname = me.name.split.last\n current_user.email = me.email\n current_user.gender = me.gender\n birthday = me.birthday\n current_user.birthday = Chronic.parse(birthday) if birthday\n\n location = me.location\n current_user.location = location if location and location.is_a? String\n current_user.location = location.try(:[], :name) if location and location.is_a? Hash\n pictureurl = me.picture+'?type=large'\n begin\n tempfile = Tempfile.new(['', '.jpg'])\n open(tempfile.path, 'wb') do |file|\n file << open(URI.parse(pictureurl)).read\n end\n current_user.avatar = tempfile\n rescue\n end\n end\n\n current_user.save\n redirect_to edit_user_path\n end",
"def fb_user\n FbGraph::User.me(fb_token)\n end",
"def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end",
"def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end",
"def create_from_fb\n fb_user = FbGraph::User.fetch(\n \"me?fields=first_name,last_name,\"\\\n \"gender,email,birthday\",\n :access_token => params[:access_token])\n\n @user = User.add_from_fb(fb_user,@source)\n end",
"def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end",
"def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end",
"def show\n user = User.find(params[:id].to_i)\n if user\n render json: {name: user.name.split(\" \").first, fb_id: user.fb_id, id: user.id}\n else\n render json: {name: \"Invalid\", fb_id: nil, id: nil}\n end\n end",
"def user_from_code(temp_code)\n MiniFB.get(access_token(temp_code), \"me\")\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def uuser\n # We can easily get the p-key of user of the session. So, that makes a nice demo:\n @fql_query= \"SELECT name, pic_square, profile_url, username, website, is_blocked, email FROM user WHERE uid = #{@facebook_session.user.uid}\"\n # fql_query() returns an array. \n # In this example the array contains only 1 element and we use .first() to get it.\n @qry_output= @facebook_session.fql_query(@fql_query).first\n end",
"def load_profile(params)\n db = connect()\n profile = db.execute('SELECT * FROM users WHERE Id=?', params[\"id\"])\n return profile.first\n end",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n session[:email] = @fb_details[:info][:email]\n session[:firstname] = @fb_details[:info][:first_name]\n session[:lastname] = @fb_details[:info][:last_name]\n session[:fb_token] = @fb_details[:credentials][:token]\n\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def prepare_info_for_facebook(oauth_info)\n { uid: oauth_info.uid.to_s,\n token: oauth_info.credentials.token,\n nickname: oauth_info.info.nickname || \"fbuser_#{uid}\",\n name: oauth_info.info.name,\n email: oauth_info.info.email }\n end",
"def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && [email protected])\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && [email protected])\n\t\t\t\n\t\t\[email protected]_id = fb_id\n\t\t\[email protected]_access_token = access_token\n\t\t\t\n\t\t\[email protected]\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def set_facebook_info omni\n info = omni['info']\n self.email = info['email']\n self.first_name = info['first_name']\n self.last_name = info['last_name']\n\n # Get the large size image. Omniauth returns 'square' by default and thats\n # too small to use.\n if info['image'].present?\n self.remote_profile_image_url = info['image'].gsub(\"square\", \"large\")\n end\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def show\n begin\n auth = Facebook.auth.from_cookie(cookies)\n fb = Facebook.identify(auth.user)\n\n # verify fb account and set session id\n authenticate fb\n\n # valid facebook account found, pull details\n profile = FbGraph::User.me(fb.access_token).fetch\n fb.first_name = profile.first_name\n fb.last_name = profile.last_name\n fb.save\n\n # redirect_to dashboard_url\n redirect_to :controller => :dashboard, :action => :index\n\n rescue Exception => e\n logger.error \"Error: \" + e.message\n # logger.error e.backtrace.inspect\n flash[:notice] = \"An error has occurred while communicating with Facebook\"\n redirect_to root_url\n end\n end",
"def show \n\t\tuser = User.find_by(id: params[:id])\n\t\tif !user.blank?\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"Found User\",\n\t\t response: {\n\t\t name: user.name,\n\t\t email: user.email,\n\t\t id: user.id,\n\t\t facebook_id: user.facebook_id\n\t\t }\n\t\t }.to_json\n\t\telse \n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: \"Can't Find User\"\n\t\t }.to_json\n\t\tend \n\tend",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"],\n :image => profile[\"image\"][\"url\"],\n :url => profile[\"url\"],\n :email => email} \n end",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def set_userfb\n @user = Userfb.find(params[:id])\n end",
"def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n @fb_data = Hash.new\n @fb_data[:email] = @fb_details[:info][:email]\n @fb_data[:firstname] = @fb_details[:info][:first_name]\n @fb_data[:lastname] = @fb_details[:info][:last_name]\n @fb_data[:fb_token] = @fb_details[:credentials][:token]\n @fb_data[:image] = @fb_details[:info][:image].concat(\"?type=#{SIZE}\")\n\n return @fb_data\n end",
"def current_user\n User.find_by(facebook_id: params[:facebook_id])\n end",
"def facebook_callback\n user_data = parse_facebook_user_data\n token = sign_user_token(user_data[\"email\"],\"facebook\")\n\n user = User.find_by_token(token)\n if user\n set_current_user(user)\n else\n user = User.new(:email => user_data[\"email\"],\n :nick => user_data[\"first_name\"],\n :token => token)\n user.save!\n\n set_current_user(user)\n end\n redirect_to :controller => \"sales_management\",\n :action => \"index\",\n :user_id => user.id\n end",
"def facebook\n user = User.from_facebook_omniauth(request.env[\"omniauth.auth\"])\n if user.persisted?\n sign_in_and_redirect user, notice: \"#{user.name}, you are signed in!\"\n else\n session[\"devise.user_attributes\"] = user.attributes\n redirect_to new_user_registration_url\n end\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def find_by_fb_user(fb_user)\n u = ::User.find(:first, :conditions => {_(:fb_user_id, :user) => fb_user.uid}) || ::User.find(:first, :conditions => {_(:facebook_hash, :user) => fb_user.email_hashes})\n # make sure we have a person\n if u && !u.person\n u.create_person_from_fb(fb_user)\n end\n u.update_attribute(:fb_user_id, fb_user.uid) if u && !u.fb_user_id\n u\n rescue ::Facebooker::Session::SessionExpired\n nil\n end",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def get_me\n response = self.class.get(api_url(\"users/me\"),\n headers: { \"authorization\" => @auth_token })\n\n # Parse the JSON document returned in the response into a Ruby hash\n JSON.parse(response.body)\n end",
"def facebook_authentication\n begin\n data = 0\n user = WebUser.find_by_email(params[:email])\n \n if user.nil?\n data = register(params[:provider], params[:uid], params[:name], params[:email], params[:oauth_token], params[:gender], params[:birthday], params[:nickname])\n else\n data = user\n check_pending_friends(user['id'], user['bv_player_id'], user['email'])\n end\n rescue\n data = 1\n end\n \n render :json => data\n end",
"def handle_omniauth_callback(auth)\n # Try to find authentication first\n authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])\n provider = auth['provider'] || 'Unknown'\n\n ## data of facebook\n # info=#<OmniAuth::AuthHash::InfoHash email=\"[email protected]\"\n # first_name=\"Long\" image=\"http://graph.facebook.com/100000709457324/picture?type=square\"\n # last_name=\"Phan-Hoàng\" location=\"Ho Chi Minh City, Vietnam\" name=\"Long Phan-Hoàng\"\n # nickname=\"phanhoanglong2610\"\n # urls=#<Hashie::Mash Facebook=\"http://www.facebook.com/phanhoanglong2610\">\n # verified=true> provider=\"facebook\" uid=\"100000709457324\"\n\n if authentication\n\n # sign in and direct to previous page\n sign_in_and_redirect authentication.user, :event => :authentication\n set_flash_message(:notice, :success, :kind => auth[\"facebook\"]) if is_navigational_format?\n\n else\n # Authentication not found, thus a new user.\n @user = User.new\n\n # temp for username social accounts such as Twitter\n\n #prefill with info from provider website\n @user.apply_omniauth(auth)\n\n @info = {\n \t:first_name => @user.first_name,\n \t:last_name => @user.last_name,\n \t:email => @user.email\n }\n\n session[\"devise.#{auth[\"provider\"]}_data\"] = auth.except(\"extra\")\n\n render :template => \"devise/registrations/new\"\n end\n\tend",
"def login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end",
"def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end",
"def extract_info_from_omniauth(omniauth)\n if omniauth.has_key?('extra') && omniauth['extra'].has_key?('user_hash')\n self.info = omniauth['user_info'].merge(omniauth['extra']['user_hash']).symbolize_keys\n else\n self.info = omniauth['user_info'].symbolize_keys\n end\n end",
"def load_user_and_profile\n\t\t@user = current_user\n\t\[email protected]_profile\n\t\t@profile = @user.profile\n\tend",
"def show\n @user = User.find(params[:id]) \n @user_me = retrieve_authenticated_user\n end",
"def get_me\n response = self.class.get(api_url(\"users/me\"), headers: { \"authorization\" => @auth_token })\n JSON.parse(response.body)\n end",
"def profile\n\t\t# determine which user's profile page\n\t\t@user = User.find_by_login(params[:username])\n\t\t# retrieve all bids by this user\n\t @bids = Bid.find_all_by_bidder_id(@user.id, :group => 'item_id')\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = @user.posted_items\n\n\t\t# code for facebox\n\t respond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend",
"def make_user\n @user = User.new(session_token: params[:session_token])\n graph = Koala::Facebook::API.new(@user.session_token)\n id = graph.get_object(\"me\")[\"id\"]\n if id != params[:facebook_id]\n render json: [\"Invalid session token\"], status: 401\n return\n end\n @user.fill_user_data(graph)\n if @user.save\n # @user.add_friends(graph)\n render \"api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"def fb_me token=nil\n \t\tif ENV['PAGE_ID']\n \t\t\t@token = token || Rails.cache.read('page_token') || ENV['PAGE_TOKEN']\n \t\t\t@fb_user = FbGraph::Page.new( ENV['PAGE_ID'], :access_token => @token ).fetch\n \t\telse\n\t\t\t@token = token || Rails.cache.read('TOKEN') || ENV['TOKEN']\n \t\t\t@fb_user = FbGraph::User.me( @token )\n \t\tend\n \tend",
"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 user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def user_from_omniauth\n IdentifierScheme.for_users.each do |scheme|\n omniauth_hash = session.fetch(\"devise.#{scheme.name}_data\", {})\n next if omniauth_hash.empty?\n\n return ::User.from_omniauth(scheme_name: scheme.name, omniauth_hash: omniauth_hash)\n end\n nil\n end",
"def fetch_user_info_by_base_oauth(code)\n open_id = _oauth_get_open_id(code)\n _fetch_user_info(open_id)\n end",
"def new_user user_or_page_data\n Services::Facebook::User.new do |user|\n # Facebook casts some IDs as strings and others as integers, but in the interest of being consistent and\n # future-proof we'll cast them all to strings.\n user.id = (user_or_page_data[:uid] || user_or_page_data[:page_id]).to_s\n user.name = user_or_page_data[:name]\n end\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def facebook_user\n (session[:facebook_session] && session[:facebook_session].session_key) ? session[:facebook_session].user : nil\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def has_facebook_profile?\n fb_userid.present?\n end",
"def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end",
"def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end",
"def facebook(name: T.unsafe(nil), email: T.unsafe(nil), username: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def new\n raise Webapp::UserSessionExistsError if session[:user_session]\n @user = User.new\n if facebook_user\n @user.first_name = facebook_user.first_name\n @user.last_name = facebook_user.last_name\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n \n rescue Webapp::UserSessionExistsError\n flash_error(:user_session_exists)\n redirect_to root_url\n end",
"def get_me\n response = self.class.get(\"https://www.bloc.io/api/v1/users/me\", headers: { \"authorization\" => @auth_token })\n body = JSON.parse(response.body)\n end",
"def get_user_info(*fields)\n str_fields = fields.map(&:to_s).join(',')\n url = GRAPH_URL + @user.id + '?fields=' + str_fields + '&access_token=' +\n ENV['ACCESS_TOKEN']\n begin\n return call_graph_api(url)\n rescue => e\n return false\n end\n end",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def set_facebook_user_session\n session[:facebook_auth] = {}.tap do |fa|\n fa[:first_name] = auth_info.first_name\n fa[:last_name] = auth_info.last_name\n fa[:email] = auth_info.email\n fa[:picture] = auth_info.image\n fa[:birth_date] = auth_hash.extra.raw_info.birthday\n end\n set_facebook_user_authentication_session()\n end",
"def get_me\n url = \"#{@api_base_path}/users/me\"\n handle_timeouts do\n response = self.class.get(url, headers: auth_header)\n convert_response(response, \"user\")\n end\n end",
"def show\n auth = Authentication.auth.from_cookie(cookies)\n authenticate Authentication.identify(auth.user)\n redirect_to Facebook.config[:app_url]\n end",
"def profile(params)\n if validate_profile(params)\n db = connect_to_db()\n db.results_as_hash = true\n \n result = db.execute('SELECT * FROM posts WHERE userId=?', params[\"id\"])\n user = db.execute('SELECT * FROM users WHERE id=?', params[\"id\"])[0]\n \n return {posts: result, user: user}\n else\n return {error: \"There is no such user!\"}\n end\n end",
"def small_profile\n\t\t# determine which user's profile page\n \t@user = User.find_by_login(params[:username])\n\t\t# get all comments for this user\n\t @comments = @user.user_comments\n\t\t# get all user_items by this user\n\t @user_items = current_user.user_items\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.js { render_to_facebox }\n end\n\tend",
"def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end",
"def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end",
"def show\n\t\trequire_login\n\t\t@user = User.find(params[:id])\n\t\t@socials = Social::Social_type\n\tend",
"def facebook_uid\n @json['uid']\n end",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def facebook_data_about(item, keys = {})\n begin\n res = JSON.parse(token_get(item) || \"{}\") \n keys[:as] ? res[keys[:as]] : res\n rescue SocketError, Errno::ECONNRESET, OAuth2::HTTPError, EOFError => e\n # TODO :: hoptoad\n nil\n end\n end",
"def show\n id = User.find_by_fb_id(params[:id]).id\n @user_game = UserGame.find_by_user_id(id)\n\n respond_to do |format|\n format.json { render json: @user_game }\n end\n end",
"def get_user(access_token_str)\r\n @access_token = get_access_token_by(access_token_str)\r\n resp = get_userinfo\r\n case resp\r\n when Net::HTTPSuccess\r\n @userinfo = JSON.parse(resp.body)\r\n parse_user_id(@userinfo)\r\n else\r\n err = \"Can't get user info: <br/>#{resp.body}\"\r\n end\r\n err\r\n end",
"def sync_with_facebook_profile(fb_user)\n fb_info = FacebookUserProfile.populate(fb_user)\n address_book.sync_with_facebook(fb_user, fb_info) && \n profile.sync_with_facebook(fb_user, fb_info)\n end",
"def facebook_auth_cache\n self.auth_profiles.where(provider: 'facebook').first\n end",
"def user_info\n auth_hash['user_info']\n end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def show\n @users = @business_profile.users\n end",
"def apply_facebook(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n self.email = (extra['email'] rescue '')\n end\nend",
"def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def facebook_user_data(data)\n raise \"SHOULD BE IMPLEMENT NEW USER DATA\"\n end"
] | [
"0.76831484",
"0.7546079",
"0.73564833",
"0.71045524",
"0.70114267",
"0.69312406",
"0.6915979",
"0.68890977",
"0.68407327",
"0.68138766",
"0.672018",
"0.6714896",
"0.6701292",
"0.66346055",
"0.6629972",
"0.6614527",
"0.6599348",
"0.655154",
"0.6530955",
"0.65033776",
"0.64979714",
"0.64898133",
"0.6475673",
"0.6471573",
"0.6467433",
"0.643088",
"0.6419484",
"0.64144164",
"0.63928705",
"0.6390295",
"0.63831496",
"0.63792723",
"0.6377272",
"0.63720536",
"0.63660014",
"0.63552904",
"0.63229007",
"0.6314542",
"0.62907404",
"0.62885505",
"0.627813",
"0.6270472",
"0.626369",
"0.62572825",
"0.6254752",
"0.6253248",
"0.6253142",
"0.62349683",
"0.62332225",
"0.62238353",
"0.62189645",
"0.6213172",
"0.6212207",
"0.6206677",
"0.6192424",
"0.6180906",
"0.6178074",
"0.6169372",
"0.6161542",
"0.61590815",
"0.61571616",
"0.6152874",
"0.6149419",
"0.61393577",
"0.6134368",
"0.6133155",
"0.61321473",
"0.6125917",
"0.6124637",
"0.6113717",
"0.6106897",
"0.60852253",
"0.60709935",
"0.60658574",
"0.6063596",
"0.6060892",
"0.60572344",
"0.6047723",
"0.6046284",
"0.6042802",
"0.6037576",
"0.6037446",
"0.6036825",
"0.6031503",
"0.60301423",
"0.6021698",
"0.6020992",
"0.60201377",
"0.60186213",
"0.6005726",
"0.6001108",
"0.5990425",
"0.598916",
"0.59883285",
"0.59883285",
"0.59881145",
"0.5982154",
"0.5981892",
"0.59767497",
"0.59761786"
] | 0.81430775 | 0 |
=> Load user details from Twitter | def fetch_details_from_twitter
# twitter_object = Twitter::Client.new(
# :oauth_token => self.token,
# :oauth_token_secret => self.secret
# )
# twitter_data = Twitter.user(self.uid.to_i)
# self.username = twitter_data.username
# self.save
# self.user.username = twitter_data.username if self.user.username.blank?
# self.user.image = twitter_data.profile_image_url if self.user.image.blank?
# self.user.location = twitter_data.location if self.user.location.blank?
# self.user.save(:validate => false)
self.user.has_twitter = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_twitter_informations\n unparsed_html = Nokogiri::HTML(open(twitter_profile_address))\n\n self.twitter_username = fetch_twitter_username(unparsed_html)\n self.twitter_description = fetch_twitter_description(unparsed_html)\n end",
"def get_user_from_twitter_as_hash(screen_name_or_twitter_id)\n Rails.cache.fetch(\"/users/show/#{screen_name_or_twitter_id}\", :expires_in => 2.hours) { twitter.get(\"/users/show/#{screen_name_or_twitter_id}\") }\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def get_profile( twitter_id ) \n if twitter_id.class == Fixnum\n data = Net::HTTP.get_response('twitter.com', \"/users/show.json?user_id=#{twitter_id}\").body\n else\n data = Net::HTTP.get_response('twitter.com', \"/users/show/#{twitter_id}.json\").body\n end\n \n # we convert the returned JSON data to native Ruby\n # data structure - a hash\n result = JSON.parse(data)\n \n # if the hash has 'Error' as a key, we raise an error\n if result.has_key? \"error\"\n raise TwitterError.new result[\"error\"]\n end\n result\n end",
"def get_user_detail_by_twitter_id(twitter_id)\n @user = User.find(:select=>\"*\",:conditions=>[\"twitter_id=#{twitter_id}\"])\n return @user\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def load_twitter_data\n create_twitter_client\n twitter_feeds = current_user.feeds.where(provider: \"twitter\")\n\n twitter_feeds.each do |feed|\n @client.user_timeline(feed.uid.to_i).each do |tweet|\n feed.posts.find_or_create_by(\n author_name: tweet.user.name,\n author_handle: tweet.user.handle,\n author_profile_pic: tweet.user.profile_image_uri.to_s,\n content: tweet.text,\n uid: tweet.id.to_s,\n posted_time: tweet.created_at\n )\n end\n end\n end",
"def assign_twitter_account_info(auth)\n user = auth.extra.raw_info\n self.twitter_id = user.id\n self.name = user.name\n self.screen_name = user.screen_name\n self.location = user.location\n self.description = user.description\n self.url = user.url\n self.profile_image_url = user.profile_image_url_https\n self\n end",
"def set_twitter_user\n @twitter_user = TwitterUser.find(params[:id])\n end",
"def twitter_user\n @twitter_user ||= prepare_access_token(self.token, self.secret)\n end",
"def import_profile_from_twitter\n self.profile.first_name = @credentials['name']\n self.profile.website = @credentials['url']\n self.profile.federated_profile_image_url = @credentials['profile_image_url']\n self.profile.save\n end",
"def getUserInfo(doc, tweet)\n\t@username = doc.at_css(\".js-action-profile-name b\").text\n\tputs \"Username: #{@username}\"\n\n\t@name = doc.at_css(\".show-popup-with-id\").text\n\tputs \"Name: #{@name}\"\n\n\t@user_location = tweet[/\\([\\s]*@([^\\)]+)\\)/i]\n\tif @user_location != nil\n\t\t@user_location = @user_location[3..(@user_location.length - 2)]\n\t\tputs \"User Location: #{@user_location}\"\n\tend\nend",
"def search_user(q)\n uri = \"https://api.twitter.com/1/users/search.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"get\",\n :params =>{:q=>q, :include_entities=>\"true\"})\n oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))\n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run \n \n profile_list = Array.new\n\n JSON.parse(req.response.body).each do |raw|\n profile_list.push([\n raw[\"id\"].to_s,\n raw[\"profile_image_url\"].to_s,\n raw[\"name\"].to_s,\n raw[\"screen_name\"].to_s]\n )# prepare to cash into database, not sure\n end\n profile_list.sort!{|x,y| x[0]<=>y[0]} \n end",
"def user\n if is_partial?\n TwitterUserPartial.from_hash raw_user\n else\n TwitterUser.from_hash raw_user\n end\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def twitter\n @data['social']['twitter']\n end",
"def twitter_user\n @twitter_user ||= TwitterClient.new.user(@user)\n end",
"def parse_tweets\n @tweets.each do |tweet|\n @user[:handle] << tweet[\"user\"][\"screen_name\"]\n unless tweet[\"place\"].nil?\n place = tweet[\"place\"][\"full_name\"]\n else\n place = nil\n end\n\n @user[:features]<<{:type =>\"Feature\",\n :geometry =>{:type=>\"Point\",\n :coordinates =>tweet[\"coordinates\"][\"coordinates\"]},\n :properties =>{:created_at=>tweet[\"created_at\"],\n :text=>tweet[\"text\"],\n :place=>place}}\n end\n end",
"def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def set_twitter_user\n @twitter_user = current_user.twitter_users.find(params[:id])\n end",
"def twitter\n unless @twitter_user\n provider = self.authentications.find_by_provider('twitter')\n @twitter_user = Twitter::Client.new(:oauth_token => provider.token, :oauth_token_secret => provider.secret )rescue nil\n end\n @twitter_user\n end",
"def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end",
"def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end",
"def get_twitter(npo)\n\t\trequire 'net/http'\n\t\trequire 'rexml/document'\n\n begin\n\n res = Net::HTTP.get(URI.parse(\"http://api.twitter.com/1/users/show.xml?screen_name=#{npo.twitter}\"))\n document = REXML::Document.new(res)\n\n if document.root.elements[2]\n document.root.elements[2].expanded_name == 'error' ? nil : npo.twitter\n end\n rescue\n nil\n end\n\tend",
"def twitter_user_id\n raw['id']\n end",
"def user_tweets(user_id)\n twitter.user_timeline(user_id)\n end",
"def show\n @tweet = Tweet.find(params[:id])\n @user=User.all\n end",
"def user_tweets screen_name\n\t\tTwitter.user_timeline(screen_name.to_s)\n\tend",
"def get_detail_info(fids)\n uri = \"https://api.twitter.com/1/users/lookup.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fids, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra = Typhoeus::Hydra.new\n hydra.queue(req)\n hydra.run\n JSON.parse(req.response.body)\n \n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def show\n @user = User.find_by!(username: params[:username])\n #This saves user tweets in desc order.\n @tweets = @user.tweets.order(created_at: :desc)\n end",
"def show\n @influencer = Influencer.find(params[:id])\n @twitter_profile = Influencer.get_twitter_profile(@influencer.twitter)\n end",
"def tweet_user(tweet) \n if ! tweet.is_a?(String)\n base = tweet.has_key?(:from_user) ? tweet[:from_user] : tweet[:user][:screen_name]\n else\n base = tweet\n end\n base =~ /^@/ ? base : \"@#{base}\"\n end",
"def apply_twitter(omniauth)\n if (extra = omniauth['extra']['user_hash'] rescue false)\n end\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def get_user_id_by_twitter_id(twitter_id)\n @user = User.find(:first ,:select=>\"id\",:conditions=>[\"twitter_id=?\",twitter_id])\n return @user.id\n end",
"def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def fetch_tweets!\n Twitter.user_timeline(username).each do |tweet|\n unless Tweet.where(twitter_user_id: self.id).find_by_content(tweet.text) \n self.tweets << Tweet.create(content: tweet.text)\n end\n end\n end",
"def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"def lookup_user (user_id)\n tweets = IBM_DB.exec(@conn, \"SELECT * from tweets t WHERE user_id = #{user_id}\")\n #TODO: Verify manually, cannot count results in DB2\n #debug 'user: ' + user_id.to_s + \" had \" + resp.count.to_s + \" tweets\"\n debug \"fetched tweets for user: \" + user_id.to_s\n end",
"def set_twitter_info omni\n info = omni['info']\n \n # Get profile image from twitter. Remove _normal to return normal size\n # (weird, right?)\n if info['image'].present?\n self.remote_profile_image_url = info['image'].gsub(\"_normal\", \"\")\n end\n end",
"def show\n user = user_from_token\n @tweet = user.tweets.where(:id => params[:id])\n render :json => @tweet\n end",
"def load_tweets_for_user(user_id)\n\t\t\tauthenticate\n\t\t\tmax_id = Tweet.get_max_tweet_id(user_id) || @@max_id\n\n\t\t\tresponse = []\n\t\t\tputs max_id\n\t\t\tresult = @@client.user_timeline(user_id.to_i, :since_id => max_id)\n\t\t\tresult.each do |tweet|\n\t\t\t\tbegin\n\t\t\t\t\tnewTweet = Tweet.new\n\t\t\t\t\tnewTweet = newTweet.init(tweet)\n\t\t\t\t\tunless newTweet.is_retweet_or_mention\n\t\t\t\t\t\tnewTweet.save!\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"Found Retweet #{newTweet.text}\"\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tputs \"COULD NOT SAVE\"\n\t\t\t\telse\n\t\t\t\t\tt = TweetViewModel.new\n\t\t\t\t\tresponse << t.initFromActiveRecord(newTweet)\n\t\t\t\tend\n\t\t\tend\n\t\t\tresponse\n\t\tend",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def update_by_twitter(auth)\n self.access_token = auth['credentials']['token']\n self.secret = auth['credentials']['secret']\n self.name = auth['info']['nickname']\n self.nickname = auth['info']['nickname']\n self.image_path = auth['info']['image']\n end",
"def load_old_tweet\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n #replace t.co link with didmichiganstatewin.com so the comparison will work\n return client.user_timeline(\"didmsuwin\").first.text.split('http').first + \"didmichiganstatewin.com\"\nend",
"def proc_twitter_login\n \n # If user is already logged in, grab session variables\n if session[:user_name] && !session[:user_name].empty?\n @real_name = session[:real_name] \n @user_name = session[:user_name]\n @user_image = session[:user_image] \n else\n # If user is not logged in, grab authentication varaibles\n @real_name = request.env['rack.auth']['user_info']['name']\n @user_name = request.env['rack.auth']['user_info']['nickname']\n @user_image = request.env['rack.auth']['user_info']['image']\n \n session[:user_name] = @user_name\n session[:real_name] = @real_name\n session[:user_image] = @user_image \n end\n \n @exists = false\n @user_id = -1\n \n puts \"Checking if user already exists in database...\"\n \n # Check if user already exists in database\n User.all.each do |user|\n if user[:twitter] == @user_name\n @exists = true\n @user_id = user.id\n session[:user_id] = @user_id\n break;\n end\n end\n \n # User does not exist in database. Add new user\n if !@exists\n new_user = User.new( :twitter => @user_name, :name => @real_name )\n new_user.save\n \n @user_id = new_user.id\n session[:user_id] = @user_id\n end\n\n # Redirect to the user home page\n redirect_to :action => \"home\" \n end",
"def callback\n\t\t# I didn't abstract this part since we don't have the user data yet.\n\t\t\n\t @request_token = OAuth::RequestToken.new(get_consumer,\n\t session[:request_token],\n\t session[:request_token_secret]) # generate request token using OAuth consumer obj\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t # and existing request token, token secret\n\n\t # Exchange the request token for an access token.\n\t @access_token = @request_token.get_access_token # access token is the application-user combo auth to twitter\n\n\t\t# do a request using the OAuth consumer, to twitter.com/account/verify_credentials.json\n\t\t# USING our access token, so we can GET the data about the user that is described with the access token\n\t @response = get_consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\t\t\n\t\t\n\t case @response\n\t when Net::HTTPSuccess\n\t user_info = JSON.parse(@response.body) # json parse the response\n\n\t unless user_info['screen_name']\n\t\t\t\t\t# for one reason or another -- no screen name was found, auth failed\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t return\n\t end\n\n\t # We have an authorized user, save the information to the database.\n\t\t\t\tfinduser = User.find_by_twitter_name(user_info['screen_name'])\n\t\t\t\tif finduser.nil?\n\t\t\t\t\t@user = User.create do |u|\n\t\t\t\t\t\tu.twitter_name = user_info['screen_name']\n\t\t\t\t\t\tu.token = @access_token.token\n\t\t\t\t\t\tu.secret = @access_token.secret\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\[email protected]!\n\t\t\t\telse\n\t\t\t\t\tfinduser.token = @access_token.token\n\t\t\t\t\tfinduser.secret = @access_token.secret\n\t\t\t\t\tfinduser.save!\n\t\t\t\t\t\n\t\t\t\t\t@user = finduser\n\t\t\t\tend\n\t\n\t\t\t\tsession[:user_id] = @user.id\n\n\t # Redirect to the show page\n\t redirect_to('/home')\n\t else\n\t RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t # The user might have rejected this application. Or there was some other error during the request.\n\t flash[:notice] = \"Authentication failed\"\n\t redirect_to :action => :index\n\t end\n\tend",
"def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end",
"def get_user_tweets\n @tweets = COLL.find(\n selector = {\"user.id\" => @user[:id]},\n opts={ :sort=>[\"created_at\", Mongo::ASCENDING],\n :fields=>[\"coordinates\",\"user\",\"text\",\"created_at\", \"entities\", \"place\"]\n })\n\n @user[:tweet_count] = @tweets.count\n @tweets.count > 1\n end",
"def user=(user)\n @user = user\n @twitter_user = nil\n load_words\n end",
"def index\n @users = User.all\n\n set_up_twitter\n\n @users.each do |user|\n tweets = @client.user_timeline(user.twitter_id, count: 5)\n user.last_tweet = tweets.first.full_text\n end\n end",
"def fetch_details(attr)\n url = attr['href'].text\n if args = url.match('https?://twitter\\.com.*status/(\\d+)')\n data = @api[\"/statuses/show/#{args[1]}.json\"].get\n tweet = Yajl::Parser.parse(data.body)\n\n tags = DeliciousLetter.build_tags(attr)\n\n template = Tilt.new('templates/twitter.haml')\n html = template.render(self, tweet: tweet, url: url, tags: tags)\n text = \"#{tweet['user']['name']}:\\n#{tweet['text']}\\n#{url}\\n\\n\"\n\n {'text' => text, 'html' => html}\n end\n end",
"def index\n # specific_assigned_version_process(__callee__, params)\n @twitter_users = current_user.twitter_users.all\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def fetch_user_timeline\n statuses = client.user_timeline(user_timeline_options)\n tweets = TweetMaker.many_from_twitter(statuses, project: project, twitter_account: self, state: :posted)\n update_max_user_timeline_twitter_id(tweets.map(&:twitter_id).max)\n tweets\n # If there's an error, just skip execution\n rescue Twitter::Error\n false\n end",
"def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end",
"def show\n set_up_twitter\n\n get_last_tweet\n get_five_last_tweets\n end",
"def callback\n\t\tself.twitagent.exchange_request_for_access_token( session[:request_token], session[:request_token_secret], params[:oauth_verifier] )\n\t\t\n\t\tuser_info = self.twitagent.verify_credentials\n\t\t\n\t\t#raise OauthSystem::RequestError unless user_info['id'] && user_info['screen_name'] && user_info['profile_image_url']\n\t\t\n\t\t# We have an authorized user, save the information to the database.\n\t\t@user = User.find_by_screen_name(user_info['screen_name'])\n\t\tif @user\n\t\t\[email protected] = self.twitagent.access_token.token\n\t\t\[email protected] = self.twitagent.access_token.secret\n\t\t\[email protected]_image_url = user_info['profile_image_url']\n\t\telse\n\t\t\t@user= User.new({ \n\t\t\t\t:twitter_id => user_info['id'],\n\t\t\t\t:screen_name => user_info['screen_name'],\n\t\t\t\t:token => self.twitagent.access_token.token,\n\t\t\t\t:secret => self.twitagent.access_token.secret,\n\t\t\t\t:profile_image_url => user_info['profile_image_url'] })\n\t\tend\n\t\tif @user.save!\n\t\t\tself.current_user = @user\n\t\telse\n\t\t\traise OauthSystem::RequestError\n\t\tend\n\t\t# Redirect to the show page\n\t\tredirect_to user_path(@user)\n\t\t\n\trescue\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t\tflash[:error] = \"Twitter API failure (account login)\"\n\t\tredirect_to root_url\n\tend",
"def load_twitter_account\n # FIXME would this be better placed in the models?\n @twitter_account = @workspace ? @workspace.twitter_account || @workspace.create_twitter_account :\n @user.twitter_account || @user.create_twitter_account\n end",
"def get_login_by_twitter_id(twitter_id)\n @user = User.find(:first ,:select=>\"login\",:conditions=>[\"twitter_id=?\",twitter_id])\n return @user.login\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"def userid_from_username(username)\n data = JSON(open(\"http://api.twitter.com/1/users/show/#{username}.json\").read)\n data[\"id\"]\n end",
"def user_connect_to_twitter(user)\n access = nil\n if user.twitter_token\n user_credentials = @t_credentials.clone # Keep consumer token\n # but override with user's access token\n user_credentials[:access_token] = user.twitter_token\n user_credentials[:access_token_secret] = user.twitter_secret\n# puts \"Using this token for #{user.ublog_name}: #{user_credentials[:access_token]}/#{user_credentials[:access_token_secret]}\"\n begin\n access = TwitterAPI::Access.new(user_credentials)\n rescue StandardError, Timeout::Error\n puts \"Failed to access Twitter for user #{user.ublog_name}:\\n\" + $!\n # Didn't expect this. User needs to get new token sometime.\n end\n end\n access\n end",
"def twitter(name: T.unsafe(nil), nickname: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def from_api(user)\n attrs = {}\n attrs[:twitter_id] = user.id\n attrs[:name] = user.name\n attrs[:screen_name] = user.screen_name\n attrs[:location] = user.location\n attrs[:profile_image_url] = user.profile_image_url\n attrs[:url] = user.url\n attrs[:protected] = user.protected\n attrs[:followers_count] = user.followers_count\n attrs\n end",
"def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end",
"def mention_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::MentionTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::MentionTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::MentionTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Mention.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def user_timeline(options={})\n perform_get(\"statuses/user_timeline.#{Twitter.format}\", options)\n end",
"def create_from_tw\n client = Twitter::Client.new(\n :consumer_key => CONFIG[:tw_consumer_key],\n :consumer_secret => CONFIG[:tw_consumer_secret],\n :oauth_token => params[:tw_access_token],\n :oauth_token_secret => params[:tw_access_token_secret])\n\n @user = User.add_from_tw(\n client.user,\n params[:tw_access_token],\n params[:tw_access_token_secret],\n @source)\n end",
"def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n @tweets = @usuario.tweets\n end",
"def get_user_timeline( id=nil, login=@login, password=@password, type='xml', count=nil )\n \n http = Net::HTTP.new('twitter.com', 80)\n data = http.start do |http_inst|\n path = \"/statuses/user_timeline.#{type}\"\n if id == nil then id = login end\n path += \"?id=#{id}\"\n if count != nil \n path += \"&count=#{count}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n end",
"def twitter\n handle_oauth\n end",
"def twitter_auth_cache\n self.auth_profiles.where(provider: 'twitter').first\n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def print_timeline(tweets)\n \n puts tweets [0][\"user\"][\"screen_name\"]\n puts tweets [0][\"text\"]\n\n \n\nend",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def user_tweets(user, count=10, since_id=nil, max_id=nil)\n print \"Getting Last %d Statuses for User %s\" % [count, user.to_s]\n print \" since %s\" % since_id if since_id\n print \" until %s\" % max_id if max_id\n print \"\\n\"\n options = {:count => count, :trim_user => true, :include_rts => true, :include_entities => true}\n options[:since_id] = since_id if since_id\n options[:max_id] = max_id if max_id\n begin\n statuses = @MT.user_timeline(user, options)\n if statuses.size > 0\n status_data = statuses.map do |s|\n {\n :user_id => s.user.id,\n :created_at => s.created_at,\n :id => s.id,\n :text => s.text,\n :source => s.source,\n :truncated => s[\"truncated\"],\n :in_reply_to_user_id => s[\"in_reply_to_user_id\"],\n :in_reply_to_screen_name => s[\"in_reply_to_screen_name\"],\n :geo => s[\"geo\"],\n :coordinates => s[\"coordinates\"],\n :place => parse_place(s[\"place\"]),\n :contributors => s[\"contributors\"],\n :retweet_count => s[\"retweet_count\"],\n :entities => parse_entities(s.attrs[\"entities\"]),\n :retweeted_status => parse_retweeted_status(s[\"retweeted_status\"])\n }\n end\n status_data\n else\n []\n end\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden\n puts \"Failed for %s (Protected)\" % user.to_s\n []\n end\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def twitter_stats\n # would be nice to use the twitter gem here, but twitter\n # doesn't expose list counts on user info.\n doc = Nokogiri::HTML(open(\"http://twitter.com/#@twitter\"))\n followers = doc.css(\"#follower_count\").first.content.to_i\n lists = doc.css(\"#lists_count\").first.content.to_i\n \"followers: #{followers}; lists #{lists}\"\n end",
"def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end",
"def set_tweet\n @tweet = current_user.tweets.find(params[:id])\n end",
"def show\n @word = Word.find(params[:id])\n if current_user.authentications[2]==\"twitter\"\n @tweet_search = current_user.twitter.search(@word.word)\n else\n @tweet_search\n end\n end",
"def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end",
"def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end",
"def show_tweets\n @user = get_user_or_current_user(params[:id])\n @tweets = Tweet.where(:user_id => @user.id).order(created_at: :desc)\n end",
"def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end",
"def twitter_oauth(access_token)\n user_info = access_token.extra.raw_info\n external_user_id = user_info.id\n email = \"#{user_info.screen_name}@twitter.com\"\n account = self.by_twitter_id(external_user_id).first || self.by_twitter_email(email).first\n if account.blank?\n account = self.new\n account.email = email\n account.provider = Provider::TWITTER\n account.external_user_id = user_info.id\n account.skip_confirmation!\n if user_info.name\n first_name, last_name = user_info.name.split\n account.build_profile :first_name => first_name, :last_name => last_name\n end\n account.save\n end\n account\n end",
"def fetch_user_timeline(screen_name, options = {})\n opts = HashWithIndifferentAccess.new(options)\n # retrieve the default maximum of tweets\n opts[:count] ||= 200\n # cut out the profile object by default\n opts[:trim_user] = opts[:trim_user] == false ? false : true\n # include retweets by default\n opts[:include_rts] = opts[:include_rts] == false ? false : true\n # include replies by default\n opts[:exclude_replies] = opts[:exclude_replies] == true ? true : false\n # call the API\n tweets = init_client.user_timeline(screen_name, opts)\n\n return tweets.collect(&:to_h)\n end",
"def new\n @auth_token = session[:auth_token]\n @auth_secret = session[:auth_secret]\n @username = session[:username]\n\n if @username.empty? or @auth_token.empty? or @auth_secret.empty?\n redirect_to '/auth/twitter'\n end\n\n @user = User.new(:username => @username, :auth_token => @auth_token,\n :auth_secret => @auth_secret)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend",
"def user\n t = []\n ville = nom_ville\n\t\tville.each do |i|\n\t\t\tCLIENT.search(i).take(1).collect do |tweet|\n\t\t\t\tt.push(\"#{tweet.user.screen_name}\") \n\n\t\t\tend\n\t\t end\n\treturn t\nend"
] | [
"0.7662446",
"0.7433523",
"0.73351854",
"0.72257066",
"0.71667516",
"0.69871825",
"0.69676465",
"0.69667876",
"0.6830381",
"0.6820844",
"0.6804855",
"0.67905843",
"0.6788494",
"0.6784897",
"0.67757905",
"0.6775429",
"0.6746366",
"0.6729981",
"0.6714724",
"0.6700383",
"0.6699526",
"0.66756326",
"0.66719556",
"0.66663575",
"0.6634434",
"0.6623168",
"0.65964204",
"0.6592469",
"0.65625304",
"0.65375555",
"0.652432",
"0.64648867",
"0.64633256",
"0.6453196",
"0.64460015",
"0.64396816",
"0.643474",
"0.6423781",
"0.64233905",
"0.6383809",
"0.63831943",
"0.6375717",
"0.63594717",
"0.6358688",
"0.6355139",
"0.63233864",
"0.6296481",
"0.62843305",
"0.62722844",
"0.625115",
"0.62370294",
"0.62044114",
"0.6202438",
"0.61868787",
"0.6181548",
"0.6181117",
"0.61782783",
"0.6177352",
"0.61764234",
"0.616865",
"0.6165917",
"0.6161927",
"0.6159766",
"0.61498874",
"0.61400604",
"0.6139224",
"0.61377084",
"0.61326456",
"0.6123854",
"0.6117624",
"0.61097765",
"0.60902536",
"0.60856605",
"0.6082432",
"0.6081911",
"0.60797924",
"0.6075728",
"0.6075415",
"0.60698235",
"0.6063846",
"0.6060367",
"0.6056941",
"0.604801",
"0.6039877",
"0.60340166",
"0.6032295",
"0.6020246",
"0.60108143",
"0.6009645",
"0.59960186",
"0.5995523",
"0.5994096",
"0.5986913",
"0.59755117",
"0.5972174",
"0.5956264",
"0.59532434",
"0.59521055",
"0.59458977",
"0.5944847"
] | 0.81216633 | 0 |
=> Load user details from GitHub | def fetch_details_from_github
# To Do
self.user.has_github = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def get_data_from_github(id)\n page = Nokogiri::HTML(open(\"https://github.com/#{id}\"))\n # fullname = page.css('body.logged_out.env-production.linux.page-profile\n # div.wrapper div.header.header-logged-out div.container.clearfix\n # div.command-bar.js-command-bar ul.top-nav li.explore a')\n fullname = page.css('span.vcard-fullname').text\n { user: fullname }\nend",
"def read_github_info\n opts = Hash.new { '' }\n # rubocop:disable Security/YAMLLoad\n opts.merge! YAML.load(File.open(GITHUB_INFO_PATH, 'r', &:read))\n # rubocop:enable Security/YAMLLoad\n\n # Validate user id and token work\n if opts[:user_id].empty? || opts[:user_token].empty?\n puts 'Invalid user information stored in yml file'\n opts = retrieve_options_from_user\n end\n opts\n end",
"def get_user_info\n response = HTTParty.get(\n \"https://api.github.com/user\",\n :headers => {\n \"Authorization\" => \"Bearer #{session[:access_token]}\",\n \"User-Agent\" => \"OAuth Test App\"\n }\n )\n session[:email] = response[\"email\"]\n session[:name] = response[\"name\"]\n session[:user_image] = response[\"avatar_url\"]\n session[:provider] = \"GitHub\"\n end",
"def get_user_details(token)\n uri = URI('https://api.github.com/user')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseText = ActiveSupport::JSON.decode res.body\n else\n responseText = 'Error receiving user details: ' + res.value\n end\n\n return responseText\n end",
"def build_from_github_user( user )\n # name\n # email\n # blog\n # company\n # location\n # bio\n end",
"def show\n @user = User.find_by_github_name params[:github_name]\n end",
"def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"login\"]\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def fetch_github_data\n self.info = GithubInfoFetcher.new.call(github_path).to_h\n end",
"def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end",
"def get_user\n response = HTTParty.get(\n GIT_BASE_URL + 'users/' + self.git_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (get user): #{response}\"\n return response\n end",
"def user(user, use_ssl=false) \n url = @base_url + \"/#{user}\"\n GitHub::User.new(JSON.parse(open(url).read)[\"user\"])\n end",
"def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end",
"def github_user_and_project(github_url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(github_url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end",
"def update_from_github(response)\n self.name = response['name']\n self.github_login = response['login']\n end",
"def retrieve_options_from_user\n opts = {}\n\n puts \"We need your Github user id and token. Please use the following steps\\n\"\n puts ' 1. Go to Github'\n puts ' 2. Click on your user name or icon in the upper right hand corner'\n puts ' 3. Click on *Developer Settings*'\n puts ' 3. Click on *Personal Access Tokens*'\n puts ' 4. Click on *Generate new token*'\n puts ' 5. Fill out your Github password'\n puts ' 6. Fill out token description'\n puts ' 7. Select *repos*'\n puts ' 8. Click on *Generate token*'\n puts ' 9. Copy your token from the resulting page'\n puts 'This information will be saved in github.yml'\n $stdout.print 'What\\'s your github user name (e.g. willosser)? '\n opts[:user_id] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_id set to '#{opts[:user_id]}'\"\n $stdout.print 'What\\'s your github user token? '\n opts[:user_token] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_token set to '#{opts[:user_token]}'\"\n\n write_github_info(opts)\n opts\n end",
"def repository\n @repository ||= Github::Repository.find user: user, name: name\n end",
"def update_profile\n response = HTTParty.get('https://api.github.com/orgs/' + org_name, :body=> {\n :username => \"9e8c7f5bb19cf14c39e38fe17c14e6d3b161f738\"\n } )\n data = response.parsed_response\n self.html_url = data['html_url']\n self.public_repos = data['public_repos']\n self.save\n end",
"def github_handle\n user.try(:github_handle)\n end",
"def github_extraction\n github_info = {}\n omniauth_info = request.env['omniauth.auth']\n github_info[:uid] = omniauth_info.uid\n github_info[:github_token] = omniauth_info.credentials.token\n github_info\n end",
"def github(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def test_input_username_retrieves_info_from_github\n skip\n # get \"/\"\n # post \"/profile\"\n assert_equal \"https://api.github.com/users/stevefake/repos\", \"\"\n end",
"def add_user_to_db(screen_name)\n user = github.get_user(screen_name)\n Cheepcreep::GithubUser.create(:login => json['login'],\n :name => json['name'],\n :blog => json['blog'],\n :followers => json['followers'],\n :following => json['following'],\n :public_repos => json['public_repos'])\n\nend",
"def fetch_projects!\n projects.destroy_all\n\n if github?\n result = YAML.load open(\"http://github.com/api/v2/yaml/repos/show/#{github}/\")\n\n result['repositories'].each do |repository|\n projects.create! :name => repository[:name], :description => repository[:description]\n end\n end\n rescue OpenURI::HTTPError # user not found, ignore\n end",
"def repo_info\n # Extract user and project name from GitHub URL.\n url = git_config['remote.origin.url']\n if url.nil?\n puts \"Error: Not a git repository.\"\n return [nil, nil]\n end\n user, project = github_user_and_project(url)\n # If there are no results yet, look for 'insteadof' substitutions in URL and try again.\n unless user && project\n short, base = github_insteadof_matching(config_hash, url)\n if short and base\n url = url.sub(short, base)\n user, project = github_user_and_project(url)\n end\n end\n [user, project]\n end",
"def load_json\n uri = URI.parse(\"https://api.github.com/users/#{@login}/repos\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n JSON.parse(response.body)\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 get_user_repo_hash(user, data)\n return {\n 'user_id' => user['_id'],\n 'open_issues' => data['open_issues'],\n 'watchers' => data['watchers'],\n 'pushed_at' => data['pushed_at'],\n 'homepage' => data['homepage'],\n 'git_url' => data['git_url'],\n 'updated_at' => data['updated_at'],\n 'fork' => data['fork'],\n 'forks' => data['forks'],\n 'language' => data['language'],\n 'private' => data['private'],\n 'size' => data['size'],\n 'clone_url' => data['clone_url'],\n 'created_at' => data['created_at'],\n 'name' => data['name'], # a unique name for a user repo\n 'html_url' => data['html_url'],\n 'description' => data['description']\n }\n end",
"def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end",
"def load_stats(data, user)\n return data if data\n raise('No data or user provided') unless user\n stats = GithubStats.new(user).data\n raise(\"Failed to find data for #{user} on GitHub\") unless stats\n stats\n end",
"def github\n @data['github']\n end",
"def find_user\n @current_user = User.find_by github_access_token: session[:github_access_token]\n end",
"def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def get_page_source(user)\n response = Curl.get(\"https://github.com/#{user}\").body_str\n fail GitHub::Exceptions::UserNotFoundException.new(user) if /Not Found/ =~ response\n Nokogiri::HTML(response, &:noblanks)\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def create_user\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"[email protected]\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n end",
"def fetch_json\n # Get raw JSON of GitHub API\n api_page = open(@api_url, http_basic_authentication: @login)\n # Parse the JSON into a hash\n @api_hash = JSON.parse(api_page.read)\n end",
"def remote_info\n return nil unless oauth_token?\n response = api(url: '/user')\n response.data\n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def github\n @data['social']['github']\n end",
"def parse(url)\n matches = url.match(%r{[:/](?<user>[^/]+)/(?<repo>[^/]+)\\z})\n [matches[:user], matches[:repo].gsub(/\\.git\\z/, '')]\n rescue StandardError => e\n raise ParseError, 'Can not parse Github URL.'\n end",
"def update_from_github(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.name if auth.info.name\n cv['image'] = auth.info.image if auth.info.image\n cv['biography'] = auth.extra.raw_info.bio if auth.extra.raw_info.bio\n token = auth.credentials.token if auth.credentials.token\n tmp = Array.new\n\n uri = URI(auth.extra.raw_info.repos_url)\n\n #repos = JSON.parse(open(uri.to_s, 'Authentication' => \"token #{token}\").read)\n\n HTTP.auth(\"token #{token}\")\n repos = JSON.parse(HTTP.get(uri.to_s).body)\n\n repos.each do |gitPr|\n if not gitPr['fork']\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n end\n $uriTmp = auth.extra.raw_info.starred_url.to_s\n $realUri = $uriTmp.gsub(/{(.*?)}/,'')\n\n starred = JSON.parse(HTTP.get($realUri).body)\n starred.each do |gitPr|\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n cv['it_languages'] = tmp.uniq\n cv['github_auth'] = true\n end",
"def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end",
"def fetch_details_from_linkedin\n\t\t# To Do\n\t\tself.user.has_linkedin = true\n\t\tself.user.save\n\tend",
"def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end",
"def github\n @obj['github']\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def user \n @user ||= @repo.config.username\n end",
"def repo_user\n # TODO: Clarify what repo_user actually is.\n # github is currently using the repo's 'owner', gitlab is using the user who pushed.\n case @vcs\n when 'github'\n @data['repository']['owner']['login']\n when 'gitlab'\n @data['user_username']\n end\n # TODO: Bitbucket, Stash/Bitbucket Server, TFS\n end",
"def index\n @github_users = GithubUser.all\n end",
"def update_user_from_auth(auth)\n user = self\n user.username = auth.info.nickname\n user.avatar_url = auth.info.image\n user.location = auth.extra.raw_info.city\n user.country = auth.extra.raw_info.country\n user.name = auth.info.name\n user\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end",
"def call\n fetch_user_from_auth_token\n end",
"def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\nend",
"def fetch_from_github\n repo, branch, path = Post.parse_github_url self.github\n Environment.github.contents repo, ref: branch, path: path\n end",
"def parse\n JSON.parse(open(github_url).read)\n end",
"def github_params\n if File.exist?(GITHUB_INFO_PATH)\n read_github_info\n else\n retrieve_options_from_user\n end\n end",
"def url\n \"http://github.com/#{login}\"\n end",
"def fetch_details_from_dropbox_oauth2\n\t\t# To Do\n\t\tself.user.has_dropbox = true\n\t\tself.user.save\n\tend",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def repository_data(user)\n Travis::RemoteVCS::Repository.new.show(\n repository_id: repository.id,\n admin_id: user.id\n )\n end",
"def github_url\n github_user.blank? ? nil : \"#{GITHUB_URL}#{github_user}\"\n end",
"def fetch_twitter_informations\n unparsed_html = Nokogiri::HTML(open(twitter_profile_address))\n\n self.twitter_username = fetch_twitter_username(unparsed_html)\n self.twitter_description = fetch_twitter_description(unparsed_html)\n end",
"def author\n user || OpenStruct.new({\n :nicename => external_author_name,\n :email => \"%s@%s\" % [external_author_id, Doers::Config.app_id]\n })\n end",
"def load_user(filepath)\n $user = load_yaml(filepath)\nend",
"def user\n UserRepository.find(user_id)\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def find_by_username_menu\n puts\n puts \"Enter a GitHub username with *EXACT* capitalization to list that user's repos:\"\n input = gets_user_input\n #if username exists in our DB, don't make API call.\n if !username_exists?(input)\n #making an API call\n get_data(input)\n end\n if find_user(input) == false\n puts \"That user doesn't exist or doesn't have any public repos\"\n menu\n else\n @user = find_user(input)\n end\n @repos = find_repos(@user)\n if show_repos(@repos) == false\n puts \"User has no repos\"\n menu\n end\n find_by_username_sub_menu\n end",
"def user\n @user ||= @repo.config.username\n end",
"def github_user(fatal = true)\n if user = GIT_CONFIG['config github.user']\n user\n elsif fatal\n abort(\"** No GitHub user set. See #{LGHCONF}\")\n end\n end",
"def github_user(fatal = true)\n if user = GIT_CONFIG['config github.user']\n user\n elsif fatal\n abort(\"** No GitHub user set. See #{LGHCONF}\")\n end\n end",
"def translate_github_user_to_jira_user (github_user_object)\n #Example: [email protected]\n #user_email_domain = thrillist.com\n #user_email_prefix = msolomon\n if github_user_object[\"email\"] != nil\n user_email_domain = github_user_object[\"email\"].split('@')[1]\n user_email_prefix = github_user_object[\"email\"].split('@')[0]\n\n #convert prefix to JIRA markdown or a link to github name if email domain is not thrillist\n if user_email_domain == \"thrillist.com\"\n user = user_email_prefix.insert(0, \"[~\") + \"]\"\n end\n else\n user = \"[\"+github_user_object[\"login\"]+\"|\"+github_user_object[\"html_url\"]+\"]\"\n end\n\n #overwrite special cases\n case github_user_object[\"login\"]\n when \"kpeltzer\"\n user = \"[~kpeltzer]\"\n when \"ken\"\n user = \"[~kpeltzer]\"\n when \"kwadwo\"\n user = \"[~kboateng]\"\n when \"tarasiegel\"\n user = \"[~tsiegel]\"\n when \"samiamorwas\"\n user = \"[~mhaarhaus]\"\n when \"patrick\"\n user = \"[~plange]\"\n when \"pfunklange\"\n user = \"[~plange]\"\n when \"stefsic\"\n user = \"[~ssicurelli]\"\n when \"lmon\"\n user = \"[~lukemonaco]\"\n when \"schuylerpenny\"\n user = \"[~spenny]\"\n when \"khalid-richards\"\n user = \"[~krichards]\"\n when \"THRILL-jacinto\"\n user = \"[~jacinto]\"\n when \"emchale\"\n user = \"[~emchale]\"\n when \"mpriscella\"\n user = \"[~mpriscella]\"\n when \"vtapia5070\"\n user = \"[~vtapia]\"\n when \"bethannezink\"\n user = \"[~bzink]\"\n when \"boskonyc\"\n user = \"[~bblagojevic]\"\n when \"fabriceTOUSSAINT\"\n user = \"[~ftoussaint]\"\n when \"mdgreenwald\"\n user = \"[~mgreenwald]\"\n when \"morelme\"\n user = \"[~mmorel]\"\n when \"vitaly-rozman\"\n user = \"[~vrozman]\"\n end\n\n return user\nend",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def set_github_user\n @github_user = GithubUser.find_by(id: params[:id]) || GithubUser.find_by(github_id: params[:id])\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def auth\n user = config(\"github.user\")\n token = config(\"github.token\")\n\n user.to_s.empty? ? {} : { :login => user, :token => token }\n end",
"def test_github_profile_exists\n people.each do |name, info|\n github_username = info.fetch(\"github\", false)\n if github_username\n assert_kind_of Sawyer::Resource, octokit.user(github_username), \"#{github_username} is not a real GitHub account\"\n end\n end\n end",
"def parse_repo(contributors_url, str_prefix=\"\")\n puts \"#{str_prefix}reading: #{contributors_url}\"\n contributors_data = load_json(contributors_url)\n write(contributors_url, contributors_data)\n contributors_data.each do |contributor|\n parse_user(contributor['url'], str_prefix+\" \")\n end\n end",
"def fetch_user_info_by_base_oauth(code)\n open_id = _oauth_get_open_id(code)\n _fetch_user_info(open_id)\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def fetch_details(attr)\n url = attr['href'].text\n if args = url.match('https?://github.com/([^\\/]+)/([^\\/]+)')\n data = @api[\"/repos/#{args[1]}/#{args[2]}\"].get\n github = Yajl::Parser.parse(data.body)\n\n tags = DeliciousLetter.build_tags(attr)\n\n template = Tilt.new('templates/github.haml')\n html = template.render(self, github: github, url: url, tags: tags)\n text = \"#{github['name']}:\\n#{github['description']}\\n#{url}\\n\\n\"\n\n {'text' => text, 'html' => html}\n end\n end",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend",
"def show_repo_details\n # Synchronize repo with Git Hub (1 day between refreshs)\n @repo.sync_github!(1.day).save!\n \n # Synchronize contributors (1 hour between refreshs)\n if @repo.sync_contribs_delay?(1.hour)\n github_contributors_login = @repo.get_github_contributors\n \n if github_contributors_login\n users = CacheUser.where(login: github_contributors_login)\n\n # Drop any relation with old contributors - I think i've wasted my time\n if users.length > 0\n CacheContrib.where(cache_repo_id: @repo).where.not(cache_user_id: users.map(&:id)).delete_all\n end\n\n # Add new contributors with empty personal data\n new_users = github_contributors_login - users.map(&:login)\n new_users.each do |github_login_new|\n CacheUser.create(login: github_login_new)\n end\n \n # Make link for each contributor\n current_contribs = CacheUser.joins(:cache_contribs).where(cache_contribs: {cache_repo_id: @repo.id})\n CacheUser.where(login: github_contributors_login).where.not(id: current_contribs).each do |user|\n user.cache_contribs.build(cache_repo: @repo)\n user.save\n end\n end\n \n @repo.upd_userlist_at = Time.now\n @repo.save!\n end\n \n # Load contributors from cache, contributors without personal data or too old are first\n # Nota : I use this method because a simple select order by synced_on show nil in first\n # but I read than oracle put them at the end depending server configuration. This suck !\n @users = CacheUser.never_synced.only_repo(@repo).order(:updated_at)\n @users.merge CacheUser.synced_from(4.days).only_repo(@repo).order(:synced_on, :updated_at)\n \n # Update contributors personal data if too old or never updated\n if @users.length > 0\n maxlist = @users.length <= 148 ? @users.length : 148 # Not exceed 148 personal data requests\n \n # Synchronize personal data of contributors : Old method\n # -> not enought efficient with large contributors list\n # @users[0...maxlist].each {|contributor| contributor.reload.sync_github!(4.days).save!}\n\n # Synchronize personal data of contributors : Use threads for concurrent requests\n work_queue = Queue.new \n # Add to the working queue all logins to proceed by threads\n @users[0...maxlist].map(&:login).each {|github_login| work_queue.push github_login}\n \n # Launch up to 10 threads\n # Warning : Each worker use a connection from ActiveRecord's pool. See database.yml for\n # set the pool size (count also the connection for this main thread).\n workers = (0...10).map do\n Thread.new do\n until work_queue.empty? do\n github_login = work_queue.pop(true) rescue nil\n if github_login\n user = CacheUser.where(login: github_login).first\n if user\n user.sync_github!(4.days).save!\n end\n end\n end\n end\n end\n workers.map(&:join) # Wait all threads finished before proceeding further \n end\n # Reload fresh data.\n @users = CacheUser.only_repo(@repo)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_details, status: :ok, location: @repo }\n end\n end",
"def get_user_github_organizations(github_orgs_url)\n uri = URI.parse(github_orgs_url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n user_organizations = JSON.parse(response.body)\n user_organizations.map { |o| o['login'] }\n end",
"def github_info\n @github_info ||= begin\n fetch_github_info unless fetched.marked? # returns true of not expired\n github_information.value\n end\n end",
"def user_repo1\n addon = Addon.joins(:user)\n .where(\"lower(users.login) = ?\", params[:login].downcase)\n .where(\"lower(repos.name) = ?\", params[:repo_name].downcase)\n .first\n render json: to_v1_repo_hash(addon)\n end",
"def assign_twitter_account_info(auth)\n user = auth.extra.raw_info\n self.twitter_id = user.id\n self.name = user.name\n self.screen_name = user.screen_name\n self.location = user.location\n self.description = user.description\n self.url = user.url\n self.profile_image_url = user.profile_image_url_https\n self\n end",
"def get_user_contents(type, params) # :yields: String\n case type\n when Api_options::USER::EMAIL\n unless personal_access_token.nil?\n \"#{BASE_URL}user/emails?access_token=#{params[:app_token]}\"\n else\n raise \"Authentication required\"\n end\n when Api_options::USER::SEARCH\n unless params[:number_of_repos] == nil\n return BASE_URL + SEARCH + USERS + \"q=#{params[:by_name]}+repos=#{params[:number_of_repos]}\"\n else\n return BASE_URL + SEARCH + USERS + \"q=#{params[:by_name]}\"\n end\n when Api_options::USER::FOLLOWERS\n BASE_URL + USERS + \"#{params[:username]}/followers?access_token=#{params[:token]}\"\n end\n end",
"def show\n @repo = @user.repos.find_by_name!(params[:id])\n render json: to_json(@repo)\n end"
] | [
"0.76056373",
"0.7480208",
"0.71343416",
"0.7055339",
"0.7037423",
"0.7022615",
"0.70083565",
"0.6901157",
"0.67184645",
"0.6682671",
"0.6566647",
"0.6498335",
"0.64597327",
"0.64379394",
"0.63784355",
"0.6377838",
"0.6356296",
"0.63347274",
"0.63313055",
"0.6292231",
"0.6243602",
"0.62424695",
"0.62316483",
"0.62118524",
"0.6193041",
"0.6192432",
"0.6175029",
"0.6150849",
"0.6137813",
"0.6131517",
"0.61313677",
"0.61298895",
"0.6113298",
"0.61057913",
"0.61048335",
"0.6094109",
"0.607215",
"0.6071041",
"0.60637707",
"0.6058454",
"0.6051403",
"0.6040868",
"0.6039955",
"0.6036138",
"0.6034029",
"0.6028999",
"0.6001846",
"0.5992629",
"0.59818655",
"0.5976692",
"0.5962619",
"0.59501857",
"0.5938189",
"0.59365684",
"0.59166163",
"0.59149456",
"0.59003824",
"0.58969337",
"0.5892654",
"0.58921033",
"0.58878696",
"0.5883821",
"0.58733535",
"0.58673334",
"0.5855237",
"0.5852668",
"0.5847605",
"0.58450055",
"0.58430535",
"0.5840891",
"0.58373874",
"0.58364105",
"0.5827728",
"0.58194053",
"0.5818366",
"0.5817464",
"0.5797315",
"0.57938445",
"0.5776713",
"0.5776713",
"0.5776688",
"0.5771122",
"0.57689184",
"0.57547474",
"0.5751313",
"0.5747765",
"0.57441944",
"0.5743905",
"0.572713",
"0.5723347",
"0.5717848",
"0.57141083",
"0.571297",
"0.5710775",
"0.5704553",
"0.5700723",
"0.56978357",
"0.5696488",
"0.56745505",
"0.56698555"
] | 0.7561229 | 1 |
=> Load user details from LinkedIn | def fetch_details_from_linkedin
# To Do
self.user.has_linkedin = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linkedin_profile\n @network = current_user.network ||= Network.new\n (@network.linkedin.nil? || @network.linkedin.blank?) ? \"\" : @network.linkedin\n end",
"def linkedin\n\t\tprocess_callback\n\t\tauth = request.env[\"omniauth.auth\"]\n session[:signed_in_with] = auth.provider\n\t\tsession[:lin_img] = auth.info.image\n\t session[\"linkedin_auth\"] = true\n\t\tsession[\"lin_name\"] = auth.info.name\n\t\tif !auth.extra.raw_info.publicProfileUrl.nil?\n\t\t\tsession[\"publicProfileUrl\"] = auth.extra.raw_info.publicProfileUrl\n\t\telse\n\t\t\tsession[\"publicProfileUrl\"] = \"#\"\n\t\tend\n\t\tsession[:lin_token] = auth.credentials.token\n\t\tsession[:lin_secret] = auth.credentials.secret\n\t\tAuthentication.find_by_provider_and_user_id(auth.provider,session[\"warden.user.user.key\"][1][0]).update_attribute('screen_name',auth.info.name)\n\t\tredirect_to \"/users/profile_edit\"\n\n end",
"def create_from_linkedin\n auth = request.env[\"omniauth.auth\"]\n user = User.find_by_email(auth['info']['email'])\n if(user)\n\n sign_in user\n client = LinkedIn::Client.new(\"mgdh4gtnqnra\", \"adFWD50VxWY35Yi1\")\n client.authorize_from_access(auth['credentials']['token'],auth['credentials']['secret'])\n user.token = auth['credentials']['token'] \n user.secret = auth['credentials']['secret'] \n\n # Updated the user information\n update_profile(client,user)\n update_educations(client,user)\n update_experiences(client,user)\n redirect_to home_path\nreturn\nend\nredirect_to root_path, :alert=> \"Login with LinkedIn failed!!\"\n end",
"def linkedin\n linkedin_config = GenericApiRails.config.linkedin_hash\n if linkedin_config.nil?\n logger.error('Linkedin login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Linkedin login/signup not configured\" }\n return\n end\n\n # Get the \"Real\" authorization code\n temp_access_token = params['access_token']\n\n code_uri = URI('https://www.linkedin.com/uas/oauth2/accessToken')\n oauth_https = Net::HTTP.new(code_uri.host, code_uri.port)\n oauth_https.use_ssl = true\n\n post_data = {\n :grant_type => 'authorization_code',\n :code => temp_access_token,\n :client_id => linkedin_config[:client_id],\n :client_secret => linkedin_config[:client_secret],\n :redirect_uri => params['redirect_uri'] || linkedin_config[:redirect_uri]\n }\n post_data_string = URI.escape(post_data.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n\n code_response = oauth_https.post(code_uri.path, post_data_string)\n\n if code_response.code.to_s != 200.to_s\n # log the error message if there is one\n if code_response.body\n resp = JSON.parse(code_response.body)\n logger.error(\"Error authenticating user against Linkedin: #{resp['error_description']}\")\n end\n render :json => { success: false , error: \"Could not authenticate using Linkedin\" }\n return\n end\n\n auth_response = JSON.parse(code_response.body)\n access_token = auth_response['access_token']\n\n if access_token.nil?\n render :json => { success: false , error: \"Could not get access token from Linkedin\" }\n return\n end\n\n # Get the user's info\n # user_uri = URI('https://api.linkedin.com/v1/people/~?format=json')\n user_uri =URI('https://api.linkedin.com/v1/people/~:(id,email-address,firstName,lastName)?format=json')\n api_https = Net::HTTP.new(user_uri.host, user_uri.port)\n api_https.use_ssl = true\n\n request = Net::HTTP::Get.new(user_uri.request_uri)\n request['Authorization'] = \"Bearer #{access_token}\"\n\n user_response = api_https.request(request)\n if user_response.code.to_s != 200.to_s\n render :json => { success: false , error: \"Could not get user info from Linkedin\" }\n return\n end\n\n user_info = JSON.parse(user_response.body)\n uid = user_info['id']\n @email = user_info['emailAddress']\n\n person_hash = {\n fname: user_info[\"firstName\"],\n lname: user_info[\"lastName\"]\n #minitial: user_info[\"middle_name\"],\n #profile_picture_uri: profile_pic,\n #birthdate: user_info[\"birthday\"]\n }\n\n # You'll have to define GenericApiRails.config.oauth_with for your\n # particular application\n @results = GenericApiRails.config.oauth_with.call(provider: \"linkedin\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end",
"def get_profile\n\n # Auth\n token = auth\n\n # Get Client info based on fields provided\n client = LinkedIn::Client.new(API_KEY, API_SECRET, token)\n client.profile(:fields => @profile_fields)\n end",
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def connect_to_linkedin(auth)\n self.linkedin_profiles.create(\n uid: auth.uid,\n token: auth.credentials.token,\n secret: auth.credentials.secret,\n first_name: auth.info.first_name,\n last_name: auth.info.last_name,\n phone: auth.info.phone,\n location: auth.info.location,\n profile_url: auth.info.urls.public_profile,\n industry: auth.info.industry,\n avatar: auth.info.image)\n # self.provider = auth.provider\n # self.save!\n end",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def linkedin_cb\n \tcode = params[:code]\n \toauth = LinkedIn::OAuth2.new\n\n \taccess_token = oauth.get_access_token(code)\n p 'access_token'\n \tp access_token.token\n\n \tapi = LinkedIn::API.new(access_token.token)\n \tmy_name = api.profile(fields: [\"first-name\", \"last-name\"])\n p my_name.first_name\n\n li_acct = LinkedinAccount.new\n li_acct[:first_name] = my_name.first_name\n li_acct[:last_name] = my_name.last_name\n li_acct[:access_token] = access_token.token\n\n current_user.linkedin_account = li_acct\n li_acct.save\n\n \tredirect_to \"\"\n end",
"def update_linkedin\n profile = self.get_profile\n self.update(\n headline: profile.headline,\n industry: profile.industry,\n profile_url: profile.public_profile_url\n )\n self.profile.present? ? self.profile.from_omniauth(profile) : self.build_profile.from_omniauth(profile)\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def extract_info_from_omniauth(omniauth)\n if omniauth.has_key?('extra') && omniauth['extra'].has_key?('user_hash')\n self.info = omniauth['user_info'].merge(omniauth['extra']['user_hash']).symbolize_keys\n else\n self.info = omniauth['user_info'].symbolize_keys\n end\n end",
"def linkedin\n \n @user = User.find_for_linkedin_oauth(omniauth_param, current_user)\n \n if current_user #invite friend from linkedin || connectting with linkedin\n if session[\"linkedin\"] && session[\"linkedin\"][:invite_friends] #invite friend from linkedin\n redirect_to invite_friends_friendships_path(provider: \"linkedin\")\n else\n redirect_to root_path\n end\n\n else #Login/sign up with linkedin\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"LinkedIn\"\n \n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.social_data\"] = omniauth_param\n redirect_to new_user_registration_url\n end\n end\n end",
"def get_profile_url_linkedin\n profile_url = self[:info][:urls][:public_profile] if self[:info] and self[:info][:urls]\n profile_url.gsub!(/^http:/, 'https:') if profile_url # protect cookies\n profile_url\n end",
"def linkedin(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend",
"def finishLinkedInAuth\n require 'oauth2'\n\n if params[:code].present? && params[:state].present?\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :token_url => '/uas/oauth2/accessToken')\n token = client.auth_code.get_token(params[:code], :redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth')\n\n #use the token to get this user's first-name, last-name, location, industry, num-connections, positions, email-address, and id\n response = token.get('https://api.linkedin.com/v1/people/~:(first-name,last-name,location,industry,num-connections,positions,email-address,id)?format=json', :headers => { 'authorization' => 'Bearer ' + token.token })\n response = ActiveSupport::JSON.decode(response.response.env['body']) #convert that JSON to a ruby array\n\n #search our database to see whether this is a new user\n found_user = User.where(:linkedInId => response['id']).first\n if found_user == nil\n found_user = createNewUser(response)\n else\n found_user = updateUser(response, found_user)\n end\n \n #set their id in the session, which designates them as logged in\n session[:user_id] = found_user.id\n \n #check whether they should be allowed into our site, as long as they have not been reported three or more times\n if found_user.reportedCount >= 3\n #if they have been reported too many times, log them out and redirect them to the locked page\n session[:user_id] = nil\n redirect_to(:action => 'locked')\n else\n redirect_to(:controller => 'home_feed', :action => 'show') #otherwise, redirect them to the home feed\n end\n \n elsif params[:error].present? && params[:error_description].present?\n puts \"Rejected\"\n \n else\n puts \"Unexpected response\"\n end\n end",
"def linkedin\n handle_callback(:linkedin)\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end",
"def update_DB\n @users=User.all\n @users.each do |user|\n if user.token\n client = LinkedIn::Client.new(\"mgdh4gtnqnra\", \"adFWD50VxWY35Yi1\")\n client.authorize_from_access(user.token,user.secret)\n Rails.logger.debug user.inspect\n Rails.logger.debug \"============================================================================\"\n update_profile(client,user)\n update_educations(client,user)\n update_experiences(client,user)\n end\n end\n redirect_to home_path\n end",
"def update_from_linkedin(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.first_name if auth.info.first_name\n cv['image'] = auth.info.picture_url if auth.info.picture_url\n cv['language_spoken'] = auth.extra.raw_info.lastName.preferredLocale.country if auth.extra.raw_info.lastName.preferredLocale.country\n cv['linkedin_auth'] = true\n end",
"def scrape_people\n people = []\n lis = @browser.lis(css: \".mod.result.people\")\n lis.each do |li|\n user_id = li.attribute_value(\"data-li-entity-id\")\n\n bd = li.div(class: \"bd\")\n name = bd.h3.a.text\n if name =~ /linkedin member/i\n next\n end\n\n if bd.dl(class: \"snippet\").present?\n title = bd.dl(class: \"snippet\").dd.p.text\n else\n title = bd.div.text\n end\n\n full_url = bd.h3.a.href\n person = {\n user_id: user_id,\n name: name,\n full_url: full_url,\n title: title\n }\n people << person\n end\n people\nend",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def map_user_attributes(omniauth)\n info = omniauth.info\n raw_info = omniauth.extra.raw_info\n\n self.login = info.nickname\n self.name = info.name || ''\n self.email = info.email || ''\n self.avatar_url = info.image || ''\n\n self.company = raw_info.company\n self.location = raw_info.location\n self.followers = raw_info.followers\n self # return self\n end",
"def load_user_and_profile\n\t\t@user = current_user\n\t\[email protected]_profile\n\t\t@profile = @user.profile\n\tend",
"def user_from_omniauth\n IdentifierScheme.for_users.each do |scheme|\n omniauth_hash = session.fetch(\"devise.#{scheme.name}_data\", {})\n next if omniauth_hash.empty?\n\n return ::User.from_omniauth(scheme_name: scheme.name, omniauth_hash: omniauth_hash)\n end\n nil\n end",
"def fetch_details_from_github\n\t\t# To Do\n\t\tself.user.has_github = true\n\t\tself.user.save\n\tend",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def fetch_user_info_by_base_oauth(code)\n open_id = _oauth_get_open_id(code)\n _fetch_user_info(open_id)\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def fetch_twitter_informations\n unparsed_html = Nokogiri::HTML(open(twitter_profile_address))\n\n self.twitter_username = fetch_twitter_username(unparsed_html)\n self.twitter_description = fetch_twitter_description(unparsed_html)\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"],\n :image => profile[\"image\"][\"url\"],\n :url => profile[\"url\"],\n :email => email} \n end",
"def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"login\"]\n end",
"def build_from_github_user( user )\n # name\n # email\n # blog\n # company\n # location\n # bio\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_data_from_github(id)\n page = Nokogiri::HTML(open(\"https://github.com/#{id}\"))\n # fullname = page.css('body.logged_out.env-production.linux.page-profile\n # div.wrapper div.header.header-logged-out div.container.clearfix\n # div.command-bar.js-command-bar ul.top-nav li.explore a')\n fullname = page.css('span.vcard-fullname').text\n { user: fullname }\nend",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def startLinkedInAuth\n require 'oauth2'\n\n client = OAuth2::Client.new('75yetg1f8atx89', 'le39CGDc1yQLCo9U', :site => 'https://www.linkedin.com/', :authorize_url => '/uas/oauth2/authorization')\n #specifies our site url which LinkedIn should redirect back to after the user successfully logs in\n #also includes a random state for security and the LinkedIn data which we will request from the user (basic profile info and their email address)\n redirect_to client.auth_code.authorize_url(:redirect_uri => request.protocol + request.host_with_port + '/access/finishLinkedInAuth') + '&state=' + getRandomState + '&scope=r_basicprofile%20r_emailaddress'\n end",
"def linkedin_client\n # load api\n\n linkedin_api_settings = YAML.load_file(\"#{Dir.home}/.linkedin\")\n \n consumer_key = linkedin_api_settings[\"consumer_key\"]\n consumer_secret = linkedin_api_settings[\"consumer_secret\"]\n authorize1 = linkedin_api_settings[\"authorize1\"]\n authorize2 = linkedin_api_settings[\"authorize2\"]\n client = LinkedIn::Client.new(consumer_key, consumer_secret)\n \n unless authorize1 && authorize2\n # If you want to use one of the scopes from linkedin you have to pass it in at this point\n # You can learn more about it here: http://developer.linkedin.com/documents/authentication\n request_token = client.request_token({}, :scope => \"r_basicprofile r_emailaddress\")\n\n rtoken = request_token.token\n rsecret = request_token.secret\n\n # to test from your desktop, open the following url in your browser\n # and record the pin it gives you\n puts request_token.authorize_url\n puts\n puts \"What was the pin?\"\n pin = gets.strip\n\n \n # then fetch your access keys\n authorize1, authorize2 = client.authorize_from_request(rtoken, rsecret, pin)\n #=> [\"OU812\", \"8675309\"] # <= save these for future requests\n \n linkedin_api_settings[\"authorize1\"] = authorize1\n linkedin_api_settings[\"authorize2\"] = authorize2\n f = File.open(\"#{Dir.home}/.linkedin\",\"w+\")\n f.puts linkedin_api_settings.to_yaml\n end\n # or authorize from previously fetched access keys\n client.authorize_from_access(authorize1, authorize2)\n binding.pry\nend",
"def extract_identity\n @identity = Identity.find_omniauth(omniauth) if omniauth\n end",
"def set_user_information\n @login = Login.find(params[:id])\n# @phones = User.includes(:user_phones).where(\"user_phones.user_id\", @login.user.id)\n end",
"def social\n @user = current_user\n @links = current_user.external_links\n \n # TWITTER\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n request_token = clientTwitter.request_token(:oauth_callback => TwitterEnv::CALLBACK_URL) \n session[:rtoken_twitter] = request_token.token\n session[:rsecret_twitter] = request_token.secret\n @login_twitter_url = request_token.authorize_url\n end\n \n # FACEBOOK\n @login_facebook_url = Koala::Facebook::OAuth.new.url_for_oauth_code(:permissions => 'read_stream,offline_access')\n \n if params[:code]\n @user.user_content.facebook_token = Koala::Facebook::OAuth.new.get_access_token(params[:code])\n @user.user_content.save\n end\n \n # LINKEDIN\n if params[:oauth_verifier]\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n if @user.user_content.linkedin_token.blank?\n pin = params[:oauth_verifier]\n atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)\n @user.user_content.linkedin_token = atoken\n @user.user_content.linkedin_secret = asecret\n @user.user_content.save\n else\n client.authorize_from_access(@user.user_content.linkedin_token, @user.user_content.linkedin_secret)\n end\n else\n client = LinkedIn::Client.new(LinkedIn::API_KEY, LinkedIn::SECRET_KEY)\n request_token = client.request_token(:oauth_callback => LinkedIn::CALLBACK_URL)\n session[:rtoken] = request_token.token\n session[:rsecret] = request_token.secret\n @login_linkedin_url = client.request_token.authorize_url\n end\n \n respond_to do |format| \n if params[:ajax] == \"true\" # Request came from ajax. Respond without layout.\n format.html { render :layout => false } # social.html.erb\n else\n format.html # social.html.erb WITH layout\n end\n end\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end",
"def linked_in_avatar(user)\n image_tag(user.user_info[\"linked_in\"][\"image\"])\n end",
"def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end",
"def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end",
"def from_omniauth(auth)\n raise 'UnknownProvider' unless omniauth_providers.include?(auth.provider)\n adapter = SuperbAuth.adapter_for(auth.to_hash)\n user = init_by_email(adapter.email)\n identity = user.identities.build(provider: auth.provider, uid: auth.uid, data: auth.to_hash)\n user.get_user_info_from_identity(identity)\n user\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def identify\n @user = User.new\n if omniauth = session[:omniauth]\n @provider = omniauth.provider.capitalize\n @user.apply_omniauth(omniauth)\n end\n end",
"def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def get_user_informations(user_id)\n url = \"#{GRAPH_URL}/#{user_id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.get url\n if data.empty?\n puts \"MessengerBot - Unable to get user_informations (User has not already send a message or has revoked platform permissions on Facebook)\"\n nil\n else\n puts \"MessengerBot - Get user information with user_id : #{user_id}\"\n JSON.parse(data)\n end\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def client\n OAuth2::Client.new(\n API_KEY,\n API_SECRET,\n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n )\n end",
"def user_from_code(temp_code)\n MiniFB.get(access_token(temp_code), \"me\")\n end",
"def set_facebook_info omni\n info = omni['info']\n self.email = info['email']\n self.first_name = info['first_name']\n self.last_name = info['last_name']\n\n # Get the large size image. Omniauth returns 'square' by default and thats\n # too small to use.\n if info['image'].present?\n self.remote_profile_image_url = info['image'].gsub(\"square\", \"large\")\n end\n end",
"def fetch_details_from_dropbox_oauth2\n\t\t# To Do\n\t\tself.user.has_dropbox = true\n\t\tself.user.save\n\tend",
"def linkedin_token\n x = authentications.find_by(provider: 'linkedin')\n return x.token unless x.nil?\n end",
"def link_with_omniauth(auth)\n identities.find_or_initialize_by(provider: auth[:provider], uid: auth[:uid])\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def get_me\n response = self.class.get(\"https://www.bloc.io/api/v1/users/me\", headers: { \"authorization\" => @auth_token })\n body = JSON.parse(response.body)\n end",
"def init_linkedin_session(access_token, access_secret)\n puts \"---- init_linkedin_session\"\n \n # Check if the user is registered in the system\n # 1. Get the basic user information from LinkedIn to perform checks on\n @my_profile = a_recruiter__do_linkedin(0)\n # @my_profile = do_linkedin(0)\n \n \n # -- [No active LinkedIn connection]\n if @my_profile.nil?\n \n session[:request_token] = get_linkedin_consumer().get_request_token({:oauth_callback => callback_url})\n \n if session[:request_token]\n session[:access_token] = session[:request_token].token\n session[:access_secret] = session[:request_token].secret\n end\n \n # -- Return the 'auth_url' if the method's 'get_aurh_url' flag is set to 'true'\n \n return session[:request_token].authorize_url\n \n end\n \n \n if @my_profile[:response_object]['id']\n user_connector = Fs2UserConnector.find_by_linkedin_id(@my_profile[:response_object]['id'])\n elsif @my_profile[:response_object]['emailAddress']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['emailAddress'])\n elsif @my_profile[:response_object]['publicProfileUrl']\n user_connector = Fs2UserConnector.find_by_linkedin_email(@my_profile[:response_object]['publicProfileUrl'])\n end\n \n # Update the access keys in case the 'user_connector' was found (a new one, an 'updated' one etc.)\n if user_connector\n user_connector.update_attributes({\n :linkedin_access_token => access_token,\n :linkedin_access_secret => access_secret\n })\n end\n \n if session[:user].nil?\n \n if user_connector && user_connector.user_id # exists in DB\n \n session[:user] = Fs2User.find_by_id(user_connector.user_id)\n \n else\n \n # Create USER\n session[:user] = Fs2User.new({\n :status_id => Fs2User::USER_STATUSES[:linkedin_signed_in], \n :user_type_id => Fs2User::USER_TYPES[:job_seeker],\n :referral_id => session[:user_referral]\n })\n session[:user].email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n session[:user].save(false)\n \n # Create JOB SEEKER\n full_name = \"\"\n full_name += @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n if @my_profile[:response_object]['lastName']\n full_name += \" \" if !full_name.blank?\n full_name += @my_profile[:response_object]['lastName'] \n end\n \n # -- Save the contact details\n @person = Fs2Contact.new({:full_name => full_name})\n @person.user_id = session[:user].id\n @person.save(false)\n \n # -- No Company\n \n # Create USER CONNECTOR\n user_connector = Fs2UserConnector.new({\n :linkedin_access_token => session[:access_token],\n :linkedin_access_secret => session[:access_secret],\n :status_id => 1\n })\n user_connector.user_id = session[:user].id if session[:user]\n user_connector.linkedin_id = @my_profile[:response_object]['id'] if @my_profile[:response_object]['id']\n user_connector.linkedin_email = @my_profile[:response_object]['emailAddress'] if @my_profile[:response_object]['emailAddress']\n user_connector.linkedin_first_name = @my_profile[:response_object]['firstName'] if @my_profile[:response_object]['firstName']\n user_connector.linkedin_last_name = @my_profile[:response_object]['lastName'] if @my_profile[:response_object]['lastName']\n user_connector.linkedin_public_profile_url = @my_profile[:response_object]['publicProfileUrl'] if @my_profile[:response_object]['publicProfileUrl']\n user_connector.save(false)\n \n end\n \n end\n \n session[:user_connector_id] = user_connector.id\n \n job_seeker = Fs2JobSeeker.find_by_user_id(user_connector.user_id)\n session[:job_seeker_id] = job_seeker.id if job_seeker\n \n skills_profile = Fs2SkillsProfile.find(:first, :conditions => \n [\"profile_type = ? AND entity_type = ? AND entity_id = ?\", \n FS_PROFILE_TYPES[:user_profile], ENTITY_TYPES[:job_seeker], session[:job_seeker_id]]) if session[:job_seeker_id]\n session[:skills_profile_id] = skills_profile.id if skills_profile\n \n @my_profile[:response_object]\n \n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def user_details(login, authenticated = false)\n result = nil\n if authenticated\n auth_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n else\n public_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n end\n result\n end",
"def build_profile_from_omniauth(auth)\n self.provider = auth.provider\n self.uid = auth.uid\n self.name = auth.info.name\n self.email = auth.info.email\n parse_description(auth)\n self\n end",
"def linkedin_profile?\n @network = current_user.network ||= Network.new\n !(@network.linkedin.nil? || @network.linkedin.blank?)\n end",
"def call\n fetch_user_from_auth_token\n end",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end",
"def apply_omniauth(omniauth)\n info = omniauth[\"info\"]\n\n user_name = %Q(#{info[\"first_name\"]} #{info[\"last_name\"]})\n user_name.gsub!(/\\s+/, \" \").strip!\n\n self.provider = omniauth[\"provider\"]\n self.uid = omniauth[\"uid\"]\n self.name = user_name if self.name.blank?\n self.email = info[\"email\"] if info[\"email\"] && self.email.blank?\n self\n end",
"def find_by_omniauth(auth)\n identity = User::Identity.find_by(provider: auth.provider, uid: auth.uid)\n identity.user if identity\n end",
"def user_record_from_upi(figshare:, upi:, &block)\n figshare.institutions.accounts( institution_user_id: \"#{upi}@auckland.ac.nz\") do |a|\n figshare.other.private_account_info(impersonate: a['id'], &block)\n end\nend",
"def find_using_oauth_email(oauth_data, oauth_user_id)\r\n user = nil\r\n oauth_email = oauth_data.info.email\r\n if oauth_email.present?\r\n user = self.find_by(email: oauth_email)\r\n if user.present? && user.oauth_user_id.blank?\r\n user.oauth_user_id = oauth_user_id\r\n else\r\n user = nil # don't update if has an oauth user id (will error on duplicate email validation)\r\n end\r\n end\r\n user\r\n end",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def import_profile_from_twitter\n self.profile.first_name = @credentials['name']\n self.profile.website = @credentials['url']\n self.profile.federated_profile_image_url = @credentials['profile_image_url']\n self.profile.save\n end",
"def find_from_omniauth(saml_hash)\n # Get configuration options for customized SAML return value identifiers\n omniauth_config = ConcertoSamlAuth::Engine.config.omniauth_config\n uid = saml_hash[:uid]\n uid = uid.downcase\n\n # Check if an identity records exists for the user attempting to sign in\n if identity = ConcertoIdentity::Identity.find_by_external_id(uid)\n # Return the matching user record\n user_existed = true\n user = identity.user\n else\n # Add a new user via omniauth SAML details\n user_existed = false\n user = User.new\n end\n\n # Set user attributes\n\n # First name is required for user validation\n if !saml_hash[:info][:first_name].nil?\n user.first_name = saml_hash[:info][:first_name]\n else\n user.first_name = uid\n end\n\n if !saml_hash[:info][:last_name].nil?\n user.last_name = saml_hash[:info][:last_name]\n end\n\n # Email is required for user validation\n if saml_hash[:info][:email].nil?\n flash.notice = \"No email was provided by the identity provider\"\n return nil\n else\n user.email = saml_hash[:info][:email]\n end\n\n\n # Set user password and confirmation to random tokens\n user.password,user.password_confirmation=Devise.friendly_token\n\n # Attempt to save our new user\n if user.save\n # Saved\n\n if omniauth_config[:member_of_key].present?\n synchronize_group_membership(user, saml_hash, omniauth_config)\n end\n\n if omniauth_config[:admin_groups].present?\n synchronize_is_admin(user, saml_hash, omniauth_config)\n end\n\n user.save!\n\n if !user_existed\n # Create a matching identity to track our new user for future\n # sessions and return our new user record\n ConcertoIdentity::Identity.create(provider: \"saml\",\n external_id: uid,\n user_id: user.id)\n end\n\n return {user: user, existed: user_existed}\n else\n # User save failed, an error occurred\n flash.notice = \"Failed to sign in with SAML.\n #{user.errors.full_messages.to_sentence}.\"\n return nil\n end\n end",
"def read\n\t\tuser = User.find_by_username(params[:username])\n\t\tif user\n payload = {\n username: user.username,\n first_name: user.first_name,\n last_name: user.last_name,\n created_at: user.created_at.strftime(\"%-m/%-d/%Y\")\n }\n\t\t\tif @current_user and @current_user.id == user.id\n payload[:email_address] = user.email_address\n end\n render status: 200, json: payload\n\t\telse\n\t\t\trender status: 404, json: {error: true}\n\t\tend\n\tend",
"def get_me\n response = self.class.get(api_url(\"users/me\"),\n headers: { \"authorization\" => @auth_token })\n\n # Parse the JSON document returned in the response into a Ruby hash\n JSON.parse(response.body)\n end",
"def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :includes => 'Profile'}\n options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)\n tmp = User.find(username, options)\n @profile = Profile.new(tmp.associated_profile)\n end\n end\n @profile\n end",
"def social_identity\n auth = request.env['omniauth.auth']\n end",
"def from_omniauth(auth)\n self.update(\n uid: auth.uid,\n nickname: auth.info.nickname,\n token: auth.credentials.token,\n profile_url: auth.info.urls.stackoverflow,\n reputation: auth.extra.raw_info.reputation,\n age: auth.extra.raw_info.age,\n badges: auth.extra.raw_info.badge_counts,\n display_name: auth.extra.raw_info.display_name,\n stackexchange_key: auth.extra.raw_info.user_id\n )\n end",
"def new\n @profile = Profile.new\n if li_auth = current_user.linkedin_auth\n @avatar_url = li_auth.avatar_url\n # fetch fields from the user's linkedin profile\n li_client = li_auth.linkedin_client\n li_profile = li_client.profile(:fields => %w(three_current_positions formatted_name summary location phone_numbers main_address))\n\n if li_profile.present?\n # use current position's company, or the user's name if company unavailable\n if li_profile['three_current_positions'].total > 0\n @profile.name = li_profile['three_current_positions'].all.first.company.name\n else\n @profile.name = li_profile['formatted_name']\n end\n\n # description/summary\n @profile.description = li_profile['summary']\n\n # phone numbers\n if li_profile['phone_numbers'].total > 0\n li_profile['phone_numbers'].all.each do |p|\n phone = @profile.phones.build(\n :number => p['phone_number'], \n :phone_type => PhoneType.find_by_name_or_default(p['phone_type']))\n end\n end\n\n # TODO address. li_profile['main_address'] is a multi-line address string. needs parsed.\n end\n end\n @profile.build_location\n @phone = @profile.phones.build\n @phone.phone_type = PhoneType.find 1\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end",
"def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend"
] | [
"0.67560947",
"0.66138816",
"0.65369385",
"0.64132136",
"0.6403929",
"0.6319666",
"0.62905455",
"0.621263",
"0.6146846",
"0.6117176",
"0.6046655",
"0.6034665",
"0.6028541",
"0.6027692",
"0.59839314",
"0.5970962",
"0.59577286",
"0.59471494",
"0.5943806",
"0.59388626",
"0.59231484",
"0.59214425",
"0.5874042",
"0.5842348",
"0.58328795",
"0.5831312",
"0.5829402",
"0.5821262",
"0.5819235",
"0.5811053",
"0.58062226",
"0.5791059",
"0.57723284",
"0.5768362",
"0.57648504",
"0.57556766",
"0.5737934",
"0.5736507",
"0.5717281",
"0.5702335",
"0.5700984",
"0.56996024",
"0.5694407",
"0.56839335",
"0.5669936",
"0.56684196",
"0.5663543",
"0.56588703",
"0.56573606",
"0.56520295",
"0.56368303",
"0.56368303",
"0.5630882",
"0.5623302",
"0.5623302",
"0.5619539",
"0.56039095",
"0.5593163",
"0.55927664",
"0.5588851",
"0.55837566",
"0.5580278",
"0.55782735",
"0.55716634",
"0.556861",
"0.55671114",
"0.5566906",
"0.55668616",
"0.5564043",
"0.5555547",
"0.5550054",
"0.55499405",
"0.55491227",
"0.5548652",
"0.5546036",
"0.554314",
"0.5540092",
"0.5530145",
"0.5528116",
"0.5526569",
"0.55190617",
"0.55174404",
"0.5515304",
"0.5511664",
"0.5503581",
"0.54994655",
"0.5490508",
"0.54899174",
"0.54830766",
"0.5466122",
"0.54530984",
"0.54432887",
"0.5439202",
"0.543876",
"0.5436377",
"0.54363686",
"0.54328924",
"0.542861",
"0.54220235",
"0.54182917"
] | 0.75067633 | 0 |
=> Load user details from Google Plus | def fetch_details_from_google_oauth2
# To Do
self.user.has_google = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_profile_from_google\n # forthcoming\n end",
"def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"],\n :image => profile[\"image\"][\"url\"],\n :url => profile[\"url\"],\n :email => email} \n end",
"def connect_gplus\n\t auth = request.env[\"omniauth.auth\"]\n\t current_member.gplus_id = auth[\"uid\"]\n current_member.gplus_token = auth.credentials.token\n if auth.info.image.present?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n end\n current_member.gplus_refresh_token = auth.credentials.refresh_token\n current_member.gplus_token_expires_at = auth.credentials.expires_at\n\t current_member.save\n\t GoogleModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\t\n end",
"def get_profile(session, user_id)\n $client.authorization.update_token!(session[:token].to_hash)\n plus = $client.discovered_api('plus')\n\n Rails.logger.debug \"TokenPair: #{$client.authorization.to_yaml}\"\n result = $client.execute(\n :api_method => plus.people.get,\n :parameters => {'userId' => user_id})\n\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n Rails.logger.debug \"GoogleClient: NM #{result.data['displayName']}\"\n Rails.logger.debug \"GoogleClient: IM #{result.data['image']['url']}\"\n Rails.logger.debug \"GoogleClient: PR #{result.data['url']}\"\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n\n @profile = Hash.new\n @profile[:name] = result.data['displayName']\n @profile[:profile_url] = result.data['url']\n\n # Avatar sizes\n @profile[:img_url] = result.data['image']['url']\n @profile[:img_url].gsub!(/sz=\\d+$/, \"\")\n\n @profile[:img_thumb_url] = @profile[:img_url] + 'sz=100'\n @profile[:img_tiny_url] = @profile[:img_url] + 'sz=32'\n @profile[:img_badge_url] = @profile[:img_url] + 'sz=15'\n\n return @profile\n end",
"def user_api\n Google::Apis::PlusV1::PlusService.new\n end",
"def get_user_info()\n return_map = nil\n if session[:google_unique] != nil && user_credentials.access_token != nil\n return_map = {}\n return_map['email'] = session[:googleemail]\n return_map['sub'] = session[:google_unique]\n return_map['useralias'] = session[:useralias]\n end\n return return_map\nend",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def get_user_info(credentials)\n client = Google::APIClient.new\n client.authorization = credentials\n oauth2 = client.discovered_api('oauth2', 'v2')\n result = client.execute!(:api_method => oauth2.userinfo.get) \n user_info = nil\n\n if result.success?\n user_info = result.data\n else\n puts \"An error occured: #{result.data['error']['message']}\"\n end\n\n if user_info != nil && user_info.id != nil\n return user_info\n end\n\n raise NoUserIdError, \"Unable to retrieve the user's Google ID.\"\nend",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def import\n # GET http://www.google.com/m8/feeds/contacts/default/base\n token = params[:token]\n uri = URI.parse(\"https://www.google.com\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = \"/m8/feeds/contacts/default/full?max-results=10000\"\n headers = {'Authorization' => \"AuthSub token=#{token}\", 'GData-Version' => \"3.0\"}\n resp, data = http.get(path, headers)\n # extract the name and email address from the response data\n # HERE USING REXML TO PARSE GOOGLE GIVEN XML DATA\n xml = REXML::Document.new(data)\n contacts = []\n xml.elements.each('//entry') do |entry|\n person = {}\n person['name'] = entry.elements['title'].text\n gd_email = entry.elements['gd:email']\n logger.debug(entry)\n if gd_email\n person['email'] = gd_email.attributes['address'] \n @user.profile.contacts << person if person\n end \n end\n @user.profile.save\n redirect_to root_url , :notice => \"imported successfully\"\n end",
"def create_from_google(user_info)\n @user = User.find_or_create_by(uid: user_info[\"uid\"]) do |u|\n u.name = user_info[\"info\"][\"name\"]\n u.email = user_info[\"info\"][\"email\"]\n u.image_url = user_info[\"info\"][\"image\"]\n u.password = \"none\"\n end # Find or create user from Google data\n\n session[:user_id] = @user.id # Log user in by adding id to session hash\n redirect_to user_path(@user) # redirect to user show page\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def apiCall(token)\n # Authorize the client and construct a Google+ service.\n $client.authorization.update_token!(token)\n plus = $client.discovered_api('plus', 'v1')\n\n # Get the list of people as JSON and return it.\n response = $client.execute!(plus.people.get, :userId => 'me').body\n puts response.inspect\nend",
"def get_user_informations(user_id)\n url = \"#{GRAPH_URL}/#{user_id}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=#{ENV['MESSENGER_BOT_ACCESS_TOKEN']}\"\n data = RestClient.get url\n if data.empty?\n puts \"MessengerBot - Unable to get user_informations (User has not already send a message or has revoked platform permissions on Facebook)\"\n nil\n else\n puts \"MessengerBot - Get user information with user_id : #{user_id}\"\n JSON.parse(data)\n end\n end",
"def google\n if params[:user_type_login].eql?(\"user\")\n @user, session[:new_register] = User.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_user)\n else\n @user, session[:new_register] = Bar.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_bar)\n end\n session[:google_user] = env[\"omniauth.auth\"][\"user_info\"]\n session[:google_email] = env[\"omniauth.auth\"][\"email\"]\n v_uid = env[\"omniauth.auth\"][\"uid\"].split(\"?id=\").last\n session[:google_uid] = v_uid\n\n if session[:new_register]\n flash[:notice] = \"Please Insert Your data for complete your profile via Google\"\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google Apps\"\n sign_in @user\n redirect_to user_root_url if params[:user_type_login].eql?(\"user\")\n redirect_to bar_root_url if params[:user_type_login].eql?(\"bar\")\n else\n session[\"devise.google_apps_data\"] = env[\"omniauth.auth\"]\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n end",
"def google_oauth2\nuser = User.from_omniauth(request.env[\"omniauth.auth\"])\nif user.persisted?\nflash.notice = \"Signed in Through Google!\"\nsign_in_and_redirect user\nelse\nsession[\"devise.user_attributes\"] = user.attributes\nflash.notice = \"You are almost Done! Please provide a password to finish setting up your account\"\nredirect_to new_user_registration_url\nend\nend",
"def googleplus_url; \"https://plus.google.com/#{googleplus}\" end",
"def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end",
"def GetProfileData()\n uri = URI(API_URL + 'me')\n\n return PerformRestrictedGet(uri)\n end",
"def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end",
"def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend",
"def signed_on_to_google\n if current_member\n # result = google_api_request( 'plus', 'v1', 'people', 'get', { userId: current_member.uid })\n # if result.status != 200\n # sign_out\n # session[:return_to] = request.url if request.get?\n # redirect_to google_signin_url, notice: \"Your session has timed out\"\n # else\n # current_member.name = result.data.display_name\n # current_member.save\n # end\n else\n redirect_to google_signin_url\n end\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def show\n @account = current_user.person.gmail_accounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @account }\n end\n end",
"def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end",
"def get_user_data(user_id, auth_token)\n request = Typhoeus::Request.new(\n \"https://oauth2-api.mapmyapi.com/v7.0/user/self/\",\n method: :get,\n body: {\n 'Content-Type' => \"application/json\",\n 'Api-Key' => ID,\n 'Authorization' => \"Bearer #{auth_token}\"\n },\n headers: {\n 'Api-Key' => ID,\n 'Authorization' => auth_token\n }\n )\n request.run\n response = request.response\n fail\n\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def googleAuth\n access_token = request.env[\"omniauth.auth\"]\n @user = User.from_omniauth(access_token)\n @user.save\n @user.google_token = access_token.credentials.token\n refresh_token = access_token.credentials.refresh_token\n @user.google_refresh_token = refresh_token if refresh_token.present?\n session[:user_id] = @user.id\n redirect_to contacts_path\n end",
"def find_google_account(params)\n GoogleAccount.find params[:userToken]\n end",
"def google_oauth2\n\t\n\t\t#~ raise request.env[\"omniauth.auth\"].to_yaml\n\t\n # This method is implemented in app/models/user.rb\n @user = User.from_omniauth_google(request.env[\"omniauth.auth\"])\n\t\t\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Google\") if is_navigational_format?\n else\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url #redirects to sign up if unsuccessful\n end\n end",
"def fetch_user_extended_detail\n @user_extended_detail_obj = UserExtendedDetail.using_client_shard(client: @client).\n get_from_memcache(@user_kyc_detail.user_extended_detail_id)\n end",
"def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def google(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def call\n fetch_user_from_auth_token\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def extract_info_from_omniauth(omniauth)\n if omniauth.has_key?('extra') && omniauth['extra'].has_key?('user_hash')\n self.info = omniauth['user_info'].merge(omniauth['extra']['user_hash']).symbolize_keys\n else\n self.info = omniauth['user_info'].symbolize_keys\n end\n end",
"def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def show\n @profile = current_user.profile\n @hash = Gmaps4rails.build_markers(@profile) do |profile, marker|\n marker.lat profile.latitude\n marker.lng profile.longitude\n marker.infowindow profile.first_name\n end\n end",
"def user_email\n @gapi.user_email\n end",
"def auth_google\n @attributes[:auth_google]\n end",
"def user_info\n auth_hash['user_info']\n end",
"def show\n @ta_as_user = User.find_by(google_email: @teaching_assistant.email)\n end",
"def google_oauth(access_token)\n user_info = access_token.extra.raw_info\n external_user_id = user_info.id\n email = user_info.email\n account = self.by_google_id(external_user_id).first || self.by_google_email(email).first\n if account.blank?\n account = self.new\n account.email = email\n account.provider = Provider::GOOGLE\n account.external_user_id = user_info.id\n account.skip_confirmation!\n account.build_profile :first_name => user_info.given_name, :last_name => user_info.family_name\n if user_info.gender.present?\n gender = Gender.enumeration[user_info.gender.to_sym]\n account.profile.gender = gender.first if gender\n end\n account.save\n end\n account\n end",
"def get_user_info(credentials)\n\t \n\n service = Google::Apis::Oauth2V2::Oauth2Service.new\n service.authorization = credentials\n user_info = service.get_userinfo\n\t \n\t if user_info != nil && user_info.id != nil\n\t return user_info\n\t end\n\t raise NoUserIdError, 'Unable to retrieve the e-mail address.'\n\tend",
"def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end",
"def google #find or create a user using the attrs sent by google\n @user = User.find_or_create_by(email: auth[\"info\"][\"email\"]) do |user|\n user.username = auth[\"info\"][\"first_name\"]\n user.password = SecureRandom.hex(10) #assigns random password to the user\n end \n if @user.save\n session[:user_id] = @user.id #set the session id which logs them in\n redirect_to user_path(@user.id)\n else \n flash[:message] = 'There was a problem signing you in through Google. Please register or try signing in later.'\n redirect_to '/login' #if user doesn't save redirect to homepage\n end \n end",
"def omniauth\r\n @user = User.create_by_google_omniauth(auth)\r\n \r\n session[:user_id] = @user.id\r\n redirect_to user_path(@user)\r\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def user_info(user_oauth_token)\n api_post(@user_info_url, user_oauth_token)\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def show\n @title = @user.complete_name\n @description = \"Informations relatives à #{@user.complete_name}\"\n @jsonld = @user.to_jsonld\n end",
"def get_me\n response = self.class.get(api_url(\"users/me\"),\n headers: { \"authorization\" => @auth_token })\n\n # Parse the JSON document returned in the response into a Ruby hash\n JSON.parse(response.body)\n end",
"def get_user \\\n name,\n options: nil,\n &block\n request = {\n name: name\n }.delete_if { |_, v| v.nil? }\n request = Google::Gax.to_proto request, Google::Showcase::V1alpha3::GetUserRequest\n @get_user.call(request, options, &block)\n end",
"def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def google_oauth2\n # You need to implement the method below in your model (e.g. app/models/user.rb)\n @user = User.find_for_google_oauth2(request.env[\"omniauth.auth\"])\n\n if @user.persisted?\n #flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google\"\n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.google_data\"] = request.env[\"omniauth.auth\"]\n\n if !session['omniauth_error_return'].nil? && session['omniauth_error_return'] == 'log_in'\n redirect_to log_in_url\n else\n redirect_to sign_up_url\n end\n end\n end",
"def fetch_user_google_calendars\n user_gcalendars = []\n if current_user.connected_to_google? && current_user.has_google_credentials?\n begin\n gcw = GoogleCalendarWrapper.new(current_user)\n gcw.import_calendars\n user_gcalendars = current_user.google_calendars\n rescue => e\n logger.error {\"#{e.message} #{e.backtrace.join(\"\\n\")}\"}\n current_user.update_attributes(connected_to_google: false)\n flash[:error] = \"We were not able to fetch data from #{current_user.name}'s Google account.\"\n end\n end\n user_gcalendars\n end",
"def get_user(access_token_str)\r\n @access_token = get_access_token_by(access_token_str)\r\n resp = get_userinfo\r\n case resp\r\n when Net::HTTPSuccess\r\n @userinfo = JSON.parse(resp.body)\r\n parse_user_id(@userinfo)\r\n else\r\n err = \"Can't get user info: <br/>#{resp.body}\"\r\n end\r\n err\r\n end",
"def user_needs(id)\n needs_data(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def show_user_profile\n\t\t# find the home address\n\t\t@home_addresses = @profile_setting.addresses.where(address_type: \"home\")\n\tend",
"def get_user(screen_name)\n result = self.class.get(\"/users/#{screen_name}\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n JSON.parse(result.body)\n\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_user request_pb, options:, &block\n request_json = JSON.parse ::Google::Showcase::V1beta1::GetUserRequest.encode_json(request_pb)\n\n uri = \"/v1beta1/#{request_pb.name}\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Showcase::V1beta1::User.decode_json result_json[:body]\n end",
"def get_me\n response = self.class.get(api_url(\"users/me\"), headers: { \"authorization\" => @auth_token })\n JSON.parse(response.body)\n end",
"def create_google\n @user = GetOauthUser.new(:service_hash => omniauth_hash).call\n\n if @user\n establish_session @user\n redirect_to return_location\n else\n redirect_to sign_in_url, :notice => \"Error signing in\"\n end\n end",
"def google_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n split_email = email.split(\"@\")\n username = split_email[0]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n refresh_token = hash[\"credentials\"][\"refresh_token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, refresh_token, email, gamer.id)\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = refresh_token\n flash[:info] = t(:continue_reg_google)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n flash[:error] = t(:connected_to_google)\n redirect_to root_url\n end\n else\n flash[:error] = t(:oops_error_google)\n redirect_to root_url\n end\n end",
"def sign_up_users(first_name, last_name, email, password)\n find_by_id('com.yelp.android:id/first_name').send_key first_name\n find_by_id('com.yelp.android:id/last_name').send_key last_name\n find_by_id('com.yelp.android:id/email_address').send_key email\n find_by_id('com.yelp.android:id/password').send_key password\n find_name('Gender')\n find_name('Male')\n end",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end",
"def show\n @user_picture = @user.profile_image.expiring_url(3600, :square)\n @bookmarks = @user.bookmarks\n @enrollments = @user.courses\n @enrollments_visible = @user.course_enrollments_visible_for_user(current_user)\n @completions_visible = @user.course_results_visible_for_user(current_user)\n end",
"def get_user_info(*fields)\n str_fields = fields.map(&:to_s).join(',')\n url = GRAPH_URL + @user.id + '?fields=' + str_fields + '&access_token=' +\n ENV['ACCESS_TOKEN']\n begin\n return call_graph_api(url)\n rescue => e\n return false\n end\n end",
"def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def scrape_people\n people = []\n lis = @browser.lis(css: \".mod.result.people\")\n lis.each do |li|\n user_id = li.attribute_value(\"data-li-entity-id\")\n\n bd = li.div(class: \"bd\")\n name = bd.h3.a.text\n if name =~ /linkedin member/i\n next\n end\n\n if bd.dl(class: \"snippet\").present?\n title = bd.dl(class: \"snippet\").dd.p.text\n else\n title = bd.div.text\n end\n\n full_url = bd.h3.a.href\n person = {\n user_id: user_id,\n name: name,\n full_url: full_url,\n title: title\n }\n people << person\n end\n people\nend",
"def fetch_user_info_by_base_oauth(code)\n open_id = _oauth_get_open_id(code)\n _fetch_user_info(open_id)\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def getUserInfo(doc, tweet)\n\t@username = doc.at_css(\".js-action-profile-name b\").text\n\tputs \"Username: #{@username}\"\n\n\t@name = doc.at_css(\".show-popup-with-id\").text\n\tputs \"Name: #{@name}\"\n\n\t@user_location = tweet[/\\([\\s]*@([^\\)]+)\\)/i]\n\tif @user_location != nil\n\t\t@user_location = @user_location[3..(@user_location.length - 2)]\n\t\tputs \"User Location: #{@user_location}\"\n\tend\nend",
"def fetch_profile_data\n puts \"Step 10: Extracting freelancer profile data\"\n freelance_profile_page = FreelancerProfilePage.new\n data = freelance_profile_page.get_profile_header\n data2 = data.find_element(css: \".overlay-container\")\n title = data2.find_element(css: \"h3\").text\n description = data2.find_elements(css: \"o-profile-overview\").first.text\n skills = freelance_profile_page.get_profile_skills.collect{|t| t.text}\n\n @profile_data = {\n title: title,\n description: description,\n skills: skills\n }\n puts \"Profile data extracted successfully\"\n end"
] | [
"0.6828771",
"0.67022216",
"0.65017575",
"0.6485825",
"0.64524746",
"0.64483804",
"0.6256732",
"0.6215875",
"0.6110562",
"0.6103185",
"0.60896564",
"0.6038388",
"0.6015874",
"0.59792376",
"0.59506166",
"0.5949301",
"0.5949201",
"0.59103143",
"0.58790207",
"0.583589",
"0.5829551",
"0.5815106",
"0.579431",
"0.5768464",
"0.57566655",
"0.573808",
"0.57348436",
"0.57210696",
"0.57210696",
"0.57112616",
"0.5693237",
"0.56891423",
"0.5679054",
"0.56789756",
"0.5642753",
"0.56235135",
"0.5613807",
"0.5604447",
"0.5591406",
"0.5583252",
"0.55822605",
"0.55698085",
"0.55542105",
"0.5549307",
"0.5544134",
"0.55388725",
"0.553358",
"0.5525218",
"0.55156565",
"0.5507243",
"0.5503097",
"0.5499939",
"0.54958886",
"0.5491301",
"0.5490472",
"0.54798126",
"0.5477968",
"0.54645336",
"0.54615575",
"0.54596776",
"0.54563373",
"0.5455745",
"0.54498386",
"0.544255",
"0.5439401",
"0.5437945",
"0.5437684",
"0.54371935",
"0.5431493",
"0.5427517",
"0.5417334",
"0.5384685",
"0.5382419",
"0.5381994",
"0.5380597",
"0.53777784",
"0.53647923",
"0.53582966",
"0.53572345",
"0.535646",
"0.53509396",
"0.535053",
"0.5349961",
"0.53497654",
"0.5343729",
"0.534111",
"0.5338316",
"0.5336661",
"0.5333716",
"0.5332226",
"0.53256494",
"0.53214216",
"0.5311242",
"0.5305749",
"0.5305344",
"0.53022873",
"0.52971417",
"0.52937746",
"0.52857107",
"0.52827626"
] | 0.7196885 | 0 |
=> Load user details from Dropbox | def fetch_details_from_dropbox_oauth2
# To Do
self.user.has_dropbox = true
self.user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(name)\n file = \"#{@@path_to_user_plists}/#{name}.plist\"\n user = NSMutableDictionary.dictionaryWithContentsOfFile(file)\n end",
"def get_user(name)\n @file = \"/private/var/db/dslocal/nodes//#{resource[:dslocal_node]}/users/#{name}.plist\"\n NSMutableDictionary.dictionaryWithContentsOfFile(@file)\n end",
"def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend",
"def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend",
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\nend",
"def dropbox\n check_auth :dropbox\n \n response = connection.post do |req|\n req.url '/user/dropbox'\n req.body = { :format => @format }\n end\n response\n end",
"def retrieve_account_details\n\t\taccount = $twitter.user(\"#{self.handle}\")\n\t\tself.name = account.name\n\t\tself.avatar_url = account.profile_image_uri\n\tend",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def load_users\n\n $test_logger.log(\"Loading users...\")\n\n #Delete all users from terminal DB\n @@cmd_proc.delete_all_uers\n\n #Fetch finger images from resource\n finger1 = Resource.get_content(\"N1.pklite\", true)\n finger2 = Resource.get_content(\"N2.pklite\", true)\n\n #Create required user records on terminal DB\n user_map = {\n USER1_ID => User_DB_record.new({:name_UTF8 => \"Test MFU User 1\", :PIN_code_UTF8 => \"4455\",\n :first_finger_nb => 1,\n :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n :template_data => finger1)]}),\n USER2_ID => User_DB_record.new({:name_UTF8 => \"Test MFU User 2\", :PIN_code_UTF8 => \"6677\",\n :first_finger_nb => 1,\n :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n :template_data => finger2)]})\n }\n\n # USER_BAD_ID => User_DB_record.new({:name_UTF8 => \"Test bad quality id\",\n # :templates => [User_templates.new(:template_type => Biofinger_template_type::Pklite,\n # :template_data => bad_qual_finger)]})\n\n @@cmd_proc.call_thrift{user_DB_set_users(user_map, false)}\n \n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def show_user(id)\n BrickFTP::API::User.find(id)\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.connect(Rcplugin::CITY_ADMIN_SECRET,Rcplugin::CITY_USER_TOKEN)\n\t\t@user = TheCityAdmin::User.load_by_id(id)\n\tend",
"def get_user_data(uid)\n @conn.get(\"/api/v1/users/#{uid}\")\n end",
"def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_user_data(user_id, auth_token)\n request = Typhoeus::Request.new(\n \"https://oauth2-api.mapmyapi.com/v7.0/user/self/\",\n method: :get,\n body: {\n 'Content-Type' => \"application/json\",\n 'Api-Key' => ID,\n 'Authorization' => \"Bearer #{auth_token}\"\n },\n headers: {\n 'Api-Key' => ID,\n 'Authorization' => auth_token\n }\n )\n request.run\n response = request.response\n fail\n\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def cdb_load(name)\n Chef::CouchDB.new.load(\"webui_user\", name)\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end",
"def retrieve_data\n File.file?(\"#{@username}\") ? customer = read_from_file : customer = User.new(username)\n customer\n end",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend",
"def user_data(data, username, user_password)\n data.each do |hash|\n next unless hash['username'].downcase == username.downcase\n\n next unless hash['password'] == user_password\n\n @user = User.new(username, user_password, hash['id'], hash['playlist'], hash['mylist'])\n go_to_menu\n end\n @count += 1\n no_auth\n end",
"def get_user_data\n @user = User.find(params[:id])\n end",
"def load_user(filepath)\n $user = load_yaml(filepath)\nend",
"def load_profile_data\n @profile_data = Nokogiri::HTML(open(\"#{PROFILE_URI}/#{@uid}\"))\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end",
"def user_content(user, options = {})\n options = options.clone\n username = user\n\n path = \"user/#{username}/%s.json\" % (options[:category] if options[:category])\n options.delete :category\n\n objects_from_response(:get, path, options)\n end",
"def show\n @big_auth_user = BigAuth::User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @big_auth_user }\n end\n end",
"def auth_info_from_file\n os = Config::CONFIG[\"host_os\"]\n if os =~ /darwin/\n info = YAML.load_file(\"/Users/#{ENV[\"USER\"]}/.dhl_info.yml\")\n else \n info = YAML.load_file(\"/home/#{ENV[\"USER\"]}/.dhl_info.yml\")\n end\n info\n end",
"def getUser( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/user\",params)\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n }\n return user\n end",
"def loadUser(userName)\n if(userName == nil)\n return nil\n end\n userFile = @CONFIG_ROOT+@CONFIG_REST_PATH+userName+\".yaml\"\n if File.exist?(userFile)\n user = YAML.load_file(userFile)\n #puts \"User: #{user}\"\n return user\n end\n return nil\n end",
"def user_info\n auth_hash['user_info']\n end",
"def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end",
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"def get_user_data(id)\n load_user_data(id)\n @user_data[@user_id]\n end",
"def get_user_info\n response = HTTParty.get(\n \"https://api.github.com/user\",\n :headers => {\n \"Authorization\" => \"Bearer #{session[:access_token]}\",\n \"User-Agent\" => \"OAuth Test App\"\n }\n )\n session[:email] = response[\"email\"]\n session[:name] = response[\"name\"]\n session[:user_image] = response[\"avatar_url\"]\n session[:provider] = \"GitHub\"\n end",
"def show\n @bb_auth_user = BbAuthUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bb_auth_user }\n end\n end",
"def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end",
"def get_user_details(token)\n uri = URI('https://api.github.com/user')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseText = ActiveSupport::JSON.decode res.body\n else\n responseText = 'Error receiving user details: ' + res.value\n end\n\n return responseText\n end",
"def load_user\n @user = User.find(params[:user_id])\n end",
"def get_all_user_data\n load_user_data(nil)\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def loginViewFetchedUserInfo( loginView, user: user )\n\t\t# here we use helper properties of FBGraphUser to dot-through to first_name and\n\t\t# id properties of the json response from the server; alternatively we could use\n\t\t# NSDictionary methods such as objectForKey to get values from the my json object\n\t\[email protected] = \"Hello #{user[ :first_name ]}!\"\n\n\t\t# setting the userID property of the FBProfilePictureView instance\n\t\t# causes the control to fetch and display the profile picture for the user\n\t\[email protected] = user[ :id ]\n\t\t@loggedInUser = user\n\tend",
"def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end",
"def load_user\n @user = User.find_by_login(params[:user_id])\n @check_ownership_of = @user\n end",
"def profile_data(uid, field)\n begin\n JSON.parse(RestClient.get construct_url(\"user/#{uid}/#{field}\"))\n rescue RestClient::BadRequest => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end \n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def getUserProfile(uid)\r\n uri = sprintf(\"/api/v1/users/%d/profile\",uid)\r\n dbg(uri)\r\n profile = $canvas.get(uri)\r\n return profile\r\nend",
"def user\n # Gets user's data\n uri = URI(\"https://api.spotify.com/v1/me\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true # This helps with the https\n request = Net::HTTP::Get.new(uri)\n request[\"authorization\"] = \"Bearer #{@data[\"access_token\"]}\"\n response = http.request(request)\n\n # Converts JSON into ruby hash\n @userData = JSON.parse(response.read_body)\n\n # Puts user country into session to be able to select the right top songs.\n @userCountry = @userData[\"country\"]\n\n # Calls on playlist method to create the playlist\n playlist\nend",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def get_me\n response = self.class.get(\"https://www.bloc.io/api/v1/users/me\", headers: { \"authorization\" => @auth_token })\n body = JSON.parse(response.body)\n end",
"def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end",
"def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end",
"def verify\n user_id = request.headers['HTTP_X_TRP_USER']\n custom_db = request.headers['X-CUSTOM-DB']\n puts \"USER ID: #{user_id}\"\n\n if custom_db\n url = URI.parse(\"http://localhost:3000/users/#{user_id}.json\")\n req = Net::HTTP::Get.new(url.path)\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req)\n }\n @output = JSON(res.body)\n puts @output\n @database = \"\"\n end\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def show()\n @authentication = Authentication.find(params[:id])\n\n if @authentication.provider == \"facebook\"\n me = FbGraph::User.me(@authentication.token).fetch\n current_user.fname = me.name.split.first\n current_user.lname = me.name.split.last\n current_user.email = me.email\n current_user.gender = me.gender\n birthday = me.birthday\n current_user.birthday = Chronic.parse(birthday) if birthday\n\n location = me.location\n current_user.location = location if location and location.is_a? String\n current_user.location = location.try(:[], :name) if location and location.is_a? Hash\n pictureurl = me.picture+'?type=large'\n begin\n tempfile = Tempfile.new(['', '.jpg'])\n open(tempfile.path, 'wb') do |file|\n file << open(URI.parse(pictureurl)).read\n end\n current_user.avatar = tempfile\n rescue\n end\n end\n\n current_user.save\n redirect_to edit_user_path\n end",
"def get_user_id(full_user_name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/users\"\n puts \"@url is #{@url}\"\n \n @payload={'search_term': full_user_name}\n puts(\"@payload is #{@payload}\")\n \n @getResponse = HTTParty.get(@url, :body => @payload.to_json, :headers => $header)\n puts(\" GET to get user has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n user_data = @getResponse.parsed_response\n user_id = nil\n\n user_data.each do |user_info|\n if user_info[\"name\"] == full_user_name\n user_id = user_info[\"id\"]\n end\n end\n\n return user_id\nend",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def user_data\n User.user_data login\n end",
"def display_users(db)\n\tputs \"First name and last name of the users.\"\n\tputs \"--------------------------------------\"\n\tname = db.execute(\"SELECT * FROM users;\")\n\tname.each do |user|\n\t\tputs \"Fisrt name: #{user['first_name']} and last name: #{user['last_name']}. #{ user['is_artist'] == 'true' ? 'This user is an artist.' : 'This user is not an artist.' }\"\n\tend\nend",
"def user_details\n\t\t@user_data = Hash.new\n\t\t@user_data[\"first_name\"] = @first_name\n\t\t@user_data[\"username\"] = @username\n\t\t@user_data[\"password\"] = @password\n\t\t@user_data[\"balance\"] = @balance\n\tend",
"def show \n user=current_user\n user={name: user.name,email: user.email ,phone: user.phone,avatar: user.avatar}\n json_response(user)\n end",
"def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end",
"def get_user(handle)\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"login\"]\n end",
"def updatedb_file_user(file)\n meta = updatedb_file_ls(file)\n if meta\n user = meta.split(\" \")[2]\n user\n else\n nil\n end\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def show\n @booking = Booking.get_user_bookings params[:id]\n @user_name = User.select(\"uname\").find(params[:id]).uname\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def update_user_from_auth(auth)\n user = self\n user.username = auth.info.nickname\n user.avatar_url = auth.info.image\n user.location = auth.extra.raw_info.city\n user.country = auth.extra.raw_info.country\n user.name = auth.info.name\n user\n end",
"def retrieve_options_from_user\n opts = {}\n\n puts \"We need your Github user id and token. Please use the following steps\\n\"\n puts ' 1. Go to Github'\n puts ' 2. Click on your user name or icon in the upper right hand corner'\n puts ' 3. Click on *Developer Settings*'\n puts ' 3. Click on *Personal Access Tokens*'\n puts ' 4. Click on *Generate new token*'\n puts ' 5. Fill out your Github password'\n puts ' 6. Fill out token description'\n puts ' 7. Select *repos*'\n puts ' 8. Click on *Generate token*'\n puts ' 9. Copy your token from the resulting page'\n puts 'This information will be saved in github.yml'\n $stdout.print 'What\\'s your github user name (e.g. willosser)? '\n opts[:user_id] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_id set to '#{opts[:user_id]}'\"\n $stdout.print 'What\\'s your github user token? '\n opts[:user_token] = $stdin.gets.rstrip\n Breadcrumbs.drop \"user_token set to '#{opts[:user_token]}'\"\n\n write_github_info(opts)\n opts\n end",
"def show\n\tuser_completed = @user.as_json(:only => [:id, :username, :login, :email, :guild_id, :otp_secret, :otp_required_for_login])\n\t\t\t\t\t\t.merge(guild: @user.guild, achievments: @user.achievments)\n\tif self.user_owner?\n \trender json: user_completed, status: :ok\n\telse\n \trender json: user_completed.except(:email, :otp_required_for_login), status: :ok\n\tend\n end",
"def dzip_user\n self.user=Zlib::Inflate.inflate(Base64.decode64 self.user)\n end",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def remote_info\n return nil unless oauth_token?\n response = api(url: '/user')\n response.data\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def load(identifier)\n user_hash = JSON.parse(redis(\"get\", \"user:session:#{identifier}\"))\n raise \"Given user is empty\" if user_hash.nil?\n\n @id = user_hash['id']\n @name = user_hash['name']\n @email = user_hash['email']\n @hash = Digest::MD5.hexdigest(user_hash['email'])\n @role = user_hash['role']\n @color = user_hash['color']\n @nsfw = user_hash['nsfw']\n end"
] | [
"0.64396983",
"0.64052385",
"0.62990063",
"0.62772024",
"0.6214347",
"0.6188702",
"0.6170385",
"0.6167212",
"0.60668814",
"0.6053577",
"0.60343385",
"0.6020621",
"0.6017606",
"0.6017606",
"0.60033715",
"0.59921306",
"0.5926278",
"0.5887276",
"0.5865386",
"0.58601135",
"0.5859452",
"0.5853844",
"0.5839176",
"0.5831235",
"0.58266336",
"0.5820811",
"0.5820811",
"0.5811116",
"0.57919693",
"0.5788699",
"0.5780327",
"0.5774519",
"0.57716906",
"0.57672554",
"0.57523406",
"0.57269424",
"0.5718477",
"0.5691237",
"0.5688452",
"0.56840205",
"0.56752384",
"0.567147",
"0.56662905",
"0.56654257",
"0.5659205",
"0.56521976",
"0.56471795",
"0.5646101",
"0.56374115",
"0.5616285",
"0.5613522",
"0.5611643",
"0.5608125",
"0.56048405",
"0.560383",
"0.558387",
"0.5583625",
"0.5579736",
"0.5579649",
"0.5579649",
"0.55586845",
"0.55508405",
"0.5548014",
"0.5548014",
"0.55435646",
"0.5539841",
"0.5538831",
"0.55384135",
"0.5536937",
"0.55356723",
"0.5523461",
"0.5519495",
"0.55175084",
"0.5514767",
"0.55144876",
"0.5512957",
"0.55124146",
"0.55091375",
"0.550746",
"0.55050397",
"0.55050147",
"0.5504406",
"0.5502049",
"0.5499463",
"0.54991835",
"0.5496082",
"0.5493539",
"0.54915637",
"0.54888827",
"0.5484127",
"0.5483492",
"0.5482639",
"0.5482207",
"0.54806596",
"0.5477768",
"0.5475093",
"0.5470405",
"0.54628956",
"0.5461856",
"0.5457526"
] | 0.7398452 | 0 |
Covers 0.10.8 and earlier | def initialize(*args)
super
@action = :save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def version_mismatch_detected\n end",
"def patch_version; end",
"def target_version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def ext; end",
"def ext; end",
"def verdi; end",
"def default_version; end",
"def def_version; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def support\n raise \"Not implemented\"\n end",
"def refutal()\n end",
"def dev_minor() end",
"def has_version?; end",
"def probers; end",
"def major_version; end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def version=(_arg0); end",
"def custom; end",
"def custom; end",
"def outdated; end",
"def ruby_version; '2.6.3' end",
"def bump_patch_version; end",
"def target_version=(_arg0); end",
"def missing; end",
"def schubert; end",
"def version\n not_implemented\n end",
"def terpene; end",
"def berlioz; end",
"def loaded_config_version; end",
"def loaded_config_version; end",
"def minor; end",
"def minor; end",
"def minor; end",
"def extra; end",
"def conscientious_require; end",
"def bump_major_version; end",
"def spec; end",
"def spec; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def user_os_complex\r\n end",
"def autorun; end",
"def minor_version; end",
"def upgrade(version)\n \n end",
"def major; end",
"def major; end",
"def major; end",
"def patch; end",
"def patch; end",
"def raise_deprecations; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def version\n 1\n end",
"def missing?; false; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end"
] | [
"0.67081916",
"0.6101657",
"0.5883818",
"0.5869871",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.5834985",
"0.58334017",
"0.58334017",
"0.58168846",
"0.5780918",
"0.5731278",
"0.5715141",
"0.5715141",
"0.5715141",
"0.5715141",
"0.5668207",
"0.5668207",
"0.5668207",
"0.5668207",
"0.56525344",
"0.56525344",
"0.56525344",
"0.55864257",
"0.5577071",
"0.5552595",
"0.5549737",
"0.55435526",
"0.550484",
"0.5489246",
"0.5489246",
"0.5489246",
"0.5489246",
"0.5489246",
"0.5452059",
"0.5452059",
"0.5444774",
"0.5439184",
"0.543158",
"0.5418529",
"0.5414723",
"0.5410375",
"0.5408119",
"0.54054475",
"0.5387529",
"0.5385009",
"0.5385009",
"0.5373696",
"0.5373696",
"0.5373696",
"0.5371461",
"0.5360951",
"0.53596526",
"0.5350876",
"0.5350876",
"0.53369695",
"0.53369695",
"0.53369695",
"0.5331661",
"0.53201383",
"0.5306842",
"0.53031474",
"0.5301219",
"0.5301219",
"0.5301219",
"0.5300189",
"0.5300189",
"0.52978635",
"0.5278949",
"0.5278949",
"0.5278949",
"0.5278949",
"0.52719283",
"0.5269705",
"0.5266478",
"0.5266478",
"0.5266478",
"0.5266478",
"0.5266478",
"0.5266478",
"0.5266478"
] | 0.0 | -1 |
GET /app_environment_credentials GET /app_environment_credentials.json def index | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_credentials\n {\n url: ENV['ONEVIEW_URL'],\n ssl_enabled: ENV['ONEVIEW_SSL_ENABLED'],\n log_level: ENV['ONEVIEW_LOG_LEVEL'] || 'info',\n api_version: ENV['ONEVIEW_API_VERSION'] || 200,\n token: ENV['ONEVIEW_TOKEN'] || nil,\n user: ENV['ONEVIEW_USER'] || nil,\n password: ENV['ONEVIEW_PASSWORD'] || nil,\n hardware_variant: ENV['ONEVIEW_HARDWARE_VARIANT'] || 'C7000'\n }\nend",
"def app_credentials\n {user: @config['mysql_app_user'], pass: @config['mysql_app_password']}\n end",
"def index\n @external_credentials = ExternalCredential.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @external_credentials }\n end\n end",
"def index\n # @credentials = Credential.all\n end",
"def credentials_show\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end",
"def set_app_environment_credential\n @app_environment_credential = AppEnvironmentCredential.find(params[:id])\n end",
"def show\n @project = @project_environment.project\n @project_credentials = @project_environment.credentials\n end",
"def fetch_credentials\n service = @application.services.find_service FILTER\n service['credentials']\n end",
"def environment_credentials(options)\n options[:type] == 'OneView' ? environment_credentials_from_oneview : environment_credentials_from_image_streamer\nend",
"def access_key\n credentials['access_key']\n end",
"def creds\n\t\tRails.application.secrets.oa_cred[provider]\n\tend",
"def index\n logger.debug(\"get secret page\")\n end",
"def credentials\n {\n client_id: client_id,\n client_secret: client_secret\n }\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def creds\n Hash[\"customer_id\" => customer_id, \"customer_secret\" => customer_secret]\n end",
"def credentials\n config.credentials.credentials\n end",
"def get_creds \n yml = YAML::load(File.open(ENV['TM_PROJECT_DIRECTORY'] + \"/config/settings.yaml\"))\n project_name = yml['project_name']\n username = yml['username']\n environment = yml['environment']\n password = KeyChain::find_internet_password(\"#{project_name}-mm\")\n endpoint = environment == \"sandbox\" ? \"https://test.salesforce.com/services/Soap/u/#{MM_API_VERSION}\" : \"https://www.salesforce.com/services/Soap/u/#{MM_API_VERSION}\"\n return { :username => username, :password => password, :endpoint => endpoint }\n end",
"def credentials\n params.values_at('username', 'password')\n end",
"def show\n render :json => @secret_key.to_json({})\n end",
"def credential\n authorizer.get_credentials('default')\n end",
"def show\n @environment = current_user.organization.environments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end",
"def credentials\n { :username => @email, :password => @password }\n end",
"def index\n @user = User.find(self.current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @credentials }\n end\n end",
"def access_token_secret\n credentials['secret']\n end",
"def credentials\n auth_hash['credentials']\n end",
"def authorized_keys\n get \"/setup/api/settings/authorized-keys\", password_hash\n end",
"def index\n @secret_keys = SecretKey.all\n end",
"def index\n # if the endpoint is the demo endpoint for checking credentials,\n # just return a straightforward success response\n if params[:endpoint] == \"demo_endpoint\"\n render json: {\"message\" => \"Success! You've made an API request with valid credentials!\"}\n else\n # If the params POSTed are not a valid combination of filters to use, i\n # the \"request\" will fail.\n request = EndpointRequest.new(@user_key, params)\n # request.failed is an error message if the filters aren't permitted for this key.\n unless request.failed\n # The 'response' will fail if there are no columns for this key for this\n # resource, or if resource name was invalid.\n response = EndpointResponse.new(@user_key, params)\n unless response.failed\n render json: JSON(response.to_hash), status: 200\n else\n # response.failed is an error message if something went wrong.\n render json: {\"message\" => response.failed }\n end\n else\n render json: {\"message\" => request.failed }\n end\n end\n end",
"def credentials\n @credentials ||= {}\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def credentials\n {\n :login => Spree::Fulfillment.config[:api_key],\n :password => Spree::Fulfillment.config[:secret_key]\n }\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_credential }\n end\n end",
"def form_credentials\n {\n username: @username,\n password: @password,\n }\n end",
"def credentials\n { :user => @user, :password => @password }\n end",
"def index\n @pluto_environment_variables = collection\n\n respond_to do |format|\n format.json { render json: @pluto_environment_variables }\n end\n end",
"def credentials\n session = Session.find_by(id: params[:id])\n if params[:userId] and user = User.find_by(id: params[:userId])\n user_id = user.id\n username = user.username\n if session_user = SessionUser.find_by(user_id: user.id, session_id: params[:id])\n role = session_user.role.to_sym\n else\n role = :publisher\n end\n else\n user_id = nil \n username = \"unknown\"\n role = :subscriber\n end\n token = @@opentok.generate_token(session.session_id, {role: role, data: user.id})\n result = {\n OTApiKey: ENV['OPENTOK_API_KEY'],\n OTSessionId: session.session_id,\n OTToken: token,\n userId: user_id,\n username: username,\n role: role\n }\n render json: result\n end",
"def authorize_application\n render json: { ok: false, message: 'unauthorized' }, status: 401 unless request.headers['App-Key'] == 'R141p7THbd5vRdH20xb5SaOsN6bJ5J5S'\n end",
"def app_environment_credential_params\n params.require(:app_environment_credential).permit(:credential_id, :app_environment_id, :encrypted_value, :text_value)\n end",
"def get_upload_credentials\n @accessKey = ENV['S3_ACCESS']\n @secretKey = ENV['S3_SECRET']\n render json: { accessKey: @accessKey, secretKey: @secretKey}\n end",
"def credentials\n []\n end",
"def credentials\n []\n end",
"def settings\n get \"/setup/api/settings\", password_hash\n end",
"def secret\n query[\"client_secret\"]\n end",
"def index\n @environments = Environment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environments }\n end\n end",
"def index\n @application_forms = ApplicationForm.where(organization_id: params['organization_id'])\n authorize @application_forms\n\n render json: @application_forms\n end",
"def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end",
"def login\n begin\n # - Creating a JSON file with the proper fields and setting the environment variable ONEVIEW_AUTH_FILE to its path\n credentials = if ENV['ONEVIEW_AUTH_FILE']\n JSON.parse(File.read(File.absolute_path(ENV['ONEVIEW_AUTH_FILE'])), symbolize_names: true)\n # - Declaring each field as an environment variable\n elsif ENV['ONEVIEW_URL']\n environment_credentials\n # - Placing a JSON file in the directory you are running the manifests from\n else\n JSON.parse(File.read(File.expand_path(Dir.pwd + '/login.json', __FILE__)), symbolize_names: true)\n end\n rescue\n raise('The Oneview credentials could not be set. Please check the documentation for more information.')\n end\n credentials_parse(credentials)\nend",
"def show\n authorize @application_form\n render json: @application_form\n end",
"def get_upload_credentials\n @accessKey = ENV['S3_ACCESS']\n @secretKey = ENV['S3_SECRET']\n render json: { accessKey: @accessKey, secretKey: @secretKey }\n end",
"def get_upload_credentials\n @accessKey = ENV['S3_ACCESS']\n @secretKey = ENV['S3_SECRET']\n render json: { accessKey: @accessKey, secretKey: @secretKey }\n end",
"def index\n @secrets = Secret.where(user_id: current_user.id)\n end",
"def get_rest_authentication()\n reader = CSV.open('keys/sf_key.csv')\n client_id = reader.shift[0]\n client_secret = reader.shift[0]\n username = reader.shift[0]\n password = reader.shift[0]\n auth_payload = \"grant_type=password&client_id=#{client_id}\" \\\n \"&client_secret=#{client_secret}\" \\\n \"&username=#{username}&password=#{password}\"\n params = {:accept => 'application/json'}\n @auth_response = RestClient.post $oauth_token_endpoint, auth_payload, params\n auth_json = JSON.parse(@auth_response)\n auth_vals = {\"access_token\" => auth_json[\"access_token\"],\n \"instance_url\" => auth_json[\"instance_url\"]}\n end",
"def credentials\n {\n \"username\" => self.username,\n \"password\" => self.password\n }\n end",
"def index\n @credential_keys = CredentialKey.all\n end",
"def read_credentials\n {\n consumer_key: SiteSetting.lti_consumer_key,\n consumer_secret: SiteSetting.lti_consumer_secret\n }\n end",
"def bc_client_secret\n ENV['BC_CLIENT_SECRET']\nend",
"def credential\n authorizer.get_credentials('default')\n end",
"def show\n get_context!\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deploy_heroku_api_key }\n end\n end",
"def verify_credentials\n get('/account/verify_credentials.json')\n end",
"def environments(host, port)\n uri = URI::HTTP.build(host: host, port: port, path: '/environments')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.get(uri.path, \"Accept\" => \"application/json\")\n end",
"def access_key_id\n credentials['access_key']\n end",
"def login\n options = {\n type: 'OneView',\n file_env_var: 'ONEVIEW_AUTH_FILE',\n env_var_url: 'ONEVIEW_URL',\n filename: '/login.json'\n }\n credentials = load_authentication_settings(options)\n credentials[:hardware_variant] ||= 'C7000'\n credentials[:hardware_variant] = credentials[:hardware_variant].to_s.capitalize\n credentials\nend",
"def get_evn_api_key\r\n\t\t#binding.pry\r\n\t\tsession[:user] = nil\r\n if request.headers[\"ENVAPIKEY\"] && request.headers[\"ENVAPIKEY\"] == APP_CONFIG['API_Key'] \r\n \tparams[:env_api_key] = request.headers[\"ENVAPIKEY\"]\r\n \telse \r\n\t \ttoken_error\r\n \tend\r\n\tend",
"def client_secret; end",
"def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end",
"def user_credentials\n {\n :VERSION => ENV['PP_VERSION'],\n :USER => ENV['PP_USER'],\n :PWD => ENV['PP_PWD'],\n :SIGNATURE => ENV['PP_SIGNATURE']\n }\n end",
"def env_key; end",
"def read_credentials\n conf = self.configuration\n return nil unless conf[:credentials]\n return [conf[:credentials][:access_key], conf[:credentials][:secret_key]]\n end",
"def read_credentials\n conf = self.configuration\n return nil unless conf[:credentials]\n return [conf[:credentials][:access_key], conf[:credentials][:secret_key]]\n end",
"def amf_credentials\n if RequestStore.rails_authentication == nil\n return {}\n end\n return RequestStore.rails_authentication\n end",
"def credentials(app_name=nil)\n #bound_app is the name of an app bound to the dat-service and that credentials\n #should be used to access the data-service.\n #for example if an app creates large objects you will need to use\n #the credentials of that app to find the objects.\n app_name ||= @wrapped['director']['bound_app'] if @wrapped['director']\n @credentials ||= VMC::KNIFE.get_credentials(name(), app_name)\n @credentials\n end",
"def credentials\n authenticating_with_api? ? {:api_key => api_key} : super\n end",
"def index\n @roles = Role.all\n @credentials = Credential.all\n end",
"def index\n render json: current_user.api_keys.api.active, status: 200\n end",
"def credentials\n {\n marketplace_id: MWS_MARKETPLACE_ID,\n merchant_id: ENV['MWS_MERCHANT_ID'],\n aws_access_key_id: ENV['MWS_ACCESS_KEY'],\n aws_secret_access_key: ENV['MWS_SECRET_KEY'],\n }\n end",
"def client_secret\n ENV['AZURE_CLIENT_SECRET']\n end",
"def well_known\n render json: {\n authorization_endpoint: \"#{root_url}oauth/authorize\",\n token_endpoint: \"#{root_url}oauth/token\",\n introspection_endpoint: \"#{root_url}oauth/introspect\",\n revocation_endpoint: \"#{root_url}oauth/revoke\",\n scopes_supported: ['user/*.read', 'user/*.write', 'user/*.*'],\n capabilities: ['launch-standalone']\n }\n end",
"def aws_credentials\n {}\n end",
"def client_id_secret\n {\n client_id: ENV['CLIENT_ID'], \n client_secret: ENV['CLIENT_SECRET'], \n }\n end",
"def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"def app_params\n params.require(:app).permit(:key, :identifier, :environment, :password, :certificate, :sandbox)\n end",
"def index\n email = AuthenticationHelper::Auth.instance.getEmailFromJWT( request )\n if ( email == nil )\n render json: :nothing, status: :unprocessable_entity\n return\n end\n\n user = User.find_by(email: email)\n if ( user )\n accounts = Account.where(user_id: user[\"id\"])\n render json: accounts, status: :ok\n else\n render json: :nothing, status: :unprocessable_entity\n end\n end",
"def list_key_credentials_for_application(app_id, options = {})\n get(\"/apps/#{app_id}/credentials/keys\", options)\n end",
"def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend",
"def index\n unless access_token\n redirect_to controller: 'oauths', action: 'welcome'\n return\n end\n \n @drivers = [:chrome, :ff, :ie, :safari]\n @scenarios = Scenario.where(user_id: current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scenarios }\n end\n end",
"def index\n @environments = Environment.all\n end",
"def index\n\t\tredirect_to oauth_applications_path\n\tend",
"def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end",
"def index\n @secrets = Secret.all\n end",
"def index\n @secrets = Secret.all\n end",
"def show\n allow :get\n expires_in 60.seconds\n\n items = @environments.find(params[:id], params)\n if items.empty?\n raise NotFound, \"Cannot find environment #{params[:id]}\"\n end\n\n # There should be only one result for a uid (name + submission date)\n item = items.first\n item['links'] ||= links_for_item(item)\n\n render_result(item)\n end",
"def credentials_file\n dir['credentials']\n end",
"def secret\n @options[:credential2]\n end",
"def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end",
"def settings\n get('/account/settings.json')\n end"
] | [
"0.6691507",
"0.6611046",
"0.64386696",
"0.638843",
"0.62616646",
"0.62159",
"0.6132317",
"0.61314076",
"0.61109257",
"0.60936415",
"0.60778624",
"0.6034152",
"0.603328",
"0.60293156",
"0.60293156",
"0.60202426",
"0.60202426",
"0.60202426",
"0.60202426",
"0.60202426",
"0.60032994",
"0.59926873",
"0.5978217",
"0.59675556",
"0.5959695",
"0.59523416",
"0.59508383",
"0.5934223",
"0.5931368",
"0.5930144",
"0.5921626",
"0.5915111",
"0.5906736",
"0.5904874",
"0.5886749",
"0.5874162",
"0.5848587",
"0.5837838",
"0.58373886",
"0.58355075",
"0.58334243",
"0.58065885",
"0.580281",
"0.5786144",
"0.57734555",
"0.57582164",
"0.57582164",
"0.573387",
"0.57320553",
"0.5731072",
"0.572861",
"0.5727943",
"0.571721",
"0.5716591",
"0.56978476",
"0.56978476",
"0.5696225",
"0.5695849",
"0.56902885",
"0.5689767",
"0.5680492",
"0.5643531",
"0.5637615",
"0.56324047",
"0.5627868",
"0.562562",
"0.5624796",
"0.5614805",
"0.5612823",
"0.5604051",
"0.5600137",
"0.55994254",
"0.5598473",
"0.5596479",
"0.5596479",
"0.5592715",
"0.5592201",
"0.5590592",
"0.5585123",
"0.5572508",
"0.5559066",
"0.55556774",
"0.55493754",
"0.5545505",
"0.5533145",
"0.5531588",
"0.5530256",
"0.5526479",
"0.55259484",
"0.55244434",
"0.5519183",
"0.5488083",
"0.54813534",
"0.5479798",
"0.54770833",
"0.54770833",
"0.5474489",
"0.54679394",
"0.5466926",
"0.5465915",
"0.5462289"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_app_environment_credential
@app_environment_credential = AppEnvironmentCredential.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def around_hooks; end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516",
"0.5311442",
"0.52963835",
"0.52955836",
"0.5295297",
"0.5258503",
"0.52442217",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5235414",
"0.5234908",
"0.5230927",
"0.52263695",
"0.5222485",
"0.5216462",
"0.52128595",
"0.52070963",
"0.520529",
"0.517586",
"0.5174021",
"0.5172379",
"0.5165636",
"0.5161574",
"0.51556087",
"0.5153217",
"0.5152898",
"0.5151238",
"0.5144674",
"0.51387095",
"0.51342636",
"0.5113545",
"0.51131564",
"0.51131564",
"0.5107665",
"0.5107052",
"0.50908124",
"0.5089785",
"0.50814754",
"0.50807786",
"0.5064482",
"0.5053022",
"0.50526255",
"0.5050246",
"0.5050246",
"0.50329554",
"0.5023997",
"0.5021236",
"0.5014815",
"0.5014393",
"0.4999298",
"0.49990913",
"0.4997733",
"0.49884573",
"0.49884573",
"0.49840933",
"0.49786162",
"0.49784446",
"0.49782816",
"0.49659815",
"0.49655175",
"0.4956222",
"0.49543875",
"0.49536037",
"0.495265",
"0.4951427",
"0.49438462",
"0.49436793",
"0.49335384",
"0.49321616",
"0.49264926",
"0.49247074",
"0.49246994",
"0.49226475",
"0.49194494",
"0.49152806",
"0.49149707",
"0.49149227",
"0.49144953",
"0.49141943"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def app_environment_credential_params
params.require(:app_environment_credential).permit(:credential_id, :app_environment_id, :encrypted_value, :text_value)
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 |
Login account actions. The ! methods are 'just get the job done'. It's true, they do some testing of their own thus unDRY'ing tests that do and should live in the user account stories but the repetition is ultimately important so that a faulty test setup fails early. | def log_out
get '/sessions/destroy'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n make_login_call\n end",
"def login; end",
"def action_login!()\n @action = TAC_PLUS_AUTHEN_LOGIN\n\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n\n end",
"def login\n\n end",
"def should_check_for_login(*actions)\n actions.each do |action|\n context \"on not being logged in for #{action} action\" do\n should \"redirect to login\" do\n post action, nil, nil\n assert_redirected_to introduction_url, \"should have been taken to login\"\n assert_flash \"Please log in to continue!\", :notice\n end\n end\n end\n end",
"def login_helper\n username = prompt.ask(\"Enter Username\")\n password = prompt.ask(\"Enter Password\")\n if User.find_by(name: username, password: password)\n self.user = User.find_by(name: username, password: password)\n # no music yet\n puts \"Let's Get Cookin, #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n else\n puts \"Incorrect Username or Password\"\n sleep(1.5)\n login_page\n end\n end",
"def account_login\n #Grab username from user. \"Find or Create\" based on input.\n username_input = @prompt.ask(\"Enter Username, or exit.\")\n @user = User.find_by(username: username_input)\n if username_input == \"quit\" || username_input == \"exit\"\n login_menu_display\n elsif !@user\n puts \"Please try again\"\n account_login\n else\n password_request\n end\n end",
"def test_login\n get \"my/page\"\n assert_redirected_to \"account/login\"\n log_user('jsmith', 'jsmith')\n \n get \"my/account\"\n assert_response :success\n assert_template \"my/account\" \n end",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Log into Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Log into Razoo ****************\"\t\nend",
"def login(login = users(:zero_user).login, password = \"testpassword\",\n remember_me = true, session: self)\n login = login.login if login.is_a?(User) # get the right user field\n session.visit(\"/account/login/new\")\n\n session.within(\"#account_login_form\") do\n session.fill_in(\"user_login\", with: login)\n session.fill_in(\"user_password\", with: password)\n session.check(\"user_remember_me\") if remember_me == true\n\n session.first(:button, type: \"submit\").click\n end\n end",
"def login_as_testuser\n login '[email protected]', 'TestPass'\n end",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def test_second_try\n admin = users(:olm_admin_1)\n post :login, :user_login => \"afds\", :user_password => \"lala\"\n assert_equal I18n.t(:login_failed), flash[:login_notice]\n\n post :login, :user_login => admin.user_name, :user_password => \"lala\"\n assert_redirected_to :action => \"index\"\n assert_equal admin.id, session[:uid]\n end",
"def login_test_user\n unless TestChamber::Config[:tc_no_login]\n dash = TestChamber::Dashboard.new\n dash.login\n end\nend",
"def test_correct_login\n admin = users(:olm_admin_1)\n post :login, :user_login => admin.user_name, :user_password => 'asfd'\n # on successful logins there shouldn't be a :login_notice\n # in the flash\n assert_equal nil, flash[:login_notice]\n assert_redirected_to :action => \"index\"\n assert_equal admin.id, session[:uid]\n assert_not_nil session[:timeout]\n end",
"def login\n\tend",
"def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end",
"def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end",
"def login_logout\n if @logged\n puts \"Competitor #{@id} is going to log out\"\n @browser.invoke_action(@kernel.resources.controllers.people.logout)\n raise \"Logout action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = false\n else\n puts \"Competitor #{@id} is going to log in\"\n @browser.invoke_action(\n @kernel.resources.controllers.people.login, \n user_tuple(@id, false).keep(:mail, :password)\n )\n raise \"Login action failed\" unless @browser.last_action_result == [\"success\", \"ok\"]\n @logged = true\n end\n end",
"def check_login\n if !check_authentication\n redirect_to controller: \"account\", action: \"login\"\n end\n end",
"def login_account(username, password)\n login_form.email_txt.set username\n login_form.password_txt.set password\n login_form.login_btn.click\n end",
"def test_B_Homepage_with_Login\r\n p 'Started - Homepage with login case'\r\n # To change this template use File | Settings | File Templates.\r\n #fail('Not implemented')\r\n @driver.get(@base_url)\r\n login = @driver.find_element(:link_text => 'LOG IN').text\r\n assert_equal(login, 'LOG IN'.encode('UTF-8'))\r\n\r\n @driver.find_element(:id => 'UserName').send_key('0001')\r\n @driver.find_element(:id => 'Password').send_key('LE0001')\r\n @driver.find_element(:id => 'btnLogin').click\r\n @id_number = /[1-9][0-9]*/\r\n # Is My Account link showing ? (logged in)\r\n if element_present?(:id, 'ctl00_ctl00_ctl37_ctlLoginView_lnkMyAccount')\r\n myaccount_link = @driver.find_element(:id => 'ctl00_ctl00_ctl37_ctlLoginView_lnkMyAccount')\r\n myname = @driver.find_element(:id => 'ctl00_ctl00_ctl37_ctlLoginView_lblLogonUser').text\r\n logon_panel = @driver.find_element(:id => 'logonbox-panel').displayed?\r\n logon_name = @driver.find_element(:id => 'lblLogonUser').text\r\n assert_not_nil(myaccount_link)\r\n verify { assert_equal(myname, 'MR. NUTTAPON PICHETPONGSA'.encode('UTF-8'), 'You are already logged on but you are not Nuttapon') }\r\n assert_equal(logon_name, myname, 'Name on My Account Link and My Account Page are not Equal')\r\n assert(logon_panel)\r\n else\r\n fail('My account link does not present')\r\n end\r\n p 'Ended - Homepage with login case\\n'\r\n\r\n end",
"def test05_ValidLogin_TC_24862\n\t\t$browser.cookies.clear\n\t\t$browser.goto($patch_login)\n\t\t$email.set(\"#{$user_master_email}\")\n\t\t$password.set(\"#{$user_master_password}\")\n\t\t$sign_in_button.click\n\t\tsleep 4\n\t\t\n\t\tbegin \n\t\t\tassert $logged_in_avatar.exists?\n\t\t\trescue => e\n\t\t\tputs e\n\t\t\tputs \"LS2T2: FAILED! User not logged in.\"\n\t\tend\t\n\tend",
"def login\n validate_arguments!\n\n Turbot::Auth.login\n display \"Authentication successful.\"\n end",
"def login_instructions\n end",
"def login(options={})\n options = resolve_delayed_fixtures(options)\n\n user = options[user_symbol]\n login = options.fetch(:login, user ? user.login : \"test_#{user_symbol.to_s}\")\n password = options.fetch(:password, 'test')\n starting_url = options.fetch(:starting_url, '/')\n\n with_controller(SessionsController) do\n post :create, {:login => login, :password => password}\n assert_redirected_to starting_url\n end\n end",
"def login!(user, *args)\n login(user, *args)\n assert_flash(/success/i)\n user = User.find_by_login(user) if user.is_a?(String)\n assert_users_equal(user, assigns(:user), \"Wrong user ended up logged in!\")\n end",
"def more_login\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n end",
"def simultaneous_login!\n redirect_to root_path if current_admin && current_account\n end",
"def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end",
"def test_action_security\n # A public action\n get '/goldberg/auth/login'\n assert_response :success\n # An administrator action\n get '/goldberg/users/list'\n assert_redirected_to_login\n\n form_login('admin', 'admin')\n\n get '/goldberg/users/list'\n assert_response :success\n end",
"def login(username, password)\n steps %Q{\n Given I am not logged in\n And I go to the login page\n And I fill in \"Username\" with \"#{username}\"\n And I fill in \"Password\" with \"#{password}\"\n And I press \"Submit\"\n }\n @current_user = User.find_by_username(username)\nend",
"def test_login\n get \"my/page\"\n assert_redirected_to \"/login?back_url=http%3A%2F%2Fwww.example.com%2Fmy%2Fpage\"\n log_user('jsmith', 'jsmith')\n\n get \"my/account\"\n assert_response :success\n assert_template \"my/account\"\n end",
"def login\n self.login\n end",
"def test_redirect_logged_in\n # log in\n admin = users(:olm_admin_1)\n post :login, :user_login => admin.user_name, :user_password => 'asfd'\n assert_redirected_to :action => \"index\"\n\n # try to go to login page when logged in\n get :login\n assert_redirected_to :action => \"index\"\n end",
"def login(username, pwd)\n # we don't really need the @login_token. If login fails, an exception will be thrown\n @login_token = @jira.login(username, pwd)\n puts \"Logged in user #{username} to Jira with access token #{@login_token}\" if @dry_run\n @login_token\n end",
"def login_user\n visit landing_page_path\n click_on 'Login'\n fill_in 'Email', with: users(:tony).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def login_for_test\n user = User.find params[:id]\n sign_in(user)\n render :text => \"OK\"\n end",
"def setup\n login_user\n end",
"def login\n abakus_config = YAML.load(File.open(\"./config/_abakus_account.yaml\"))\n username = abakus_config['app']['username']\n password = abakus_config['app']['password']\n \n login_page = @agent.get(\"https://abakus.no/user/login/\")\n login_form = login_page.form_with(:action => \"/user/login/\")\n login_form.username = username\n login_form.password = password\n login_form.submit\n end",
"def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n end",
"def test_login_with_correct_creds\n @driver.get(@base_url + \"/\")\n @driver.find_element(:id, \"email\").clear\n @driver.find_element(:id, \"email\").send_keys users(:laxmi)[\"email\"]\n @driver.find_element(:id, \"password\").clear\n @driver.find_element(:id, \"password\").send_keys users(:laxmi)[\"password\"] \n @driver.find_element(:name, \"commit\").click\n #assert_equal \"Signed in!\", @driver.find_element(:xpath, \"//div[class='flash-message success']/div[2]\").text\n logout\n end",
"def login_as(email, password)\n click_link \"Log in\"\n fill_in 'Email', with: email\n fill_in 'Password', with: password\n click_button 'Log in'\n end",
"def login\n return redirect_to '/' if current_account && current_account.refresh_credentials(cookies) && !current_account.reviewer? && current_account.active?\n\n return render layout: 'new' unless request.post?\n next_url = (params[:next] && CGI.unescape(params[:next])) || '/'\n account = Account.log_in(params[:email], params[:password], session, cookies)\n return redirect_to(next_url) if account && account.active?\n if account && !account.active?\n flash[:error] = \"Your account has been disabled. Contact [email protected].\"\n else\n flash[:error] = \"Invalid email or password.\"\n end\n begin\n if referrer = request.env[\"HTTP_REFERER\"]\n redirect_to referrer.sub(/^http:/, 'https:')\n end\n rescue RedirectBackError => e\n return render layout: 'new'\n end\n end",
"def test_private_method_actually_logging_in\n test_private_method\n login :index, 'ferret', 'REVOLUTION'\n assert_response :success\n login :index, 'ferret', 'WRONGPASSWORD'\n assert_protected\n end",
"def login_clark\n top_login_button.click\n login_page.text\n \n user_email.send_keys($test_data['prod_email'])\n user_password.send_keys($test_data['prod_password'])\n\n login_button.click\n sleep 3\n profile_displayed\n end",
"def login\n return redirect_to '/' if current_account && current_account.refresh_credentials(cookies) && !current_account.reviewer? && current_account.active?\n return render unless request.post?\n next_url = (params[:next] && CGI.unescape(params[:next])) || '/'\n account = Account.log_in(params[:email], params[:password], session, cookies)\n return redirect_to(next_url) if account && account.active?\n if account && !account.active?\n flash[:error] = \"Your account has been disabled. Contact [email protected].\"\n else\n flash[:error] = \"Invalid email or password.\"\n end\n begin\n if referrer = request.env[\"HTTP_REFERER\"]\n redirect_to referrer.sub(/^http:/, 'https:')\n end\n rescue RedirectBackError => e\n # Render...\n end\n end",
"def log_in_with(email, password)\n click_on \"Log In\"\n fill_in :email, with: email\n fill_in :password, with: password\n click_on \"Finish\"\n end",
"def test_A_Homepage_without_Login\r\n p 'Started - Homepage without login case'\r\n # To change this template use File | Settings | File Templates.\r\n #fail('Not implemented')\r\n @driver.get(@base_url)\r\n login = @driver.find_element(:link_text => 'LOG IN').text\r\n assert_equal(login, 'LOG IN'.encode('UTF-8'))\r\n username_field = @driver.find_element(:id => 'UserName')\r\n password_field = @driver.find_element(:id => 'Password')\r\n # Check if there are username and password fields, this mean the user has not logged in yet\r\n assert_not_nil(username_field)\r\n assert_not_nil(password_field)\r\n p 'Ended - Homepage without log in case\\n'\r\n end",
"def login\n puts \"Login successfull\"\n end",
"def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end",
"def login\n @current_user = nil\n system 'clear'\n puts \"--------LOGIN--------\"\n username = @prompt.ask(\"Username: \", required: true)\n if User.all.map(&:name).include?(username)\n @current_user = User.all.find{|user_instance| user_instance.name == username}\n if password\n main_menu\n end\n else\n if @prompt.yes?(\"There is no user by this name. Would you like to create an account?\")\n create_account\n end\n end\n end",
"def action_login?()\n return true if (@action == TAC_PLUS_AUTHEN_LOGIN)\n return false\n end",
"def login\n\t\tnavigate(@login_path)\n\n\t\tlogin_form = find_by_xpath(@signin_xpath)\n\t\tlogin_field = find_by_id('login_field')\n\t\tpassword_field = find_by_id('password')\n\n\t\tlogin_field.send_keys(@username); sleep 1\n\t\tpassword_field.send_keys(@password); sleep 1\n\n\t\tlogin_form.click; sleep 15\n\tend",
"def assert_access_without_login(*actions)\n\t\t\tuser_options = actions.extract_options!\n\n\t\t\toptions = {}\n\t\t\tif ( self.constants.include?(:ASSERT_ACCESS_OPTIONS) )\n\t\t\t\toptions.merge!(self::ASSERT_ACCESS_OPTIONS)\n#\t\t\telsif ( self.constants.include?('ASSERT_ACCESS_OPTIONS') )\n#\t\t\t\toptions.merge!(self::ASSERT_ACCESS_OPTIONS)\n\t\t\tend\n\t\t\toptions.merge!(user_options)\n\t\t\tactions += options[:actions]||[]\n\n\t\t\tm_key = options[:model].try(:underscore).try(:to_sym)\n\n\t\t\ttest \"#{brand}AWoL should get new without login\" do\n\t\t\t\tget :new\n\t\t\t\tassert_response :success\n\t\t\t\tassert_template 'new'\n\t\t\t\tassert assigns(m_key), \"#{m_key} was not assigned.\"\n\t\t\t\tassert_nil flash[:error], \"flash[:error] was not nil\"\n\t\t\tend if actions.include?(:new) || options.keys.include?(:new)\n\n\t\t\ttest \"#{brand}AWoL should post create without login\" do\n\t\t\t\targs = if options[:create]\n\t\t\t\t\toptions[:create]\n\t\t\t\telsif options[:attributes_for_create]\n\t\t\t\t\t{m_key => send(options[:attributes_for_create])}\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\t\tassert_difference(\"#{options[:model]}.count\",1) do\n\t\t\t\t\tsend(:post,:create,args)\n\t\t\t\tend\n\t\t\t\tassert_response :redirect\n\t\t\t\tassert_nil flash[:error], \"flash[:error] was not nil\"\n\t\t\tend if actions.include?(:create) || options.keys.include?(:create)\n\n#\t\t\ttest \"should NOT get edit without login\" do\n#\t\t\t\targs=[]\n#\t\t\t\tif options[:factory]\n#\t\t\t\t\tobj = Factory(options[:factory])\n#\t\t\t\t\targs.push(:id => obj.id)\n#\t\t\t\tend\n#\t\t\t\tsend(:get,:edit, *args)\n#\t\t\t\tassert_redirected_to_login\n#\t\t\tend if actions.include?(:edit) || options.keys.include?(:edit)\n#\n#\t\t\ttest \"should NOT put update without login\" do\n#\t\t\t\targs={}\n#\t\t\t\tif options[:factory]\n#\t\t\t\t\tobj = Factory(options[:factory])\n#\t\t\t\t\targs[:id] = obj.id\n#\t\t\t\t\targs[options[:factory]] = Factory.attributes_for(options[:factory])\n#\t\t\t\tend\n#\t\t\t\tsend(:put,:update, args)\n#\t\t\t\tassert_redirected_to_login\n#\t\t\tend if actions.include?(:update) || options.keys.include?(:update)\n\n\t\t\ttest \"#{brand}AWoL should get show without login\" do\n\t\t\t\targs={}\n\t\t\t\tif options[:method_for_create]\n\t\t\t\t\tobj = send(options[:method_for_create])\n\t\t\t\t\targs[:id] = obj.id\n\t\t\t\tend\n\t\t\t\tsend(:get,:show, args)\n\t\t\t\tassert_response :success\n\t\t\t\tassert_template 'show'\n\t\t\t\tassert assigns(m_key), \"#{m_key} was not assigned.\"\n\t\t\t\tassert_nil flash[:error], \"flash[:error] was not nil\"\n\t\t\tend if actions.include?(:show) || options.keys.include?(:show)\n\n#\t\t\ttest \"should NOT delete destroy without login\" do\n#\t\t\t\targs=[]\n#\t\t\t\tif options[:factory]\n#\t\t\t\t\tobj = Factory(options[:factory])\n#\t\t\t\t\targs.push(:id => obj.id)\n#\t\t\t\tend\n#\t\t\t\tassert_no_difference(\"#{options[:model]}.count\") do\n#\t\t\t\t\tsend(:delete,:destroy,*args)\n#\t\t\t\tend\n#\t\t\t\tassert_redirected_to_login\n#\t\t\tend if actions.include?(:destroy) || options.keys.include?(:destroy)\n#\n#\t\t\ttest \"should NOT get index without login\" do\n#\t\t\t\tget :index\n#\t\t\t\tassert_redirected_to_login\n#\t\t\tend if actions.include?(:index) || options.keys.include?(:index)\n\n\t\t\ttest \"#{brand}should get index without login\" do\n\t\t\t\tget :index\n\t\t\t\tassert_response :success\n\t\t\t\tassert_template 'index'\n\t\t\t\tassert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),\n\t\t\t\t\t\"#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned.\"\n\t\t\t\tassert_nil flash[:error], \"flash[:error] was not nil\"\n\t\t\tend if actions.include?(:index) || options.keys.include?(:index)\n\n\t\t\ttest \"#{brand}should get index without login and items\" do\n\t\t\t\tsend(options[:before]) if !options[:before].blank?\n\t\t\t\t3.times{ send(options[:method_for_create]) } if !options[:method_for_create].blank?\n\t\t\t\tget :index\n\t\t\t\tassert_response :success\n\t\t\t\tassert_template 'index'\n\t\t\t\tassert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),\n\t\t\t\t\t\"#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned.\"\n\t\t\t\tassert_nil flash[:error], \"flash[:error] was not nil\"\n\t\t\tend if actions.include?(:index) || options.keys.include?(:index)\n\n\t\tend",
"def demo_login\n if demo_mode?\n @user = User.find(params[:id])\n if UserSession.login(@user)\n record_action!(:demo_login, current_user)\n redirect_to after_login_url\n else\n render :action => :new\n end\n end\n end",
"def test_12_login_while_donating()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 12 ----------------------\"\n\t\tsearchOrg($new_orgname)\n\t\tgotoDonFormClickLogin($donation_amount, $normal2_emailId, $normal2_password)\n\t\tdonateUsingNewCard($donation_amount, $normal2_nameoncard, $street, $state, \n\t\t\t\t\t $city, $pin_code, $mastercard_number, $mastercard_seccode, $normal2don_emailId)\n\t\tpostComments(\"Give and be Blessed!!\")\n\t\tcheckMydonation($donation_amount)\n\t\tputs \"---------------------- END OF SCENARIO 12 --------------------------\"\n\tend",
"def login(username, password)\n raise AssertionError, \"You're already logged in\" if browser.link(href: '/logout').present?\n change_endpoint(:login)\n username_field = browser.text_field(id: 'username')\n update_action_log(:text_field, !username_field.nil? && username_field.present?)\n username_field.set(username)\n update_action_log(:set_text, username_field.value == username)\n\n browser.text_field(id: 'password').set(password)\n input_button = browser.input(type: 'submit')\n update_action_log(:input, !input_button.nil? && input_button.present?)\n\n input_button.click\n sleep 2\n update_action_log(:submit_login, browser.link(href: '/logout').present?)\n update_action_log(\n :link,\n browser.link(href: '/logout').present? || browser.link(href: '/login').present?\n )\n browser.link(href: '/logout').present?\n end",
"def test_login_controls\n get :login_controls\n assert_response :success\n assert_nil session[:user]\n end",
"def login_user_controller(login, password, good_login = true)\r\n post :login, :user => {:login => login, :password => password}\r\n if good_login\r\n assert_no_errors\r\n assert_not_nil(session[:user], \"Username '#{login}' or password '#{password}' was bad\")\r\n user = User.find_by_login(login)\r\n assert session[:user][:id] , user.id\r\n assert_equal login, user.login, \"Login name '#{login}' should match session name '#{user.login}'\"\r\n assert_redirected_to_welcome\r\n else\r\n assert_msg_notice('Login unsuccessful')\r\n assert_msg_error('Not authorized') \r\n assert_nil(session[:user], \"Login '#{login}' with password '#{password}' succeeded but it should have failed\")\r\n end \r\n end",
"def test_valid_login\n login_user = Login.authenticate(\"gordon\", \"wibble\")\n assert login_user == @login\n end",
"def login_without_usr_psd\n click_login_btn\nend",
"def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end",
"def login\n # puts \"UserNAme #{username}.\"\n self.login_username_element.when_present(30)\n # expect(self.login_username?).to be_truthy\n self.login_username= DT['ENV']['Username']\n self.login_password= DT['ENV']['Password']\n self.login_login\n end",
"def login(name='user', password='super')\r\n post:login, :user=>{:username=>name, :password=>password}\r\n assert_redirected_to :action =>'index'\r\n assert_not_nil(session[:user])\r\n user = User.find(session[:user].id)\r\n assert_equal 'super', user.username\r\n end",
"def test_blank_login_and_pwd\n get :login\n post :login, :user_login => \"\", :user_password => \"\"\n assert_not_equal \"\", flash[:login_notice]\n end",
"def test_auth_only_actually_logging_in\n test_auth_only\n login :secret_ferret_brigade, 'ferret', 'REVOLUTION'\n assert_response :success\n login :secret_ferret_brigade, 'ferret', 'WRONGPASSWORD'\n assert_protected\n end",
"def test_logged_in_user_access_to_userland_approved\n # first log in\n post '/login', { :username => GOOD_USERNAME, :password => GOOD_PASSWORD }\n\n # then specifically request the index page in userland\n get '/in/index'\n assert last_response.ok?\n assert last_response.body.include?('You are logged in as') \n assert last_response.body.include?(GOOD_USERNAME) \n end",
"def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end",
"def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end",
"def default_login\n login(\"[email protected]\",\"codetheoryio\")\n end",
"def login_required\n call(Rs(:login)) unless logged_in?\n end",
"def login_page\n end",
"def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\tsleep 10\n\t#***************** Link position check *****************#\n\t@loginlink_topposition = @browser.get_element_position_top \"link=Log in\"\n\tputs \"Login link Top position : #{@loginlink_topposition}\"\n\tif @loginlink_topposition == '44'\n\t\tputs \"UI Check : Pass. Login link is present at the correct position in Home screen.\"\n\telse\n\t\tputs \"UI Check : Fail. Login link is not present at the correct position in Home screen.\"\n\tend\n\[email protected] \"link=Log in\"\n\[email protected]_for_page_to_load \n\tsleep 5\n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\[email protected] \"user_session_email\", email_id \n\[email protected] \"user_session_password\", pass_word\n\t#***************** Button position check *****************#\n\t@loginbutton_topposition = @browser.get_element_position_top \"//button[@type='submit']\"\n\tputs \"Login button Top position : #{@loginbutton_topposition}\"\n\tif @loginbutton_topposition == '488'\n\t\tputs \"UI Check : Pass. Login button is present at the correct position in Login screen.\"\n\telse\n\t\tputs \"UI Check : Fail. Login button is not present at the correct position in Login screen.\"\n\tend\n\[email protected] \"//button[@type='submit']\"\n\[email protected]_for_page_to_load \n\tbegin\n\t\tassert @browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend",
"def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend",
"def test_login_test_case_2\n\n\t\t# Initialize logger\n\t\tpath = File.dirname(__FILE__)\n\t\tlog_name = \"login_test_case_2\"\n\t\tfile = File.open(path + \"/logs/\" + log_name + \".log\", File::WRONLY | File::APPEND | File::CREAT)\n\t\tlogger = Logger.new(file)\n\n\t\t# Logs start of testing\n\t\tlogger.info(\":::: START TESTING \" + log_name)\n\n\t\t# Step 1: Open browser\n\t\tlogger.info(\"Step 1: Open browser\")\n\t\tb = Watir::Browser.new :ff\n\n\t\t# Step 2: Go to 'https://www.groupjump.com'\n\t\tlogger.info(\"Step 2: Go to 'https://www.groupjump.com'\")\n\t\tb.goto(\"https://www.groupjump.com\")\n\n\t\tjson = File.read(\"data/login_users.json\")\n\t\tusers = JSON.parse(json)\n\t\texisting_users = users[\"existing_users\"]\n\t\t\n\t\texisting_users.each do |user|\n\t\t\t# Step 3: Click 'Login' link\n\t\t\tlogger.info(\"Step 3: Click 'Login' link\")\n\t\t\tb.link(:href => \"/login\").click\n\n\t\t\t# Step 4: Enter email address\n\t\t\tlogger.info(\"Step 4: Enter email address\")\n\t\t\tb.text_field(:id => \"email\").set(user[\"email\"])\n\n\t\t\t# Step 5: Enter password\n\t\t\tlogger.info(\"Step 5: Enter password\")\n\t\t\tb.text_field(:id => \"password\").set(user[\"password\"])\n\n\t\t\t# Step 6: Click 'Login' button\n\t\t\tlogger.info(\"Step 6: Click 'Login' button\")\n\t\t\tb.button(:value => \"Login\").click\n\n\t\t\tif b.url == \"https://www.groupjump.com/dashboard/flow\"\n\t\t\t\t# Step 7: If browser url is 'https://www.groupjump.com/dashboard/flow', print TEST PASSED\n\t\t\t\tlogger.info(\"TEST PASSED\")\n\t\t\telse\n\t\t\t\t# Step 8: Otherwise, print TEST FAILED\n\t\t\t\tlogger.info(\"TEST FAILED\")\n\t\t\tend\n\n\t\t\tb.link(:class => \"css_settings\").click\n\t\t\tb.link(:href => \"/index/logout\").click\n\t\tend\n\n\t\t# Logs end of testing\n\t\tlogger.info(\":::: END TESTING \" + log_name)\n\tend",
"def login\n visit login_path\n click_link 'Create an account'\n fill_in 'identity_name', with: 'alice'\n fill_in 'identity_email', with: '[email protected]'\n fill_in 'identity_password', with: '1234567'\n fill_in 'identity_password_confirmation', with: '1234567'\n click_button 'Sign up'\n page.should have_content('Signed in')\n end",
"def do_login\n @login_results = get_organizations\n end",
"def try_to_login\n User.login(self.name, self.password)\n end",
"def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end",
"def needs_login?() false end",
"def test\n user = User.find_by(email: \"[email protected]\")\n login user\n flash[:success] = t(\"sessions.create.success\")\n redirect_to root_path\n end",
"def login\n \t# Find a user with params\n \tuser = User.authenticate(@credentials[:password], @credentials[:username])\n \tif user\n\t \t# Save them in the session\n\t \tlog_in user\n\t \t# Redirect to articles page\n\t \tredirect_to articles_path\n\telse\n\t\tredirect_to :back, status: :created\n\tend\n end",
"def login\n\n username = prompt.ask(\"Enter your username:\\n\")\n while !User.find_by(username: username)\n puts \"Username not found - please try again.\\n\"\n username = prompt.ask(\"Enter your username:\\n\")\n end\n\n password = prompt.mask(\"Enter your password:\")\n while User.find_by(username: username).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your password:\")\n end\n \n self.user_id = User.find_by(username: username).id\n puts \"Successfully logged in! Welcome #{User.return_username(user_id)}!\\n\"\n\n show_threads\n end",
"def login_to_recruiter(username, password)\n \tself.load unless current_url == self.load\n \tusername_field.set username\n \tpassword_field.set password\n \tlogin_button.click\n end",
"def log_in(email_address, password)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n email_address_field.value = email_address\n password_field.value = password\n log_in_button.click\n wait_for_landing_page_load\n log_out_link.should_exist\n end",
"def test_login_page\n get :login\n title = assigns(:title)\n\n assert_equal \"Login Page\", title\n assert_response :success\n assert_template \"login\"\n assert_form_tag \"/user/login\"\n assert_screen_name_field\n assert_password_field\n assert_tag \"input\", :attributes => { :name => \"user[remember_me]\",\n :type => \"checkbox\"\n }\n assert_submit_button \"Login!\"\n end"
] | [
"0.71258557",
"0.71202743",
"0.7120012",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.711287",
"0.70233953",
"0.7018653",
"0.7018653",
"0.6917435",
"0.6854989",
"0.6783446",
"0.6781806",
"0.67470473",
"0.67378354",
"0.6732503",
"0.67241836",
"0.67241836",
"0.67241836",
"0.67081666",
"0.6697158",
"0.6693398",
"0.66866624",
"0.6685948",
"0.6683453",
"0.66797286",
"0.66539425",
"0.6653496",
"0.66444373",
"0.6640718",
"0.66072255",
"0.65978515",
"0.65951645",
"0.6578805",
"0.65715086",
"0.65691847",
"0.65462846",
"0.65318036",
"0.65191704",
"0.65148443",
"0.65053725",
"0.65039295",
"0.6500596",
"0.6496079",
"0.64921653",
"0.6469717",
"0.64693654",
"0.64655185",
"0.64621025",
"0.6460492",
"0.6454868",
"0.64458287",
"0.6442804",
"0.643857",
"0.64201385",
"0.6419815",
"0.64140743",
"0.64105433",
"0.64076",
"0.64070535",
"0.64051735",
"0.6399639",
"0.639831",
"0.63969624",
"0.63911265",
"0.6388536",
"0.637696",
"0.63664895",
"0.636322",
"0.6356735",
"0.6354547",
"0.6351655",
"0.63498944",
"0.63474774",
"0.63466793",
"0.6342561",
"0.6333398",
"0.6333398",
"0.63328445",
"0.632352",
"0.6315851",
"0.6310271",
"0.63091683",
"0.630846",
"0.62935746",
"0.6288647",
"0.6287219",
"0.62833077",
"0.62830114",
"0.6282115",
"0.6279735",
"0.62653697",
"0.62598175",
"0.6258608",
"0.625616"
] | 0.0 | -1 |
I worked on this challenge [by myself]. shortest_string is a method that takes an array of strings as its input and returns the shortest string +list_of_words+ is an array of strings shortest_string(array) should return the shortest string in the +list_of_words+ If +list_of_words+ is empty the method should return nil Your Solution Below | def shortest_string(list_of_words)
if list_of_words[0].nil?
return nil
else
string_length = Hash.new
sorted = Hash.new
list_of_words.each do |words|
string_length[words] = words.length
end
sorted = string_length.sort_by{|x, y| y}
return sorted.first.first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n\n#If presented with an array of mixed objects, maybe not all strings\n# strings = []\n# list_of_words.each do |i|\n# if i.is_a? String\n# strings.push(i)\n# end\n# end\n\n\n\n if list_of_words.length ==0\n return nil\n else\n i=0\n shorty = list_of_words[0]\n while i<list_of_words.length do\n if list_of_words[i].length <= shorty.length\n shorty = list_of_words[i]\n end\n i += 1\n end\n return shorty\n end\nend",
"def shortest_string(list_of_words)\n # PSEUDOCODE\n # return nil if list has no strings in it\n # I'm assuming the .length method is okay here, otherwise this problem would be a lot more tedious\n # Initialize initial shortest word as first word in array\n # Initialize initial shortest length as length of that word\n # FOR each word\n # IF word length is smaller than minimum\n # Set shortest word as that word\n # Set shortest length as word's length\n # Return minimum\n\n\n# INITIAL SOLUTION\n# return nil if list_of_words == []\n#\n# shortest = list_of_words[0]\n# min_length = shortest.length\n# list_of_words.each { |word|\n#\n# if word.length < min_length\n# shortest = word\n# min_length = word.length\n# end\n# }\n# return shortest\n\n #BUILT-IN SOLUTION\n\n return list_of_words.min { |a, b| a.length <=> b.length }\n\n\nend",
"def shortest_string(list_of_words)\n # Your code goes here!\n if list_of_words.empty?\n return nil\n end\n shortest_word = list_of_words[0]\n for word in list_of_words\n if word.length < shortest_word.length\n shortest_word = word\n end\n end\n return shortest_word\n\nend",
"def shortest_string(list_of_words)\n if list_of_words.length == 0\n nil\n else\n index = 0\n shortest_word = list_of_words[0]\n while index < list_of_words.length do\n if list_of_words[index].length <= shortest_word.length\n shortest_word = list_of_words[index]\n end\n index+=1\n end\n shortest_word\n end\n end",
"def shortest_string(list_of_words)\n if list_of_words == []\n return nil\n end\n i = 0\n array_length = array_size(list_of_words)\n smallest_index = 0\n for i in 0..array_length - 1\n if string_length(list_of_words[smallest_index]) > string_length(list_of_words[i])\n smallest_index = i\n end\n end\n return list_of_words[smallest_index]\nend",
"def shortest_string(list_of_words)\n # Your code goes here!\n return nil if list_of_words.empty?\n\n shortest = list_of_words[0]\n i = 1\n while(i < list_of_words.length)\n \tshortest = list_of_words[i] if list_of_words[i].size < shortest.size\n \ti += 1\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n if list_of_words.length == 0\n \treturn nil\n end\n shortest_str = list_of_words[0]\n list_of_words.each do |str| \n \tif str.size < shortest_str.size\n \t\tshortest_str = str\n \tend\n end\n shortest_str\nend",
"def shortest_string(list_of_words)\n \n array = []\n\n list_of_words.each {|value|\n \tarray << value.length\n }\n\n if array.empty?\n \tnil\n else\n return list_of_words[array.index(array.min)]\n end\n\nend",
"def shortest_string(list_of_words)\n if list_of_words.empty? \n return nil\n end\n \n short=list_of_words[0]\n list_of_words.each { |str| \n if str.length < short.length\n short=str\n end \n }\n return short\nend",
"def shortest_string(list_of_words)\n shortest = list_of_words[0]\n array_number = 1\n while array_number < list_of_words.length\n \tif list_of_words[array_number].length < shortest.length\n \t\tshortest = list_of_words[array_number]\n \tend\n \tarray_number += 1\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest_length = list_of_words.first.length\n shortest_word = ''\n list_of_words.each do |word|\n if word.length <= shortest_length\n shortest_length = word.length\n shortest_word = word\n else\n shortest_word = shortest_word\n end\n end\n return shortest_word\n end\nend",
"def shortest_string(list_of_words)\n return nil if no_string?(list_of_words)\n return list_of_words[0] if one_string?(list_of_words)\n \telse\n \t\tfirst_word = list_of_words[0]\n \t\tx = 1\n \t\twhile x < list_of_words.length\n \t\t\tif first_word.length > list_of_words[x].length\n \t\t\t\tfirst_word = list_of_words[x]\n \t\t\tend\n \t\t\tx += 1\n \t\tend\n \t\treturn first_word\nend",
"def shortest_string(list_of_words)\n shortest = list_of_words[0]\n\n list_of_words.each do |word|\n if word.length < shortest.length\n shortest = word\n end\nend\n\nreturn shortest\nend",
"def shortest_string(list_of_words)\n if list_of_words == []\n \treturn nil\n else\n \tcounter = 0\n \tshortest_word = ''\n \tshorest_word_length = list_of_words[0].length\n \twhile counter < list_of_words.length\n \t\tif shorest_word_length >= list_of_words[counter].length\n \t\t\tshortest_word = list_of_words[counter]\n \t\tend\n \tcounter += 1\n \tend\n end\n return shortest_word\nend",
"def shortest_string(list_of_words)\n shortest = list_of_words[0]\n for word in 1...list_of_words.length\n if shortest.length > list_of_words[word].length then\n shortest = list_of_words[word]\n end\n end\n return shortest\nend",
"def shortest_string(list_of_words)\n # Your code goes here!\n shortest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length < shortest.length\n shortest = word\n end\n }\n\n return shortest\nend",
"def shortest_first(array_of_words)\n # TODO\nend",
"def shortest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\tlist_of_words.sort_by! {|i| i.length}\n\treturn list_of_words[0]\nend",
"def shortest_string(list_of_words)\n\tif list_of_words==[]\n\t\treturn nil\n\telse\n\t\tshort_string=list_of_words[0]\n \t\tlist_of_words.each do |x|\n \t\t\tif x.length < short_string.length\n \t\t\t\tshort_string = x\n\t\t\tend\t\t\n\t\tend\n \t\treturn short_string\n \tend\nend",
"def shortest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.min == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"def shortest_string(list_of_words)\n shortest = list_of_words[0]\n list_of_words.each do |i|\n \tif shortest.length <= i.length\n \t\tshortest = shortest\n \telse\n \t\tshortest = i\n \tend\n end\n p shortest\nend",
"def shortest_string(list_of_words)\n\n for x in 0..list_of_words.length - 1\n if x == 0\n currentSmallest = list_of_words[x]\n else\n if list_of_words[x].length < currentSmallest.length\n currentSmallest = list_of_words[x]\n end\n end\n end\n\n return currentSmallest\nend",
"def shortest_string(list_of_words)\n list_of_words = list_of_words.sort_by {|x| x.length}\n short_string = list_of_words[0]\n return short_string\nend",
"def shortest_string(list_of_words)\n\tshortest_string.each {|x1| x1.length}\n\t\tshortest_string.each {|x2| x2.length.to_i} #iterrates over each string in array, counts the string's length \n\t\tif shortest_string|x1.length| > shortest_string|x2.length| #compares the 2 pulled string lenghts\n\t\t\tshortest_string|x1| , shortest_string|x2| = shortest_string|x2| > shortest_string|x1| #keeps putting the smallest one to the front\n\t\tend\n\t\treturn shortest_string[0] #returns the first stirng in the array which should be the smallest one\nend\n\n# was getting some errors I could not resolve in order to get this to run. ",
"def shortest_string(list_of_words)\n # Your code goes here!\n return list_of_words[0].to_s if list_of_words.length == 1\n smallest_word(list_of_words)\n# until_loop(list_of_words)\n# for_loop(list_of_words)\n# smallest = list_of_words[0]\n# list_of_words.each do |word|\n# smallest = word if word.length < smallest.length\n# end\n# return smallest\nend",
"def shortest_string(list_of_words)\n\tif list_of_words.empty?\n\t\treturn nil\n\telse p list_of_words.sort_by {|x| x.length}.shift\n\tend\nend",
"def shortest_string(list_of_words)\n \n short_string = list_of_words[0]\n \n i = 0\n while i < list_of_words.length\n current_item = list_of_words[i]\n if current_item.length < short_string.length\n short_string = current_item\n end\n i = i + 1\n\n end\n short_string\nend",
"def shortest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length > list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend",
"def shortest_string(list_of_words)\n\tmethod = 1\n\tcase method\n\twhen 1\n\t\tlist_of_words.min_by {|x| x.size} #The easy way\n\twhen 2\n\t\tshortest = list_of_words[0]\n \t\tlist_of_words.each do |element|\n \t\t\tshortest = element if element.size < shortest.size\n \t\tend\n \t\treturn shortest\n \twhen 3\n \t\tshortest = list_of_words[0]\n \t\tfor element in list_of_words\n \t\t\tshortest = element if element.size < shortest.size\n \t\tend\n \t\treturn shortest\n \tend\nend",
"def shortest_string(list_of_words)\n\treturn list_of_words.min_by {|x| x.length }\nend",
"def shortest_string(list_of_words)\n # Your code goes here!\n list_of_words.sort! { |a , b| a.length <=> b.length }\n\t\treturn list_of_words[0]\nend",
"def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\nend",
"def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\nend",
"def shortest_string(list_of_words)\n\n return nil if list_of_words.length == 0\n return \" \" if list_of_words.length == 1 && list_of_words[0] == \" \"\n return list_of_words[0] if list_of_words.length == 1\n\n test_word = list_of_words.pop\n not_it = []\n solution = []\n list_of_words.each do |word|\n if word.length < test_word.length\n not_it << test_word\n test_word = word\n else\n not_it << word\n end\n end\n\n solution.push test_word\n return solution[0]\n\n #------SOLUTION WITH sort_by METHOD:\n\n # new_list = list_of_words.sort_by {|x| x.length}\n # return new_list[0]\n\nend",
"def shortest_string(list_of_words)\n length_of_words = {}\n list_of_words.each do |word|\n word_length = word.length\n length_of_words[word] = word_length\n end\n answer = length_of_words.min_by{|k,v| v}\n if answer == nil\n return nil\n else\n answer.first\n end\nend",
"def shortest_string(list_of_words)\n list_of_words.min {|x,y| x.size <=> y.size}\nend",
"def shortest_string(list_of_words)\n if list_of_words.empty? == true\n return nil\n end\n word = 1\n list_of_words.each do |x|\n if x.length <= word.to_s.length\n word = x\n end\n end\n p word\nend",
"def shortest_string(list_of_words)\n\treturn list_of_words.min{|a,b| a.size <=> b.size}\nend",
"def shortest_string(list_of_words)\n list_of_words.min { |a, b| a.size <=> b.size }\nend",
"def shortest_word_in_array(array)\n array.min_by{|word|word.length}\nend",
"def shortest_word_in_array(array)\n # check each element of array\n # if the shortest, update the shortest word\n shortest_word = array[0]\n array.each {|word|\n shortest_word = word if shortest_word.size>word.size\n }\n shortest_word\nend",
"def shortest_string(list)\n\tshortest = list.first\n\tlist.each do |current_str|\n\t\tif current_str.length < shortest.length\n\t\t\tshortest = current_str\n\t\tend\n\tend\n\n\tshortest\nend",
"def shortest_string(list)\n # This is your job. :)\n shortest_so_far = list.first\n list.each do |item|\n if item.length < shortest_so_far.length\n shortest_so_far = item\n end\n end\n return shortest_so_far\nend",
"def shortest_word(words)\n words.inject { |memo, word| memo.length < word.length ? memo : word}\nend",
"def shortest_string(list)\n shortest_so_far = list.first\n list.each do |item|\n if shortest_so_far.length > item.length\n shortest_so_far = item\n end\n end\n shortest_so_far\nend",
"def shortest_word_in_array(array)\n array.min{ | x, y | x.length <=> y.length }\nend",
"def shortest_word_in_array(array)\n array.min_by(&:length)\n # array.min_by { |x| x.length }\nend",
"def shortest_word_in_array(array)\n\tn = %w(here is a bunch of words of different lengths)\n\tsorted = n.sort_by! { | word | word.length }\n\tsorted.first\nend",
"def shortest(word1, word2)\n \n end",
"def smallest_word(array)\n smallest = array[0]\n array.each do |word|\n smallest = word if word.length < smallest.length\n end\n return smallest\nend",
"def find_short(s)\n # your code here\n the_1st_array = s.split(\" \")\n this_counts = []\n i = 0\n while i < the_1st_array.count\n this_counts.push(the_1st_array[i].length)\n i+=1\n end\n l = this_counts.min\n return l # l: length of the shortest word\nend",
"def find_shortest_words(str)\n words = str.downcase.split(/[^a-z0-9]/)\n words = words.sort_by {|word| word.size}\n shortest = []\n\n words = words.select {|word| word.size > 0}\n\n size = words[0].size\n words.each do |word|\n break if word.size > size\n shortest << word\n end\n shortest.sort\nend",
"def smallest_string(strings)\n smallest = strings[0]\n strings.each do |string|\n if string.length < smallest.length\n smallest = string\n end\n end\n smallest\nend",
"def find_short(s)\n l = s.split(\" \").min_by { |x| x.length}.length\n return l #l: length of the shortest word\nend",
"def shortest(letters)\n x = 0\n y = 0\n longitud =[]\n delevery =letters.sort_by{|i|i.length}#sort_by ordena de menor a mayor\n delevery.each do |f| #sacar los valores ordenador del array\n if delevery[0].length == letters[x].length #toma el primer valor que es el menor y compara con los demas si tiene la misma longitud\n longitud[y] = letters[x] #se mete el resultado en el array vacio \n y += 1 #posiciona en el array el valor que resulta de la comparacion\n end\n x += 1 #guarda e incrementa en el array que va encontrando en el array o,1,2,3,...\n end\n\n longitud\nend",
"def until_loop(array)\n shortest = array[0]\n until array.empty?\n word = array.shift\n shortest = word if shortest.length > word.length\n end\n return shortest\nend",
"def longest_string(list_of_words)\n if list_of_words == []\n return nil\n elsif list_of_words == ['']\n return ''\n elsif list_of_words.length == 1\n return list_of_words[0]\n elsif\n sorted_words = list_of_words.sort_by { |x| x.length}\n return sorted_words[-1]\n end\nend",
"def solution(a)\n shortest = a.min_by &:length\n maxlen = shortest.length\n maxlen.downto(0) do |len|\n 0.upto(maxlen - len) do |start|\n substr = shortest[start,len]\n return substr if a.all?{|str| str.include? substr }\n end\n end\nend",
"def break_ties(tied_words)\n puts \"This is our array of just words: #{tied_words}\"\n all_tens = tied_words.select{|word| word.length == 10}\n\n winning_word = \"\"\n if all_tens.size >= 1 \n winning_word = all_tens[0]\n else\n all_smallest = tied_words.min_by{|word| word.length}\n if all_smallest.class == Array \n winning_word = all_smallest[0]\n else\n winning_word = all_smallest\n end\n end\n return winning_word\nend",
"def longest_prefix(strings)\n return \"\" if strings.empty?\n prefix = \"\"\n smallest_word = strings.min_by { |word| word.length } # start with smallest word\n for i in 0..smallest_word.length-1\n if strings.all? { |word| word[i] == smallest_word[i] } # if the index matches the same index of the other words\n prefix += smallest_word[i] # then append the index value to the prefix\n else\n break # otherwise index is not in all words, so stop\n end\n end\n return prefix\nend",
"def longest_string(list_of_words)\n longest = list_of_words[0]\n list_of_words.each do |x|\n if x.length >= longest.length\n longest = x\n end\n end\n if list_of_words.empty?\n return nil\n end\nreturn longest\nend",
"def shortest(word1, word2)\n ans = @M\n for i in @d[word1]\n for j in @d[word2]\n ans = [ans, (i-j).abs].min\n end\n end\n return ans\n end",
"def find_short(s)\n # input is string\n # convert string to array\n converted = s.split(\" \") # gives us an array of words\n # order elements of array by length\n sorted_by_length = converted.sort_by {|x| x.length}\n # returns an array of words sorted by length\n # return the first element in array\n return sorted_by_length[0].length\n \nend",
"def find_short(s)\n return s.split(\" \").map { |word| word.length }.min\nend",
"def longest_prefix(strings)\n strings_in_common = \"\"\n #checking if array is emptyh\n if strings.length == 0\n return strings_in_common\n end\n\n shortest_string = strings.min(){|a, b| a.length <=> b.length}.chars\n\n i = 0\n while i < shortest_string.length\n letter = shortest_string[i]\n strings.each do |string|\n if letter != string.chars[i]\n return strings_in_common\n end\n end\n strings_in_common += letter\n i += 1\n end\n return strings_in_common\nend",
"def minimum_set_of_words(input)\n return [] if input.nil? || input.size == 0\n return input if input.size == 1\n\n w = input[-1] # take last word, that has just been added\n ww = input[0..-2] # take the words without last.\n\n w_letter_set = letter_set_from_words(w)\n ww_letter_set = letter_set_from_words(ww)\n\n if w_letter_set <= ww_letter_set\n\n minimum_set_of_words(ww)\n\n elsif (w_letter_set & ww_letter_set < w_letter_set) && (w_letter_set & ww_letter_set).size >= 1\n\n temp = minimum_set_of_words(ww)\n without_words_not_contributing_to_letter_set(temp, w)\n temp + [w]\n\n else\n\n minimum_set_of_words(ww) + [w]\n\n end\nend",
"def longest_prefix(strings)\n common_string = \"\"\n if strings.length == 0\n return common_string\n end\n \n shortest_element = strings.min\n shortest_element_length = shortest_element.length\n i = 0\n while i < shortest_element_length\n char = shortest_element[i]\n strings.each do |string|\n if char != string[i]\n return common_string\n end\n end\n common_string += char\n i += 1\n end\n \n return common_string\nend",
"def for_fs_sake(string)\n words = string.split\n min_f_distance = nil\n min_f_word = \"\"\n\n words.each do |word|\n current_f_distance = find_f_distance(word)\n if current_f_distance && (min_f_distance.nil? || current_f_distance < min_f_distance)\n min_f_distance = current_f_distance\n min_f_word = word\n end\n end\n\n min_f_word\nend",
"def longest_prefix(strings)\n strings_in_common = \"\"\n #checking if array is emptyh\n if strings.length == 0\n return strings_in_common\n end\n shortest_string = strings.min(){|a, b| a.length <=> b.length}.chars\n i = 0\n while i < shortest_string.length\n letter = shortest_string[i]\n strings.each do |string|\n if letter != string.chars[i]\n return strings_in_common\n end\n end\n strings_in_common += letter\n i += 1\n end\n return strings_in_common\nend",
"def get_the_shortest_word(str)\n str.split(\" \").sort! {|s, l| s.length <=> l.length}[0]\nend",
"def longest_prefix(strings)\n\n # Assign relevant variables\n winning_ticket = \"\"\n i = 0 \n fastest_furthest = strings[0][i]\n\n # Account for non-nil values and return method result \n while fastest_furthest != nil\n strings.each do |string|\n unless string[i] == fastest_furthest\n return winning_ticket\n end \n end \n winning_ticket += fastest_furthest\n i += 1\n fastest_furthest = strings[0][i]\n end\n return winning_ticket\nend",
"def least_frequent_word(str)\n words = str.split\n frequency = words.length\n min_word = \"\"\n\n words.each_with_index do |word, idx|\n if words.count(word) < frequency\n frequency = words.count(word)\n min_word = words[idx]\n end\n end\n min_word\nend",
"def first_wa(array)\n new_array = [ ]\n other_new_array = [ ]\n \n array.each do |word|\n new_array << word.to_s\n end\n new_array.each do |word|\n if word.include?(\"wa\") == true\n then other_new_array << word\n end\n end\n other_new_array.first\nend",
"def longest_prefix(strings)\n return \"\" if strings.empty? \n index = 0\n min = strings.min_by{|s| s.length} # find the shortest string\n longest_prefix = \"\"\n while index < min.length # keep running based on the length of the sortest the string \n strings.each do |string|\n if min[index] != string[index] # if the it's not equal, return the \"\"\n return longest_prefix\n end\n end\n longest_prefix += min[index]\n index +=1\n end \n return longest_prefix\nend",
"def longest_string(list_of_words)\n if list_of_words.length > 0\n longest_word = list_of_words[0]\n for word in list_of_words\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\n end\nend",
"def for_cs_sake(string)\n words = string.delete(\"!.,?;:\").split(\" \")\n words = words.select { |word| word.include?(\"c\") }\n c_distances = []\n words.each do |word|\n c_distances << find_c_distance(word)\n end\n c_distances\n lowest_c_distance = c_distances.min\n p words.select { |word| find_c_distance(word) == lowest_c_distance }[0]\nend",
"def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend",
"def find_short(s)\n s.split(' ').map{|e|e.length}.min\nend",
"def find_short(s)\n return s.split(' ').min_by{|word| word.length}.length\nend",
"def find_short(sentence)\n word_array = sentence.split\n\n word_array.sort! do |word_a, word_b|\n word_a.length <=> word_b.length\n end\n\n return word_array.first.length\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend",
"def shortest(word1, word2)\n word1_indices = @hash[word1]\n word2_indices = @hash[word2]\n\n dis = @size\n i, j = 0, 0\n while word1_indices[i] && word2_indices[j]\n dis = [dis, (word1_indices[i] - word2_indices[j]).abs].min\n if word1_indices[i] < word2_indices[j]\n i += 1\n else\n j += 1\n end\n end\n\n return dis\n end",
"def longest_string(list_of_words)\n return list_of_words[0] if list_of_words.length <= 1\n\n longest = list_of_words.pop\n trash = []\n\n list_of_words.each do |test_item|\n if test_item.length < longest.length\n trash.push test_item\n else\n trash.push longest\n longest = test_item\n end\n end\n return longest\nend",
"def shortest\n '-shortest'\n end",
"def longest_string(list_of_words)\n\tif list_of_words.size == []\n\t\treturn nil\n\telsif list_of_words.size == 1\n\t\treturn list_of_words[0]\n\telsif list_of_words.size >= 2\n\t\tlist_of_words.sort_by! {|word| word.length}\n\t\treturn list_of_words.last\n\tend\nend",
"def common_prefix(words)\n smallest_string= words.min_by{|word| word.size}\n\n result = \"\"\n\n smallest_string.chars.each_with_index do |current_char, current_index|\n if words.all?{|word| word[current_index] == current_char}\n result << current_char\n else\n return result\n end\n end\n result\nend",
"def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend",
"def find_short(string)\n string.split.map(&:length).min\nend",
"def first_wa(array)\n\n array.each do |word|\n temp = word.to_s\n return temp if temp.start_with?(\"wa\")\n end\n\nend",
"def common_prefix(words)\n longest = ''\n\n shortest_word = words.min\n (0...shortest_word.length).each do |stop_index|\n sequence = shortest_word[0..stop_index]\n\n match = words.all? do |word|\n word[0..stop_index] == sequence\n end\n\n longest = sequence if match\n end\n\n longest\nend",
"def longest_prefix(strings)\n # Return an empty string \"\" if no common prefix\n\n # shortest string in array\n prefix = strings.min_by(&:length)\n\n for string in strings\n for j in 0...prefix.length\n if prefix[j] != string[j]\n # update prefix from start, up until j (not including)\n prefix = prefix.slice(0, j)\n break\n end\n end\n end\n\n return prefix\nend",
"def longest_common_prefix (array_of_strings)\n\n # Establish default value\n lcp = \"\"\n\n # Get the length of the shortest string\n min_length =\n if array_of_strings.size.zero?\n 0\n else\n array_of_strings.min_by(&:length).size\n end\n\n # Go through all of the strings, but not past the length of the shortest string\n min_length.times do |i|\n\n # If all of the strings have the same character at this index,\n # then it's part of the LCP\n chars_at_index = array_of_strings.map { |s| s[i] }\n\n if chars_at_index.uniq.count == 1\n lcp += chars_at_index[0]\n else\n break\n end\n\n end\n\n # Return\n return lcp\n\nend",
"def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend",
"def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0 then return nil\n end\n longest_word = list_of_words.max_by { |x| x.length }\n return longest_word\nend",
"def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend",
"def find_short(s)\n # s.split.map(&:size).min\n s.split\n .map(&:size)\n .min\nend",
"def longest_string(list_of_words)\n longest = nil\n list_of_words.each do |words|\n if longest.nil? || longest.length < words.length\n longest = words\n end\n end\nlongest\nend",
"def best_next_word(set, goal)\n set.to_a[0]\n end",
"def longest_string(list_of_words)\n\tif list_of_words == []\n\t\treturn nil\n\telsif list_of_words == [\" \"]\n\t\treturn \" \"\n\telse\n\t\tstring_length = []\n\t\tlist_of_words.each do |string|\n\t\t\t string_length.push string.length\n\t\tend\n\t\tlist_of_words.each do |string|\n\t\t\tif string_length.max == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend"
] | [
"0.8888499",
"0.88468236",
"0.8824444",
"0.88168263",
"0.8797715",
"0.87475526",
"0.8725633",
"0.8715202",
"0.8693984",
"0.8693899",
"0.8674872",
"0.86344963",
"0.8620828",
"0.8613896",
"0.85997814",
"0.85821843",
"0.8577634",
"0.85773295",
"0.8566398",
"0.8507879",
"0.84484494",
"0.84142977",
"0.8371567",
"0.83586097",
"0.83535707",
"0.8339655",
"0.8303935",
"0.82737124",
"0.8262457",
"0.820201",
"0.81994855",
"0.8193703",
"0.8157507",
"0.8157507",
"0.8133737",
"0.8117962",
"0.81075066",
"0.81058145",
"0.8054074",
"0.8034144",
"0.79311585",
"0.7810023",
"0.7791524",
"0.7741892",
"0.7680941",
"0.76573944",
"0.7641745",
"0.7527963",
"0.7527555",
"0.74440134",
"0.7404871",
"0.73982745",
"0.73336726",
"0.7068446",
"0.6914372",
"0.68294835",
"0.6780589",
"0.6745462",
"0.67004937",
"0.6687824",
"0.66441965",
"0.66180164",
"0.6613724",
"0.6581827",
"0.6571802",
"0.6556827",
"0.6543283",
"0.65426576",
"0.6537144",
"0.6519626",
"0.65142226",
"0.6469916",
"0.64445764",
"0.6429248",
"0.64224696",
"0.64140695",
"0.6391121",
"0.63757724",
"0.6358971",
"0.6348027",
"0.6304149",
"0.6297727",
"0.6246865",
"0.6239108",
"0.6222083",
"0.6218822",
"0.6215471",
"0.6208728",
"0.6207434",
"0.61951506",
"0.6194118",
"0.6193336",
"0.6179973",
"0.61716247",
"0.6168536",
"0.614613",
"0.61426973",
"0.61402375",
"0.6104099",
"0.60920894"
] | 0.8006971 | 40 |
AC Accession number (1 per entry) AC T00001 in the case of FACTOR AC M00001 in the case of MATRIX AC R00001 in the case of SITE AC G000001 in the case of GENE AC C00001 in the case of CLASS AC 00001 in the case of CELL | def ac
unless @data['AC']
@data['AC'] = fetch('AC')
end
@data['AC']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aliphatic_index\n aa_map = aa_comp_map\n @aliphatic_index ||= round(aa_map[:A] +\n 2.9 * aa_map[:V] +\n (3.9 * (aa_map[:I] + aa_map[:L])), 2)\n end",
"def amino_acid (bases)\n case bases\n when /^TT[TCY]$/\n return \"F\"\n when /^TT[AGR]$/\n return \"L\"\n when /^CT.$/\n return \"L\"\n when /^AT[TCAHYWM]$/\n return \"I\"\n when \"ATG\"\n return \"M\"\n when /^GT.$/\n return \"V\"\n when /^TC.$/\n return \"S\"\n when /^CC.$/\n return \"P\"\n when /^AC.$/\n return \"T\"\n when /^GC.$/\n return \"A\"\n when /^TA[TCY]$/\n return \"Y\"\n when /^TA[AGR]$/\n return \"*\"\n when /^T[GR]A$/\n return \"*\"\n when /^CA[TCY]$/\n return \"H\"\n when /^CA[AGR]$/\n return \"Q\"\n when /^AA[TCY]$/\n return \"N\"\n when /^AA[AGR]$/\n return \"K\"\n when /^GA[TCY]$/\n return \"D\"\n when /^GA[AGR]$/\n return \"E\"\n when /^TG[TCY]$/\n return \"C\"\n when \"TGG\"\n return \"W\"\n when /^CG.$/\n return \"R\"\n when /^AG[TCY]$/\n return \"S\"\n when /^[AM]G[AGR]$/\n return \"R\"\n when /^GG.$/\n return \"G\"\n when /^[ATW][CGS][CTY]$/\n return \"S\"\n when /^[TCY]T[AGR]$/\n return \"L\"\n else\n return \"#\"\n end\n end",
"def to_ace\n ace_line=''\n @acc.each{|k,v|\n @acc.each{|k2,v2|\n next if k.eql?(k2)\n ace_line << _print_ace(v,v2,\"Caenorhabditis #{k2}\")\n }\n }\n return ace_line\n end",
"def cac2\n 0\n end",
"def amino_acid_2 (bases)\n bases_to_aa = []\n aa_list = []\n base1 = bases[0].to_list\n base2 = bases[1].to_list\n base3 = bases[2].to_list\n l1 = base1.size - 1\n l2 = base2.size - 1\n l3 = base3.size - 1\n (0..l1).each do |n1|\n b1 = base1[n1]\n (0..l2).each do |n2|\n b2 = base2[n2]\n (0..l3).each do |n3|\n b3 = base3[n3]\n bases_all = b1 + b2 + b3\n bases_to_aa << bases_all\n end\n end\n end\n\n bases_to_aa.each do |base|\n case base\n when /^TT[TCY]$/\n aa = \"F\"\n when /^TT[AGR]$/\n aa = \"L\"\n when /^CT.$/\n aa = \"L\"\n when /^AT[TCAHYWM]$/\n aa = \"I\"\n when \"ATG\"\n aa = \"M\"\n when /^GT.$/\n aa = \"V\"\n when /^TC.$/\n aa = \"S\"\n when /^CC.$/\n aa = \"P\"\n when /^AC.$/\n aa = \"T\"\n when /^GC.$/\n aa = \"A\"\n when /^TA[TCY]$/\n aa = \"Y\"\n when /^TA[AGR]$/\n aa = \"*\"\n when /^T[GR]A$/\n aa = \"*\"\n when /^CA[TCY]$/\n aa = \"H\"\n when /^CA[AGR]$/\n aa = \"Q\"\n when /^AA[TCY]$/\n aa = \"N\"\n when /^AA[AGR]$/\n aa = \"K\"\n when /^GA[TCY]$/\n aa = \"D\"\n when /^GA[AGR]$/\n aa = \"E\"\n when /^TG[TCY]$/\n aa = \"C\"\n when \"TGG\"\n aa = \"W\"\n when /^CG.$/\n aa = \"R\"\n when /^AG[TCY]$/\n aa = \"S\"\n when /^[AM]G[AGR]$/\n aa = \"R\"\n when /^GG.$/\n aa = \"G\"\n when /^[ATW][CGS][CTY]$/\n aa = \"S\"\n when /^[TCY]T[AGR]$/\n aa = \"L\"\n else\n aa = \"-\"\n end\n aa_list << aa\n end\n aa_out = aa_list.uniq.join\n return aa_out\n end",
"def get_1CAA()\n caa = get_CAA(1)\n return caa\n end",
"def rna_to_amino_acid(rna)\n # Protein Translation Problem: Translate an RNA string into an amino acid string.\n # Input: An RNA string Pattern and the array GeneticCode.\n # Output: The translation of Pattern into an amino acid string Peptide. \n\n r_to_c_h = rna_to_codon_hash\n # puts r_to_c_h\n i = 0\n codon_length = 3\n amino_acid = \"\"\n while (codon = rna.slice(i, codon_length)) do\n # puts codon\n # puts r_to_c_h[codon.to_sym]\n break if codon.empty?\n amino_acid += r_to_c_h[codon.to_sym].to_s\n i += codon_length\n end\n return amino_acid\n end",
"def comp(_comp)\n a = '0'\n c1 = '0'\n c2 = '0'\n c3 = '0'\n c4 = '0'\n c5 = '0'\n c6 = '0'\n\n if (_comp.include?'M')\n a = '1'\n end\n\n if (_comp == '0')\n c1 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == '1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-1')\n c1 = '1'\n c2 = '1'\n c3 = '1'\n c5 = '1'\n elsif (_comp == 'D')\n c3 = '1'\n c4 = '1'\n elsif (_comp == 'A' or _comp == 'M')\n c1 = '1'\n c2 = '1'\n elsif (_comp == '!D')\n c3 = '1'\n c4 = '1'\n c6 = '1'\n elsif (_comp == '!A' or _comp == '!M')\n c1 = '1'\n c2 = '1'\n c6 = '1'\n elsif (_comp == '-D')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == '-A' or _comp == '-M')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D+1')\n c2 = '1'\n c3 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A+1' or _comp == 'M+1')\n c1 = '1'\n c2 = '1'\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D-1')\n c3 = '1'\n c4 = '1'\n c5 = '1'\n elsif (_comp == 'A-1' or _comp == 'M-1')\n c1 = '1'\n c2 = '1'\n c5 = '1'\n elsif (_comp == 'D+A' or _comp == 'D+M')\n c5 = '1'\n elsif (_comp == 'D-A' or _comp == 'D-M')\n c2 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'A-D' or _comp == 'M-D')\n c4 = '1'\n c5 = '1'\n c6 = '1'\n elsif (_comp == 'D&A' or _comp == 'D&M')\n #Do nothing\n elsif (_comp == 'D|A' or _comp == 'D|M')\n c2 = '1'\n c4 = '1'\n c6 = '1'\n else\n raise 'invalid syntax'\n end\n return a + c1 + c2 + c3 + c4 + c5 + c6\n end",
"def get_cas01_code(crosswalked_codes)\n rcc_log.debug \"Obtaining CAS 01 code.\"\n if facility && crosswalked_codes\n cas_01_config = facility.details[:cas_01].to_s.downcase.gsub(' ', '_')\n rcc_log.debug \"CAS 01 config : #{facility.details[:cas_01]}\"\n rcc_log.debug \"Obtaining Group code as CAS 01 code.\"\n cas_01_code = crosswalked_codes[cas_01_config.to_sym]\n rcc_log.debug \"CAS 01 code : #{cas_01_code}\"\n end\n cas_01_code.to_s.upcase\n end",
"def az_index c\n c.upcase.ord - 'A'.ord\nend",
"def tc_number(accounting_element)\n\t\t\t\t payment_form = accounting_element[:payment_info][:payment][:form]\n\t\t\t\t if payment_form == \"CC\" then\n\t\t\t\t return accounting_element[:payment_info][:payment][:cc_info][:payment_card][:@number]\n\t\t\t\t else\n return \"\"\n\t\t\t\t end\n\t\t\t end",
"def valid_acn?\n return false unless @acn.is_a?(String)\n return false if (@acn =~ /^[0-9]{9}$/).nil?\n weighting = [8,7,6,5,4,3,2,1]\n chksum = 0\n (0..7).each do |d|\n chksum += @acn[d].to_i * weighting[d]\n end\n return (10 - chksum % 10) % 10 == @acn[8].to_i\n rescue => e\n puts \"Error: #{e.class}\\n#{e.backtrace.join(\"\\n\")}\"\n return false\n end",
"def amino_acid_number\n @seq.length\n end",
"def amino_acid_mass_hash\n {\n \"G\" => 57, \"A\" => 71, \"S\" => 87, \"P\" => 97, \"V\" => 99,\n \"T\" => 101, \"C\" => 103, \"I\" => 113, \"L\" => 113, \"N\" => 114,\n \"D\" => 115, \"K\" => 128, \"Q\" => 128, \"E\" => 129, \"M\" => 131,\n \"H\" => 137, \"F\" => 147, \"R\" => 156, \"Y\" => 163, \"W\" => 186,\n }\n end",
"def acn_to_s\n valid_acn? ? \"%s%s%s %s%s%s %s%s%s\" % @acn.split('') : \"\"\n end",
"def instability_index\n @instability_index ||=\n begin\n instability_sum = 0.0\n i = 0\n while @seq[i+1] != nil\n aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym]\n if DIWV.key?(aa) && DIWV[aa].key?(next_aa)\n instability_sum += DIWV[aa][next_aa]\n end\n i += 1\n end\n round((10.0/amino_acid_number.to_f) * instability_sum, 2)\n end\n end",
"def is_ace?(card)\n\t\tcard == \"A\" ? true : false\n\tend",
"def ace_type_string\n case @ace_type\n when 0x0\n 'ACCESS_ALLOWED_ACE_TYPE'\n when 0x1\n 'ACCESS_DENIED_ACE_TYPE'\n when 0x2\n 'SYSTEM_AUDIT_ACE_TYPE'\n when 0x3\n 'SYSTEM_ALARM_ACE_TYPE'\n when 0x4\n 'ACCESS_ALLOWED_COMPOUND_ACE_TYPE'\n when 0x5\n 'ACCESS_ALLOWED_OBJECT_ACE_TYPE'\n when 0x6\n 'ACCESS_DENIED_OBJECT_ACE_TYPE'\n when 0x7\n 'SYSTEM_AUDIT_OBJECT_ACE_TYPE'\n when 0x8\n 'SYSTEM_ALARM_OBJECT_ACE_TYPE'\n when 0x9\n 'ACCESS_ALLOWED_CALLBACK_ACE_TYPE'\n when 0xA\n 'ACCESS_DENIED_CALLBACK_ACE_TYPE'\n when 0xB\n 'ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE'\n when 0xC\n 'ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE'\n when 0xD\n 'SYSTEM_AUDIT_CALLBACK_ACE_TYPE'\n when 0xE\n 'SYSTEM_ALARM_CALLBACK_ACE_TYPE'\n when 0xF\n 'SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE'\n when 0x10\n 'SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE'\n end\n end",
"def clean_an\n if aleph_record?\n an_numeric_component.prepend('MIT01')\n elsif aleph_cr_record?\n an_numeric_component.prepend('MIT30')\n end\n end",
"def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end",
"def convert_aces(all_sums)\n\t\tall_sums[1] = Array.new(all_sums[0])\n\t\tall_sums[1][all_sums[1].index(1)] = 11 if all_sums[1].any?{|value| value == 1}\n\tend",
"def an_numeric_component\n @record.eds_accession_number.split('.').last\n end",
"def refseq_sequence\n \"NC_0000\" + chrom.sub(/X/, \"23\").sub(/Y/, \"24\")\n end",
"def get_agc()\n return(get_cmd('GT;',0.1,0.5,3).gsub(/^GT/,'').gsub(/;$/,'').to_i)\nend",
"def km_reduce_reacid(acc, crt)\n return acc if crt[\"reaction\"].nil?\n k = crt[\"entry\"][0].match(/^(?<id>M\\d{5})/)[:id]\n r = km_get_reacid(crt[\"reaction\"])\n return acc if r.empty?\n acc[k] = r\n return acc\nend",
"def acidic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n ACIDIC_AMINO_ACIDS.each do |acidic|\n if comp[acidic]\n count += comp[acidic]\n end\n end\n return count\n end",
"def is_ace?\n @value == 'A'\n end",
"def agc_to_string(agc)\n if agc==AGC_FAST\n return(\"Fast\")\n elsif agc==AGC_SLOW\n return(\"Slow\")\n else\n return(\"Unknown\")\n end\nend",
"def adc_a_c\n end",
"def aa_comp(aa_code=nil)\n if aa_code.nil?\n aa_map = {}\n IUPAC_CODE.keys.each do |k|\n aa_map[k] = 0.0\n end\n aa_map.update(aa_comp_map){|k,_,v| round(v, 1) }\n else\n round(aa_comp_map[aa_code], 1)\n end\n end",
"def chromatic_index(note)\n CHROMATICS[note.match(/^[A-G][#b]?/).to_s]\n end",
"def smart_aces hand\n# Adjusts the value of \"Ace\" elements to be either 1 or 11 depending on the hand total\n\thand_total = hand.reduce :+\n\tif hand_total < 12 && hand_total > 2\n\t\thand.map! do |card|\n\t\t\tif card == 1\n\t\t\t\t11\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total > 21\n\t\thand.map! do |card|\n\t\t\tif card == 11\n\t\t\t\t1\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total == 2\n\t\thand[0] = 11\n\tend\n\nend",
"def ace_count\n buf = 0.chr * 12 # sizeof(ACL_SIZE_INFORMATION)\n\n unless GetAclInformation(@acl, buf, buf.size, AclSizeInformation)\n raise Error, get_last_error\n end\n\n buf[0, 4].unpack('L')[0]\n end",
"def adc_a_a\n end",
"def accion_num\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n\n return_value = AccionNumReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_NUM168__ = nil\n __LPAR169__ = nil\n __Identificador170__ = nil\n __COMA172__ = nil\n __RPAR174__ = nil\n __EOL175__ = nil\n var_local171 = nil\n valor173 = nil\n\n\n tree_for_K_NUM168 = nil\n tree_for_LPAR169 = nil\n tree_for_Identificador170 = nil\n tree_for_COMA172 = nil\n tree_for_RPAR174 = nil\n tree_for_EOL175 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 168:4: K_NUM LPAR ( Identificador | var_local ) COMA valor RPAR EOL\n __K_NUM168__ = match( K_NUM, TOKENS_FOLLOWING_K_NUM_IN_accion_num_768 )\n if @state.backtracking == 0\n tree_for_K_NUM168 = @adaptor.create_with_payload( __K_NUM168__ )\n @adaptor.add_child( root_0, tree_for_K_NUM168 )\n\n end\n\n __LPAR169__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_accion_num_770 )\n if @state.backtracking == 0\n tree_for_LPAR169 = @adaptor.create_with_payload( __LPAR169__ )\n @adaptor.add_child( root_0, tree_for_LPAR169 )\n\n end\n\n # at line 168:15: ( Identificador | var_local )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == Identificador )\n alt_23 = 1\n elsif ( look_23_0 == DOUBLEDOT )\n alt_23 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 23, 0 )\n\n end\n case alt_23\n when 1\n # at line 168:16: Identificador\n __Identificador170__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_accion_num_773 )\n if @state.backtracking == 0\n tree_for_Identificador170 = @adaptor.create_with_payload( __Identificador170__ )\n @adaptor.add_child( root_0, tree_for_Identificador170 )\n\n end\n\n\n when 2\n # at line 168:30: var_local\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_accion_num_775 )\n var_local171 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local171.tree )\n end\n\n\n end\n __COMA172__ = match( COMA, TOKENS_FOLLOWING_COMA_IN_accion_num_778 )\n if @state.backtracking == 0\n tree_for_COMA172 = @adaptor.create_with_payload( __COMA172__ )\n @adaptor.add_child( root_0, tree_for_COMA172 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_accion_num_780 )\n valor173 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor173.tree )\n end\n\n __RPAR174__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_accion_num_782 )\n if @state.backtracking == 0\n tree_for_RPAR174 = @adaptor.create_with_payload( __RPAR174__ )\n @adaptor.add_child( root_0, tree_for_RPAR174 )\n\n end\n\n __EOL175__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_accion_num_784 )\n if @state.backtracking == 0\n tree_for_EOL175 = @adaptor.create_with_payload( __EOL175__ )\n @adaptor.add_child( root_0, tree_for_EOL175 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n\n end\n\n return return_value\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # zeros 2\n # conta corrente 7\n # digito da conta 1\n # complemento 6\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def getLetter100kID(column, row, parm)\n index = parm - 1\n colOrigin = ['A','J','S','A','J','S'][index].ord\n rowOrigin = ['A','F','A','F','A','F'][index].ord\n\n colInt = colOrigin + column - 1\n rowInt = rowOrigin + row\n rollover = false\n\n _A = 65\n _I = 73\n _O = 79\n _V = 86\n _Z = 90\n\n if (colInt > _Z)\n colInt = colInt - _Z + _A - 1\n rollover = true\n end\n\n if (colInt == _I or (colOrigin < _I and colInt > _I) or ((colInt > _I or colOrigin < _I) and rollover))\n colInt = colInt + 1\n end\n\n if (colInt == _O or (colOrigin < _O and colInt > _O) or ((colInt > _O or colOrigin < _O) and rollover))\n colInt = colInt + 1\n\n if (colInt == _I)\n colInt = colInt + 1\n end\n end\n\n if (colInt > _Z)\n colInt = colInt - _Z + _A - 1\n end\n\n if (rowInt > _V)\n rowInt = rowInt - _V + _A - 1\n rollover = true\n else\n rollover = false\n end\n\n if (((rowInt == _I) or ((rowOrigin < _I) and (rowInt > _I))) or (((rowInt > _I) or (rowOrigin < _I)) and rollover))\n rowInt = rowInt + 1\n end\n\n if (((rowInt == _O) or ((rowOrigin < _O) and (rowInt > _O))) or (((rowInt > _O) or (rowOrigin < _O)) and rollover))\n rowInt = rowInt + 1\n\n if (rowInt == _I)\n rowInt = rowInt + 1\n end\n end\n\n if (rowInt > _V)\n rowInt = rowInt - _V + _A - 1\n end\n\n return \"#{colInt.chr}#{rowInt.chr}\"\n end",
"def from_alpha(col)\n result = 0\n col = col.split(//)\n col.each_with_index do |c, i|\n result += (c.ord - 64) * (26**(col.length - (i + 1)))\n end\n result\n end",
"def from_alpha(col)\n result = 0\n col = col.split(//)\n col.each_with_index do |c,i|\n result += (c.ord - 64) * (26 ** (col.length - (i+1)))\n end\n result\n end",
"def set_fac_code_terms\n FAC_CODE_TERMS.each_pair do |c, v|\n # self[c] = (issue =~ Regexp.new(v, true)).nil? ? 0 : 1\n self[c] = Complaint.match(v, issue) ? 1 : 0\n end\n end",
"def genetic_code_table; 11; end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}00#{conta_corrente}#{digito_conta}#{''.rjust(8, ' ')}\"\n end",
"def cannabinoid_abbreviation; end",
"def nobasicas_indice_seq_con_id\n Msip::Ability::NOBASICAS_INDSEQID +\n Mr519Gen::Ability::NOBASICAS_INDSEQID +\n Heb412Gen::Ability::NOBASICAS_INDSEQID +\n Cor1440Gen::Ability::NOBASICAS_INDSEQID\n end",
"def set_agc(agc)\n puts \"Setting AGC to #{agc}\" if $verbose\n a='GT'+(('000'+agc.to_s)[-3..-1])+';'\n puts a if $verbose\n ret=send_cmd(a,'GT;',a,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^GT/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def nonterms_to_order_of_appearance_number\r\n order_numbers = Hash.new(1e10)\r\n next_free_number = 0\r\n order_numbers[@nonterms_in_order.first] = (next_free_number += 1)\r\n @nonterms_in_order.each do |nonterm|\r\n productions[nonterm].each do |production|\r\n\tproduction.elements.each do |element|\r\n\t if nonterms.include?(element) and order_numbers[element] == 1e10\r\n\t order_numbers[element] = (next_free_number += 1)\r\n\t elsif element =~ /list\\((\\w+), (\\w+)\\)/ # Hack!!\r\n\t order_numbers[$1] = (next_free_number += 1) if order_numbers[$1] == 1e10\r\n\t order_numbers[$2] = (next_free_number += 1) if order_numbers[$2] == 1e10\r\n\t elsif element =~ /^(\\w*)\\?$/\r\n\t order_numbers[$1] = (next_free_number += 1) if order_numbers[$1] == 1e10\r\n\t end\r\n\tend\r\n end\r\n end\r\n order_numbers\r\n end",
"def get_aa_array(initial_position = 0)\n @aa_array = []\n require_sequence = @dna_sequence[initial_position..-1].tr('-','N')\n base_array = []\n require_sequence.each_char {|base| base_array << base}\n while (base_array.length>=3) do\n base_3= \"\"\n 3.times{base_3 += base_array.shift}\n @aa_array<< amino_acid_2(base_3)\n end\n end",
"def acuse\r\n return false unless acuse?\r\n row = @acuse.shift\r\n return {\r\n id: row[0],\r\n destino: row[1],\r\n timestamp_acuse: row[2],\r\n estado: row[3].to_sym,\r\n timestamp_envio: row[4],\r\n texto: row[5] || ''\r\n }\r\n end",
"def calibration\n @cal_AC1, @cal_AC2, @cal_AC3, @cal_AC4, @cal_AC5, @cal_AC6, @cal_B1, @cal_B2,\n @cal_MB, @cal_MC, @cal_MD = i2cget(BMP085_CAL_AC1, 22).unpack('s>s>s>S>S>S>s>s>s>s>s>')\n end",
"def lccn\n s = subfield(\"010\", \"a\")\n return nil if s.empty?\n s.first.value\n end",
"def arith(b,opt=\"M\") return \"@SP\\nAM=M-1\\nD=M\\nA=A-1\\n\"+opt+\"=M\"+b+\"D\\n\" end",
"def validate_accession_number(accession_no,seq_type)\n is_valid_accession_no = false\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=AEE34859.1&api_key=e2eded7b94c28c0734a03b44d4a2d5a15308\n # check NCBI. to determine the accession_no is correct, grap the origin aa sequence and compare\n # documents about ncbi api\n # https://www.ncbi.nlm.nih.gov/books/NBK25500/#_chapter1_Downloading_Document_Summaries_\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&api_key=db1a6c70014467857721f83996c2c9d4a207&db=protein&id=AEE34859.1\n api_key = \"db1a6c70014467857721f83996c2c9d4a207\"\n ncbi_api = nil\n if seq_type == \"aa\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?api_key=#{api_key}&db=protein&id=#{accession_no}\"\n elsif seq_type == \"nt\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?api_key=#{api_key}&db=nuccore&id=#{accession_no}\"\n end\n\n ncbi_res = open(ncbi_api) # StringIO object\n if ncbi_res.status.include? \"200\"\n doc = Nokogiri::XML(ncbi_res.read)\n if doc.xpath('//ERROR').length == 0\n\n is_valid_accession_no = true\n\n end\n end\n\n return is_valid_accession_no\n\n end",
"def basic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n BASIC_AMINO_ACIDS.each do |basic|\n if comp[basic]\n count += comp[basic]\n end\n end\n return count\n end",
"def rc_to_alphanum(row:, column:)\n index_to_letter(row) + (column + 1).to_s\n end",
"def read_sequence (seq)\n g = 0\n a = 0\n t = 0\n c = 0\n # testen, ob uebergebenes Objekt einzelne Zeichen zurueckgeben kann\n if not seq.respond_to?(\"each_char\")\n return nil\n end\n # iteration ueber alle Symbole (in Großschreibweise) und Ermittlung\n # der absoluten Haeufigkeit der Basen\n seq.each_char do |base|\n base.upcase!\n if base == \"G\"\n g += 1\n elsif base == \"A\"\n a += 1\n elsif base == \"T\"\n t += 1\n elsif base == \"C\"\n c += 1\n else\n return nil\n end\n end\n return g,a,t,c\nend",
"def card_value(card)\n basic_value = card.to_i\n if card.start_with?(\"A\")\n basic_value = 11\n elsif basic_value == 0\n basic_value = 10\n end\n basic_value\n end",
"def ace?\n value == 'A'\n end",
"def adc_a_e\n end",
"def alphanumeric(row, column)\n alpha_r = ('A'..'H').to_a\n \"#{alpha_r[row]}#{column + 1}\"\n end",
"def _print_ace(a,b,species)\n ace=String.new\n a.each{|_a|\n next if b.nil? || _a.nil? ||b.size<1\n ace << \"Gene : \\\"#{_a}\\\"\\n\"\n b.each{|_b|\n ace << \"Ortholog #{_b} \\\"#{species}\\\" Inferred_automatically OrthoMCL\\n\"\n }\n ace << \"\\n\"\n }\n return ace\nend",
"def _print_ace(a,b,species)\n ace=String.new\n a.each{|_a|\n next if b.nil? || _a.nil? ||b.size<1\n ace << \"Gene : \\\"#{_a}\\\"\\n\"\n b.each{|_b|\n ace << \"Ortholog #{_b} \\\"#{species}\\\" Inferred_automatically OrthoMCL\\n\"\n }\n ace << \"\\n\"\n }\n return ace\nend",
"def type_accounting!()\n @type = TAC_PLUS_ACCT\n end",
"def letterToInt (c)\n\t\treturn c.ord() -'A'.ord() + 1\n\tend",
"def countAtoms(seq)\n\t\t\t\to = 0\n\t\t\t\tn = 0\n\t\t\t\tc = 0\n\t\t\t\th = 0\n\t\t\t\ts = 0\n\t\t\t\tp = 0\n\t\t\t\tse = 0\n\t\t\t\tseq.each_char do |aa|\n\t\t\t\t\to = o + MS::Feature::AA::ATOM_COUNTS[aa][:o]\n\t\t\t\t\tn = n + MS::Feature::AA::ATOM_COUNTS[aa][:n]\n\t\t\t\t\tc = c + MS::Feature::AA::ATOM_COUNTS[aa][:c]\n\t\t\t\t\th = h + MS::Feature::AA::ATOM_COUNTS[aa][:h]\n\t\t\t\t\ts = s + MS::Feature::AA::ATOM_COUNTS[aa][:s]\n\t\t\t\t\tp = p + MS::Feature::AA::ATOM_COUNTS[aa][:p]\n\t\t\t\t\tse = se + MS::Feature::AA::ATOM_COUNTS[aa][:se]\n\t\t\t\tend\n\t\t\t\treturn o,n,c,h,s,p,se\n\t\t\tend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def BCC(address:)\n unless set?(SR_CARRY)\n @program_counter += signed_int(@ram[address])\n end\n end",
"def calculate_accidental_from_pitch(value)\n ACCIDENTALS_FOR_PITCH[value % 12]\n end",
"def autonomous_system_number; end",
"def flag_ac\n reg_flag[FLAG_AUX_CARRY]\n end",
"def dnaSequence s\n hash, diff = Hash.new(0), Hash.new(0)\n diff[[0, 0, 0]] = 1\n\n sum = 0\n s.chars.each { |c|\n hash[c] += 1\n res = [hash['A'] - hash['C'], hash['C'] - hash['G'], hash['G'] - hash['T']]\n sum += diff[res]\n diff[res] += 1\n }\n sum\nend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def single_card_value(card)\n case card[1].strip\n when \"2\"..\"10\" then card[1].to_i\n when \"J\", \"Q\", \"K\" then 10\n when \"A\" then 11\n end\nend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end",
"def type\n :american\n end",
"def pcba_unique_number\n self.pcba_prefix + '-' + self.pcba_number\n end",
"def mapping_rule\n @mapping_rule = {}\n prev = 100\n [\"A_grade_min\", \"A_minus_grade_min\", \"B_plus_grade_min\", \"B_grade_min\", \"B_minus_grade_min\", \"C_plus_grade_min\", \"C_grade_min\", \"C_minus_grade_min\"].each do |attr_name|\n key = attr_name.gsub(\"_grade_min\", \"\").gsub(\"_minus\", \"-\").gsub(\"_plus\", \"+\")\n @mapping_rule[key] = prev if attr_name ==\"A_grade_min\"\n attr = self.read_attribute(attr_name)\n if attr.nil?\n @mapping_rule[key] = prev\n prev = attr - 0.1 unless attr.nil?\n end\n [\"R\", \"W\", \"I\"].each do |attr|\n @mapping_rule[attr] = 0\n end\n end\n @mapping_rule\n end",
"def calculate_nus_matric_number(id)\n matric_regex = /^A\\d{7}|U\\d{6,7}/\n matches = matric_regex.match(id.upcase)\n\n if (matches)\n match = matches[0]\n\n if (match[0].eql?('U') && match.length === 8)\n match = match[0, 3] + match[4]\n end\n\n weights = {\n U: [0, 1, 3, 1, 2, 7],\n A: [1, 1, 1, 1, 1, 1]\n }\n\n weights = weights[:\"#{match[0]}\"]\n\n sum = 0\n digits = match[2, 7]\n\n for i in 0..6 do\n sum += weights[i].to_i * digits[i].to_i\n end\n\n match.to_s + 'YXWURNMLJHEAB' [sum % 13]\n end\nend",
"def nucleotide_score\n {\n A: 0,\n C: 0,\n G: 0,\n T: 0\n }\nend",
"def nucleotide_score\n {\n A: 0,\n C: 0,\n G: 0,\n T: 0\n }\nend",
"def argot_rollup_id(spec)\n lambda do |rec, acc|\n extractor = MarcExtractor.cached(spec, separator: nil)\n oclc_num = extractor.extract(rec).collect! do |o|\n Marc21Semantics.oclcnum_extract(o)\n end.compact\n acc << \"OCLC#{oclc_num.first}\"\n end\n end",
"def value(hand)\n # Sorting hack to get aces at the very end so we count them last\n hand.sort_by { |c| c.to_i != 0 ? c : c[0] - 81 }.reverse().inject(0) do |total,cur|\n if cur.to_i != 0\n total + cur # 2-10 case\n elsif [\"J\",\"Q\",\"K\"].include? cur\n total + 10 # J,Q, or K\n elsif cur == \"A\"\n if (total+11) > 21\n total + 1 # Count ace as 1\n else\n total+11 # Count ace as 11\n end\n end\n end\n end",
"def incc(cat)\n @cc[cat] ||= 0\n @cc[cat] += 1\n end",
"def per_trip_accom\n accom_cost\n end",
"def bib_number\n get_id_from_lane_assignment(competition, heat, lane) || 0\n end",
"def __card_value( card )\n\tnumber = card.split( '' )[ 0 ]\n\n\tif 'T' == number\n\t\tnumber = 10\n\telsif 'J' == number\n\t\tnumber = 11\n\telsif 'Q' == number\n\t\tnumber = 12\n\telsif 'K' == number\n\t\tnumber = 13\n\telsif 'A' == number\n\t\tnumber = 14\n\tend\n\n\treturn number\nend",
"def find_ace(prin_id, acc_type, priv_id, res_ob_id) \n query = \"#{@doc}//#{self.class.name}s/descendant::*\n[Principal/@idref=\\\"#{prin_id}\\\" and accessType=\\\"#{acc_type}\\\" and \nPrivilege/@idref=\\\"#{priv_id}\\\" and ResourceObject/@idref=\\\"#{res_ob_id}\\\"]\n/string(@id)\"\n handle = @connector.execute_query(query)\n hits = @connector.get_hits(handle)\n case hits\n when 1\n ace_id = @connector.retrieve(handle, 0)\n if(ace_id == \"\") #eXist returns empty result => should return no result\n return nil\n else\n return ace_id\n end\n \n when 0\n return nil\n else\n raise RubyACLExceptionRubyACLException.new(self.class.name, __method__,\n \"#{self.class.name} \nPrincipal=\\\"#{prin_id}\\\" and accessType=\\\"#{acc_type}\\\" and \nPrivilege=\\\"#{priv_id}\\\" and ResourceObject=\\\"#{res_ob_id}\\\" \nexists more then once. (#{hits}x)\", 220), caller\n end\n rescue => e\n raise e\n end",
"def total\n total = 0\n aces = 0\n @hand.each do |card|\n case card[0]\n when 2..10 then total += card[0]\n when 'A' then aces += 1\n else total += 10\n end\n end\n total += add_aces(total, aces)\n total\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end",
"def upc_a\n generate_barcode('barcode.upc_a')\n end",
"def match_agency_ref_by_name name\n\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\n\t\tagency_code = $1.to_s\n\n\t\treturn agency_code \n\tend",
"def match_agency_ref_by_name name\n\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\n\t\tagency_code = $1.to_s\n\n\t\treturn agency_code \n\tend",
"def mapping\n {\n \"ch\" => 4,\n \"co\" => 3,\n \"gen\" => 0,\n \"char\" => 4,\n \"copy\" => 3,\n \"art\" => 1,\n \"meta\" => 5,\n \"general\" => 0,\n \"character\" => 4,\n \"copyright\" => 3,\n \"artist\" => 1,\n }\n end",
"def apobec3gf(seq = \"\")\n seq.tr!(\"-\", \"\")\n seq_length = seq.size\n apobec_position = []\n control_position = []\n (0..(seq_length - 3)).each do |n|\n tri_base = seq[n,3]\n if tri_base =~ /G[A|G][A|G|T]/\n apobec_position << n\n elsif seq[n] == \"G\"\n control_position << n\n end\n end\n return [apobec_position,control_position]\nend",
"def match_agency_ref_by_name name\r\n\r\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\r\n\t\tagency_code = $1.to_s\r\n\r\n\t\treturn agency_code \r\n\tend",
"def cardinal; end",
"def match_agency_ref_by_name name\r\n\t\treturn nil unless name =~ /([0-9]+)_[0-9]+/\r\n\t\tagency_code = $1.to_s\r\n\r\n\t\treturn agency_code \r\n\tend",
"def score_aces(cards_aces, score_without_aces)\n # first, assume all \"ace\" cards score as 1\n aces_count = cards_aces.count\n return 0 if aces_count.zero?\n\n # check if we can convert one ace card to 11\n if (score_without_aces + aces_count <= 11)\n 11 + (aces_count - 1)\n else\n # all ace cards still score as 1\n aces_count\n end\n end",
"def ticket_airline(accounting_element)\n\t \taccounting_element[:airline][:@code]\n\t end"
] | [
"0.61729413",
"0.60010636",
"0.59769976",
"0.57690585",
"0.57093006",
"0.570085",
"0.5603868",
"0.557024",
"0.55517805",
"0.5512673",
"0.54792017",
"0.5424732",
"0.54194164",
"0.5395567",
"0.5365008",
"0.5357663",
"0.5346508",
"0.5346019",
"0.5343276",
"0.531822",
"0.5261729",
"0.52554",
"0.5235656",
"0.5227423",
"0.5221444",
"0.5183333",
"0.5181645",
"0.5180621",
"0.5160327",
"0.51433444",
"0.5136345",
"0.51281685",
"0.51096344",
"0.5100305",
"0.50803214",
"0.5059733",
"0.503773",
"0.500022",
"0.49974063",
"0.49934822",
"0.49873087",
"0.49850577",
"0.49849263",
"0.49849263",
"0.49726605",
"0.49665326",
"0.49622235",
"0.4956455",
"0.49562576",
"0.49555603",
"0.4949134",
"0.494554",
"0.49430794",
"0.49302775",
"0.49196145",
"0.49196047",
"0.4908158",
"0.49005476",
"0.48952204",
"0.48950177",
"0.48911053",
"0.48818654",
"0.48818654",
"0.48812687",
"0.4874653",
"0.48504576",
"0.48487952",
"0.48409045",
"0.48289514",
"0.48284233",
"0.48283502",
"0.48204333",
"0.48177725",
"0.48170874",
"0.48137888",
"0.4813511",
"0.4811971",
"0.480795",
"0.4805977",
"0.4799746",
"0.4799746",
"0.47961196",
"0.47899404",
"0.47863784",
"0.4782417",
"0.47779226",
"0.4774125",
"0.4766789",
"0.47657502",
"0.4762794",
"0.47566047",
"0.47538012",
"0.47538012",
"0.4750278",
"0.4746203",
"0.4741453",
"0.47411475",
"0.47399378",
"0.47252575",
"0.47249842"
] | 0.61634475 | 1 |
DT Date (1 per entry) DT DD.MM.YYYY (created); ewi. DT DD.MM.YYYY (updated); mpr. | def dt
field_fetch('DT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def add_date\n @bib.date.each do |d|\n case d.type\n when \"published\"\n @item.year = d.on :year\n month = d.on :month\n @item.month = month if month\n when \"accessed\" then @item.urldate = d.on.to_s\n end\n end\n end",
"def date() updated; end",
"def read_date; end",
"def modification_date; end",
"def updated_date\n extractor = MarcExtractor.new(\"907b\", :first => true)\n lambda do |record, acc|\n datestr = extractor.extract(record).first\n begin\n date = Date.strptime(datestr, \"%m-%d-%y\")\n acc << solr_date(date)\n rescue ArgumentError\n yell.debug \"Unable to parse datestr #{datestr}\"\n end\n end\n end",
"def date_time_reference\n ['DTM', '405', @batch.date.strftime(\"%Y%m%d\")].join(@element_seperator)\n end",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def crdt\n @pubmed['CRDT'].strip # in the form 2005/06/10\n end",
"def date() self[:date]; end",
"def data_upload_date\n formatted_timestamp(data['modifyDate'])\n end",
"def modification_date=(_); end",
"def dates\n end",
"def date\n result_hash['dte']\n end",
"def read_date=(_); end",
"def creation_date=(_); end",
"def date_updated\n updated_at.strftime(\"%b %d, %Y\")\n end",
"def display_date dt, dFlg=true\r\n ListingDataProcessor.new(self).display_date dt, dFlg\r\n end",
"def packed_update_date\n all_characters[(content_offset + 2)*characters_per_word, 8].join\n end",
"def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def statement_to_date\n end",
"def create_date\n data.create_date\n end",
"def create_date\n data.create_date\n end",
"def create_date\n data.create_date\n end",
"def get_object_sortable_date\n\t\tdate = nil\n if descMetadata.origin_info && (descMetadata.origin_info.date_issued || descMetadata.origin_info.date_valid)\n\t\t\tbegin\n\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first.to_s\n\t\t\t\tdate_issued = descMetadata.origin_info.date_issued.first.to_s\n\t\t\t\t\t\n\t\t\t\tif date_valid.size > 0\n\t\t\t\t\tdate_valid = descMetadata.origin_info.date_valid.first\n\t\t\t\t\tif date_valid.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_valid[date_valid.index('/')+1..date_valid.size])\n\t\t\t\t\telse\n\t\t\t\t\t\t\tval = to_long_date(date_valid) \n\t\t\t\t\tend\n\t\t\t\telsif\tdate_issued.size > 0\n\t\t\t\t\tif date_issued.include? \"/\"\n\t\t\t\t\t\t\tval = to_long_date(date_issued[date_issued.index('/')+1..date_issued.size])\n\t\t\t\t\telse\t\t\t\n\t\t\t\t\t\tval = to_long_date(descMetadata.origin_info.date_issued.first)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\t\t\tif val\n\t\t\t\t\tdate = Time.parse val\n\t\t\t\tend\n\t\t\trescue ArgumentError => e\n #nop\n end\n\t\tend\n\tend",
"def datum\nt = Time.now\ndate = t.strftime(\"%y%m%d\")\nend",
"def _update_date\n all_characters[(content_offset + 2)*characters_per_word, 8].join\n end",
"def listing_date() self.created_at.strftime('%a %b %d, %Y') end",
"def easy_date; date; end",
"def date\n dreport.date_format\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def date_updated\n Time.parse(@attrs['DateUpdated'])\n end",
"def departureDate = (value)",
"def created_at; @doc['created_at']; end",
"def date; raw_changeset.time; end",
"def creation_date\n data.creation_date\n end",
"def collect_posting_date(doc, offer_object)\n puts \"Mining posting date\"\n meta = doc.at('script:contains(\"localeData\")')\n # extract CDATA\n meta = meta.children[0].content\n date = meta.match(/Creation-Date:([^\\\\]+)/)[1]\n date[0] = ''\n offer_object[:posting_date] = date.to_datetime\n end",
"def date(name)\n input(name + \"_m\", 2, 2) + \" / \" +\n input(name + \"_d\", 2, 2) + \" / \" +\n input(name + \"_y\", 4, 4)\n end",
"def publication_date\n the_date = nil\n return the_date if @pubmed['DP'].blank?\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9] [a-zA-Z]+)-([0-9][0-9][0-9][0-9] [a-zA-Z]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.split(\"-\")[1]\n end\n if @pubmed['DP'].strip =~ /([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i\n @pubmed['DP'] = @pubmed['DP'].strip.gsub(/([0-9][0-9][0-9][0-9]) ([a-zA-Z]+ [0-9]+)-([a-zA-Z]+ [0-9]+)/i, '\\1 \\3')\n end\n pubdate=@pubmed['DP'].strip.split(\" \")\n year_range = pubdate[0].split(\"-\")\n if year_range.length > 1\n pubdate[0] = year_range[1]\n end\n if pubdate.length > 1\n month_range = pubdate[1].split(\"-\")\n if month_range.length > 1\n pubdate[1] = month_range[1]\n end\n pubdate[1] = case pubdate[1] \n when /spring/i then 'Mar'\n when /summer/i then 'Jun'\n when /fall|autumn/i then 'Sep'\n when /winter/i then 'Dec'\n else pubdate[1]\n end\n end\n if pubdate.length > 2\n day_range = pubdate[2].split(\"-\")\n if day_range.length > 1\n pubdate[2] = day_range[1]\n end\n the_date = pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n the_date = '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n the_date = '01-JAN-'+ pubdate[0]\n end\n return the_date\n end",
"def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end",
"def publication_date\n end",
"def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end",
"def dates\n entries = Entry.all\n $dates_array = Array.new\n entries.each do |entry|\n $dates_array << entry.created_at.strftime(\"%Y-%m-%d\")\n end\n $dates_array.uniq\n end",
"def day() end",
"def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"def fix_dates( data )\n\n ## check for missing / no dates \n ## examples\n ## - rubytogether feed @ https://rubytogether.org/news.xml\n data.items.each do |item|\n if item.updated.nil? &&\n item.published.nil?\n ## try to get date from slug in url\n ## e.g. /news/2019-10-17-growing-ruby-together\n if (m=FIX_DATE_SLUG_RE.match( item.url ))\n ## todo/fix: make sure DateTime gets utc (no timezone/offset +000)\n published = DateTime.new( m[:year].to_i(10),\n m[:month].to_i(10),\n m[:day].to_i(10) )\n item.published_local = published\n item.published = published\n end\n end\n end\n\n \n ## check if all updated dates are the same (uniq count is 1)\n ## AND if all published dates are present\n ## than assume \"fake\" updated dates and nullify updated dates\n ## example real-world \"messed-up\" feeds include:\n ## - https://bundler.io/blog/feed.xml\n ## - https://dry-rb.org/feed.xml\n ##\n ## todo/check - limit to atom feed format only - why? why not?\n\n count = data.items.size\n count_published = data.items.reduce( 0 ) {|count,item| count += 1 if item.published; count }\n\n if count == count_published\n uniq_count_updated = 0\n last_updated = nil\n\n data.items.each do |item|\n uniq_count_updated += 1 if item.updated != last_updated\n last_updated = item.updated\n end\n\n if uniq_count_updated == 1\n puts \"bingo!! nullify all updated dates\"\n ## todo/fix: log report updated date fix!!!!\n data.items.each do |item|\n item.updated = nil\n item.updated_local = nil\n end\n end\n end\n end",
"def mday() end",
"def date\n @date\n end",
"def date\n @date\n end",
"def day; end",
"def getDate(day, month, year)\n day << @day\n month << @month\n year << @year\n end",
"def date\n @date\n end",
"def date\n @date\n end",
"def duedate\n @date\n end",
"def date_of_change\n created_at.display_date\n end",
"def date_of_change\n created_at.display_date\n end",
"def created_at\n data['creationDate'].to_date\n end",
"def entered_senedd\n representations.first.log_date\n end",
"def creation_date\n data[:creation_date]\n end",
"def date\n model.created_at.strftime(\"%d-%b-%Y\")\n end",
"def date_tod(dt, tm)\n DateTime.parse \"#{fmt_date(dt)} #{tm}\"\n end",
"def formatted_date(dt, format=\"%m/%d/%Y\")\n\t\tDate.strptime(dt, '%Y-%m-%d').strftime(format)\n\tend",
"def post_date\n find_post_content @file_contents, '<p class=\"date\">', 4\n end",
"def date_str d\n Util::date(d)\n end",
"def dncDate(dnc)\n if dnc.date == nil\n \"\"\n else\n dnc.date.strftime(\"%m/%d/%y\")\n end\n end",
"def get_date(row_data)\n values = row_data.to_s.chomp.split(' ')\n month = values.map { |token| MONTHS[token.downcase] }.compact.first\n year = values.find { |token| /\\d{4}/ =~ token }\n date = Date.new(year.to_i, month)\n @latest_date = date if latest_date < date\n date\n end",
"def process_date(ddtt)\n #puts \"\\nPROCESS_DATE\"\n if(ddtt)\n text_date=\"\"\n text_date = ddtt.strftime(\"%A, %d %B, %Y at %H:%m%p\")\n return text_date\n else\n return nil\n end\nend",
"def return_date\n\t\tif(last_line_modified_date && last_modified_date != nil)\n\t\t\tif(last_line_modified_date <= last_modified_date)\n\t\t\t\treturn last_line_modified_date()\n\t\t\telse\n\t\t\t\treturn last_modified_date()\n\t\t\tend\n\t\telse\n\t\t\treturn '2000-01-01'\n\t\tend\n\tend",
"def fmt_dow_date(dt) _format_dt dt, DOW_M_D end",
"def to_date()\n #This is a stub, used for indexing\n end",
"def publication_date\n Time.parse self.table[:publication_date]\n end",
"def data_geracao\n Date.current.strftime('%d%m%Y')\n end",
"def data_geracao\n Date.current.strftime('%d%m%Y')\n end",
"def create_date_month_day\n\t\tcreated_at.to_date.to_formatted_s(:short)\n\tend",
"def date\n object.date.strftime(\"%m/%d/%Y\")\n end",
"def by_date(year, month, day)\n request = @client.call(:recupera_tc_dia, message: {\n Ano: year,\n Mes: month,\n Dia: day\n })\n\n request.body[:recupera_tc_dia_response][:recupera_tc_dia_result]\n end",
"def creation_date\n stat.ctime\n end",
"def date \n\t\tI18n.l(moment, format: :date_long)\n\tend",
"def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend",
"def date\n updated_at.strftime(\"%d %b %y %H:%M\")\n end",
"def created_at; end",
"def get_date()\n @date\n end",
"def get_date()\n @date\n end",
"def formatted_date\n \tobject.created_at.strftime(\"%R - %B %e, %Y \")\n end",
"def updateAudiopost(showHTML, firstTime, dbLastDay)\n audiopostUpdateArray = []\n fetchAudiopost = getEpisodeInfo(showHTML, firstTime)\n fetchAudiopost.each do |i|\n \t#puts Date.strptime(i.date[0..1]+'-'+i.date[3..4]+'-'+i.date[6..9], '%d-%m-%Y')\n \t#puts i.date\n if i.date > dbLastDay \n #we need to turn the i.date into datevalue\n audiopostUpdateArray.push(i) \n end\n end\n return audiopostUpdateArray\nend",
"def mday\n end",
"def extract_date(day)\n [day.year, day.month, day.day]\n end",
"def created_date\n details[\"created_at\"].to_date.strftime(\"%m/%d/%Y\")\n end",
"def date(input, format); end",
"def __evolve_date__\n map { |value| value.__evolve_date__ }\n end",
"def datacite_available_date\n res = resources.files_published.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end",
"def article_date(article, format=':nday, :nmonth :day:ordinal :year — :hour12::minute :meridian')\n (article.published_at || article.updated_at).eztime(format)\n end",
"def create_date(post)\n \" created at: \" + post.created_at.strftime(\"%d %b. %Y\") + \" - \" + post.created_at.strftime(\"%H:%M\") \n end",
"def article_date(article, format=':nday, :nmonth :day:ordinal :year — :hour12::minute :meridian')\n (article.published_at || article.updated_at).eztime(format)\n end",
"def create_date\n\t\tcreated_at.to_date\n\tend"
] | [
"0.64901584",
"0.64901584",
"0.64901584",
"0.64901584",
"0.6408105",
"0.6398278",
"0.6334681",
"0.62907463",
"0.6274645",
"0.6241588",
"0.6197172",
"0.6131131",
"0.6110888",
"0.61002123",
"0.6071945",
"0.6035028",
"0.60025036",
"0.59964055",
"0.5996035",
"0.59764814",
"0.59519476",
"0.59410197",
"0.59176147",
"0.5908166",
"0.5908166",
"0.5908166",
"0.5905184",
"0.5905184",
"0.5905184",
"0.589388",
"0.58837765",
"0.58836484",
"0.58624345",
"0.58269083",
"0.5823136",
"0.5763933",
"0.5763933",
"0.574147",
"0.57325566",
"0.5727247",
"0.5724663",
"0.5707925",
"0.56871045",
"0.56780595",
"0.5677427",
"0.5672595",
"0.56718916",
"0.56614304",
"0.56601113",
"0.5651685",
"0.5644833",
"0.56435865",
"0.5643579",
"0.5643579",
"0.5640271",
"0.5631887",
"0.5623933",
"0.5623933",
"0.562294",
"0.5610263",
"0.5610263",
"0.56077987",
"0.56028384",
"0.5579301",
"0.5563221",
"0.5558319",
"0.55474883",
"0.55400896",
"0.5524555",
"0.55197966",
"0.5502095",
"0.54928464",
"0.54926413",
"0.548715",
"0.5485907",
"0.54817134",
"0.5480074",
"0.5480074",
"0.54769814",
"0.54727834",
"0.5470338",
"0.5466192",
"0.54652107",
"0.54632646",
"0.5462727",
"0.5460236",
"0.5458038",
"0.5458038",
"0.545743",
"0.5457008",
"0.545412",
"0.5451835",
"0.54467046",
"0.54410267",
"0.54359907",
"0.54334676",
"0.5430509",
"0.54296297",
"0.5428862",
"0.54202807"
] | 0.6169319 | 11 |
NA Name of the binding factor | def na
field_fetch('NA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nilBinding; ProcFactory.new.create.binding end",
"def nonexisting_name\n\t\t\t\treturn self unless self.may_exist?\n\t\t\t\tnew_name(Proc.new {|f| !f.may_exist?}) do |old_name, ind|\n\t\t\t\t\told_name.append_name(\"%02d\" % ind)\n\t\t\t\tend\n\t\t\tend",
"def name\n \"dummy\"\n end",
"def name\n nil\n end",
"def ndp_reserved; self[:ndp_reserved].to_i; end",
"def nonblank_name\n if name.to_s == \"\"\n wrapped.inspect\n else\n name\n end\n end",
"def to_nvar(name)\n name[0] == at ? name[1..-1].to_sym : name.to_sym\n end",
"def name\n nil\n end",
"def fine_name\r\n nil\r\n end",
"def get_na_label\n \"<span class='label label-default'><i class='fas fa-ban' aria-hidden='true'></i> N/A</span>\".html_safe\n end",
"def name\n ''\n end",
"def lose_n_labels(name, n)\n if (name.labels.length <= n)\n return EMPTY_NAME # Name.create(\".\")\n end\n n = Name.new(name.labels()[0, name.labels.length-n], name.absolute?)\n return n\n end",
"def default_name\n \"Dux::NullObject(#{inspect_id(self)})\"\n end",
"def undefined_names\n @undef ||= @rhs_names - @lhs_names\n @undef\n end",
"def coin_name(coin: T.unsafe(nil)); end",
"def bel_parameter_without_namespace\n value = Rantly.value {\n sized(range(3,10)) {\n string(/[[:alnum:]]|[[:blank:]]|[[:punct:]]/)\n }\n }\n BEL::Nanopub::Parameter.new(\n nil,\n value,\n :A\n )\n end",
"def grpNull \n \"grpNull\" \n end",
"def indefinite_name\n return \"something\"\n end",
"def name\n self.pcb_name + ' / ' + self.pcba_name\n end",
"def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end",
"def new_dummy_label\n @dummy_label_index ||= 0\n @dummy_labels ||= (\"a\"..\"aaaaaa\").to_a\n dummy_label = @dummy_labels[@dummy_label_index]\n @dummy_label_index += 1\n dummy_label\n end",
"def name_no_group\n has_attribute?(\"name_no_group\") ? self[\"name_no_group\"] : nickname || name\n end",
"def label\n \"\"\n end",
"def default_bd_name\n 'Bridge-Domain' + @bd_ids\n end",
"def notename\n self.class.notename_s(notename_i)\n end",
"def get_name_middleman\n name ? name : 'N/a'\n end",
"def label name\n UnknownLabel.new(name)\n end",
"def nodename\n options[:nodename]\n end",
"def name\n @n.to_s + characterization\n end",
"def name\n not_yet\n end",
"def anonymous_name\n @@sequence ||= 0 # not inherited, don't want it to be\n @@sequence += 1\n \"anon.#{Time.now.to_i}.#{@@sequence}\"\n end",
"def blank_nodes\n bindings.values.select {|v| v.is_a?(RDF::Node)}.uniq\n end",
"def empty_binding # :nodoc:\n binding\n end",
"def undefined_parameter_type_name; end",
"def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end",
"def missing_name?(name)\n if name.is_a? Symbol\n last_name = (missing_name || '').split('::').last\n last_name == name.to_s\n else\n missing_name == name.to_s\n end\n end",
"def variable_name; end",
"def variable_name; end",
"def to_label\n \"#{person.nil? ? '' : person.name}\"\n end",
"def logi_bill_name_bill\n logi_bill ? logi_bill.name_bill : 'N/a'\n end",
"def label\r\n\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\tend",
"def label\r\n\t\t\tname.match(/\\?$/) ? name : name + \":\"\r\n\t\tend",
"def name\n @name || \"Unspecified\"\n end",
"def ___\n Blank.()\n end",
"def name_with_formatting\n (self.name.blank?) ? 'N/A' : self.name\n end",
"def name\n fail\n end",
"def label\r\n\t\t''\r\n\tend",
"def full_label\n ''\n end",
"def label\n @label || \"unknown\"\n end",
"def phys_adapter_name\n new_resource.vlan.nil? ? new_resource.device : \"#{new_resource.device}-NIC\"\n end",
"def none\n NationalSplitters::None.instance_for\n end",
"def binding_n(n = 0)\n Debugger.current_context.frame_binding[n+1]\n end",
"def real_name; end",
"def name\n name = \"\"\n end",
"def name\n name = \"\"\n end",
"def binding_n(n = 0)\n Debugger.current_context.frame_binding[n+1]\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:neighbor]} #{self[:afi]} \" \\\n \"#{self[:safi]}\"\n end",
"def name(n)\n\tn.sample\nend",
"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(prefix = T.unsafe(nil)); end",
"def name(prefix = T.unsafe(nil)); end",
"def name(prefix = T.unsafe(nil)); end",
"def name\n name_priorities.each do |method|\n n = send(method)\n return n unless n.blank?\n end\n end",
"def name\n problem\n end",
"def nomenclator_name \n case @rank\n # TODO: update for infrasubspecifics if we start tracking those\n when 'species', 'subspecies', 'genus', 'subgenus', 'variety'\n nomenclator_array.compact.join(\" \")\n else\n @name\n end\n end",
"def vrf_name\n return :default if @resource[:vrf_name] == :default &&\n @property_hash[:vrf_name] ==\n @aaa_group.default_vrf\n @property_hash[:vrf_name]\n end",
"def fathers_name\n\t\tfathersname = fathers_names.delete_if(&:blank?).join(' ')\n\t\t( fathersname.blank? ) ? '[name not available]' : fathersname\n\tend",
"def name\n @name ||= @data[:cn].last\n end",
"def pool_name()\n #This is a stub, used for indexing\n end",
"def calcIUPACname\n getIncompleteName + Constants::ALKANE_SFIX\n end",
"def aceite\n 'N'\n end",
"def name_or_none\n name || \"\"\n end",
"def ndp_lla; self[:ndp_lla].to_s; end",
"def value\n nsdname.to_s\n end",
"def name(variable=default)\n\t\t ### The last line in here get's returned by default\n\t\tend",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:afi]} #{self[:safi]} #{self[:aa]}\"\n end",
"def name\n \"#{@namespace}:bf\"\n end",
"def notify_binding_problem\n end",
"def netObjNull \n \"netObjNull\" \n end",
"def ndp_type; self[:ndp_type].to_i; end",
"def display_name(attr)\n attr.name unless attr.nil?\n end",
"def nbd_device\n sys_parts = lsblk('')\n nbds = []\n\n sys_parts.each do |p|\n m = p['name'].match(/nbd(\\d+)/)\n next unless m\n\n nbds << m[1].to_i\n end\n\n nbds_max.times do |i| # if nbds_max returns 0 block is skipped\n return \"/dev/nbd#{i}\" unless nbds.include?(i)\n end\n\n OpenNebula.log_error(\"#{__method__}: Cannot find free nbd device\")\n\n ''\n end",
"def name\n recipient.name.nil? ? \"NA\" : recipient.name\n end",
"def human_name(klass = T.unsafe(nil)); end",
"def human_name(klass = T.unsafe(nil)); end",
"def alternate_name(namespace)\n\t\tif ( ! @alternate_name[namespace] )\n\t\t\traise MonosaccharideException.new(\"No name defined in namespace #{namespace} for #{name}\")\n\t\tend\n\t\treturn @alternate_name[namespace]\n\tend",
"def name\n @name || 'generic'\n end",
"def varietal_name\n if varietal.nil? || varietal.name.nil?\n return nil\n else\n varietal.name\n end\n end",
"def binding_params\n params.require(:binding).permit(:name)\n end",
"def name(_)\n\n end",
"def base_metric_name\n nil\n end",
"def to_nvar(name)\n self.class.to_nvar(name)\n end",
"def format_name\n name ? name.observation_name : \"\"\n end"
] | [
"0.5598792",
"0.5574257",
"0.5553878",
"0.5454623",
"0.54373753",
"0.5409184",
"0.5382266",
"0.5378362",
"0.536445",
"0.53516304",
"0.534592",
"0.5294941",
"0.5284641",
"0.5239776",
"0.5176041",
"0.5160207",
"0.5159699",
"0.5142772",
"0.51082367",
"0.5091374",
"0.5082392",
"0.5079399",
"0.5068086",
"0.5063135",
"0.5062606",
"0.5022795",
"0.50159854",
"0.50115377",
"0.50078684",
"0.5004463",
"0.5001273",
"0.4966855",
"0.49654832",
"0.49444366",
"0.49431056",
"0.49431056",
"0.49220946",
"0.49220946",
"0.491468",
"0.4907528",
"0.4905042",
"0.48984885",
"0.48964602",
"0.48950496",
"0.48928973",
"0.48925722",
"0.48875657",
"0.48842126",
"0.488358",
"0.48822677",
"0.48814732",
"0.48778382",
"0.48682377",
"0.48672774",
"0.48672774",
"0.4864572",
"0.48532334",
"0.48501226",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48480338",
"0.48415187",
"0.48415187",
"0.48415187",
"0.48373964",
"0.48348367",
"0.48292407",
"0.48278162",
"0.4820761",
"0.48189262",
"0.48177668",
"0.48143566",
"0.48126692",
"0.481042",
"0.48092067",
"0.4803158",
"0.4802718",
"0.4780801",
"0.47774693",
"0.47758037",
"0.47723255",
"0.47568232",
"0.47546497",
"0.47424662",
"0.47380808",
"0.47366443",
"0.47366443",
"0.47364727",
"0.47360915",
"0.47332877",
"0.47299984",
"0.47259605",
"0.47189862",
"0.47186092",
"0.47101575"
] | 0.5278881 | 13 |
DE Short factor description | def de
field_fetch('DE')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def long_description\n return 'invalid' unless self.is_valid?\n \"#{VALUE_DESCRIPTIONS[self.value_index].capitalize} of #{self.suit.to_s.capitalize}\"\n end",
"def description_and_dosage\n \t\"#{self.name} #{self.dosage}#{MedicationOrder.human_enum_name(:units, self.unit)} #{MedicationOrder.human_enum_name(:routes, self.route)} #{self.order_frequency.value} #{OrderFrequency.human_enum_name(:units,self.order_frequency.unit)} to #{self.necessity}\"\n end",
"def short_description\n description\n end",
"def description\n description = super\n if description.blank?\n if quantity.blank? || measure.blank?\n description\n else\n measure = self.measure.dup\n if quantity == '1'\n measure.slice!(measure.index('(')..-1)\n else\n measure.gsub!(/[()]/, '')\n end\n \"#{quantity} #{measure} #{variety}\".strip\n end\n else\n description\n end\n end",
"def description\n pricing_db_hp_short_description.description\n end",
"def descr_value\n @value.to_s\n end",
"def desc() summary; end",
"def describe\n return @magnitude.to_s if magnitude?\n u_descr = Units.units_descr(@units, true)\n \"#{@magnitude} #{u_descr}\"\n end",
"def formal_description\n @data['formalDescription']\n end",
"def modeler_description\n return 'This measure receives the power density level from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current power density of each case and it substitute it with the level chosen by the user.'\n end",
"def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end",
"def indefinite_short_description\n return \"something\"\n end",
"def to_s\n descr\n end",
"def short\n quality + number.to_s \n end",
"def description\n \"#{@number}, #{@symbol}, #{@color}, #{@shading}\"\n end",
"def short_description\n object.description[0..40] if object.description.present?\n end",
"def description\n return summary\n end",
"def short_description\n\t\tself.description[0..200] + '...'\n\tend",
"def to_s\n descr_value\n end",
"def long_appearance\n # How Med does it:\n # description\n # glance\n # eq\n # inventory\n \"{!{FG#{description}\\n\\n{FY{#{short_name} is in excellent condition.\"\n end",
"def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend",
"def short_description\n if respond_to?(:short_desc)\n short_desc\n else\n tag.to_s\n end\n end",
"def shortdesc\n @obj['shortdesc']\n end",
"def modeler_description\r\n return \"E+ measure to popolate the Kiva settings values\"\r\n end",
"def descr\n return text_get(2, id)\n end",
"def description d\n @description = d\n end",
"def shortdesc\n @data['shortdesc']\n end",
"def transport_descr_short\n descr = self[:transportdescription].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def base_description(_); end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def short_description\n if @model\n return (@short_description || @model.short_description.to_s)\n end\n return @short_description.to_s\n end",
"def level_with_descript\n\t\t\"#{level}, #{description}\"\n\tend",
"def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end",
"def descriptions\n \n return @detail + \": \" + \"#{@extra_cost}\" + \". \" + @basic_transfer.descriptions\n end",
"def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end",
"def describe()\n return \"d\" + @faces.to_s()\n end",
"def to_s\n\t\treturn \"#@num/#@den\"\n\tend",
"def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end",
"def description\n name + ': ' + resource_type.to_s + ' | Sueldo: ' + salary.to_s +\n ' | Experiencia: ' + experience.to_s + ' años'\n end",
"def to_s; description end",
"def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end",
"def modeler_description\r\n return \"This measure imports 8760 chilled water and hot water demand profiles for use in the LoadProfilePlant. The source is a csv file with seven columns titles: timestep, chw_supply_temp_f, chw_flow_frac, chw_load_w, hw_supply_temp_f, hw_flow_frac, hw_load_w.\"\r\n end",
"def modeler_description\n return \"Grey water tank overflow will be dirrected to drainage. \"\n end",
"def display_label_descr\n currency = \" #{CustomFields::NumericFormat.find_currency_unit(option[:unit].to_sym)[:symbol]}\" if format == :currency\n \"#{label.descr}#{currency}\"\n end",
"def description\n super + \", Milk\"\n end",
"def heading\n\t\t\"Character Descriptors\"\n\tend",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end",
"def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end",
"def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end",
"def bde_description\n read_attribute(:description)\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_prescription.details\n end",
"def short_description\n if self.description.size<SHORT_SIZE_LIMIT\n return self.description\n end\n return self.description[0,SHORT_SIZE_LIMIT]+\"...\"\n end",
"def full_description(ulterior_desc='', debug = false)\n return (description rescue '(no desc.)' ) unless debug\n arr_descr = [ \n \"Full Description:\",\n\t\t\tkv('description'), \n\t\t\tkv('location'), \n kv('repeat_frequency'), \n kv('repeats'), \n kv('url'), \n kv('price') ,\n kv('active') ,\n kv('repetition_magic_string'),\n \"#RICCAL=#{self.calendar.abbrev rescue \"No Abbrev available\"}\",\n 'Ulteriore descrizione: ',\n ulterior_desc ,\n ]\n if self.venue\n arr_descr << self.venue\n #arr_descr << self.venue.lat.to_s\n end\n return arr_descr[debug].join(\"\\n--\\n\") # rescue \"Exception w/ full_description: #{$!}\"\n end",
"def descriptive_label\n @attributes[:descriptive_label]\n end",
"def desc\n\tend",
"def desc\n\tend",
"def description\n if powered?\n separator = @description.include?('|') ? ' ' : '|'\n @description + separator + '\\c[14]' + @power_description\n else\n @description\n end\n end",
"def description\n return @description if @description\n \n parts = []\n \n tp = trial_period(false)\n parts << \"#{tp}-day trial\" if tp && tp > 0\n \n sa = setup_amount(false)\n parts << \"#{number_to_currency(sa)} setup fee\" if sa && sa > 0\n \n am = amount(false)\n parts << \"#{number_to_currency(am)}/mo\"\n \n if prepaid_message_count >= UNLIMITED\n texts = \"unlimited\"\n else\n texts = \"#{prepaid_message_count}/mo prepaid\"\n end\n \n @description = parts.join(', ') + \" and #{texts} texts after that.\"\n\n return @description\n end",
"def short_title_with_lecture\n lecture.short_title + ', S.' + number.to_s\n end",
"def desc\n return @desc\n end",
"def den()\n @den\n end",
"def modeler_description\n return \"Each DX cooling coil in the model is replaced by a membrane heat pump. To represent the membrane heat pump, the DX cooling coil COP is increased to 7.62 (26 EER). Additionally, add a water use equipment object to account for the 3 gallons of water used per ton*hr of sensible cooling process.\"\n end",
"def description\n @power_up.description\n end",
"def description\n \"Color is \" + color + \" and pinstripes is \" + pinstripes \n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_cycle.details\n end",
"def description\n end",
"def description\n end",
"def description\n end",
"def modeler_description\n 'This measure changes the Layer 0 properties of Thickness, Density, Thermal Absorptance, Solar Absorptance, Visible Absoptance, Thermal Conductivity, Specific Heat.'\n end",
"def modeler_description\n return \"Multipliers for LPD, EPD, and people densities.\"\n end",
"def details\n \"This Oreo Cookie has #{filling_type} Filling Type and #{sugar}g of sugar and #{butter}g of butter\"\n end",
"def modeler_description\n return \"This measure will demonstrate how an OpenStudio measure calling EMS functions can be used to model the performance of HVAC equipment that cannot be represented well by using single “standard” performance curve objects (cubic, quadratic, biquadratic, etc.) For example, properly characterizing some HVAC equipment objects requires using different performance curves that cover operation of different parts of the performance regime. This measure will alter (overwrite) the Coil Cooling DX Single Speed Cooling Capacity as a function of temperature performance curve object and attributes used by the simulation if the outdoor air temperature falls below a user defined threshold. This measure allows the user to define the biquadratic curve coefficients associated with the Coil Cooling DX Single Speed Cooling Capacity.\"\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def deca\n big_self * DECA\n end",
"def modeler_description\n return 'This a test measure in relation with https://github.com/NREL/OpenStudio/issues/4156'\n end",
"def modeler_description\n return \"This measure will demonstrate how EMS functions can be used to demonstrate how information from a sizing run can be used to select HVAC equipment from nominal product sizes where unit total capacity is directly related to the unit supply airflow (1 ton = 1200 cfm, 1.5 ton = 1600 cfm, etc.) of commercial packaged single-zone HVAC air systems. This measure is designed to work on AirLoops with packaged DX cooling equipment only. EMS functions will be used to extract the design supply airflow generated from system auto-sizing calculations. An interval variable is used to override the Sizing:System - 'Intermediate Air System Main Supply Volume Flow Rate' value variable. This measure approximates the manner that appropriate ‘real world’ equipment selections are made by HVAC design engineers. The table below will be used to map to the Maximum Flow rate of the packaged unit Fan:ConstantVolume object.\"\n end",
"def description; @text; end",
"def desc; end",
"def dean_label\n 'děkan'\n end",
"def short\n @short\n end",
"def summary\n Rumoji.decode(description)\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def describe opts\n bits = size\n if bits > 32 and bits % 8 == 0\n len_str = \"%dB\" % (bits/8)\n else\n len_str = \"%db\" % bits\n end\n\n byte_offset = offset / 8 + (opts[:byte_offset] || 0)\n\n yield [\"@%d\" % byte_offset, class_name, name, len_str, display_name]\n end",
"def dean_label_en\n 'dean'\n end",
"def description\n \"\"\n end",
"def description_title(desc)\n result = desc.partial_format_name\n\n # Indicate rough permissions.\n permit = if desc.parent.description_id == desc.id\n :default.l\n elsif desc.public\n :public.l\n elsif reader?(desc)\n :restricted.l\n else\n :private.l\n end\n result += \" (#{permit})\" unless /(^| )#{permit}( |$)/i.match?(result)\n\n t(result)\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end"
] | [
"0.69538736",
"0.663123",
"0.6589655",
"0.6577291",
"0.65237695",
"0.6517052",
"0.64537776",
"0.6377532",
"0.63733166",
"0.6351722",
"0.6322169",
"0.62699974",
"0.6263901",
"0.6259049",
"0.6247018",
"0.6243944",
"0.62421817",
"0.6206465",
"0.61988264",
"0.6196216",
"0.619103",
"0.61726916",
"0.61562943",
"0.6141545",
"0.6140081",
"0.61287177",
"0.6121712",
"0.6114322",
"0.6067501",
"0.60556006",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6049434",
"0.6048375",
"0.60207665",
"0.60023856",
"0.5994033",
"0.5992708",
"0.5987215",
"0.5985378",
"0.5982563",
"0.5980238",
"0.59605813",
"0.59546757",
"0.5941339",
"0.5939862",
"0.59324414",
"0.59172964",
"0.59157205",
"0.5914526",
"0.5913842",
"0.5904573",
"0.5902015",
"0.5898995",
"0.5897351",
"0.58959925",
"0.58895874",
"0.58847237",
"0.58847237",
"0.5883001",
"0.587134",
"0.5854611",
"0.5853009",
"0.58460367",
"0.58424264",
"0.5842119",
"0.5840724",
"0.5829928",
"0.58277303",
"0.58277303",
"0.58232725",
"0.58228683",
"0.5818147",
"0.580996",
"0.5809701",
"0.58096313",
"0.5807174",
"0.58016515",
"0.5800209",
"0.5791647",
"0.57845837",
"0.5782362",
"0.5778416",
"0.5776263",
"0.5762667",
"0.5762667",
"0.5762667",
"0.57600415",
"0.57590616",
"0.5754207",
"0.57480055",
"0.5743267",
"0.5743267",
"0.5743267"
] | 0.0 | -1 |
BF List of linked factor entries | def bf
field_fetch('bf')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bfs\n\n\n end",
"def bfs\n\n end",
"def factors\n k = 1\n max = Math.sqrt(self).ceil\n lofacs = []\n hifacs = []\n while k <= max.ceil\n if (self.to_f/k) == (self.to_i/k)\n lofacs << k\n hifacs << self/k unless self/k == k\n end\n k += 1\n end\n lofacs + hifacs.reverse\n end",
"def entries; end",
"def entries; end",
"def entries; end",
"def entries; end",
"def bfs\n # raise NotImplementedError\n end",
"def bfs(start_node_num)\n node = find_node(start_node_num)\n _clear_visited\n ret_list = [node.value]\n # Your code here\n q = Queue.new\n q << node\n node.visited = true\n\n until q.empty?\n current = q.pop\n current.edges.each do |edge|\n next if edge.node_to.visited\n q << edge.node_to\n edge.node_to.visited = true\n ret_list << edge.node_to.value\n end\n end\n\n return ret_list\n end",
"def display\n\t\tcurrent_node = @head\n\t\tlinked_list_array = []\n\t\twhile current_node != nil\n\t\t\t\n\t\t\tlinked_list_array << current_node.value\n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tlinked_list_array\n\tend",
"def entries() end",
"def bfs\r\n q = Queue.new\r\n visited = Set.new\r\n\r\n q << [0, panda]\r\n visited << panda\r\n\r\n until q.empty?\r\n level, current_panda = q.shift\r\n unvisited = @members[current_panda].select { |v| !visited.include? v }\r\n unvisited.each do |v|\r\n q << [level + 1, v]\r\n visited << v\r\n end\r\n end\r\n end",
"def linked_list_per_depth\n list = Array.new(height)\n each_depth do |layer, depth|\n n = layer.size - 1\n list[depth] = (0..n).reduce(nil) do |acc, i|\n layer[n-i].nil? ? acc : LinkedList.new(layer[n-i].value, acc)\n end\n end\n list\n end",
"def bag_list(node)\n node.children.flat_map do |child|\n [child.color] + bag_list(child)\n end\n end",
"def create_list\n @linkedList.append(cols/2, lines/2)\n @linkedList.append(cols/2 - 1, lines/2)\n @linkedList.append(cols/2 - 2, lines/2)\n # @linkedList.print\n end",
"def return_list\n entries = []\n current_node = @head\n\n while current_node.next != nil\n entries << current_node.value\n current_node = current_node.next\n end\n entries << current_node.value\n end",
"def bnodes\n @graphs.inject([]) {|memo, g| memo += g.bnodes}\n end",
"def list_fibers total, candidate: 2\n raise ArgumentError unless total.is_a? Integer\n prime = Fiber.new do\n loop do\n Fiber.yield candidate if is_prime?(candidate)\n candidate += 1\n end\n end\n primes = []\n total.times{ primes << prime.resume }\n primes\n end",
"def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end",
"def fuck_the_factors(n)\n f = []\n i = 2\n while n > 1\n while n % i == 0\n f.push(i)\n n /= i\n end\n i += 1\n end\n return f\nend",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def load_factor\n counter = 0\n @items.each do |item|\n if item != nil && item.kind_of?(LinkedList) == false\n counter += 1\n elsif item != nil && item.kind_of?(LinkedList) == true\n temp_node = item.head\n while temp_node != nil\n counter += 1\n temp_node = temp_node.next\n end\n else\n next\n end\n end\n return counter.to_f / size\n end",
"def run_bf(items)\n\n counts = Hash.new{|h,k| h[k] = 0}\n\n items.each {|item| counts[item] += 1 }\n \n dd = items.length / 10\n \n results = []\n counts.each {|item, count|\n results << item if count > dd\n }\n \n return results\n end",
"def map_to_linked_list(fn)\n result = LinkedList.new\n current = @head\n index = 0\n until current.nil?\n result.append(fn.call(current.value, index))\n current = current.next\n index += 1\n end\n result\n end",
"def factors(num)\n facs = [1]\n (2..num/2).each{|n| facs.push(n) if num % n == 0 }\n facs.push(num)\nend",
"def bfs\n list = []\n if @root\n queue = []\n queue << @root\n queue.each do |current|\n list << {key: current.key, value: current.value}\n queue << current.left if current.left\n queue << current.right if current.right\n end\n end\n return list\n end",
"def find_factors\n 1.upto(@triangle_number / 2) do |possible_factor|\n @factors.push(possible_factor) if @triangle_number % possible_factor == 0\n end\nend",
"def bfs(val) \n queue = [self] \n\n until queue.empty? \n if queue.first.value == val\n return queue.first\n else\n queue.concat(queue.shift.children) #you add [] + children's children\n end\n end\n nil #if noting == val\n end",
"def set_exponential_stable_matchings_pool_lists pool\n raise RuntimeError if Math.log2(pool.men.size) != Math.log2(pool.men.size).to_i\n\n n = pool.men.size\n g = []\n n.times do |i|\n row = []\n n.times do |j|\n row << j\n end\n g << row\n end\n\n g.each_with_index do |row,i|\n if i % 2 == 0\n row.rotate! i\n else\n row.reverse!\n row.rotate! i + 1\n end\n end\n\n women_lists = []\n g.each do |row|\n women_lists << row.reverse\n end\n\n puts g.inspect\n puts women_lists.inspect\n\n set_custom_pool_lists pool, g, women_lists, true\n end",
"def factor_list\n a = one_or_more { factor }\n AST.new(:and, a)\n end",
"def receive_list(fromIndria)\n if @buckets.empty?\n # make new bucket\n @buckets << [fromIndria]\n @bucketCounts << 1\n @bucketsCount += 1\n else\n # get representatives\n reps = []\n @buckets.each_with_index do |bucket, idx|\n rIdx = rand(@bucketCounts[idx])\n reps << bucket[rIdx]\n end\n\n mIdx = reps.find_index { |rep| compare(rep, fromIndria) }\n\n if mIdx\n # for each representative, compare and store in @buckets accordingly\n @buckets[mIdx] << fromIndria\n @bucketCounts[mIdx] += 1\n else\n # make new bucket\n @buckets << [fromIndria]\n @bucketCounts << 1\n @bucketsCount += 1\n end\n end\n end",
"def build_refinement(entry, ffs)\n @refinement = {}\n entry.each { |level,function|\n cfr = ControlFlowRefinement.new(function, level)\n ffs.each { |ff|\n next if ff.level != level\n cfr.add_flowfact(ff)\n }\n @refinement[level] = cfr\n }\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def create_linked_list(values)\n nodes = []\n\n previous_node = nil\n values.each do |num|\n previous_node = ListNode.new(num, previous_node)\n nodes.push(previous_node)\n end\n\n nodes.reverse\nend",
"def display\n current = @head\n full_list = []\n while current.next != nil\n full_list += [current.data.to_s]\n current = current.next\n end\n full_list += [current.data.to_s]\n puts full_list.join(\"->\")\n end",
"def addAllFactors array\n array.each do |item|\n addFactor item[0], item[1]\n end\n end",
"def newDemandListForCycle()\n list = [] ;\n @factoryList.each{|factory|\n sublist = factory.newDemandListForCycle() ;\n list.concat(sublist) ;\n }\n return list ;\n end",
"def listFactorialsOf(n)\n list = []\n while n > 0\n list.push n\n n -= 1\n end\n list\nend",
"def nodelist; end",
"def nodelist; end",
"def load_factor\n node_count = 0.0\n \n @items.each do |item|\n if item != nil\n current_node = item.head\n while current_node != nil\n node_count += 1\n current_node = current_node.next\n end\n end\n end\n @max_load_factor = (node_count / @items.size)\n if @max_load_factor > 0.70\n self.resize\n self.load_factor\n else\n @max_load_factor\n end\n end",
"def factors(num)\n facs = []\n i = 1\n while i <= num\n if num % i == 0\n facs << i\n end\n i += 1\n end\n facs\nend",
"def pairs(factors)\n pairs = []\n # only have to iterate thru half the list of factors, since beyond the\n # halfway line has already been accounted for in the pairs\n (factors.size/2).times do |i|\n pairs << Pair.new(factors[i], factors.last/factors[i])\n end\n pairs\nend",
"def prime_factorization\n factors_list = self.factors\n return [self] if factors.size == 0\n return factors_list.first.prime_factorization + [factors_list.last]\n end",
"def linked_list_from_num(n)\n current = Node.new()\n head = current\n parent = nil\n n.digits.each do |d|\n current.val = d \n parent = current\n current.next = Node.new()\n current = current.next\n end\n parent.next = nil\n head\nend",
"def factors\n all_factors = []\n (1..Math.sqrt(self).to_i).each do |x|\n all_factors.push(x, self/x) if (self % x == 0)\n end\n\n all_factors.sort.uniq\n end",
"def return_list\n list = []\n current_node = @head\n\n while current_node != nil\n node = current_node\n case node\n when @head\n node = [\"HEAD - value: #{current_node.value}, next: #{current_node.next_node}, random: #{current_node.random.value}\"]\n else\n node = [\"NODE - value: #{current_node.value}, next: #{current_node.next_node}, random: #{current_node.random.value}\"]\n end\n list << node\n current_node = current_node.next_node\n end\n return list\n end",
"def bfs_adj_list(queue, item)\n @checked_edges = []\n @current_node = start\n queue.add(@current_node)\n until current_node == item || current_node.nil?\n @current_node.linked_list.each do |next_node|\n queue.add(next_node)\n end\n current_node = queue.pop\n end\n return @current_node\n end",
"def load_factor\n total_size = 0\n @items.each do |list|\n unless list == nil\n node = list.head\n while node != nil\n total_size += 1\n node = node.next\n end\n end\n end\n total_size.to_f / @items.count\n end",
"def init; @entries = [] end",
"def bfs(v)\n curr = v\n queue = []\n distances = Hash.new(0)\n queue.push(curr)\n distances[curr] = 0\n while !queue.empty?\n curr = queue.shift\n dst = distances[curr] + 1\n if @hypernyms.include?(curr)\n queue += @hypernyms[curr]\n end\n queue.each do |v|\n \n distances[v] = dst if !distances.include?(v)\n end\n end\n distances\n end",
"def bfs_names(start_node_num)\n bfs(start_node_num).map do |num|\n @node_names[num]\n end\n end",
"def entries\n @list\n end",
"def lnFact(z) \n\t\t\tif (z < @@fact.length) \n\t\t\t\treturn @@fact[z]\n\t\t\tend\n\t\t\treturn lnStirling(z);\n\t\tend",
"def find_order_bfs\n queue = []\n @num_courses.times { |v| queue.push(v) if @in_degrees[v].zero? } # 入度为0的全都放入\n\n visited = []\n until queue.empty?\n node_key = queue.shift\n\n visited.unshift(node_key) # 注意顺序\n\n @nodes[node_key]&.each do |neighbor|\n @in_degrees[neighbor] -= 1\n queue.push(neighbor) if @in_degrees[neighbor].zero?\n end\n end\n\n visited.size == @num_courses ? visited : []\n end",
"def factors_for( num )\n facts = []\n (1..(num/2)).each {|divisor| facts << divisor if (num % divisor == 0)}\n facts\nend",
"def bfs\n return [] if @root.nil?\n queue = []\n list = []\n queue.push(@root)\n while queue.length > 0\n curr_node = queue[0]\n list << {key: curr_node.key, value: curr_node.value}\n queue.push(curr_node.left) if curr_node.left\n queue.push(curr_node.right) if curr_node.right\n queue.shift\n end\n return list \n end",
"def factors\n factors = []\n for divisor in 2..(Math.sqrt(self).to_i)\n if self%divisor == 0\n factors << divisor \n factors << (self/divisor)\n end\n end\n return factors.sort!.reverse!\n end",
"def forest_leaves\n acc.map.with_index{|a, i| a.nil? ? nil : 2 ** i}.compact.reverse\n end",
"def collect_relation(es, h, q)\n #p \"%0#{ @ps.size + 1 }b\" % es\n @elim[es] = [h, q]\n\n if @elim.size > 0.9 * @f && @elim.size % [1, @f / 100].max == 0\n @elim.eliminate do |relations|\n # factor candidate found\n check_factor_candidate(relations)\n end\n end\n\n if @elim.size > @f * 1.5\n raise Failed, \"failed to find a factor: #{ @n }\"\n end\n end",
"def list\n current_list = []\n\n allergens.each_with_index do |allergen, index|\n if score & (2 ** index) > 0\n current_list << allergen\n end\n end\n\n # if score & (2**0) > 0\n # current_list << allergens[0]\n # end\n\n # if score & (2**1) > 0\n # current_list << allergens[1]\n # end\n\n current_list\n end",
"def find_factors(n, possible_factors)\n factors = []\n\n possible_factors.each do |possible_factor|\n factors << possible_factor if n % possible_factor == 0\n end\n\n factors\nend",
"def divisors\n [self] + self.factors << 1\n end",
"def fibs(limit, n=2)\n\t@a ||= []\n\tf = fib(n)\n\tif f < limit \n\t\[email protected](f) \n\t\tn += 1\n\t\tfibs(limit, n)\n\telse\n\t\t@a\n\tend\nend",
"def initialize(size)\n @max_load_factor = 0.7\n @buckets = Array.new(size)\n @buckets.each_with_index do |bucket, index|\n @buckets[index] = LinkedList.new\n end\n @num_items = 0\n end",
"def populate(nPeople)\n @floors[0].enqueue(Person.new(0,1,self))\n @floors[0].enqueue(Person.new(0,3,self))\n @floors[0].enqueue(Person.new(0,4,self))\n @floors[0].enqueue(Person.new(0,3,self))\n @floors[0].enqueue(Person.new(0,4,self))\n @floors[3].enqueue(Person.new(3,1,self))\n @floors[4].enqueue(Person.new(4,2,self))\n @floors[2].enqueue(Person.new(2,0,self))\n @floors[1].enqueue(Person.new(1,4,self))\n\n end",
"def factors_of(num)\n \n index = 1 \n \n factors = []\n \n while index <= num\n if num % index == 0 \n factors << index \n end \n \n index += 1 \n end \n \n return factors \n \nend",
"def status\n if @item_count === 0.0\n puts \"There are no entries in this hash.\"\n puts \"Load Factor for hash is 0.\"\n else\n @items.each do |ll|\n unless ll.nil?\n current = ll.head\n index = self.index(current.key, @items.length)\n until current.nil?\n puts \"Entry #{current} is located at Index #{index} and has a value of \" + \"\\\"\" + \"#{current.value}\" + \"\\\"\" + \".\"\n current = current.next\n end\n end\n end\n puts \"Load Factor for hash is #{@item_count / @items.length}.\"\n end\n end",
"def bfs\n q = []\n list = []\n\n return [] if @root.nil?\n\n current_node = @root\n \n q.push(current_node)\n # put current node into queue\n while q.length != 0\n # put current node into list and delete from queue\n # add current node's children into the queue\n list.push({key: q[0].key, value: q[0].value})\n q.shift\n \n if current_node.left != nil \n q.push(current_node.left) \n end \n\n if current_node.right != nil \n q.push(current_node.right)\n end\n current_node = q[0] \n end \n\n return list\n end",
"def display_branch_list\n table = build_table_view\n\n puts \"\\n\\n\"\n puts table\n end",
"def smart_bfs(len, to_get_users = [], to_get_neighbors = [], visited = Set.new)\n sample = []\n i = 0\n while i < len do\n while i < len do\n if to_get_users.empty? then\n break\n end\n # ask Twitter for a chunk of user objects from ids list\n uids = to_get_users.slice!(0..$max_users-1)\n users = get_users(uids)\n p \"got #{users.length} users\"\n sample.concat(users)\n\n # add ids to neighbors todo\n to_get_neighbors.concat( users.map { |u| u.attrs[:id] } )\n i+=users.length\n end\n\n while to_get_users.empty? do\n if to_get_neighbors.empty? then \n return sample\n end\n uid = to_get_neighbors.slice!(0)\n\n next_cursor = -1\n last_index = 0\n next_user_id = 0\n while next_cursor != 0 do\n # get the next page of follower ids\n cur = get_followers_cursor(uid, next_cursor)\n\n # add never-before-seen users to worklist\n newusers = cur[:ids].sselect { |fid| not visited.member?(fid) }\n newusers.each { |u| visited.add(u) }\n to_get_users.concat( newusers ) \n\n # next page index \n next_cursor = cur[:next_cursor]\n end\n end\n end\n \n return sample\nend",
"def proper_factors(n)\n f = []\n 1.step((n/2).to_i, 1).each do |x|\n if n % x == 0\n f.push(x)\n end\n end\n f.sort\nend",
"def prime_factors\n if prime?\n [self]\n else\n pair = factorize\n (pair[0].prime_factors + pair[1].prime_factors).sort.uniq\n end\n end",
"def generate_list(name, count); end",
"def factors(number)\r\n divisor = number\r\n factors = []\r\n while divisor > 0 do \r\n factors << number / divisor if number % divisor == 0\r\n divisor -= 1\r\n end \r\n factors\r\nend",
"def factors(number)\n dividend = number\n divisors = []\n while dividend > 0\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end \n divisors\nend",
"def factor(num)\n\tcurrent_factor = num/2\n\tfactors = []\n\tfactors << num\n\twhile current_factor > 0\n\t\tif num%current_factor == 0\n\t\t\tfactors << current_factor\n\t\t\tcurrent_factor -= 1\n\t\telse\n\t\t\tcurrent_factor -= 1\n\t\tend\n\tend\n\t\n\treturn factors\nend",
"def factors(num)\n pn = num.prime_division\n ans = []\n pn.each_index do |i|\n ans << pn[i][0]\n end\n return ans\nend",
"def prime_factors_helper(f, n)\n if f > n\n []\n elsif is_prime(f) && n % f == 0\n [f] + prime_factors_helper(f, n / f)\n else\n prime_factors_helper(f == 2 ? f + 1 : f + 2, n)\n end\nend",
"def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend",
"def print_list\n current_node = @head\n\n until current_node == nil\n\t print \"#{current_node.value} -> \"\n\t current_node = current_node.next\n end\n\n puts '' \t\n end"
] | [
"0.5981058",
"0.58847076",
"0.55191183",
"0.55093557",
"0.55093557",
"0.55093557",
"0.55093557",
"0.54690695",
"0.544137",
"0.5430159",
"0.5427889",
"0.53939795",
"0.5389247",
"0.5237021",
"0.52076745",
"0.5186634",
"0.5186143",
"0.51566356",
"0.512871",
"0.51270884",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.50881344",
"0.5087054",
"0.5084935",
"0.50475",
"0.50441056",
"0.5031782",
"0.5014759",
"0.5014034",
"0.5011362",
"0.5000424",
"0.49907425",
"0.49866065",
"0.49803463",
"0.49803463",
"0.49803463",
"0.49803463",
"0.49803463",
"0.49706227",
"0.49693343",
"0.4968492",
"0.4955295",
"0.4944877",
"0.4940266",
"0.4940266",
"0.49184668",
"0.49154535",
"0.4910301",
"0.49013674",
"0.4900521",
"0.48959818",
"0.4890791",
"0.4877148",
"0.4874356",
"0.48682484",
"0.48654014",
"0.48566532",
"0.4846121",
"0.48443374",
"0.48365155",
"0.48345655",
"0.48294094",
"0.48274806",
"0.48199153",
"0.4815283",
"0.4799966",
"0.47988796",
"0.47940952",
"0.4790774",
"0.4785945",
"0.4781666",
"0.47813267",
"0.47800985",
"0.47767186",
"0.47763476",
"0.4766227",
"0.47625366",
"0.4750962",
"0.47498903",
"0.47477686",
"0.47474337",
"0.4742094",
"0.4741259",
"0.47396296",
"0.47330543",
"0.47291943"
] | 0.0 | -1 |
DR Crossreferences to other databases (>=0 per entry) | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referencing_databases\n ensure_service!\n\n @grpc.referencing_databases.map do |referencing_database|\n segments = referencing_database.split \"/\"\n database_grpc = service.get_database segments[3], segments[5]\n Database.from_grpc database_grpc, service\n end\n end",
"def on_db_ref(ref)\n\tend",
"def references; end",
"def references; end",
"def __foreign_key_list_ds(reverse)\n if reverse\n ctable = Sequel[:att2]\n cclass = Sequel[:cl2]\n rtable = Sequel[:att]\n rclass = Sequel[:cl]\n else\n ctable = Sequel[:att]\n cclass = Sequel[:cl]\n rtable = Sequel[:att2]\n rclass = Sequel[:cl2]\n end\n\n if server_version >= 90500\n cpos = Sequel.expr{array_position(co[:conkey], ctable[:attnum])}\n rpos = Sequel.expr{array_position(co[:confkey], rtable[:attnum])}\n # :nocov:\n else\n range = 0...32\n cpos = Sequel.expr{SQL::CaseExpression.new(range.map{|x| [SQL::Subscript.new(co[:conkey], [x]), x]}, 32, ctable[:attnum])}\n rpos = Sequel.expr{SQL::CaseExpression.new(range.map{|x| [SQL::Subscript.new(co[:confkey], [x]), x]}, 32, rtable[:attnum])}\n # :nocov:\n end\n\n ds = metadata_dataset.\n from{pg_constraint.as(:co)}.\n join(Sequel[:pg_class].as(cclass), :oid=>:conrelid).\n join(Sequel[:pg_attribute].as(ctable), :attrelid=>:oid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:conkey])).\n join(Sequel[:pg_class].as(rclass), :oid=>Sequel[:co][:confrelid]).\n join(Sequel[:pg_attribute].as(rtable), :attrelid=>:oid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:confkey])).\n join(Sequel[:pg_namespace].as(:nsp), :oid=>Sequel[:cl2][:relnamespace]).\n order{[co[:conname], cpos]}.\n where{{\n cl[:relkind]=>%w'r p',\n co[:contype]=>'f',\n cpos=>rpos\n }}.\n select{[\n co[:conname].as(:name),\n ctable[:attname].as(:column),\n co[:confupdtype].as(:on_update),\n co[:confdeltype].as(:on_delete),\n cl2[:relname].as(:table),\n rtable[:attname].as(:refcolumn),\n SQL::BooleanExpression.new(:AND, co[:condeferrable], co[:condeferred]).as(:deferrable),\n nsp[:nspname].as(:schema)\n ]}\n\n if reverse\n ds = ds.order_append(Sequel[:nsp][:nspname], Sequel[:cl2][:relname])\n end\n\n ds\n end",
"def on_db_ref(context, ref)\n\tend",
"def references_bw_canonical\n view_name = references_bw_canonical_tn\n if @references_bw_canonical_tn_exists.nil?\n @references_bw_canonical_tn_exists=true\n if !$db.table_exists?(view_name)\n $db.run(\"CREATE VIEW #{view_name} AS SELECT r.canonical_document_id as cd_start, ref.canonical_document_id as cd_end FROM records r INNER JOIN records_searches br ON r.id=br.record_id INNER JOIN searches b ON br.search_id=b.id INNER JOIN records_references rr ON rr.record_id=r.id INNER JOIN bib_references ref ON ref.id=rr.reference_id WHERE systematic_review_id='#{self[:id]}' AND ref.canonical_document_id IS NOT NULL AND b.valid=1 GROUP BY cd_start, cd_end\")\n end\n end\n $db[view_name.to_sym]\n end",
"def update_links\n return if self.suppress_recreate_trigger == true\n \n marc_foreign_objects = Hash.new\n \n # All the allowed relation types *must* be in this array or they will be dropped\n allowed_relations = [\"people\", \"standard_titles\", \"standard_terms\", \"institutions\", \"catalogues\", \"liturgical_feasts\", \"places\"]\n \n # Group all the foreign associations by class, get_all_foreign_associations will just return\n # a flat list of objects\n marc.get_all_foreign_associations.each do |object_id, object|\n next if object.is_a? Source\n \n foreign_class = object.class.name.pluralize.underscore\n marc_foreign_objects[foreign_class] = [] if !marc_foreign_objects.include? (foreign_class)\n \n marc_foreign_objects[foreign_class] << object\n \n end\n \n # allowed_relations explicitly needs to contain the classes we will repond to\n # Log if in the Marc there are \"unknown\" classes, should never happen\n unknown_classes = marc_foreign_objects.keys - allowed_relations\n # If there are unknown classes purge them\n related_classes = marc_foreign_objects.keys - unknown_classes\n \n if !unknown_classes.empty?\n puts \"Tried to relate with the following unknown classes: #{unknown_classes.join(',')}\"\n end\n \n related_classes.each do |foreign_class|\n relation = self.send(foreign_class)\n \n # The foreign class array holds the correct number of object\n # We want to delete or add only the difference betweend\n # what is in marc and what is in the DB relations\n new_items = marc_foreign_objects[foreign_class] - relation.to_a\n remove_items = relation.to_a - marc_foreign_objects[foreign_class]\n \n # Delete or add to the DB relation\n relation.delete(remove_items)\n relation << new_items\n\n # If this item was manipulated, update also the src count\n # Unless the suppress_update_count is set\n if !self.suppress_update_count_trigger\n (new_items + remove_items).each do |o|\n o.update_attribute( :src_count, o.sources.count )\n end\n end\n \n end\n \n # update the parent manuscript when having 773/772 relationships\n update_77x unless self.suppress_update_77x_trigger == true \n end",
"def references(current_table)\r\n references = []\r\n tables = get_tables\r\n tables.each do |table|\r\n columns = get_column_names(table)\r\n columns.each do |column|\r\n if /[_id]$/.match(column)\r\n references << table if column.split('_id').join == current_table\r\n end\r\n end\r\n end\r\n references\r\n end",
"def macro\n :references_one\n end",
"def macro\n :references_one\n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:is_ref?).select(&:is_active?).map(&:name)\n return if r.nil?\n [:haai_db, :aai_db, :ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? or not File.size? db\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def referenced?; end",
"def crossref_query\n CrossrefQuery.generate_query_from_text( ref_apa_6 )\n end",
"def referenced; end",
"def referenced_tables(tables)\n result = {}\n tables.each do |table|\n result[table] = []\n self.select_all(\"select reftabname from syscat.references where tabname = '#{table.upcase}'\").each do |row|\n result[table] << row['reftabname'].downcase\n end\n end\n result\n end",
"def __drbref\n @ref\n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)\n return if r.nil?\n\n %i[haai_db aai_db ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? || !File.size?(db)\n\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def check_db_changes\n partist = DBClasses::Artist.new.ref_load(self.artist.rartist)\n precord = DBClasses::Record.new.ref_load(self.record.rrecord)\n psegment = DBClasses::Segment.new.ref_load(self.segment.rsegment)\n ptrack = DBClasses::Track.new.ref_load(self.track.rtrack)\n\n\n end",
"def tables_with_referential_integrity\n schemas_and_tables = select_rows <<-SQL.strip_heredoc\n SELECT s.name, o.name\n FROM sys.foreign_keys i\n INNER JOIN sys.objects o ON i.parent_object_id = o.OBJECT_ID\n INNER JOIN sys.schemas s ON o.schema_id = s.schema_id\n SQL\n schemas_and_tables.map do |schema_table|\n schema, table = schema_table\n \"#{SQLServer::Utils.quoted_raw(schema)}.#{SQLServer::Utils.quoted_raw(table)}\"\n end\n end",
"def serialize_dbxref(feature_uri, dbxref_composite)\n abbreviation, accession = dbxref_composite.split(':', 2)\n dbxref_uri = RDF::URI.new(\"#{feature_uri.to_s}/dbxref/#{BioInterchange.make_safe_label(abbreviation)}\")\n create_triple(feature_uri, @base.references, dbxref_uri)\n\n create_triple(dbxref_uri, RDF.type, @base.ExternalReference)\n create_triple(dbxref_uri, @base.refers_to, BioInterchange::LifeScienceRegistry.send(dbxref_composite.split('_', 2)[0].downcase).sub('$id', accession))\n if dbxref_composite.match(/^.+_.+:.+$/) then\n # Entry with version information.\n version_uri = RDF::URI.new(\"#{dbxref_uri}/version\")\n create_triple(dbxref_uri, @base.has_identifier, version_uri)\n create_triple(version_uri, @base.has_value, abbreviation[6..-1])\n end\n\n #if dbxref_composite.match(/^dbSNP(_\\d+)?:rs\\d+$/) then\n # # linkout = \"http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs=#{dbxref_composite.split(/:/)[1].sub(/^rs/, '')}\"\n #elsif dbxref_composite.match(/^COSMIC(_\\d+)?:COSM\\d+$/) then\n # linkout = \"http://cancer.sanger.ac.uk/cosmic/mutation/overview?id=#{accession.sub(/^COSM/, '')}\"\n #else\n # BioInterchange::GOXRef.send(BioInterchange.make_safe_label(abbreviation)).to_s + accession\n #end\n end",
"def references\n alias_of.references\n end",
"def update_direct_refs_to_docs(docxml, identifier)\n erefs = collect_erefs(docxml)\n docxml.xpath(ns(\"//bibitem[not(ancestor::bibitem)]\")).each do |b|\n docid = b.at(ns(\"./docidentifier[@type = 'repository']\"))\n (docid && %r{^current-metanorma-collection/}.match(docid.text)) or next\n update_bibitem(b, identifier)\n docid = docid_to_citeas(b) or next\n erefs[:citeas][docid] and update_anchors(b, docxml, docid)\n end\n end",
"def migrate_contact_entity_linkages\n contacts_for_keys = @source_redis.keys('contacts_for:*')\n\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n contacts_for_keys.each do |contacts_for_key|\n\n unless contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_id = $1\n check_name = $2\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |check_name|\n tag_for_check.call(entity_name, check_name, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def second_reference_id\n nil\n end",
"def column_references_sql(options)\n sql = [super(options)]\n\t sql << flag_option_sql(options, :rely)\n\t sql << flag_option_sql(options, :enable, 'DISABLE')\n\t sql << flag_option_sql(options, :validate)\n\t sql.join ' '\n end",
"def associates\n self.doc_refs\n end",
"def objects_with_references\n end",
"def _reverse_foreign_key_list_ds\n @_reverse_foreign_key_list_ds ||= __foreign_key_list_ds(true)\n end",
"def add_references(klazz, string)\n klazz.references.each do |r|\n string << \" many_to_one #{r.name.to_sym.inspect}, :class => #{r.rb_klazz.to_sym.inspect}, :key => #{r.foreignkeys.map {|fk| fk.field.to_sym}.inspect}\\n\"\n end\n string << (klazz.references.empty? ? '' : \"\\n\")\n end",
"def referring_record\n return @referring_record == :nil ? nil : @referring_record unless @referring_record.nil?\n\n res = referenced_from\n if res.length == 1\n @referring_record = res.first&.from_record\n return @referring_record if @referring_record\n end\n\n @referring_record = :nil\n nil\n end",
"def validate_relation_references(primary_ir)\n primary_ir.keys.each do |k|\n if primary_ir[k][:source_dsd_name]\n unless primary_ir[k][:source_structure][:dsd] == primary_ir[k][:source_dsd_name]\n raise \"#{primary_ir[k][:full_source_relation_name]} is not an implementation of #{primary_ir[k][:source_dsd_name]} as required by #{primary_ir[k][:full_relation_name]}... which is an implementation of #{primary_ir[k][:dsd]}\"\n end\n end\n end\n nil\n end",
"def migrate_contact_entity_linkages\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n source_keys_matching('contacts_for:?*').each do |contacts_for_key|\n\n contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n entity_id = Regexp.last_match(1)\n check_name = Regexp.last_match(2)\n if entity_id.nil?\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |cn|\n next if cn.empty?\n tag_for_check.call(entity_name, cn, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def ref\n @references += 1\n end",
"def absorption_references\n @references.inject([]) do |array, ref|\n array << ref\n # puts \"Column #{name} spans #{ref}, #{ref.is_absorbing ? \"\" : \"not \"} absorbing (#{ref.to.name} absorbs via #{ref.to.absorbed_via.inspect})\"\n break array unless ref.is_absorbing\n array\n end\n end",
"def refs_table_required(site, doc)\n if doc.data.key?('refs')\n doc.data['refs']\n elsif site.config['collections'][doc.collection.label].key?('refs')\n site.config['collections'][doc.collection.label]['refs']\n elsif site.config.key?('refs')\n site.config['refs']\n end\n end",
"def references_from\n @mapping.all_member.select do |m|\n !m.is_a?(MM::Absorption) or\n !m.forward_mapping && m.parent_role.is_unique # A forward absorption has no forward absorption\n end\n end",
"def migrate_contact_entity_linkages\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n source_keys_matching('contacts_for:?*').each do |contacts_for_key|\n\n contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n entity_id = $1\n check_name = $2\n if entity_id.nil?\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |check_name|\n tag_for_check.call(entity_name, check_name, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def validate_references\n if datasets.count == 1\n []\n else\n x = datasets.reduce([]) { |a, e| e.anchor? ? a << [e.name, e.anchor[:name]] : a }\n refs = datasets.reduce([]) do |a, e|\n a.concat(e.references)\n end\n refs.reduce([]) do |a, e|\n x.include?([e[:dataset], e[:reference]]) ? a : a.concat([e])\n end\n end\n end",
"def refs_at; end",
"def read_new_schema\n AssociatedRecord.reset_column_information\n DeeplyAssociatedRecord.reset_column_information\n\n AssociatedRecord.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n Item.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n end",
"def uri_for_other_referent_than(obj)\n self.class.participating_models.each {|model|\n self.class.reference_columns_for(model).each {|column|\n if self[column] && (model != obj.class || self[column] != obj.id)\n return model.my_jsonmodel.uri_for(self[column],\n :repo_id => RequestContext.get(:repo_id))\n end\n }\n }\n\n raise \"Failed to find a URI for other referent in #{self}: #{obj.id}\"\n end",
"def idref\n \"c#{rank}\"\n end",
"def default_ref_node(this_db = self.started_db)\n this_db.graph.reference_node\n end",
"def get_drv_graph\n map = {}\n query = <<END\nselect r1.path, r2.path\nfrom Refs r\njoin ValidPaths r1 on r1.id == referrer\njoin ValidPaths r2 on r2.id == reference\nwhere r1.path like '%.drv' and r2.path like '%.drv';\nEND\n nix_db.execute(query) do |drv1, drv2|\n drv1 = drv1.to_sym\n drv2 = drv2.to_sym\n (map[drv1] ||= []) << drv2\n map[drv2] ||= []\n end\n map\nend",
"def target_ds_ref\n if @target_ds_ref.nil?\n if one_item.nil?\n raise \"'one_item' must be previously set to be able to \" <<\n 'access the target Datastore.'\n end\n\n target_ds_id = one_item['HISTORY_RECORDS/HISTORY[last()]/DS_ID']\n raise 'No valid target_ds_id found.' if target_ds_id.nil?\n\n target_ds =\n VCenterDriver::VIHelper\n .one_item(\n OpenNebula::Datastore,\n target_ds_id\n )\n\n @target_ds_ref = target_ds['TEMPLATE/VCENTER_DS_REF']\n end\n\n @target_ds_ref\n end",
"def auto_assoc(opts = {})\n except = opts[:except] || []\n\n assocs = db.schema_parse_associations(table_name)\n relations = process_join_tables(assocs)\n\n relations.each do |row|\n src_tbl = row[:src_tbl]\n src_col = row[:src_col]\n if src_tbl == table_name && ! (src_col & except).empty?\n # TODO enable except for *_to_many\n next\n end\n src_uniq = row[:src_uniq]\n src_cardinality = cardinality(src_uniq)\n\n join_tbl = row[:join_tbl]\n\n dst_tbl = row[:dst_tbl]\n dst_col = row[:dst_col]\n dst_uniq = row[:dst_uniq]\n dst_cardinality = cardinality(dst_uniq)\n\n TABLE_MODELS.wait_all(src_tbl, dst_tbl) do |src_cls, dst_cls|\n self_ref = src_cls == dst_cls\n\n src = self_ref ? :child : underscore(src_cls.name).to_sym\n src = src_uniq ? singularize(src).to_sym : pluralize(src).to_sym\n\n dst = self_ref ? :parent : underscore(dst_cls.name).to_sym\n dst = dst_uniq ? singularize(dst).to_sym : pluralize(dst).to_sym\n\n if join_tbl\n left_col = row[:left_col]\n right_col = row[:right_col]\n send :many_to_many, src, :class => src_cls, :join_table => join_tbl,\n :left_key => left_col, :left_primary_key => dst_col,\n :right_key => right_col, :right_primary_key => src_col\n else\n # TODO name overrides\n\n if self == dst_cls\n # dst holds the foreign key -> one_to_*\n meth = dst_cardinality + '_to_' + src_cardinality\n send meth, src, :class => src_cls, :key => src_col, :primary_key => dst_col\n end\n\n if self == src_cls\n # src holds the foreign key -> *_to_one\n meth = src_cardinality + '_to_' + dst_cardinality\n\n # one_to_one requires to swap pk and fk\n src_col, dst_col = dst_col, src_col if src_uniq\n send meth, dst, :class => dst_cls, :key => src_col, :primary_key => dst_col\n end\n end\n\n end\n end\n end",
"def migrate_contact_entity_linkages\n contacts_for_keys = @source_redis.keys('contacts_for:*')\n\n contacts_for_keys.each do |contacts_for_key|\n\n if contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n\n entity_id = $1\n check_name = $2\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n\n next if contact_ids.empty?\n\n contacts = contact_ids.collect do |contact_id|\n find_contact(contact_id)\n end\n\n entity = find_entity(:id => entity_id)\n\n if check_name.nil?\n # interested in entity\n entity.contacts.add(*contacts)\n else\n # interested in check\n check = find_or_create_check(entity.name, check_name)\n check.contacts.add(*contacts)\n end\n\n else\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n end\n\n entity_tag_keys = @source_redis.keys('entity_tag:*')\n\n entities_with_changed_tags = {}\n\n entity_tag_keys.each do |entity_tag_key|\n\n # TODO fix regex, check current code\n raise \"Bad regex for '#{entity_tag_key}'\" unless entity_tag_key =~ /\\Aentity_tag:(#{TAG_PATTERN_FRAGMENT})\\z/\n\n tag = $1\n\n entity_ids = @source_redis.smembers(entity_tag_key)\n\n entity_ids.each do |entity_id|\n\n entity = Flapjack::Data::Entity.find_by_id(entity_id)\n raise \"No entity with id #{entity_id}\" if entity.nil?\n entity.tags << tag\n entities_with_changed_tags[entity_id] = entity\n end\n end\n\n entities_with_changed_tags.values.each do |entity|\n entity.save\n end\n\nend",
"def resolve_reference; end",
"def default_associated_key_alias\n self[:uses_left_composite_keys] ? (0...self[:left_keys].length).map{|i| :\"x_foreign_key_#{i}_x\"} : :x_foreign_key_x\n end",
"def references\n @references\n end",
"def referer_transaction( diary = nil, save = false )\n\treturn if @conf.io_class.to_s != 'TDiary::DbiIO'\n\n\tFile.open(\"#{@conf.data_path}/dbi_io_ref.lock\", 'w') {|file|\n\t\tfile.flock(File::LOCK_EX)\n\t\tdbh = DBI.connect(@conf.dbi_driver_url, @conf.dbi_user, @conf.dbi_passwd)\n\t\tdbh.transaction{\n\t\t\tif diary.respond_to?( :date ) then\n\t\t\t\ttable = 'refererdata'\n\t\t\t\tymd = diary.date.strftime('%Y%m%d')\n\t\t\t\tbegin\n\t\t\t\t\tsql = \"SELECT diary_id, count, ref FROM \" + table + \" WHERE author=? AND diary_id=?;\"\n\t\t\t\t\tdbh.select_all(sql, @conf.dbi_author || 'default', ymd) {|diary_id, count, ref|\n\t\t\t\t\t\tyield(ref.chomp, count.to_i)\n\t\t\t\t\t}\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\tend\n\t\t\telse\n\t\t\t\ttable = 'referervolatile'\n\t\t\t\tymd = nil\n\t\t\t\tbegin\n\t\t\t\t\tsql = \"SELECT diary_id, count, ref FROM \" + table + \" WHERE author=?;\"\n\t\t\t\t\tdbh.select_all(sql, @conf.dbi_author || 'default') {|diary_id, count, ref|\n\t\t\t\t\t\tyield(ref.chomp, count.to_i)\n\t\t\t\t\t\tymd = diary_id\n\t\t\t\t\t}\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @mode =~ /^(append|replace)$/ and !diary.respond_to?( :date ) then\n\t\t\t\tif !ymd or (@date.strftime( '%Y%m%d' ) > ymd) then\n\t\t\t\t\tymd = nil\n\t\t\t\t\tdiary.clear_referers\n\t\t\t\t\tbegin\n\t\t\t\t\t\tdbh.execute(\"TRUNCATE TABLE \" + table + \";\")\n\t\t\t\t\trescue Errno::ENOENT\n\t\t\t\t\tend\n\t\t\t\t\tsave = false\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif save then\n\t\t\t\tunless ymd then\n\t\t\t\t\tymd = (@date ? @date : Time::now).strftime( '%Y%m%d' )\n\t\t\t\tend\n\t\t\t\tno = 0\n\t\t\t\tdiary.each_referer(diary.count_referers) {|count,ref|\n\t\t\t\t\tno += 1\n\t\t\t\t\tparam = [count, @conf.dbi_author, ymd, ref]\n\t\t\t\t\tbegin\n\t\t\t\t\t\tsth = dbh.execute(\"UPDATE \" + table + \" SET count=? WHERE author=? AND diary_id=? AND ref=?;\", *param)\n\t\t\t\t\t\tif sth.rows==0\n\t\t\t\t\t\t\tno = dbh.select_one(\"SELECT MAX(no) FROM \" + table + \" WHERE author=? AND diary_id=?\", @conf.dbi_author, ymd).first.to_i + 1\n\t\t\t\t\t\t\tparam << no\n\t\t\t\t\t\t\tdbh.execute(\"INSERT INTO \" + table + \" (count, author, diary_id, ref, no ) VALUES (?,?,?,?,?);\", *param)\n\t\t\t\t\t\tend\n\t\t\t\t\trescue DBI::ProgrammingError\n\t\t\t\t\t\t$stderr.puts \"invalid referer:#{ref}\"\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\t}\n\t}\nend",
"def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end",
"def go_terms\n go_db_id = ExternalDb.find_by_db_name('GO').id\n return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq\n end",
"def reference_columns(excluded_supertypes) #:nodoc:\n trace :columns, \"Reference Columns for #{name}\" do\n\n if absorbed_via and\n # If this is not a subtype, or is a subtype that has its own identification, use the id.\n (all_type_inheritance_as_subtype.size == 0 ||\n all_type_inheritance_as_subtype.detect{|ti| ti.provides_identification })\n rc = absorbed_via.from.reference_columns(excluded_supertypes)\n # The absorbed_via reference gets skipped here, and also in object_type.rb\n trace :columns, \"Skipping #{absorbed_via}\"\n absorbed_mirror ||= absorbed_via.reversed\n rc.each{|col| col.prepend(absorbed_mirror)}\n return rc\n end\n\n # REVISIT: Should have built preferred_identifier_references\n preferred_identifier.role_sequence.all_role_ref.map do |role_ref|\n # REVISIT: Should index references by to_role:\n ref = references_from.detect {|ref| ref.to_role == role_ref.role}\n\n raise \"reference for role #{role_ref.describe} not found on #{name} in #{references_from.size} references:\\n\\t#{references_from.map(&:to_s)*\"\\n\\t\"}\" unless ref\n\n ref.columns({})\n end.flatten\n end\n end",
"def test_manager_database_collection\n first_db = XMLDBApi::RedDatabase.new(\"first\")\n assert_equal(true, first_db.accepts_uri?(\"xmldb:first://some/collections\") == true)\n second_db = XMLDBApi::RedDatabase.new(\"second\")\n service = first_db.get_collection_management_service\n service.create_collection(\"coll-1\")\n service.create_collection(\"coll-2\")\n XMLDBApi::DatabaseManager.register_database(first_db)\n \n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n service = coll.get_service(\"CollectionManagementService\", \"1.0\")\n service.create_collection(\"coll-1-child\")\n child_coll = coll.get_child_collection(\"coll-1-child\")\n coll = child_coll.get_parent_collection\n assert_equal(true, coll.get_child_collection_count == 1)\n service = coll.get_service(\"CollectionManagementService\", \"1.0\")\n service.remove_collection(\"coll-1-child\")\n child_coll = coll.get_child_collection(\"coll-1-child\")\n \n assert_equal(true, child_coll == nil)\n assert_equal(true, coll.get_child_collection_count == 0)\n assert_raise XMLDBApi::Base::XMLDBException do\n XMLDBApi::DatabaseManager.deregister_database(first_db)\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n end\n \n XMLDBApi::DatabaseManager.register_database(first_db)\n \n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n coll.create_child_collection(\"order\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order\")\n coll.create_child_collection(\"another\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order/another\")\n coll = coll.get_parent_collection\n coll.remove_child_collection(\"another\")\n assert_raise XMLDBApi::Base::XMLDBException do\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order/another\")\n end\n \n first_db.create_collection(\"root_one\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_one\")\n assert_equal(true, coll.get_name == \"root_one\")\n first_db.create_collection(\"root_two\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_two\")\n assert_equal(true, coll.get_name == \"root_two\")\n first_db.remove_collection(\"root_two\")\n assert_raise XMLDBApi::Base::XMLDBException do\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_two\")\n end\n end",
"def store_reference\n 5.times do\n self[:reference] = generate_reference\n return reference unless self.class.where(:reference => reference).first\n end\n\n raise \"Could not generate unique reference for order\"\n end",
"def default_associated_key_alias\n self[:uses_left_composite_keys] ? (0...self[:through].first[:left].length).map{|i| :\"x_foreign_key_#{i}_x\"} : :x_foreign_key_x\n end",
"def all_linked_zone_identifiers; end",
"def all_linked_zone_identifiers; end",
"def references\n @references ||= []\n end",
"def references_to\n # REVISIT: If some other object has a Mapping to us, that should be in this list\n @mapping.all_member.select do |m|\n m.is_a?(MM::Absorption) and\n f = m.forward_mapping and # This Absorption has a forward counterpart, so must be reverse\n f.parent_role.is_unique\n end\n end",
"def cross_reference(aspect1, name1, aspect2, name2)\n self.search_by(aspect1, name1) & self.search_by(aspect2, name2)\n end",
"def vulns_by_ref(ref)\n\t\tVuln.find_by_sql(\n\t\t\t\"SELECT vulns.* FROM vulns, vulns_refs WHERE \" +\n\t\t\t\"vulns_refs.ref_id = #{ref.id} AND \" +\n\t\t\t\"vulns_refs.vuln_id = vulns.id\"\n\t\t)\n\tend",
"def references\n GameContent.where reference_id: self.id\n end",
"def single_object_db; end",
"def related_concept_ids(db, *ids)\n ids = ids.flatten\n other_ids = db[:mappings].where(concept_2_id: ids).where{Sequel.function(:lower, :relationship_id) =~ 'is_a'}.select_map(:concept_1_id)\n other_ids + ids\n end",
"def updateReference\n return @references\n end",
"def odata_table_reference\n @odata_table_reference\n end",
"def test_manipulate_databases\n number=1000\n relation_name = \"Dog\"\n relation_schema = {\"name\" => \"string\", \"race\" => \"string\", \"age\" => \"integer\"}\n values = {\"name\" => \"Bobby\", \"age\" => 2, \"race\"=> \"labrador\"}\n @dbids.each do |id|\n database(id).create_relation(relation_name,relation_schema)\n assert_equal(\"Dog\",database(id).relation_classes[\"Dog\"].table_name)\n end\n \n @dbids.each do |id|\n puts \"insert into db : #{id}\"\n\n (0..number).each do |i|\n count_values = {\"name\" => \"Bobby#{i}\", \"age\" => i, \"race\"=> \"labrador\"}\n database(id).relation_classes[\"Dog\"].insert(count_values)\n end\n assert_equal(number+1,database(id).relation_classes[\"Dog\"].all.size)\n\n end\n \n @dbids.each do |id|\n number_of_tuples_to_delete = rand(number)\n (1..number_of_tuples_to_delete).each do |i|\n database(id).relation_classes[\"Dog\"].delete(i)\n end\n assert_equal(number+1-number_of_tuples_to_delete,database(id).relation_classes[\"Dog\"].all.size)\n end\n \n end",
"def differences(dbh1, dbh2, name1, name2, masks, block) # :nodoc:\n idc = []\n mask_insert = []\n mask_delete = []\n mask = 0 # mask of previous table\n count = 0\n inserts = 0\n updates = 0\n deletes = 0\n (masks.size-1).downto(0) do |level|\n next_idc = []\n $stderr.print(\"investigating #{idc.inspect}, level=#{level}\\n\") if @verbose > 1\n raise \"giving up at level #{level}: #{idc.size} differences exceeeds max_report (#{@max_report})\" if (@max_report > 0 && idc.size > @max_report)\n\n # select statement handlers\n s1 = selidc(dbh1, \"#{name1}#{level}\", mask, level == 0, idc)\n s2 = selidc(dbh1, \"#{name2}#{level}\", mask, level == 0, idc)\n r1 = nil\n r2 = nil\n s1_active = true\n s2_active = true\n \n # content of one row from the above select result\n # let us merge the two ordered select\n while (true) do\n # update current lists if necessary\n if !r1 && s1_active\n r1 = s1.fetch\n s1_active = false unless r1\n end\n if !r2 && s2_active\n r2 = s2.fetch\n s2_active = false unless r2\n end\n break unless (r1 || r2)\n \n # else both lists are defined\n if (r1 && r2 && r1[0] == r2[0]) # matching idc\n if (r1[1] != r2[1]) # non matching checksums\n if (level != 0)\n next_idc.push(r1[0]) # to be investigated...\n else\n # the level-0 table keeps the actual key\n count += 1\n updates += 1\n block.call(:update, r1[2]) unless block.nil? # final result\n end\n end\n # both tuples are consummed\n r1 = nil\n r2 = nil\n \n # if they do not match, one is missing or less than the other\n elsif (!r2 || (r1 && r1[0] < r2[0])) # more idc in table 1\n if (level != 0)\n mask_insert.push([ r1[0], masks[masks.size-1] ]) # later\n else\n count += 1\n inserts += 1\n block.call(:insert, r1[2]) unless block.nil? # final result\n end\n # left tuple is consummed\n r1 = nil\n \n # this could be a else\n elsif (!r1 || (r2 && r1[0] > r2[0])) # more idc in table 2\n if (level != 0)\n mask_delete.push([ r2[0], masks[masks.size-1] ]) # later\n else\n count += 1\n deletes += 1\n block.call(:delete, r1[2]) unless block.nil? # final result\n end\n # right tuple is consummed\n r2 = nil\n else\n raise 'this state should never happen'\n end\n end\n s1.finish\n s2.finish\n level -= 1 # next table! 0 is the initial checksum table\n mask = masks.pop() # next mask\n idc = next_idc # idcs to be investigated on next round\n break if idc.empty?\n end\n {\n :count => count,\n :inserts => inserts,\n :updates => updates,\n :deletes => deletes,\n :mask_insert => mask_insert,\n :mask_delete => mask_delete\n }\n end",
"def _foreign_key_list_ds\n @_foreign_key_list_ds ||= __foreign_key_list_ds(false)\n end",
"def collect_foreign_key_references(metadata, foreign_keys, row)\n schema = metadata.tableSchema\n\n # Add row as foreignKey source\n Array(schema ? schema.foreignKeys : []).each do |fk|\n colRef = Array(fk['columnReference'])\n\n # Referenced cells, in order\n cells = colRef.map {|n| row.values.detect {|cell| cell.column.name == n}}.compact\n cell_values = cells.map {|cell| cell.stringValue unless cell.stringValue.to_s.empty?}.compact\n next if cell_values.empty? # Don't record if empty\n (fk[:reference_from] ||= {})[cell_values] ||= row\n end\n\n # Add row as foreignKey dest\n Array(foreign_keys).each do |fk|\n colRef = Array(fk['reference']['columnReference'])\n\n # Referenced cells, in order\n cells = colRef.map {|n| row.values.detect {|cell| cell.column.name == n}}.compact\n fk[:reference_to] ||= {}\n cell_values = cells.map {|cell| cell.stringValue unless cell.stringValue.to_s.empty?}.compact\n next if cell_values.empty? # Don't record if empty\n log_error \"Table #{metadata.url} row #{row.number}(src #{row.sourceNumber}): found duplicate foreign key target: #{cell_values.map(&:to_s).inspect}\" if fk[:reference_to][cell_values]\n fk[:reference_to][cell_values] ||= row\n end\n end",
"def handle_references_label(vals)\n @references_collection << vals.last\n @references = vals.last if matches_mdes_version(vals)\n end",
"def links(options={})\n options = {:get_dataset => false, :type => Ecore::Link, :reload => false, :preconditions => {:hidden => false}}.merge(options)\n return @links_chache if @links_chache and !options[:get_dataset] and !options[:reload]\n query = Ecore::db[options[:type].table_name].store_preconditions((@group_ids || @user_id),self.class.get_type_if_has_superclass,self,nil,(options[:preconditions] || {:hidden => false}))\n query = query.where(:orig_document_id => id)\n return query if options[:get_dataset]\n @links_chache = query.order(:name,:created_at).receive(:all)\n end",
"def ref; end",
"def dereference(dbref)\n collection(dbref.namespace).find_one(\"_id\" => dbref.object_id)\n end",
"def gain(doc_id)\n return @qrels[doc_id] # as is\n end",
"def refs_by_vuln(vuln)\n\t\tRef.find_by_sql(\n\t\t\t\"SELECT refs.* FROM refs, vulns_refs WHERE \" +\n\t\t\t\"vulns_refs.vuln_id = #{vuln.id} AND \" +\n\t\t\t\"vulns_refs.ref_id = refs.id\"\n\t\t)\n\tend",
"def references_for_repository(repository_name)\n @reference_mapping[repository_name] || []\n end",
"def refers_to(*args)\n require \"og/relation/refers_to\"\n relations! << Og::RefersTo.new(args, :owner_class => self)\n end",
"def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end",
"def filtered_references\n super.select do |ref|\n ref.candidate_uris.for(class:URI::DOI).nil?\n end\n end",
"def ref?\n schema[\"$ref\"]\n end",
"def references(collection)\n target.try(:references, collection) || []\n end",
"def rpc_get_ref(name)\n ::ApplicationRecord.connection_pool.with_connection {\n db_check\n self.framework.db.get_ref(name)\n }\n end",
"def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commentable_type, self.commentable_id, self.reference_ids], :order => 'comments.position ASC')\n end",
"def right_table; table_sync.right_table; end",
"def _References\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_Reference)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_SkipBlock)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n set_failed_rule :_References unless _tmp\n return _tmp\n end",
"def fetch_diff(database)\n anc = ActiveRecord::Base.connection.select_all <<~SQL\n select identifier, person_name.given_name, person_name.family_name\n from #{database}.person_name\n inner join #{database}.patient_identifier\n on person_name.person_id = patient_identifier.patient_id\n where patient_identifier.identifier_type = 3\n and patient_identifier.voided = 0\n and person_name.voided = 0\n SQL\n\n openmrs = ActiveRecord::Base.connection.select_all <<~SQL\n select identifier, person_name.given_name, person_name.family_name\n from person_name\n inner join patient_identifier\n on person_name.person_id = patient_identifier.patient_id\n where patient_identifier.voided = 0\n and person_name.voided = 0\n SQL\n\n anc.to_a - openmrs.to_a\nend",
"def ==(other)\n other.is_a?(Recliner::Database) && uri == other.uri\n end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def locate_internal_refs1(refs, identifier, ident)\n #file, _filename = targetfile(filedesc, read: true)\n file, _filename = @files.targetfile_id(ident, read: true)\n xml = Nokogiri::XML(file) { |config| config.huge }\n t = xml.xpath(\"//*/@id\").each_with_object({}) { |i, x| x[i.text] = true }\n refs.each do |schema, ids|\n ids.keys.select { |id| t[id] }.each do |id|\n n = xml.at(\"//*[@id = '#{id}']\") and\n n.at(\"./ancestor-or-self::*[@type = '#{schema}']\") and\n refs[schema][id] = identifier\n end\n end\n end",
"def reciprocal_type\n :one_to_many\n end",
"def references\n @references = operands.select {|op| op.is_a?(RDF::Resource)}\n end",
"def insert_references( heap_objects )\n sql = <<-SQL\n INSERT INTO 'references' ('a', 'b') VALUES (:a, :b)\n SQL\n\n db.transaction do |transaction|\n transaction.prepare(sql) do |statement|\n heap_objects.each do |obj|\n address = obj.address\n references = obj.references\n next if references.nil? || references.empty?\n\n references.uniq.each do |reference|\n statement.execute({\":a\" => address, \":b\" => reference})\n end\n end\n end\n end\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def refresh_db_related\n return if @table_follows.empty?\n\n @first_db_entry = @table_follows.first\n @last_follow_time = @first_db_entry[:follow_time]\n end",
"def register_references_to(live_objects, options = Hash.new)\n orig_options = options # to exclude it from the graph\n options = Kernel.validate_options options,\n :roots => [Object], :excluded_classes => [], :excluded_objects => [],\n :include_class_relation => false\n roots_class, roots = options[:roots].partition { |obj| obj.kind_of?(Class) }\n excluded_classes = options[:excluded_classes]\n excluded_objects = options[:excluded_objects]\n include_class_relation = options[:include_class_relation]\n\n # Create a single ObjectRef per (interesting) live object, so that we\n # can use a BGL::Graph to represent the reference graph. This will be\n # what we are going to access later on. Use object IDs since we really\n # want to refer to objects and not use eql? comparisons\n desired_seeds = roots.map(&:object_id)\n excludes = [live_objects, self, graph, references, orig_options, options, roots, roots_class].to_value_set\n live_objects_total = live_objects.size\n live_objects.delete_if do |obj|\n if obj.kind_of?(DRbObject)\n true\n elsif excludes.include?(obj) || obj.respond_to?(:__ruby_object_graph_internal__)\n true\n else\n references[obj.object_id] ||= ObjectRef.new(obj)\n if roots_class.any? { |k| obj.kind_of?(k) }\n if !excluded_classes.any? { |k| obj.kind_of?(k) }\n if !excluded_objects.include?(obj)\n desired_seeds << obj.object_id\n end\n end\n end\n false\n end\n end\n\n desired_seeds.each do |obj_id|\n graph.insert(references[obj_id])\n end\n ignored_enumeration = Hash.new\n\n names = Hash[\n :array => \"Array\",\n :value_set => \"ValueSet[]\",\n :vertex => \"Vertex[]\",\n :edge => \"Edge[]\",\n :hash_key => \"Hash[key]\",\n :hash_value => \"Hash[value]\",\n :proc => \"Proc\",\n :ancestor => \"Ancestor\"]\n puts \"RubyObjectGraph: #{live_objects.size} objects found, #{desired_seeds.size} seeds and #{live_objects_total} total live objects\"\n loop do\n old_graph_size = graph.size\n live_objects.each do |obj|\n obj_ref = references[obj.object_id]\n\n if include_class_relation\n test_and_add_reference(obj_ref, obj.class, \"class\")\n end\n\n for var_name in obj.instance_variables\n var = obj.instance_variable_get(var_name)\n test_and_add_reference(obj_ref, var, var_name.to_s)\n end\n\n case obj\n when Array\n for var in obj\n test_and_add_reference(obj_ref, var, names[:array])\n end\n when ValueSet\n for var in obj\n test_and_add_reference(obj_ref, var, names[:value_set])\n end\n when BGL::Graph\n obj.each_vertex do\n test_and_add_reference(obj_ref, var, names[:vertex])\n end\n obj.each_edge do |_, _, info|\n test_and_add_reference(obj_ref, info, names[:edge])\n end\n when Hash\n for var in obj\n test_and_add_reference(obj_ref, var[0], names[:hash_key])\n test_and_add_reference(obj_ref, var[1], names[:hash_value])\n end\n when Proc\n if obj.respond_to?(:references)\n for var in obj.references\n begin\n test_and_add_reference(obj_ref, ObjectSpace._id2ref(var), names[:proc])\n rescue RangeError\n end\n end\n end\n when Class\n for ref in obj.ancestors\n test_and_add_reference(obj_ref, ref, names[:ancestor])\n end\n else\n if obj.respond_to?(:each)\n if obj.kind_of?(Module) || obj.kind_of?(Class)\n if !ignored_enumeration[obj]\n ignored_enumeration[obj] = true\n puts \"ignoring enumerator class/module #{obj}\"\n end\n else\n if !ignored_enumeration[obj.class]\n ignored_enumeration[obj.class] = true\n puts \"ignoring enumerator object of class #{obj.class}\"\n end\n end\n end\n end\n end\n if old_graph_size == graph.size\n break\n end\n end\n live_objects.clear # to avoid making it a central node in future calls\n return graph\n end"
] | [
"0.6384657",
"0.5922631",
"0.5818222",
"0.5818222",
"0.5795421",
"0.57603663",
"0.572891",
"0.56636584",
"0.5658218",
"0.55373156",
"0.5443452",
"0.5430512",
"0.5425988",
"0.542276",
"0.5421809",
"0.5420887",
"0.53477037",
"0.5316272",
"0.5305135",
"0.5300155",
"0.52511823",
"0.520731",
"0.5188656",
"0.51676923",
"0.5164796",
"0.51627696",
"0.5162491",
"0.5160502",
"0.5156509",
"0.51501",
"0.51414853",
"0.5138755",
"0.5126814",
"0.511592",
"0.5103794",
"0.5102952",
"0.50963783",
"0.5091787",
"0.5063684",
"0.504359",
"0.50379294",
"0.50254077",
"0.5022355",
"0.50199413",
"0.5011995",
"0.5000584",
"0.49992502",
"0.49983415",
"0.4981334",
"0.49811298",
"0.49769726",
"0.4971927",
"0.4964",
"0.49536753",
"0.49425116",
"0.49373326",
"0.4914194",
"0.49026066",
"0.48950815",
"0.48950815",
"0.4891738",
"0.4886698",
"0.488337",
"0.4879162",
"0.4868104",
"0.4859987",
"0.4848496",
"0.48410144",
"0.48379874",
"0.48318735",
"0.48293993",
"0.4825565",
"0.4819205",
"0.48182335",
"0.4816055",
"0.48137596",
"0.4810906",
"0.47962505",
"0.4793969",
"0.47935507",
"0.47930717",
"0.47906476",
"0.47865447",
"0.47757465",
"0.47687942",
"0.4755627",
"0.47545156",
"0.47503904",
"0.4746634",
"0.4745678",
"0.47316954",
"0.47308934",
"0.47278142",
"0.47257525",
"0.47221413",
"0.4720743",
"0.47205177",
"0.47205177",
"0.47205177",
"0.4716418",
"0.471495"
] | 0.0 | -1 |
DR Crossreferences to other databases (>=0 per entry) | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def referencing_databases\n ensure_service!\n\n @grpc.referencing_databases.map do |referencing_database|\n segments = referencing_database.split \"/\"\n database_grpc = service.get_database segments[3], segments[5]\n Database.from_grpc database_grpc, service\n end\n end",
"def on_db_ref(ref)\n\tend",
"def references; end",
"def references; end",
"def __foreign_key_list_ds(reverse)\n if reverse\n ctable = Sequel[:att2]\n cclass = Sequel[:cl2]\n rtable = Sequel[:att]\n rclass = Sequel[:cl]\n else\n ctable = Sequel[:att]\n cclass = Sequel[:cl]\n rtable = Sequel[:att2]\n rclass = Sequel[:cl2]\n end\n\n if server_version >= 90500\n cpos = Sequel.expr{array_position(co[:conkey], ctable[:attnum])}\n rpos = Sequel.expr{array_position(co[:confkey], rtable[:attnum])}\n # :nocov:\n else\n range = 0...32\n cpos = Sequel.expr{SQL::CaseExpression.new(range.map{|x| [SQL::Subscript.new(co[:conkey], [x]), x]}, 32, ctable[:attnum])}\n rpos = Sequel.expr{SQL::CaseExpression.new(range.map{|x| [SQL::Subscript.new(co[:confkey], [x]), x]}, 32, rtable[:attnum])}\n # :nocov:\n end\n\n ds = metadata_dataset.\n from{pg_constraint.as(:co)}.\n join(Sequel[:pg_class].as(cclass), :oid=>:conrelid).\n join(Sequel[:pg_attribute].as(ctable), :attrelid=>:oid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:conkey])).\n join(Sequel[:pg_class].as(rclass), :oid=>Sequel[:co][:confrelid]).\n join(Sequel[:pg_attribute].as(rtable), :attrelid=>:oid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:confkey])).\n join(Sequel[:pg_namespace].as(:nsp), :oid=>Sequel[:cl2][:relnamespace]).\n order{[co[:conname], cpos]}.\n where{{\n cl[:relkind]=>%w'r p',\n co[:contype]=>'f',\n cpos=>rpos\n }}.\n select{[\n co[:conname].as(:name),\n ctable[:attname].as(:column),\n co[:confupdtype].as(:on_update),\n co[:confdeltype].as(:on_delete),\n cl2[:relname].as(:table),\n rtable[:attname].as(:refcolumn),\n SQL::BooleanExpression.new(:AND, co[:condeferrable], co[:condeferred]).as(:deferrable),\n nsp[:nspname].as(:schema)\n ]}\n\n if reverse\n ds = ds.order_append(Sequel[:nsp][:nspname], Sequel[:cl2][:relname])\n end\n\n ds\n end",
"def on_db_ref(context, ref)\n\tend",
"def references_bw_canonical\n view_name = references_bw_canonical_tn\n if @references_bw_canonical_tn_exists.nil?\n @references_bw_canonical_tn_exists=true\n if !$db.table_exists?(view_name)\n $db.run(\"CREATE VIEW #{view_name} AS SELECT r.canonical_document_id as cd_start, ref.canonical_document_id as cd_end FROM records r INNER JOIN records_searches br ON r.id=br.record_id INNER JOIN searches b ON br.search_id=b.id INNER JOIN records_references rr ON rr.record_id=r.id INNER JOIN bib_references ref ON ref.id=rr.reference_id WHERE systematic_review_id='#{self[:id]}' AND ref.canonical_document_id IS NOT NULL AND b.valid=1 GROUP BY cd_start, cd_end\")\n end\n end\n $db[view_name.to_sym]\n end",
"def update_links\n return if self.suppress_recreate_trigger == true\n \n marc_foreign_objects = Hash.new\n \n # All the allowed relation types *must* be in this array or they will be dropped\n allowed_relations = [\"people\", \"standard_titles\", \"standard_terms\", \"institutions\", \"catalogues\", \"liturgical_feasts\", \"places\"]\n \n # Group all the foreign associations by class, get_all_foreign_associations will just return\n # a flat list of objects\n marc.get_all_foreign_associations.each do |object_id, object|\n next if object.is_a? Source\n \n foreign_class = object.class.name.pluralize.underscore\n marc_foreign_objects[foreign_class] = [] if !marc_foreign_objects.include? (foreign_class)\n \n marc_foreign_objects[foreign_class] << object\n \n end\n \n # allowed_relations explicitly needs to contain the classes we will repond to\n # Log if in the Marc there are \"unknown\" classes, should never happen\n unknown_classes = marc_foreign_objects.keys - allowed_relations\n # If there are unknown classes purge them\n related_classes = marc_foreign_objects.keys - unknown_classes\n \n if !unknown_classes.empty?\n puts \"Tried to relate with the following unknown classes: #{unknown_classes.join(',')}\"\n end\n \n related_classes.each do |foreign_class|\n relation = self.send(foreign_class)\n \n # The foreign class array holds the correct number of object\n # We want to delete or add only the difference betweend\n # what is in marc and what is in the DB relations\n new_items = marc_foreign_objects[foreign_class] - relation.to_a\n remove_items = relation.to_a - marc_foreign_objects[foreign_class]\n \n # Delete or add to the DB relation\n relation.delete(remove_items)\n relation << new_items\n\n # If this item was manipulated, update also the src count\n # Unless the suppress_update_count is set\n if !self.suppress_update_count_trigger\n (new_items + remove_items).each do |o|\n o.update_attribute( :src_count, o.sources.count )\n end\n end\n \n end\n \n # update the parent manuscript when having 773/772 relationships\n update_77x unless self.suppress_update_77x_trigger == true \n end",
"def references(current_table)\r\n references = []\r\n tables = get_tables\r\n tables.each do |table|\r\n columns = get_column_names(table)\r\n columns.each do |column|\r\n if /[_id]$/.match(column)\r\n references << table if column.split('_id').join == current_table\r\n end\r\n end\r\n end\r\n references\r\n end",
"def macro\n :references_one\n end",
"def macro\n :references_one\n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:is_ref?).select(&:is_active?).map(&:name)\n return if r.nil?\n [:haai_db, :aai_db, :ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? or not File.size? db\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def referenced?; end",
"def crossref_query\n CrossrefQuery.generate_query_from_text( ref_apa_6 )\n end",
"def referenced; end",
"def referenced_tables(tables)\n result = {}\n tables.each do |table|\n result[table] = []\n self.select_all(\"select reftabname from syscat.references where tabname = '#{table.upcase}'\").each do |row|\n result[table] << row['reftabname'].downcase\n end\n end\n result\n end",
"def __drbref\n @ref\n end",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)\n return if r.nil?\n\n %i[haai_db aai_db ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? || !File.size?(db)\n\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def check_db_changes\n partist = DBClasses::Artist.new.ref_load(self.artist.rartist)\n precord = DBClasses::Record.new.ref_load(self.record.rrecord)\n psegment = DBClasses::Segment.new.ref_load(self.segment.rsegment)\n ptrack = DBClasses::Track.new.ref_load(self.track.rtrack)\n\n\n end",
"def tables_with_referential_integrity\n schemas_and_tables = select_rows <<-SQL.strip_heredoc\n SELECT s.name, o.name\n FROM sys.foreign_keys i\n INNER JOIN sys.objects o ON i.parent_object_id = o.OBJECT_ID\n INNER JOIN sys.schemas s ON o.schema_id = s.schema_id\n SQL\n schemas_and_tables.map do |schema_table|\n schema, table = schema_table\n \"#{SQLServer::Utils.quoted_raw(schema)}.#{SQLServer::Utils.quoted_raw(table)}\"\n end\n end",
"def serialize_dbxref(feature_uri, dbxref_composite)\n abbreviation, accession = dbxref_composite.split(':', 2)\n dbxref_uri = RDF::URI.new(\"#{feature_uri.to_s}/dbxref/#{BioInterchange.make_safe_label(abbreviation)}\")\n create_triple(feature_uri, @base.references, dbxref_uri)\n\n create_triple(dbxref_uri, RDF.type, @base.ExternalReference)\n create_triple(dbxref_uri, @base.refers_to, BioInterchange::LifeScienceRegistry.send(dbxref_composite.split('_', 2)[0].downcase).sub('$id', accession))\n if dbxref_composite.match(/^.+_.+:.+$/) then\n # Entry with version information.\n version_uri = RDF::URI.new(\"#{dbxref_uri}/version\")\n create_triple(dbxref_uri, @base.has_identifier, version_uri)\n create_triple(version_uri, @base.has_value, abbreviation[6..-1])\n end\n\n #if dbxref_composite.match(/^dbSNP(_\\d+)?:rs\\d+$/) then\n # # linkout = \"http://www.ncbi.nlm.nih.gov/projects/SNP/snp_ref.cgi?rs=#{dbxref_composite.split(/:/)[1].sub(/^rs/, '')}\"\n #elsif dbxref_composite.match(/^COSMIC(_\\d+)?:COSM\\d+$/) then\n # linkout = \"http://cancer.sanger.ac.uk/cosmic/mutation/overview?id=#{accession.sub(/^COSM/, '')}\"\n #else\n # BioInterchange::GOXRef.send(BioInterchange.make_safe_label(abbreviation)).to_s + accession\n #end\n end",
"def references\n alias_of.references\n end",
"def update_direct_refs_to_docs(docxml, identifier)\n erefs = collect_erefs(docxml)\n docxml.xpath(ns(\"//bibitem[not(ancestor::bibitem)]\")).each do |b|\n docid = b.at(ns(\"./docidentifier[@type = 'repository']\"))\n (docid && %r{^current-metanorma-collection/}.match(docid.text)) or next\n update_bibitem(b, identifier)\n docid = docid_to_citeas(b) or next\n erefs[:citeas][docid] and update_anchors(b, docxml, docid)\n end\n end",
"def migrate_contact_entity_linkages\n contacts_for_keys = @source_redis.keys('contacts_for:*')\n\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n contacts_for_keys.each do |contacts_for_key|\n\n unless contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_id = $1\n check_name = $2\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |check_name|\n tag_for_check.call(entity_name, check_name, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def second_reference_id\n nil\n end",
"def column_references_sql(options)\n sql = [super(options)]\n\t sql << flag_option_sql(options, :rely)\n\t sql << flag_option_sql(options, :enable, 'DISABLE')\n\t sql << flag_option_sql(options, :validate)\n\t sql.join ' '\n end",
"def associates\n self.doc_refs\n end",
"def objects_with_references\n end",
"def _reverse_foreign_key_list_ds\n @_reverse_foreign_key_list_ds ||= __foreign_key_list_ds(true)\n end",
"def add_references(klazz, string)\n klazz.references.each do |r|\n string << \" many_to_one #{r.name.to_sym.inspect}, :class => #{r.rb_klazz.to_sym.inspect}, :key => #{r.foreignkeys.map {|fk| fk.field.to_sym}.inspect}\\n\"\n end\n string << (klazz.references.empty? ? '' : \"\\n\")\n end",
"def referring_record\n return @referring_record == :nil ? nil : @referring_record unless @referring_record.nil?\n\n res = referenced_from\n if res.length == 1\n @referring_record = res.first&.from_record\n return @referring_record if @referring_record\n end\n\n @referring_record = :nil\n nil\n end",
"def validate_relation_references(primary_ir)\n primary_ir.keys.each do |k|\n if primary_ir[k][:source_dsd_name]\n unless primary_ir[k][:source_structure][:dsd] == primary_ir[k][:source_dsd_name]\n raise \"#{primary_ir[k][:full_source_relation_name]} is not an implementation of #{primary_ir[k][:source_dsd_name]} as required by #{primary_ir[k][:full_relation_name]}... which is an implementation of #{primary_ir[k][:dsd]}\"\n end\n end\n end\n nil\n end",
"def migrate_contact_entity_linkages\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n source_keys_matching('contacts_for:?*').each do |contacts_for_key|\n\n contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n entity_id = Regexp.last_match(1)\n check_name = Regexp.last_match(2)\n if entity_id.nil?\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |cn|\n next if cn.empty?\n tag_for_check.call(entity_name, cn, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def ref\n @references += 1\n end",
"def absorption_references\n @references.inject([]) do |array, ref|\n array << ref\n # puts \"Column #{name} spans #{ref}, #{ref.is_absorbing ? \"\" : \"not \"} absorbing (#{ref.to.name} absorbs via #{ref.to.absorbed_via.inspect})\"\n break array unless ref.is_absorbing\n array\n end\n end",
"def refs_table_required(site, doc)\n if doc.data.key?('refs')\n doc.data['refs']\n elsif site.config['collections'][doc.collection.label].key?('refs')\n site.config['collections'][doc.collection.label]['refs']\n elsif site.config.key?('refs')\n site.config['refs']\n end\n end",
"def references_from\n @mapping.all_member.select do |m|\n !m.is_a?(MM::Absorption) or\n !m.forward_mapping && m.parent_role.is_unique # A forward absorption has no forward absorption\n end\n end",
"def migrate_contact_entity_linkages\n all_entity_names_by_id = @source_redis.hgetall('all_entity_names_by_id')\n\n source_keys_matching('contacts_for:?*').each do |contacts_for_key|\n\n contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n entity_id = $1\n check_name = $2\n if entity_id.nil?\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n entity_name = all_entity_names_by_id[entity_id]\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n next if contact_ids.empty?\n\n contacts = contact_ids.collect {|c_id| find_contact(c_id) }\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] ||= []\n end\n\n tag_for_check = proc do |en, cn, tn|\n check = find_check(en, cn)\n check.tags << find_tag(tn, :create => true)\n\n contacts.each do |contact|\n @check_ids_by_contact_id_cache[contact.id] << check.id\n end\n end\n\n if check_name.nil?\n # interested in entity, so apply to all checks for that entity\n tag_name = \"entity_#{entity_name}\"\n\n all_checks_for_entity = @source_redis.zrange(\"all_checks:#{entity_name}\", 0, -1)\n all_checks_for_entity.each do |check_name|\n tag_for_check.call(entity_name, check_name, tag_name)\n end\n else\n # interested in check\n tag_for_check.call(entity_name, check_name,\n \"check_#{entity_name}:#{check_name}\")\n end\n end\n end",
"def validate_references\n if datasets.count == 1\n []\n else\n x = datasets.reduce([]) { |a, e| e.anchor? ? a << [e.name, e.anchor[:name]] : a }\n refs = datasets.reduce([]) do |a, e|\n a.concat(e.references)\n end\n refs.reduce([]) do |a, e|\n x.include?([e[:dataset], e[:reference]]) ? a : a.concat([e])\n end\n end\n end",
"def refs_at; end",
"def read_new_schema\n AssociatedRecord.reset_column_information\n DeeplyAssociatedRecord.reset_column_information\n\n AssociatedRecord.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n Item.cached_primary_index.send(:instance_variable_set, :@cache_key_prefix, nil)\n end",
"def uri_for_other_referent_than(obj)\n self.class.participating_models.each {|model|\n self.class.reference_columns_for(model).each {|column|\n if self[column] && (model != obj.class || self[column] != obj.id)\n return model.my_jsonmodel.uri_for(self[column],\n :repo_id => RequestContext.get(:repo_id))\n end\n }\n }\n\n raise \"Failed to find a URI for other referent in #{self}: #{obj.id}\"\n end",
"def idref\n \"c#{rank}\"\n end",
"def default_ref_node(this_db = self.started_db)\n this_db.graph.reference_node\n end",
"def get_drv_graph\n map = {}\n query = <<END\nselect r1.path, r2.path\nfrom Refs r\njoin ValidPaths r1 on r1.id == referrer\njoin ValidPaths r2 on r2.id == reference\nwhere r1.path like '%.drv' and r2.path like '%.drv';\nEND\n nix_db.execute(query) do |drv1, drv2|\n drv1 = drv1.to_sym\n drv2 = drv2.to_sym\n (map[drv1] ||= []) << drv2\n map[drv2] ||= []\n end\n map\nend",
"def target_ds_ref\n if @target_ds_ref.nil?\n if one_item.nil?\n raise \"'one_item' must be previously set to be able to \" <<\n 'access the target Datastore.'\n end\n\n target_ds_id = one_item['HISTORY_RECORDS/HISTORY[last()]/DS_ID']\n raise 'No valid target_ds_id found.' if target_ds_id.nil?\n\n target_ds =\n VCenterDriver::VIHelper\n .one_item(\n OpenNebula::Datastore,\n target_ds_id\n )\n\n @target_ds_ref = target_ds['TEMPLATE/VCENTER_DS_REF']\n end\n\n @target_ds_ref\n end",
"def auto_assoc(opts = {})\n except = opts[:except] || []\n\n assocs = db.schema_parse_associations(table_name)\n relations = process_join_tables(assocs)\n\n relations.each do |row|\n src_tbl = row[:src_tbl]\n src_col = row[:src_col]\n if src_tbl == table_name && ! (src_col & except).empty?\n # TODO enable except for *_to_many\n next\n end\n src_uniq = row[:src_uniq]\n src_cardinality = cardinality(src_uniq)\n\n join_tbl = row[:join_tbl]\n\n dst_tbl = row[:dst_tbl]\n dst_col = row[:dst_col]\n dst_uniq = row[:dst_uniq]\n dst_cardinality = cardinality(dst_uniq)\n\n TABLE_MODELS.wait_all(src_tbl, dst_tbl) do |src_cls, dst_cls|\n self_ref = src_cls == dst_cls\n\n src = self_ref ? :child : underscore(src_cls.name).to_sym\n src = src_uniq ? singularize(src).to_sym : pluralize(src).to_sym\n\n dst = self_ref ? :parent : underscore(dst_cls.name).to_sym\n dst = dst_uniq ? singularize(dst).to_sym : pluralize(dst).to_sym\n\n if join_tbl\n left_col = row[:left_col]\n right_col = row[:right_col]\n send :many_to_many, src, :class => src_cls, :join_table => join_tbl,\n :left_key => left_col, :left_primary_key => dst_col,\n :right_key => right_col, :right_primary_key => src_col\n else\n # TODO name overrides\n\n if self == dst_cls\n # dst holds the foreign key -> one_to_*\n meth = dst_cardinality + '_to_' + src_cardinality\n send meth, src, :class => src_cls, :key => src_col, :primary_key => dst_col\n end\n\n if self == src_cls\n # src holds the foreign key -> *_to_one\n meth = src_cardinality + '_to_' + dst_cardinality\n\n # one_to_one requires to swap pk and fk\n src_col, dst_col = dst_col, src_col if src_uniq\n send meth, dst, :class => dst_cls, :key => src_col, :primary_key => dst_col\n end\n end\n\n end\n end\n end",
"def migrate_contact_entity_linkages\n contacts_for_keys = @source_redis.keys('contacts_for:*')\n\n contacts_for_keys.each do |contacts_for_key|\n\n if contacts_for_key =~ /\\Acontacts_for:(#{ID_PATTERN_FRAGMENT})(?::(#{CHECK_PATTERN_FRAGMENT}))?\\z/\n\n entity_id = $1\n check_name = $2\n\n contact_ids = @source_redis.smembers(contacts_for_key)\n\n next if contact_ids.empty?\n\n contacts = contact_ids.collect do |contact_id|\n find_contact(contact_id)\n end\n\n entity = find_entity(:id => entity_id)\n\n if check_name.nil?\n # interested in entity\n entity.contacts.add(*contacts)\n else\n # interested in check\n check = find_or_create_check(entity.name, check_name)\n check.contacts.add(*contacts)\n end\n\n else\n raise \"Bad regex for '#{contacts_for_key}'\"\n end\n\n end\n\n entity_tag_keys = @source_redis.keys('entity_tag:*')\n\n entities_with_changed_tags = {}\n\n entity_tag_keys.each do |entity_tag_key|\n\n # TODO fix regex, check current code\n raise \"Bad regex for '#{entity_tag_key}'\" unless entity_tag_key =~ /\\Aentity_tag:(#{TAG_PATTERN_FRAGMENT})\\z/\n\n tag = $1\n\n entity_ids = @source_redis.smembers(entity_tag_key)\n\n entity_ids.each do |entity_id|\n\n entity = Flapjack::Data::Entity.find_by_id(entity_id)\n raise \"No entity with id #{entity_id}\" if entity.nil?\n entity.tags << tag\n entities_with_changed_tags[entity_id] = entity\n end\n end\n\n entities_with_changed_tags.values.each do |entity|\n entity.save\n end\n\nend",
"def resolve_reference; end",
"def default_associated_key_alias\n self[:uses_left_composite_keys] ? (0...self[:left_keys].length).map{|i| :\"x_foreign_key_#{i}_x\"} : :x_foreign_key_x\n end",
"def references\n @references\n end",
"def referer_transaction( diary = nil, save = false )\n\treturn if @conf.io_class.to_s != 'TDiary::DbiIO'\n\n\tFile.open(\"#{@conf.data_path}/dbi_io_ref.lock\", 'w') {|file|\n\t\tfile.flock(File::LOCK_EX)\n\t\tdbh = DBI.connect(@conf.dbi_driver_url, @conf.dbi_user, @conf.dbi_passwd)\n\t\tdbh.transaction{\n\t\t\tif diary.respond_to?( :date ) then\n\t\t\t\ttable = 'refererdata'\n\t\t\t\tymd = diary.date.strftime('%Y%m%d')\n\t\t\t\tbegin\n\t\t\t\t\tsql = \"SELECT diary_id, count, ref FROM \" + table + \" WHERE author=? AND diary_id=?;\"\n\t\t\t\t\tdbh.select_all(sql, @conf.dbi_author || 'default', ymd) {|diary_id, count, ref|\n\t\t\t\t\t\tyield(ref.chomp, count.to_i)\n\t\t\t\t\t}\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\tend\n\t\t\telse\n\t\t\t\ttable = 'referervolatile'\n\t\t\t\tymd = nil\n\t\t\t\tbegin\n\t\t\t\t\tsql = \"SELECT diary_id, count, ref FROM \" + table + \" WHERE author=?;\"\n\t\t\t\t\tdbh.select_all(sql, @conf.dbi_author || 'default') {|diary_id, count, ref|\n\t\t\t\t\t\tyield(ref.chomp, count.to_i)\n\t\t\t\t\t\tymd = diary_id\n\t\t\t\t\t}\n\t\t\t\trescue Errno::ENOENT\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @mode =~ /^(append|replace)$/ and !diary.respond_to?( :date ) then\n\t\t\t\tif !ymd or (@date.strftime( '%Y%m%d' ) > ymd) then\n\t\t\t\t\tymd = nil\n\t\t\t\t\tdiary.clear_referers\n\t\t\t\t\tbegin\n\t\t\t\t\t\tdbh.execute(\"TRUNCATE TABLE \" + table + \";\")\n\t\t\t\t\trescue Errno::ENOENT\n\t\t\t\t\tend\n\t\t\t\t\tsave = false\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif save then\n\t\t\t\tunless ymd then\n\t\t\t\t\tymd = (@date ? @date : Time::now).strftime( '%Y%m%d' )\n\t\t\t\tend\n\t\t\t\tno = 0\n\t\t\t\tdiary.each_referer(diary.count_referers) {|count,ref|\n\t\t\t\t\tno += 1\n\t\t\t\t\tparam = [count, @conf.dbi_author, ymd, ref]\n\t\t\t\t\tbegin\n\t\t\t\t\t\tsth = dbh.execute(\"UPDATE \" + table + \" SET count=? WHERE author=? AND diary_id=? AND ref=?;\", *param)\n\t\t\t\t\t\tif sth.rows==0\n\t\t\t\t\t\t\tno = dbh.select_one(\"SELECT MAX(no) FROM \" + table + \" WHERE author=? AND diary_id=?\", @conf.dbi_author, ymd).first.to_i + 1\n\t\t\t\t\t\t\tparam << no\n\t\t\t\t\t\t\tdbh.execute(\"INSERT INTO \" + table + \" (count, author, diary_id, ref, no ) VALUES (?,?,?,?,?);\", *param)\n\t\t\t\t\t\tend\n\t\t\t\t\trescue DBI::ProgrammingError\n\t\t\t\t\t\t$stderr.puts \"invalid referer:#{ref}\"\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\t}\n\t}\nend",
"def references\n @data[:refs].map { |ref|\n ref[:id] = nil\n ref[:doi] = nil if ref[:doi].nil?\n ref[:volume] = nil if ref[:volume].nil?\n ref[:journal_name] = nil if ref[:journal_name].nil?\n RefEm::Entity::Reference.new(ref)\n }\n end",
"def go_terms\n go_db_id = ExternalDb.find_by_db_name('GO').id\n return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq\n end",
"def reference_columns(excluded_supertypes) #:nodoc:\n trace :columns, \"Reference Columns for #{name}\" do\n\n if absorbed_via and\n # If this is not a subtype, or is a subtype that has its own identification, use the id.\n (all_type_inheritance_as_subtype.size == 0 ||\n all_type_inheritance_as_subtype.detect{|ti| ti.provides_identification })\n rc = absorbed_via.from.reference_columns(excluded_supertypes)\n # The absorbed_via reference gets skipped here, and also in object_type.rb\n trace :columns, \"Skipping #{absorbed_via}\"\n absorbed_mirror ||= absorbed_via.reversed\n rc.each{|col| col.prepend(absorbed_mirror)}\n return rc\n end\n\n # REVISIT: Should have built preferred_identifier_references\n preferred_identifier.role_sequence.all_role_ref.map do |role_ref|\n # REVISIT: Should index references by to_role:\n ref = references_from.detect {|ref| ref.to_role == role_ref.role}\n\n raise \"reference for role #{role_ref.describe} not found on #{name} in #{references_from.size} references:\\n\\t#{references_from.map(&:to_s)*\"\\n\\t\"}\" unless ref\n\n ref.columns({})\n end.flatten\n end\n end",
"def test_manager_database_collection\n first_db = XMLDBApi::RedDatabase.new(\"first\")\n assert_equal(true, first_db.accepts_uri?(\"xmldb:first://some/collections\") == true)\n second_db = XMLDBApi::RedDatabase.new(\"second\")\n service = first_db.get_collection_management_service\n service.create_collection(\"coll-1\")\n service.create_collection(\"coll-2\")\n XMLDBApi::DatabaseManager.register_database(first_db)\n \n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n service = coll.get_service(\"CollectionManagementService\", \"1.0\")\n service.create_collection(\"coll-1-child\")\n child_coll = coll.get_child_collection(\"coll-1-child\")\n coll = child_coll.get_parent_collection\n assert_equal(true, coll.get_child_collection_count == 1)\n service = coll.get_service(\"CollectionManagementService\", \"1.0\")\n service.remove_collection(\"coll-1-child\")\n child_coll = coll.get_child_collection(\"coll-1-child\")\n \n assert_equal(true, child_coll == nil)\n assert_equal(true, coll.get_child_collection_count == 0)\n assert_raise XMLDBApi::Base::XMLDBException do\n XMLDBApi::DatabaseManager.deregister_database(first_db)\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n end\n \n XMLDBApi::DatabaseManager.register_database(first_db)\n \n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1\")\n coll.create_child_collection(\"order\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order\")\n coll.create_child_collection(\"another\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order/another\")\n coll = coll.get_parent_collection\n coll.remove_child_collection(\"another\")\n assert_raise XMLDBApi::Base::XMLDBException do\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://coll-1/order/another\")\n end\n \n first_db.create_collection(\"root_one\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_one\")\n assert_equal(true, coll.get_name == \"root_one\")\n first_db.create_collection(\"root_two\")\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_two\")\n assert_equal(true, coll.get_name == \"root_two\")\n first_db.remove_collection(\"root_two\")\n assert_raise XMLDBApi::Base::XMLDBException do\n coll = XMLDBApi::DatabaseManager.get_collection(\"xmldb:first://root_two\")\n end\n end",
"def store_reference\n 5.times do\n self[:reference] = generate_reference\n return reference unless self.class.where(:reference => reference).first\n end\n\n raise \"Could not generate unique reference for order\"\n end",
"def default_associated_key_alias\n self[:uses_left_composite_keys] ? (0...self[:through].first[:left].length).map{|i| :\"x_foreign_key_#{i}_x\"} : :x_foreign_key_x\n end",
"def all_linked_zone_identifiers; end",
"def all_linked_zone_identifiers; end",
"def references\n @references ||= []\n end",
"def references_to\n # REVISIT: If some other object has a Mapping to us, that should be in this list\n @mapping.all_member.select do |m|\n m.is_a?(MM::Absorption) and\n f = m.forward_mapping and # This Absorption has a forward counterpart, so must be reverse\n f.parent_role.is_unique\n end\n end",
"def cross_reference(aspect1, name1, aspect2, name2)\n self.search_by(aspect1, name1) & self.search_by(aspect2, name2)\n end",
"def vulns_by_ref(ref)\n\t\tVuln.find_by_sql(\n\t\t\t\"SELECT vulns.* FROM vulns, vulns_refs WHERE \" +\n\t\t\t\"vulns_refs.ref_id = #{ref.id} AND \" +\n\t\t\t\"vulns_refs.vuln_id = vulns.id\"\n\t\t)\n\tend",
"def references\n GameContent.where reference_id: self.id\n end",
"def single_object_db; end",
"def related_concept_ids(db, *ids)\n ids = ids.flatten\n other_ids = db[:mappings].where(concept_2_id: ids).where{Sequel.function(:lower, :relationship_id) =~ 'is_a'}.select_map(:concept_1_id)\n other_ids + ids\n end",
"def updateReference\n return @references\n end",
"def odata_table_reference\n @odata_table_reference\n end",
"def test_manipulate_databases\n number=1000\n relation_name = \"Dog\"\n relation_schema = {\"name\" => \"string\", \"race\" => \"string\", \"age\" => \"integer\"}\n values = {\"name\" => \"Bobby\", \"age\" => 2, \"race\"=> \"labrador\"}\n @dbids.each do |id|\n database(id).create_relation(relation_name,relation_schema)\n assert_equal(\"Dog\",database(id).relation_classes[\"Dog\"].table_name)\n end\n \n @dbids.each do |id|\n puts \"insert into db : #{id}\"\n\n (0..number).each do |i|\n count_values = {\"name\" => \"Bobby#{i}\", \"age\" => i, \"race\"=> \"labrador\"}\n database(id).relation_classes[\"Dog\"].insert(count_values)\n end\n assert_equal(number+1,database(id).relation_classes[\"Dog\"].all.size)\n\n end\n \n @dbids.each do |id|\n number_of_tuples_to_delete = rand(number)\n (1..number_of_tuples_to_delete).each do |i|\n database(id).relation_classes[\"Dog\"].delete(i)\n end\n assert_equal(number+1-number_of_tuples_to_delete,database(id).relation_classes[\"Dog\"].all.size)\n end\n \n end",
"def differences(dbh1, dbh2, name1, name2, masks, block) # :nodoc:\n idc = []\n mask_insert = []\n mask_delete = []\n mask = 0 # mask of previous table\n count = 0\n inserts = 0\n updates = 0\n deletes = 0\n (masks.size-1).downto(0) do |level|\n next_idc = []\n $stderr.print(\"investigating #{idc.inspect}, level=#{level}\\n\") if @verbose > 1\n raise \"giving up at level #{level}: #{idc.size} differences exceeeds max_report (#{@max_report})\" if (@max_report > 0 && idc.size > @max_report)\n\n # select statement handlers\n s1 = selidc(dbh1, \"#{name1}#{level}\", mask, level == 0, idc)\n s2 = selidc(dbh1, \"#{name2}#{level}\", mask, level == 0, idc)\n r1 = nil\n r2 = nil\n s1_active = true\n s2_active = true\n \n # content of one row from the above select result\n # let us merge the two ordered select\n while (true) do\n # update current lists if necessary\n if !r1 && s1_active\n r1 = s1.fetch\n s1_active = false unless r1\n end\n if !r2 && s2_active\n r2 = s2.fetch\n s2_active = false unless r2\n end\n break unless (r1 || r2)\n \n # else both lists are defined\n if (r1 && r2 && r1[0] == r2[0]) # matching idc\n if (r1[1] != r2[1]) # non matching checksums\n if (level != 0)\n next_idc.push(r1[0]) # to be investigated...\n else\n # the level-0 table keeps the actual key\n count += 1\n updates += 1\n block.call(:update, r1[2]) unless block.nil? # final result\n end\n end\n # both tuples are consummed\n r1 = nil\n r2 = nil\n \n # if they do not match, one is missing or less than the other\n elsif (!r2 || (r1 && r1[0] < r2[0])) # more idc in table 1\n if (level != 0)\n mask_insert.push([ r1[0], masks[masks.size-1] ]) # later\n else\n count += 1\n inserts += 1\n block.call(:insert, r1[2]) unless block.nil? # final result\n end\n # left tuple is consummed\n r1 = nil\n \n # this could be a else\n elsif (!r1 || (r2 && r1[0] > r2[0])) # more idc in table 2\n if (level != 0)\n mask_delete.push([ r2[0], masks[masks.size-1] ]) # later\n else\n count += 1\n deletes += 1\n block.call(:delete, r1[2]) unless block.nil? # final result\n end\n # right tuple is consummed\n r2 = nil\n else\n raise 'this state should never happen'\n end\n end\n s1.finish\n s2.finish\n level -= 1 # next table! 0 is the initial checksum table\n mask = masks.pop() # next mask\n idc = next_idc # idcs to be investigated on next round\n break if idc.empty?\n end\n {\n :count => count,\n :inserts => inserts,\n :updates => updates,\n :deletes => deletes,\n :mask_insert => mask_insert,\n :mask_delete => mask_delete\n }\n end",
"def _foreign_key_list_ds\n @_foreign_key_list_ds ||= __foreign_key_list_ds(false)\n end",
"def collect_foreign_key_references(metadata, foreign_keys, row)\n schema = metadata.tableSchema\n\n # Add row as foreignKey source\n Array(schema ? schema.foreignKeys : []).each do |fk|\n colRef = Array(fk['columnReference'])\n\n # Referenced cells, in order\n cells = colRef.map {|n| row.values.detect {|cell| cell.column.name == n}}.compact\n cell_values = cells.map {|cell| cell.stringValue unless cell.stringValue.to_s.empty?}.compact\n next if cell_values.empty? # Don't record if empty\n (fk[:reference_from] ||= {})[cell_values] ||= row\n end\n\n # Add row as foreignKey dest\n Array(foreign_keys).each do |fk|\n colRef = Array(fk['reference']['columnReference'])\n\n # Referenced cells, in order\n cells = colRef.map {|n| row.values.detect {|cell| cell.column.name == n}}.compact\n fk[:reference_to] ||= {}\n cell_values = cells.map {|cell| cell.stringValue unless cell.stringValue.to_s.empty?}.compact\n next if cell_values.empty? # Don't record if empty\n log_error \"Table #{metadata.url} row #{row.number}(src #{row.sourceNumber}): found duplicate foreign key target: #{cell_values.map(&:to_s).inspect}\" if fk[:reference_to][cell_values]\n fk[:reference_to][cell_values] ||= row\n end\n end",
"def handle_references_label(vals)\n @references_collection << vals.last\n @references = vals.last if matches_mdes_version(vals)\n end",
"def links(options={})\n options = {:get_dataset => false, :type => Ecore::Link, :reload => false, :preconditions => {:hidden => false}}.merge(options)\n return @links_chache if @links_chache and !options[:get_dataset] and !options[:reload]\n query = Ecore::db[options[:type].table_name].store_preconditions((@group_ids || @user_id),self.class.get_type_if_has_superclass,self,nil,(options[:preconditions] || {:hidden => false}))\n query = query.where(:orig_document_id => id)\n return query if options[:get_dataset]\n @links_chache = query.order(:name,:created_at).receive(:all)\n end",
"def ref; end",
"def dereference(dbref)\n collection(dbref.namespace).find_one(\"_id\" => dbref.object_id)\n end",
"def gain(doc_id)\n return @qrels[doc_id] # as is\n end",
"def refs_by_vuln(vuln)\n\t\tRef.find_by_sql(\n\t\t\t\"SELECT refs.* FROM refs, vulns_refs WHERE \" +\n\t\t\t\"vulns_refs.vuln_id = #{vuln.id} AND \" +\n\t\t\t\"vulns_refs.ref_id = refs.id\"\n\t\t)\n\tend",
"def references_for_repository(repository_name)\n @reference_mapping[repository_name] || []\n end",
"def refers_to(*args)\n require \"og/relation/refers_to\"\n relations! << Og::RefersTo.new(args, :owner_class => self)\n end",
"def references(collection)\n target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || []\n end",
"def filtered_references\n super.select do |ref|\n ref.candidate_uris.for(class:URI::DOI).nil?\n end\n end",
"def ref?\n schema[\"$ref\"]\n end",
"def references(collection)\n target.try(:references, collection) || []\n end",
"def rpc_get_ref(name)\n ::ApplicationRecord.connection_pool.with_connection {\n db_check\n self.framework.db.get_ref(name)\n }\n end",
"def references\n @references ||= Comment.find(:all, :conditions => [\"(comments.commentable_type = ? AND comments.commentable_id = ?) AND comments.position IN (?)\", self.commentable_type, self.commentable_id, self.reference_ids], :order => 'comments.position ASC')\n end",
"def right_table; table_sync.right_table; end",
"def _References\n while true\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_Reference)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_SkipBlock)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n set_failed_rule :_References unless _tmp\n return _tmp\n end",
"def fetch_diff(database)\n anc = ActiveRecord::Base.connection.select_all <<~SQL\n select identifier, person_name.given_name, person_name.family_name\n from #{database}.person_name\n inner join #{database}.patient_identifier\n on person_name.person_id = patient_identifier.patient_id\n where patient_identifier.identifier_type = 3\n and patient_identifier.voided = 0\n and person_name.voided = 0\n SQL\n\n openmrs = ActiveRecord::Base.connection.select_all <<~SQL\n select identifier, person_name.given_name, person_name.family_name\n from person_name\n inner join patient_identifier\n on person_name.person_id = patient_identifier.patient_id\n where patient_identifier.voided = 0\n and person_name.voided = 0\n SQL\n\n anc.to_a - openmrs.to_a\nend",
"def ==(other)\n other.is_a?(Recliner::Database) && uri == other.uri\n end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def locate_internal_refs1(refs, identifier, ident)\n #file, _filename = targetfile(filedesc, read: true)\n file, _filename = @files.targetfile_id(ident, read: true)\n xml = Nokogiri::XML(file) { |config| config.huge }\n t = xml.xpath(\"//*/@id\").each_with_object({}) { |i, x| x[i.text] = true }\n refs.each do |schema, ids|\n ids.keys.select { |id| t[id] }.each do |id|\n n = xml.at(\"//*[@id = '#{id}']\") and\n n.at(\"./ancestor-or-self::*[@type = '#{schema}']\") and\n refs[schema][id] = identifier\n end\n end\n end",
"def reciprocal_type\n :one_to_many\n end",
"def references\n @references = operands.select {|op| op.is_a?(RDF::Resource)}\n end",
"def insert_references( heap_objects )\n sql = <<-SQL\n INSERT INTO 'references' ('a', 'b') VALUES (:a, :b)\n SQL\n\n db.transaction do |transaction|\n transaction.prepare(sql) do |statement|\n heap_objects.each do |obj|\n address = obj.address\n references = obj.references\n next if references.nil? || references.empty?\n\n references.uniq.each do |reference|\n statement.execute({\":a\" => address, \":b\" => reference})\n end\n end\n end\n end\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end",
"def refresh_db_related\n return if @table_follows.empty?\n\n @first_db_entry = @table_follows.first\n @last_follow_time = @first_db_entry[:follow_time]\n end",
"def register_references_to(live_objects, options = Hash.new)\n orig_options = options # to exclude it from the graph\n options = Kernel.validate_options options,\n :roots => [Object], :excluded_classes => [], :excluded_objects => [],\n :include_class_relation => false\n roots_class, roots = options[:roots].partition { |obj| obj.kind_of?(Class) }\n excluded_classes = options[:excluded_classes]\n excluded_objects = options[:excluded_objects]\n include_class_relation = options[:include_class_relation]\n\n # Create a single ObjectRef per (interesting) live object, so that we\n # can use a BGL::Graph to represent the reference graph. This will be\n # what we are going to access later on. Use object IDs since we really\n # want to refer to objects and not use eql? comparisons\n desired_seeds = roots.map(&:object_id)\n excludes = [live_objects, self, graph, references, orig_options, options, roots, roots_class].to_value_set\n live_objects_total = live_objects.size\n live_objects.delete_if do |obj|\n if obj.kind_of?(DRbObject)\n true\n elsif excludes.include?(obj) || obj.respond_to?(:__ruby_object_graph_internal__)\n true\n else\n references[obj.object_id] ||= ObjectRef.new(obj)\n if roots_class.any? { |k| obj.kind_of?(k) }\n if !excluded_classes.any? { |k| obj.kind_of?(k) }\n if !excluded_objects.include?(obj)\n desired_seeds << obj.object_id\n end\n end\n end\n false\n end\n end\n\n desired_seeds.each do |obj_id|\n graph.insert(references[obj_id])\n end\n ignored_enumeration = Hash.new\n\n names = Hash[\n :array => \"Array\",\n :value_set => \"ValueSet[]\",\n :vertex => \"Vertex[]\",\n :edge => \"Edge[]\",\n :hash_key => \"Hash[key]\",\n :hash_value => \"Hash[value]\",\n :proc => \"Proc\",\n :ancestor => \"Ancestor\"]\n puts \"RubyObjectGraph: #{live_objects.size} objects found, #{desired_seeds.size} seeds and #{live_objects_total} total live objects\"\n loop do\n old_graph_size = graph.size\n live_objects.each do |obj|\n obj_ref = references[obj.object_id]\n\n if include_class_relation\n test_and_add_reference(obj_ref, obj.class, \"class\")\n end\n\n for var_name in obj.instance_variables\n var = obj.instance_variable_get(var_name)\n test_and_add_reference(obj_ref, var, var_name.to_s)\n end\n\n case obj\n when Array\n for var in obj\n test_and_add_reference(obj_ref, var, names[:array])\n end\n when ValueSet\n for var in obj\n test_and_add_reference(obj_ref, var, names[:value_set])\n end\n when BGL::Graph\n obj.each_vertex do\n test_and_add_reference(obj_ref, var, names[:vertex])\n end\n obj.each_edge do |_, _, info|\n test_and_add_reference(obj_ref, info, names[:edge])\n end\n when Hash\n for var in obj\n test_and_add_reference(obj_ref, var[0], names[:hash_key])\n test_and_add_reference(obj_ref, var[1], names[:hash_value])\n end\n when Proc\n if obj.respond_to?(:references)\n for var in obj.references\n begin\n test_and_add_reference(obj_ref, ObjectSpace._id2ref(var), names[:proc])\n rescue RangeError\n end\n end\n end\n when Class\n for ref in obj.ancestors\n test_and_add_reference(obj_ref, ref, names[:ancestor])\n end\n else\n if obj.respond_to?(:each)\n if obj.kind_of?(Module) || obj.kind_of?(Class)\n if !ignored_enumeration[obj]\n ignored_enumeration[obj] = true\n puts \"ignoring enumerator class/module #{obj}\"\n end\n else\n if !ignored_enumeration[obj.class]\n ignored_enumeration[obj.class] = true\n puts \"ignoring enumerator object of class #{obj.class}\"\n end\n end\n end\n end\n end\n if old_graph_size == graph.size\n break\n end\n end\n live_objects.clear # to avoid making it a central node in future calls\n return graph\n end"
] | [
"0.6384657",
"0.5922631",
"0.5818222",
"0.5818222",
"0.5795421",
"0.57603663",
"0.572891",
"0.56636584",
"0.5658218",
"0.55373156",
"0.5443452",
"0.5430512",
"0.5425988",
"0.542276",
"0.5421809",
"0.5420887",
"0.53477037",
"0.5316272",
"0.5305135",
"0.5300155",
"0.52511823",
"0.520731",
"0.5188656",
"0.51676923",
"0.5164796",
"0.51627696",
"0.5162491",
"0.5160502",
"0.5156509",
"0.51501",
"0.51414853",
"0.5138755",
"0.5126814",
"0.511592",
"0.5103794",
"0.5102952",
"0.50963783",
"0.5091787",
"0.5063684",
"0.504359",
"0.50379294",
"0.50254077",
"0.5022355",
"0.50199413",
"0.5011995",
"0.5000584",
"0.49992502",
"0.49983415",
"0.4981334",
"0.49811298",
"0.49769726",
"0.4971927",
"0.4964",
"0.49536753",
"0.49425116",
"0.49373326",
"0.4914194",
"0.49026066",
"0.48950815",
"0.48950815",
"0.4891738",
"0.4886698",
"0.488337",
"0.4879162",
"0.4868104",
"0.4859987",
"0.4848496",
"0.48410144",
"0.48379874",
"0.48318735",
"0.48293993",
"0.4825565",
"0.4819205",
"0.48182335",
"0.4816055",
"0.48137596",
"0.4810906",
"0.47962505",
"0.4793969",
"0.47935507",
"0.47930717",
"0.47906476",
"0.47865447",
"0.47757465",
"0.47687942",
"0.4755627",
"0.47545156",
"0.47503904",
"0.4746634",
"0.4745678",
"0.47316954",
"0.47308934",
"0.47278142",
"0.47257525",
"0.47221413",
"0.4720743",
"0.47205177",
"0.47205177",
"0.47205177",
"0.4716418",
"0.471495"
] | 0.0 | -1 |
CL Classification (class accession no.; class identifier; decimal CL classification number.) | def cl
field_fetch('CL')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classification\n @line1[07]\n end",
"def classify cutoff\n if score >= cutoff\n @classification = :good\n else\n @classification = :bad\n end\n return @classification\n end",
"def classify(text)\n scores = classification_scores(text)\n if scores.any?\n (scores.sort_by { |a| -a[1] })[0][0]\n else\n ''\n end\n end",
"def classification=(value)\n @classification = value\n end",
"def classification=(value)\n @classification = value\n end",
"def classify\n Rails.logger.debug \"Classification #{id}.classify\"\n weights_sum = classifiers.map( &:weight ).reduce( 0, :+ )\n Rails.logger.debug \"weights_sum: #{weights_sum}\"\n\n available_sum = classifiers.reduce( 0.0 ) { |sum, c|\n true_weight = weights_sum / c.weight\n Rails.logger.debug \"#{c.name} true_weight: #{true_weight}\"\n\n sum += c.available * true_weight\n }\n\n Rails.logger.debug \"available_sum: #{available_sum}\"\n self.available = available_sum / classifiers.length\n Rails.logger.debug \"available: #{available}\"\n\n if available >= @@available_threshold\n self.status = 'up'\n else\n self.status = 'down'\n end\n end",
"def classification\n return @classification\n end",
"def classification\n return @classification\n end",
"def classify(example)\n self.probability(example)[:class]\n end",
"def classify(features)\r\n # Order by probability\r\n res = classes.sort_by do |class_name|\r\n class_probability(features, class_name)\r\n end\r\n\r\n return res[-1]\r\n end",
"def classify(text)\n rating = @classifiers[@mailbox].rate text\n rating > @threshold\n end",
"def writeup_classification\n classification_label().split(\"-\").first\n end",
"def classify(features)\r\n # # Order by probability\r\n feature_normalized = get_features_normalized(features)\r\n \r\n res = @classes.sort_by do |klasse|\r\n discriminating(klasse, feature_normalized)\r\n end.first\r\n\r\n res\r\n end",
"def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end",
"def parse_classification(str = nil)\n self.class.parse_classification(str || classification)\n end",
"def writeup_classification\n classification_label.split(\"-\").first\n end",
"def classify_with_score(text)\n (classifications(text).sort_by { |a| -a[1] })[0]\n end",
"def accuracy\n\t\tnumber_of_documents > 0 ? number_of_right_classifications.fdiv(number_of_documents) : 0\n\tend",
"def classifyLR(data2Classify, weightingMtx)\n t = sigmod(data2Classify.multi(weightingMtx).sum)\n if(t>=0.5)\n return 1\n else\n return 0\n end\n end",
"def classify(classifying_row, options = {})\n k = options.delete(:k) || 10\n distances = []\n @rows.each_with_index do |row, row_num|\n distance = Array.new(row.size)\n row.each_with_index do |elem, elem_num|\n if elem.is_a?(String) || elem.is_a?(CSV::Cell) # if the element is categorical\n # distance = probability of category for row we are classifying minus\n # the probability of the category of the row we are measuring the\n # distance against\n distance[elem_num] = @cat_probs[elem_num][classifying_row[elem_num]] - @cat_probs[elem_num][elem] \n else\n # if not categorical variable, then just subtract the value of the\n # classifying variable with the variable we are measuring against\n distance[elem_num] = classifying_row[elem_num].to_i - elem.to_i\n end\n end\n d = sum(distance.map{|x| x*x}) # dot(distance, distance)\n distances << [d, @classes[row_num]]\n end\n\n distances.sort.first(k).inject(Hash.new(0)) do |hash, distance|\n hash[distance.last] += 1.0 / distance.first # weigh the class at an inverse to it's distance\n # if distance is 0, weight will be infinity\n hash\n end.to_a.sort_by(&:last).last.first # sort by weight, return class with highest weight\n end",
"def classify(commit)\n @classifier.classify(commit)\n end",
"def classify(feature_vector)\n class_probabilities = []\n \n @number_of_documents_in_class.keys.each do |classification|\n class_probability = Math.log10(probability_of_class(classification))\n feature_vector.each do |feature|\n class_probability += Math.log10(probability_of_feature_given_class(feature.name, classification)) * feature.value\n end\n class_probabilities << [class_probability, classification]\n end\n \n # this next bit picks a random item first\n # this covers the case that all the class probabilities are equal and we need to randomly select a class\n max = class_probabilities.pick_random\n class_probabilities.each do |cp|\n max = cp if cp.first > max.first\n end\n max\n end",
"def classify\n pos_probs = cond_probs(:pos)\n neg_probs = cond_probs(:neg)\n\n # Label the reviews in each polarity folder\n pos_labels = @features[:pos].map { |f| label(f, pos_probs, neg_probs) }\n neg_labels = @features[:neg].map { |f| label(f, pos_probs, neg_probs) }\n\n { pos_labels: pos_labels, neg_labels: neg_labels }\n end",
"def test\n rows = Util.get_rows(:file => 'data/vehicles.csv', :n => 3000, :pre_process => true)\n classes = rows.transpose.last\n rows = rows.transpose[0..-2].transpose\n train(rows.first(2000), classes.first(2000))\n \"#{classes.last} classified as #{classify(rows.last)}\"\n end",
"def classify(text)\n choose classifications(text)\n end",
"def classification=(value)\n case value\n when \"\"\n value = \"admitted\"\n when \"认可的\", \"допустимый\", \"admitido\"\n value = \"admitted\"\n when \"首选的\", \"suositettava\", \"suositeltava\", \"рекомендуемый\", \"preferente\"\n value = \"preferred\"\n when %w(preferred admitted deprecated)\n # do nothing\n end\n @classification = value\n end",
"def catalog_number\n model.labels.first.catno\n end",
"def classification(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/classification', {'query' => query})\n else\n is_valid_with_error(__method__.to_s, [:classification], set)\n post('actions/classification', { 'query' => query, 'classification' => set })\n end\n end",
"def set_classification_code\n @classification_code = ClassificationCode.find(params[:id])\n end",
"def classify(doc)\n result = classify_with_all_result(doc)\n\n return nil unless result\n\n best = result.max_by { |classify_relust| classify_relust[1] }\n best[0]\n end",
"def inference_classification=(value)\n @inference_classification = value\n end",
"def classify(text)\n classify_features(features_of(text)).last\n end",
"def precision category\n\t\tpositive[category] + negative[category] + neutral[category] > 0 ? send(category)[category].fdiv(positive[category] + negative[category] + neutral[category]) : 0\n\tend",
"def classify_sample_ind(classes, sample)\r\n llh = []\r\n classes.each do |classs|\r\n likelihood = 1\r\n classs[:probs].zip(sample).each do |prob, feature|\r\n chance = feature == 0 ? prob : 1 - prob\r\n likelihood = likelihood * chance\r\n end\r\n llh << likelihood\r\n end\r\n llh.index(llh.max)\r\n rescue => e\r\n byebug\r\n end",
"def classify(text)\n positive_value = 1\n neutral_value = 1\n negative_value = 1\n\n word = text.split(/\\W+/)\n word = word.drop(1) if word.first == ''\n word.each_with_index { |_, i|\n find_instances(word[i])\n positive_value *= ((((positive_polarity.to_f/positive_population.to_f).to_f) * ((positive_polarity).to_f))/word_pop)\n negative_value *= ((((negative_polarity.to_f/negative_population.to_f).to_f) * ((negative_polarity).to_f))/word_pop)\n neutral_value *= ((((neutral_polarity.to_f/neutral_population.to_f).to_f) * ((neutral_polarity).to_f))/word_pop)\n }\n total_counter(negative_value, neutral_value, positive_value)\n\n rescue => error\n puts error.backtrace\n\n end",
"def classify(features, k = 3)\r\n # # Order by probability\r\n feature_normalized = get_features_normalized(features)\r\n \r\n res = @dataset_normalized.sort_by do |features_ds|\r\n distance(features_ds, feature_normalized)\r\n end\r\n\r\n # Collect class of neighbors\r\n res[0...k].collect{|n| n.last }.mode\r\n end",
"def classify(tokens)\n max_prob, max_category = -1, -1\n\n if tokens.empty? \n # If the example is empty, find the category with the highest prior probability.\n (0..@num_categories - 1).each do |i|\n prior_prob = get_prior_category_probability(i)\n max_prob, max_category = prior_prob, i if prior_prob > max_prob\n end\n else\n # Otherwise, find the category with the highest posterior probability.\n get_posterior_category_probabilities(tokens).each_with_index do |prob, category|\n max_prob, max_category = prob, category if prob > max_prob\n end\n end\n \n return max_category\n end",
"def class_for_code(code)\n \"r#{Integer(code)/100}\" \n end",
"def classification\n return nil if tracking_is_empty\n\n delivery_status_details_box ||= @tracking_page.css(\".indent table[summary='配達状況詳細']\")\n classification = delivery_status_details_box.css(\"tr:last .w_380\").text.strip\n return classification\n end",
"def inference_classification\n return @inference_classification\n end",
"def calc_class(weights)\n sum = weights.inner_product @attributes\n if sum > 0\n 1\n else\n 0\n end\n end",
"def word_classification_detail(word)\n\n p \"word_probability\"\n result=self.categories.inject({}) do |h, cat|\n h[cat]=self.word_probability(word, cat); h\n end\n p result\n\n p \"word_weighted_average\"\n result=categories.inject({}) do |h, cat|\n h[cat]=word_weighted_average(word, cat); h\n end\n p result\n\n p \"doc_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=doc_probability(word, cat); h\n end\n p result\n\n p \"text_probability\"\n result=categories.inject({}) do |h, cat|\n h[cat]=event_probability(word, cat); h\n end\n p result\n\n end",
"def classify(text)\n result, score = classify_with_score(text)\n result = nil if score < @threshold || score == Float::INFINITY if threshold_enabled?\n result\n end",
"def classification?(c)\n not [\"malicious\", \"non-malicious\", \"suspicious\", \"unknown\"].index(c).nil?\n end",
"def ind_bayes_classification(sample_set)\r\n all_samples = sample_set.shuffle\r\n matrix = initialize_conf_matrix\r\n classes = Array.new(@num_classes) {|i| Hash.new}\r\n test_size = all_samples.count / @k_fold\r\n\r\n i = 0\r\n @k_fold.times do\r\n test_samples = all_samples[(test_size*i)...(test_size*(i+1))]\r\n train_samples = all_samples[0...(test_size*i)]\r\n train_samples += all_samples[(test_size*(i+1))...all_samples.count]\r\n\r\n classes.each_with_index do |classs, index|\r\n class_samples = train_samples.select {|s| s.last == index}\r\n classs[:probs] = est_feature_probabilities(class_samples)\r\n end\r\n\r\n test_samples.each do |test_sample|\r\n predicted = classify_sample_ind(classes, test_sample)\r\n actual = test_sample.last\r\n matrix[:\"#{actual}_#{predicted}\"] += 1\r\n end\r\n i += 1\r\n end\r\n matrix\r\n end",
"def classify(doc, cutoff = 0.30, &block)\n scored_categories(doc, cutoff, &block).last.first\n end",
"def clasifica(mensajeRec)\n classifier = Classifier::Bayes.new 'sells','client','human'\n\n #Train the classifier\n\n Correo.where(:departamento => \"Ventas\").find_each do |v|\n classifier.train_sells v.mensaje\n end\n\n Correo.where(:departamento => \"Recursos humanos\").find_each do |h|\n classifier.train_human h.mensaje\n end\n\n Correo.where(:departamento => \"Atencion a cliente\").find_each do |c|\n classifier.train_client c.mensaje\n end\n\n return classifier.classify mensajeRec\n end",
"def classify_with_score(doc, cutoff = 0.30, &block)\n scored_categories(doc, cutoff, &block).last\n end",
"def accuracy labels\n pos_size = labels[:pos_labels].size\n neg_size = labels[:neg_labels].size\n pos_count = labels[:pos_labels].count { |l| l == :pos }\n neg_count = labels[:neg_labels].count { |l| l == :neg }\n\n # Compute the accuracies of the labeling\n pos_accuracy = pos_count / pos_size.to_f\n neg_accuracy = neg_count / neg_size.to_f\n accuracy = (pos_count + neg_count) / (pos_size + neg_size).to_f\n\n # Return a hash containing the results:\n # - the overall classification accuracy\n # - the confusion matrix for the results\n {\n accuracy: accuracy,\n confusion: [[pos_accuracy, (1 - pos_accuracy)],\n [(1 - neg_accuracy), neg_accuracy]]\n }\n end",
"def adaClassify(datToClass,classifierArr)\n m = shape(datToClass)[0]\n aggClassEst = zeros(m,0)\n len(classifierArr).times do |i|\n classEst = stumpClassify(datToClass,\n classifierArr[i]['dim'], \n classifierArr[i]['thresh'], \n classifierArr[i]['ineq'])#call stump classify\n # aggClassEst += classifierArr[i]['alpha']*classEst\n aggClassEst.plus!(classEst.multi(classifierArr[i]['alpha']))\n end\n return sign(aggClassEst)\n end",
"def classifySample(sample)\n if sample =~/VIR|viral/\n return \"VIR\"\n elsif sample =~/LG/ || sample =~/01a/\n return 3.0\n elsif sample =~/SM/ || sample =~/01b/ || sample =~/GS-25-/ || sample =~/GOS108XLRVAL-4F-1-400_FG5HGJH01/ || sample =~/GOS108XLRVAL-4F-1-400_FG5HGJH02/ || sample =~/GOS108XLRVAL-4F-1-400_FJGGSX101/\n return 0.8\n elsif sample =~/00[b|c|d]/\n return 0.22\n else\n return 0.1\n end\nend",
"def classify\n # TODO\n # Inflector.classify(self)\n end",
"def classify(token)\n classifiers.each do |classifier|\n classified = classifier.try(token)\n\n break classified if classified\n end\n end",
"def validate_classification(str = nil)\n self.class.validate_classification(str || classification)\n end",
"def label() @positive end",
"def classify(word)\n return word unless rare? word\n case word\n when /^\\d+$/ then CARD\n when /^\\d+[.,;:]+$/ then CARDPUNCT\n when /^\\d+\\D+$/ then CARDSUFFIX\n when /^\\d+[.,;:\\-]+(\\d+[.,;:\\-]+)*\\d+$/ then CARDSEPS\n else UNKNOWN\n end\n end",
"def status_category\n\t\treturn 0 if self.status.nil?\n\t\treturn (self.status / 100).ceil\n\tend",
"def fetch_accuracy\n @xml.slice(%r{Accuracy=\"([^\"]+)\"}, 1).to_i\n end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def accuracy(classifier, test_set)\n \tcorrect = 0.0\n \ttest_set.each { |e| correct += 1.0 if e.label == classifier.guess_for(e) }\n \tcorrect / test_set.size.to_f\n end",
"def rdp_classify(ds_name)\n ds_miga = miga.dataset(ds_name)\n return if ds_miga.nil?\n res = ds_miga.result(:ssu)\n return if res.nil?\n file = res.file_path(:all_ssu_genes)\n file = res.file_path(:longest_ssu_gene) if file.nil?\n return if file.nil?\n seq = (file =~ /\\.gz$/ ? Zlib::GzipReader : File).open(file).read\n wsdl = \"http://rdp.cme.msu.edu:80/services/classifier?wsdl\"\n client = Savon.client(wsdl: wsdl)\n client.call(:classifier, message: seq)\n end",
"def class_level(class_id)\n return @level if YEA::CLASS_SYSTEM::MAINTAIN_LEVELS\n current_class = $data_classes[class_id]\n maxLevel = CXJ::CLASS_EXTENSIONS::DEFAULT_MAX_LEV\n maxLevel = current_class.max_level if current_class.max_level > -1\n maxLevel = max_level if !CXJ::CLASS_EXTENSIONS::ENABLE_CLASS_LEVEL_LIMITER\n maxExp = current_class.exp_for_level(maxLevel)\n @exp[class_id] = 0 if @exp[class_id].nil?\n n = 1\n loop do\n break if maxExp < current_class.exp_for_level(n + 1)\n break if @exp[class_id] < current_class.exp_for_level(n + 1)\n n+= 1\n end\n return n\n end",
"def classification(num_neighbors, point, data)\n closest_neighbors(num_neighbors, point, data).map { |p| data[p] }.group_by { |n| n }.max_by(&:size).first\nend",
"def category_class\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n value = nil\n class_type12 = nil\n\n begin\n # at line 72:37: ';' ( WS )? 'class' '=' '\\\"' class_type '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_class_202)\n # at line 72:41: ( WS )?\n alt_9 = 2\n look_9_0 = @input.peek(1)\n\n if (look_9_0 == WS)\n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 72:41: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_class_204)\n\n end\n match(T__15, TOKENS_FOLLOWING_T__15_IN_category_class_207)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_class_209)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_class_211)\n @state.following.push(TOKENS_FOLLOWING_class_type_IN_category_class_213)\n class_type12 = class_type\n @state.following.pop\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_class_215)\n # --> action\n value = (class_type12 && @input.to_s(class_type12.start, class_type12.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 5 )\n\n end\n\n return value\n end",
"def accuracy\n data.accuracy\n end",
"def addClassifications(filename)\n\t# open the file with classifications\n\tclassificationTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a classification description. Iterate through the file and create a classification for each line.\n\tclassificationTypes.each do |curClassificationType|\n\t\tClassification.find_or_create_by({ :classification_description => curClassificationType.strip })\n\tend\nend",
"def predict(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n scores = decision_function(x)\n n_samples, n_classes = scores.shape\n label_ids = scores.max_index(axis: 1) - Numo::Int32.new(n_samples).seq * n_classes\n @classes[label_ids].dup\n end",
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end",
"def classify(row)\n probabilities = {}\n\n row_class = row.last\n row = Utils::remove_last_element(row)\n\n # P(Row) = P(R1) * P(R2) * ... * P(Rn)\n @cv.classes.each do |clazz|\n # calculate probability density for each element in this row\n prob_of_item_given_class = 1\n row.each_with_index do |item, i|\n prob_of_item_given_class *= probability_density(item, i, clazz)\n end\n\n probabilities[clazz] = prob_of_item_given_class *\n prob_of_class(clazz)\n end\n\n # filter out values that aren't the most probable (possibly equal) values\n most_probable = probabilities.inject([]) do |acc, (k,v)|\n last_element = acc.last\n last_count = (last_element ? last_element[1] : 0)\n if last_count > v\n acc\n elsif last_count == v\n acc << [k,v]\n else\n acc.clear\n acc = [[k,v]]\n end\n end\n\n # randomly choose out of the top equal probable values\n most_probable[Random.rand(most_probable.length)][0]\n end",
"def classify_image\n\n\t\trequire 'rubygems'\n\t\trequire 'RMagick'\n\t\trequire \"open-uri\"\n\n\t\timagelist = Magick::ImageList.new # not sure why using ImageList and not an Image, but thats the example. can try rewrite \n\t\turlimage = open(params[:url]) # Image URL \n\t\timagelist.from_blob(urlimage.read)\n\t\timage = imagelist.cur_image\n\n\tputs \"image opened, color coding\"\n\n\t\tcolorcodes = {\n\t\t\t:red => [255,0,0],\n\t\t\t:green => [0,255,0],\n\t\t\t:blue => [0,0,255],\n\t\t\t:yellow => [255,255,0],\n\t\t}\n\t\t@colors = {}\n\t\t@classmodel = ClassModel.find params[:classmodel]\n\t\tclassnames = @classmodel.classnames.split(',') # user-supplied classes; \n\t\tclassnames.each_with_index do |classname,index|\n\t\t\t@colors[classname] = colorcodes.to_a[index]\n\t\tend\n\n\tputs \"assembling classes\"\n\n\t\tclasses = ClassModel.find(params[:classmodel]).to_hash\n\n\tputs \"parsing pixels and writing new pixels\"\n\n\t\t@percentages = {}\n\t\tclasses.each do |classname,classbands|\n\t\t\t@percentages[classname] = 0\n\t\tend\n\n\t\t# this can also surely be more efficient, look at: http://www.simplesystems.org/RMagick/doc/image2.html#import_pixels\n\t\t(0..image.columns-1).each do |x|\n\t\t\t(0..image.rows-1).each do |y|\n\t\t\t\t# classify the pixel\n\t\t\t\t# first, extract a JSON string of the colors... inefficient but a start:\n\t\t\t\ta = image.export_pixels(x, y, 1, 1, \"RGB\");\n\t\t\t\tpixel_string = {\"red\" => a[0]/255,\"green\" => a[1]/255,\"blue\" => a[2]/255} # MaxRGB is 255^2\n\t\t\t\t\t#puts pixel_string\n\t\t\t\tclosest = CartesianClassifier.closest_hash(pixel_string,classes)\n\t\t\t\t\t#puts closest\n\t\t\t\t@percentages[closest] += 1\n\t\t\t\t# match the resulting class to a color and write to a pixel\n\t\t\t\ta = colorcodes[@colors[closest][0]].map { |c| c*255 } #MaxRGB is 255^2\n\t\t\t\timage.import_pixels(x, y, 1, 1, \"RGB\", a);\n\t\t\tend\n\t\tend\n\n\t\[email protected] do |key,value|\n\t\t\t@percentages[key] = (100*((1.00 * value) / (image.rows*image.columns))).to_i\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html { \n\t\t\t\t@b64 = Base64.encode64(image.to_blob)\n\t\t\t}\n\t\t\tformat.png { \n\t\t\t\theaders['Content-Type'] = 'image/png'\n\t\t\t\theaders['Cache-Control'] = 'public'\n\t\t\t\theaders['Expires'] = 'Mon, 28 Jul 2020 23:30:00 GMT'\n\t\t\t\trender :text => image.to_blob\n\t\t\t}\n\t\tend\n\tend",
"def most_likely_class(decisions_for_single_token)\n sums = {\n :job_component => 0,\n :name_component => 0,\n :address_component => 0,\n :predicate => 0,\n :ambiguous => 0.1,\n }\n decisions_for_single_token[:votes].each do |vote|\n vote.each do |type, score|\n sums[type] += score\n end\n end\n sums.max_by { |k, v| v }\nend",
"def class_distribution dataset\n classes = Hash.new {|h,k| h[k] = 0}\n dataset.each do |item|\n classes[item[\"label\"]]=1+classes[item[\"label\"]]\n end\n \n result={}\n classes.each do |key,array|\n result[key]=array.to_f/dataset.size.to_f\n end\n \n return result\nend",
"def category_class\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n value = nil\n class_type12 = nil\n\n begin\n # at line 45:37: SEMICOLON ( WS )? CLASS EQUALS QUOTE class_type QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_category_class_199 )\n # at line 45:47: ( WS )?\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == WS )\n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 45:47: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_class_201 )\n\n end\n match( CLASS, TOKENS_FOLLOWING_CLASS_IN_category_class_204 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_category_class_206 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_class_208 )\n @state.following.push( TOKENS_FOLLOWING_class_type_IN_category_class_210 )\n class_type12 = class_type\n @state.following.pop\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_class_212 )\n # --> action\n value = ( class_type12 && @input.to_s( class_type12.start, class_type12.stop ) ) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 5 )\n\n end\n \n return value\n end",
"def choose(classification)\n sorted = classification.sort_by{|k,v| -v }\n\n case sorted.size\n when 0\n return classification\n when 1\n return sorted[0][0]\n when 2\n delta_choose(*sorted)\n else\n delta_choose(*sorted.first(2))\n end\n end",
"def train(rows, classes)\n @rows = rows\n @classes = classes\n @table = (rows.transpose + [classes]).transpose\n @cat_probs = Array.new(rows.transpose.size) { Hash.new(0) }\n \n # calculate the sum over all classes the probability of a category value\n # belonging to a class\n \n @classes.uniq.each do |c| # for every class\n rows_for_class = @table.select{|row| row.last == c} # select the rows for that class\n rows_for_class.transpose[0..-2].each_with_index do |row, i|\n next unless row.first.is_a?(String) # if it's not a string, don't do anything\n counts = row.group_by{|x| x} # group by the values\n counts.each_pair do |category, group| \n # the group size will be the count, divide it by the number of rows\n # for that class to get the probability that that category belongs to\n # that class\n @cat_probs[i][category] += group.size / (rows_for_class.size * 1.0)\n end\n end\n end\n end",
"def cc_number_label\n #unit_test_no_generate: cc_number_label, span.className(create_ats_regex_string(\"ats-ccnumlbl\"))\n $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ccnumlbl\")), __method__)\n end",
"def classify(doc)\n frag = nil\n probs = 1\n feat = ''\n doc.frags.each do |frag|\n probs = @p0\n frag.features.each do |feat|\n probs *= @feats[feat]\n end\n frag.pred = probs / (probs + 1)\n end\n end",
"def priority_marks\n 1000000000\n end",
"def ip_class(ip)\n\t\tipclass = ''\n\t\tipclass = 'A' if (ip_int(\"10.0.0.0\")..ip_int(\"127.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'B' if (ip_int(\"128.0.0.0\")..ip_int(\"191.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'C' if (ip_int(\"192.0.0.0\")..ip_int(\"223.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'D' if (ip_int(\"224.0.0.0\")..ip_int(\"239.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'E' if (ip_int(\"240.0.0.0\")..ip_int(\"255.255.255.255\")) === ip_int(ip)\n\t\treturn ipclass\n\tend",
"def ip_class(ip)\n\t\tipclass = ''\n\t\tipclass = 'A' if (ip_int(\"10.0.0.0\")..ip_int(\"127.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'B' if (ip_int(\"128.0.0.0\")..ip_int(\"191.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'C' if (ip_int(\"192.0.0.0\")..ip_int(\"223.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'D' if (ip_int(\"224.0.0.0\")..ip_int(\"239.255.255.255\")) === ip_int(ip)\n\t\tipclass = 'E' if (ip_int(\"240.0.0.0\")..ip_int(\"255.255.255.255\")) === ip_int(ip)\n\t\treturn ipclass\n\tend",
"def classify(element)\n neighbors = nearest_neighbors(element)\n\n neighbor_classes = neighbors.map(&:last)\n classes = neighbor_classes.uniq\n\n classes.zip(classes.map { |c| neighbor_classes.count(c) }).\n sort_by(&:last).last.first\n end",
"def assign_category_jaccard_score\n company_information = get_company_info_from_fullcontact\n organization_info = company_information[\"organization\"]\n @attributes = parse_attributes(organization_info[\"keywords\"])\n @name = organization_info[\"name\"]\n jaccard_index = Jaccard::Index.generate(attributes, user_categories)\n @score += jaccard_index * 10\n end",
"def probability_of_class(classification)\n @number_of_documents_in_class[classification] / @number_of_documents.to_f\n end",
"def fetchCats(dataDir, minConfidence)\n return NellELoad.allCategories(dataDir, minConfidence, NellE::STRICT_TRAINING_CAT_FILENAMES)\nend",
"def total_cat_count\n @training_count\n end",
"def total_cat_count\n @training_count\n end",
"def evaluate_macro(predicted_class, actual_class)\n # Since this is macro, figoure out what the real\n # class is we should be looking at\n# puts \"Params: #{predicted_class}, #{actual_class}\"\n# puts \"Actual class: #{actual_class}, Class 0: #{@classes.to_a[0][0]}\"\n if actual_class == @classes.to_a[0][0] then\n# puts \"They match\"\n if predicted_class == @classes.to_a[0][0] then\n if predicted_class == actual_class then @confusion_matrix_c1['TP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c1['FN'] += 1 end\n else\n if predicted_class == actual_class then @confusion_matrix_c1['FP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c1['TN'] += 1 end\n end\n else\n# puts \"They DONT match\"\n if predicted_class == @classes.to_a[0][0] then\n if predicted_class == actual_class then @confusion_matrix_c2['TP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c2['FN'] += 1 end\n else\n if predicted_class == actual_class then @confusion_matrix_c2['FP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c2['TN'] += 1 end\n end\n end\n end",
"def test_class_label\n Allure::ResultUtils.test_class_label(File.basename(example.file_path, \".rb\"))\n end",
"def confidence; end",
"def score(category, feature)\n n = Float(@total_lines)\n n11 = Float(f_n11(category, feature))\n n1dot = Float(f_n1dot(category))\n ndot1 = Float(f_ndot1(feature))\n n01 = Float(f_n01(category, feature))\n n0dot = Float(f_n0dot(category))\n n10 = Float(f_n10(category, feature))\n ndot0 = Float(f_ndot0(feature))\n n00 = Float(f_n00(category, feature))\n\n score = 0.0\n\n score += (n11/n)*log2(n*n11/(n1dot*ndot1)) if n11 > 0.0 and n1dot > 0.0 and ndot1 > 0.0\n score += (n01/n)*log2((n*n01)/(n0dot*ndot1)) if n01 > 0.0 and n0dot > 0.0 and ndot1 > 0.0\n score += (n10/n)*log2(n*n10/(n1dot*ndot0)) if n10 > 0.0 and n1dot > 0.0 and ndot0 > 0.0\n score += (n00/n)*log2(n*n00/(n0dot*ndot0)) if n00 > 0.0 and n0dot > 0.0 and ndot0 > 0.0\n\n score\n end",
"def get_predicted_class(input, class_array)\n output = calculate_output\n max = output.find_index(output.max)\n class_array[max]\n end",
"def label_class\n visibility_term&.label_class\n end",
"def label_class\n visibility_term&.label_class\n end",
"def decision_tree_class\n C100App::CompletionDecisionTree\n end",
"def inherit_classification(parent)\n raise(\"missing parent!\") unless parent\n raise(\"only do this on genera or up!\") if below_genus?\n raise(\"parent has no classification!\") if parent.classification.blank?\n\n str = parent.classification.to_s.sub(/\\s+\\z/, \"\")\n str += \"\\r\\n#{parent.rank}: _#{parent.text_name}_\\r\\n\"\n change_classification(str)\n end",
"def category\n case self.scorable_type\n when \"GovernmentScore\"\n return \"Government\"\n when \"ParkScore\"\n return \"Parks\"\n when \"SchoolScore\"\n return \"Schools\"\n when \"PoliceScore\"\n return \"Police\"\n when \"PublicScore\"\n return \"Public Works\"\n end\n end",
"def discretize_by_TID!\n # cut points for each feature\n f2cp = {}\n \n each_feature do |f|\n cv = get_class_labels\n fv = get_feature_values(f)\n \n n = cv.size\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" missing feature value is not allowed!\" if n != fv.size\n \n # sort cv and fv according to ascending order of fv\n sis = (0...n).to_a.sort { |i,j| fv[i] <=> fv[j] }\n cv = cv.values_at(*sis)\n fv = fv.values_at(*sis)\n \n # get initial boundaries\n bs = []\n fv_u = fv.uniq\n fv_u.each_with_index do |v, i|\n # cut points are the mean of two adjacent data points\n if i < fv_u.size-1\n bs << (v+fv_u[i+1])/2.0\n end\n end\n \n # test each pair cut point\n s_best, h1_best, h2_best = nil, nil, nil\n \n bs.each_with_index do |h1, i| \n bs.each_with_index do |h2, j|\n next if j <= i\n \n n_h1 = (0...n).to_a.select { |x| fv[x] < h1 }.size.to_f\n n_h1_h2 = (0...n).to_a.select { |x| fv[x] > h1 and fv[x] < h2 }.size.to_f\n n_h2 = (0...n).to_a.select { |x| fv[x] > h2 }.size.to_f\n \n s = 0.0\n \n each_class do |k|\n n_h1_k = (0...n).to_a.select { |x| fv[x] < h1 and cv[x] == k }.size.to_f\n n_h1_h2_k = (0...n).to_a.select { |x| fv[x] > h1 and fv[x] < h2 and cv[x] == k }.size.to_f\n n_h2_k = (0...n).to_a.select { |x| fv[x] > h2 and cv[x] == k }.size.to_f\n \n s += n_h1_k * Math.log2(n_h1_k/n_h1) if not n_h1_k.zero?\n s += n_h1_h2_k * Math.log2(n_h1_h2_k/n_h1_h2) if not n_h1_h2_k.zero?\n s += n_h2_k * Math.log2(n_h2_k/n_h2) if not n_h2_k.zero?\n \n #pp [s_best, s, h1, h2] + [n_h1, n_h1_k] + [n_h1_h2, n_h1_h2_k] + [n_h2, n_h2_k]\n end\n \n if not s_best or s > s_best\n s_best, h1_best, h2_best = s, h1, h2\n #pp [s_best, h1_best, h2_best]\n end\n \n break if s_best.zero? # allow early temination at maximum value 0.0\n end\n \n break if s_best.zero? # allow early temination at maximum value 0.0\n end\n \n #pp [s_best, h1_best, h2_best]\n f2cp[f] = [h1_best, h2_best]\n end\n \n # discretize based on cut points\n discretize_at_cutpoints!(f2cp, true)\n end",
"def classify(string)\n camelize(string.to_s.sub(/.*\\./, ''))\n end",
"def C\n @nb\n end"
] | [
"0.7657727",
"0.67104816",
"0.6587297",
"0.6568726",
"0.6568726",
"0.6554412",
"0.64724636",
"0.64724636",
"0.63105464",
"0.6252844",
"0.62512267",
"0.61822873",
"0.61709994",
"0.6152809",
"0.6138507",
"0.6090028",
"0.605185",
"0.6046962",
"0.5996158",
"0.59455645",
"0.5942739",
"0.59330356",
"0.5925058",
"0.5858485",
"0.5838564",
"0.5828986",
"0.5818846",
"0.57649714",
"0.573614",
"0.5715993",
"0.5688422",
"0.5684527",
"0.56766474",
"0.5676127",
"0.5675451",
"0.56708753",
"0.5647223",
"0.5624937",
"0.5591104",
"0.5547327",
"0.5523966",
"0.55110675",
"0.55005866",
"0.54905343",
"0.5488028",
"0.54734886",
"0.5451791",
"0.54488593",
"0.5446077",
"0.54421806",
"0.5430984",
"0.5409872",
"0.5408176",
"0.5406699",
"0.54030263",
"0.5391029",
"0.53718466",
"0.5366145",
"0.5363402",
"0.53538805",
"0.5352478",
"0.53494924",
"0.5332505",
"0.53280693",
"0.5320148",
"0.5317732",
"0.53174114",
"0.53157634",
"0.5303983",
"0.5299904",
"0.5263845",
"0.52585036",
"0.52563715",
"0.52560896",
"0.52166677",
"0.52110046",
"0.51990575",
"0.51966566",
"0.5194926",
"0.5183468",
"0.5183468",
"0.51654613",
"0.51607466",
"0.51587933",
"0.5152064",
"0.51420134",
"0.51420134",
"0.51414335",
"0.5140298",
"0.5139239",
"0.5135536",
"0.51276267",
"0.51230955",
"0.51230955",
"0.5122336",
"0.5121773",
"0.51193184",
"0.51138914",
"0.5098334",
"0.5075687"
] | 0.55707365 | 39 |
SZ Size (length (number of amino acids); calculated molecular mass SZ in kDa; experimental molecular mass (or range) in kDa SZ (experimental method) [Ref] | def sz
field_fetch('SZ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass\n (detail[:area] * material.thickness * material.density / 1000).ceil\n end",
"def profile p_name, p_size\n ## Calculate cross section array from dimensions for PAR\n case p_name\n when \"PAR\"\n case @length_unit\n\t\t\t\twhen 0..1 ## Units are imperial (inches or feet)\n\t\t\t\t## Define standard imperial timber sizes (nominal and actual)\n\t\t\t\t\t@n_size=[]\n\t\t\t\t\t@n_size[0]=['1 x 1',0.875.inch,0.875.inch]\n\t\t\t\t\t@n_size[1]=['2 x 1',1.75.inch,0.875.inch]\n\t\t\t\t\t@n_size[2]=['3 x 1',2.75.inch,0.875.inch]\n\t\t\t\t\t@n_size[3]=['4 x 1',3.75.inch,0.875.inch]\n\t\t\t\t\t@n_size[4]=['5 x 1',4.75.inch,0.875.inch]\n @n_size[5]=['6 x 1',5.75.inch,0.875.inch]\n\t\t\t\t\t@n_size[6]=['2 x 2',1.75.inch,1.75.inch]\n\t\t\t\t\t@n_size[7]=['3 x 2',2.75.inch,1.75.inch]\n\t\t\t\t\t@n_size[8]=['4 x 2',3.75.inch,1.75.inch]\n\t\t\t\t\t@n_size[9]=['6 x 2',5.75.inch,1.75.inch]\n\t\t\t\t\t@n_size[10]=['3 x 3',2.75.inch,2.75.inch]\n\t\t\t\t\t@n_size[11]=['4 x 4',3.75.inch,3.75.inch]\t\t\n\n\t\t\t\t\tif @@custom_size[1] == 0.0 ## if custom size hasn't been set, put in a default (actual) size \n\t\t\t\t\t\t@@custom_size = ['1/2 x 3/4',0.5.inch,0.75.inch]\n\t\t\t\t\tend\n \n @n_size[12] = @@custom_size\n\n\t\t\t\t\twhen 2..4 ## Units are metric (mm, cm, or metres)\n\t\t\t\t## Define standard metric timber sizes (nominal and actual)\n\t\t\t\t\t@n_size=[]\n\t\t\t\t\t@n_size[0]=['25 x 25 mm',22.0.mm, 22.0.mm]\n\t\t\t\t\t@n_size[1]=['50 x 25 mm',44.0.mm, 22.0.mm]\n\t\t\t\t\t@n_size[2]=['75 x 25 mm',69.0.mm, 22.0.mm]\n\t\t\t\t\t@n_size[3]=['100 x 25 mm',94.0.mm, 22.0.mm]\n\t\t\t\t\t@n_size[4]=['125 x 25 mm',119.0.mm, 22.0.mm]\n\t\t\t\t\t@n_size[5]=['150 x 25 mm',144.0.mm, 22.0.mm]\n @n_size[6]=['50 x 50 mm',44.0.mm, 44.0.mm]\n\t\t\t\t\t@n_size[7]=['75 x 50 mm',69.0.mm, 44.0.mm]\n\t\t\t\t\t@n_size[8]=['100 x 50 mm',94.0.mm, 44.0.mm]\n\t\t\t\t\t@n_size[9]=['150 x 50 mm',144.0.mm, 44.0.mm]\n\t\t\t\t\t@n_size[10]=['75 x 75 mm',69.0.mm, 69.0.mm]\n\t\t\t\t\t@n_size[11]=['100 x 100 mm',94.0.mm, 94.0.mm]\n\n\t\t\t\t\tif @@custom_size[1] == 0.0\t## if custom size hasn't been set, put in a default size \n\t\t\t\t\t\t@@custom_size = [\"13mm x 19mm \",13.mm,19.mm] \n\t\t\t\t\tend \n \n @n_size[12] = @@custom_size\n\t\t\t\telse ## Something else \n\t\t\t\t\tUI.messagebox \"Model units are not defined\"\n\t\t\tend ## case @length_unit\n \n ## Calculate profile points for selected PAR size\n width = @n_size[p_size][1]\n thickness = @n_size[p_size][2]\n ## PAR is simply a rectangle with width and thickness, drawn in the x, y (red/green) plane\n## profile = [\"PAR\", @n_size[p_size][0],[0,0,0],[width,0,0],[width,thickness,0],[0,thickness,0],[0,0,0]]\n ## For testing, put in an angle\n profile = [\"PAR\", @n_size[p_size][0],[0,0,0],[0.5*width,0,0],[width,0.5*thickness,0],[width,thickness,0],[0,thickness,0],[0,0,0]]\n ## Make an array of just the profile points\n @profile_points0 = profile[2..-1]\n return profile\n else\n UI.messagebox \"Sorry, that profile name isn't defined yet\"\n end ##case p_name\n\n end",
"def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end",
"def display_size\n # (1.9 ** @magnitude) / 3.0 + 2.5\n (2.15 ** @magnitude) / 3.6 + 2.5\n end",
"def calculate_size(a_size)\n\tres = 0\n\tif(a_size == \"small\")\n\t\tres = 1\n\telsif(a_size == \"medium\")\n\t\tres = 2\t\n\telsif(a_size == \"large\")\n\t\tres = 3\t\n\tend\n\tres\n end",
"def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end",
"def format_size(sz)\n if (emptyval?(sz))\n EMPTYVAL\n else\n case\n when sz < KB then \"#{sz}B\"\n when sz >= KB && sz < MB then \"#{sz/KB}KB\"\n when sz >= MB && sz < GB then \"#{sz/MB}MB\"\n when sz >= GB && sz < TB then \"#{sz/GB}GB\"\n when sz >= TB && sz < PB then \"#{sz/TB}TB\"\n else\n XXL_SIZE\n end\n end\n end",
"def mass\n @ob.get_exact_mass - (@ob.get_total_charge * Rubabel::MASS_E)\n end",
"def rms\n Math.sqrt(energy / size)\n end",
"def calc_size(size)\n eax = size\n edx = size + 0xf\n eax = 0x10\n eax -= 1\n eax += edx\n var_390 = 0x10\n edx = 0\n eax = eax / var_390\n eax *= 0x10\n\n return eax + 0x1c\nend",
"def smr_man(settings)\n smr = 66.5 + (13.75 * settings[:weight].to_f)\n smr += (5.003 * settings[:height].to_f)\n smr - (6.775 * settings[:age].to_f)\n end",
"def size\n @atoms.size\n end",
"def initialize size=6, mines=20\n @size = size\n @mines = mines\n end",
"def sparsity\n coverage.to_f / length\n end",
"def pbSize(pokemon)\n dexdata = pbOpenDexData\n pbDexDataOffset(dexdata,pokemon.fSpecies,33)\n baseheight = dexdata.fgetw # Gets the base height in tenths of a meter\n dexdata.close\n hpiv = pokemon.iv[0]&15\n ativ = pokemon.iv[1]&15\n dfiv = pokemon.iv[2]&15\n spiv = pokemon.iv[3]&15\n saiv = pokemon.iv[4]&15\n sdiv = pokemon.iv[5]&15\n m = pokemon.personalID&0xFF\n n = (pokemon.personalID>>8)&0xFF\n s = (((ativ^dfiv)*hpiv)^m)*256+(((saiv^sdiv)*spiv)^n)\n xyz = []\n if s<10\n xyz = [290,1,0]\n elsif s<110\n xyz = [300,1,10]\n elsif s<310\n xyz = [400,2,110]\n elsif s<710\n xyz = [500,4,310]\n elsif s<2710\n xyz = [600,20,710]\n elsif s<7710\n xyz = [700,50,2710]\n elsif s<17710\n xyz = [800,100,7710]\n elsif s<32710\n xyz = [900,150,17710]\n elsif s<47710\n xyz = [1000,150,32710]\n elsif s<57710\n xyz = [1100,100,47710]\n elsif s<62710\n xyz = [1200,50,57710]\n elsif s<64710\n xyz = [1300,20,62710]\n elsif s<65210\n xyz = [1400,5,64710]\n elsif s<65410\n xyz = [1500,2,65210]\n else\n xyz = [1700,1,65510]\n end\n return (((s-xyz[2])/xyz[1]+xyz[0]).floor*baseheight/10).floor\nend",
"def mass\n 10\n end",
"def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend",
"def calculate_size(show)\n print \"\\rcalculating size for #{show}\".ljust(120)\n size = directory_size \"#{PATH}/#{show}\"\n if SHOWS.include? show\n anime = SHOWS[show]\n anime.bytes += size\n else\n anime = Anime.new(show, size)\n RESULTS << anime\n SHOWS[anime.name] = anime\n end\nend",
"def sz\n self.to_s.size\n end",
"def interpret_size(size); end",
"def size\n\t\t7500\n\tend",
"def size\n @size \n end",
"def size\n @size \n end",
"def sizes\n h_sizes = [@size]\n prog = @prog\n add_sizes = proc { h_sizes << h_sizes.last / prog.to_f**(1.0 / 48) }\n nb_notes = notes_range.to_a.size\n\n if @prog_change.nil?\n (nb_notes - 1).times(&add_sizes)\n elsif !@prog_change[:note].nil?\n nb_notes = (notes_range.min.succ..@prog_change[:note]).to_a.size\n nb_notes.times(&add_sizes)\n\n prog = @prog_change[:prog].to_f\n unless @prog_change[:size].nil?\n h_sizes.pop\n h_sizes << @prog_change[:size]\n end\n nb_notes = (@prog_change[:note].succ..notes_range.max).to_a.size\n nb_notes.times(&add_sizes)\n end\n h_sizes.map { |size| size.round(0) }\n end",
"def kcalproteinas\n\t\t\t@proteinas * 4\n\t\tend",
"def size_with_meta_data(style = nil)\n style ? meta_for_style(style)[:size] : size_without_meta_data\n end",
"def parent_ion_mass(charge=1)\r\n (mass(nterm) + ladder.last + mass(cterm) + charge * proton_mass)/charge\r\n end",
"def size\n @sizes ||= strip(:size)\n end",
"def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end",
"def size\n sku.size * amount\n end",
"def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end",
"def size\n\t\treturn @m.capacity\n\tend",
"def size\n # return the value of the instance variable @size\n @size\n # end size method\n end",
"def get_shirt_size\n return @size\n end",
"def human_size(*args); end",
"def size\n # returns the value of the instance var @size\n @size\n # end of size method\n end",
"def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end",
"def size=(dimension); end",
"def size\nend",
"def memsize; RAtlas::memsize(@storage);end",
"def manufacturing_cost\n\tcost = 0.0\n\tself.item.materials.each do |mat|\n\t\tcost += ( (mat.quantity * waste_factor).round * mat.item.market_data.value )\n\tend\n\tself.manufacturing_requirements.each do |ram|\n\t\tnext if ram.item.skill?\n\t\tcost += ( ram.quantity * ram.damagePerJob * ram.item.market_data.value )\n\tend\n\tif self.tech_level == 2\n\t\tcost += self.invention_cost\n\tend\n\tcost /= self.item.portionSize\nend",
"def total_per_big_component(&block)\n @scms.sort.each do | name, linehash |\n size = linehash.values.sum\n output name, 0, size, &block if !size.nil? and size > 20000\n end\n end",
"def mass(consider_electron_masses = true)\n mss = inject(0.0) do |sum,(el,cnt)| \n sum + (Mspire::Mass::Element::MONO[el]*cnt)\n end\n mss -= (Mspire::Mass::ELECTRON * charge) if consider_electron_masses\n mss\n end",
"def size; @size end",
"def update_masses\n self.total = 0\n masses.clear\n self.hashes.each do |hash, nodes|\n masses[hash] = nodes.first.mass * nodes.size\n masses[hash] *= (nodes.size) if identical[hash]\n self.total += masses[hash]\n end\n end",
"def total_mass\n sum = 0\n @bodies.each{ |body| body[:mass] += sum}\n sum\n end",
"def size(*) end",
"def size(*) end",
"def size_with_meta_data(style = nil)\n style ? read_meta(style, :size) : size_without_meta_data\n end",
"def peptide_mass_with_amino_acids(peptide, amh)\n mass = 0\n peptide.chars.each do |pep|\n mass += amh[pep]\n end\n return mass\n end",
"def md_size\n self[:md_size]\n end",
"def size\n\t\t\treturn @m.capacity\n\t\tend",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size\n @stak.size\n end",
"def size(e, params)\n if (params.empty?)\n help(e, [\"SIZE\"])\n return\n end\n\n name = params.first.upcase\n msg = nil\n\n for key, data in @size_data\n datanick = data[:nick].upcase\n if datanick == name\n cm = data[:size] / 2.0\n inches = cm / 2.54\n fmt = name == @message.nick.upcase ? \"HEY %s YOUR DONG IS\" : \"%s'S DONG IS\"\n msg = \"#{fmt} %0.1f INCHES (%0.1f CM)\" % [name, inches, cm]\n break\n end\n end\n\n msg ||= \"ONOES THERE IS NO DONG FOR #{name}\"\n\n @irc.msg(e.channel || e.nick, msg.upcase)\nend",
"def size_mb \n return size / 1048576 # (1024 * 1024) \n end",
"def proton_mass\r\n mass(HYDROGEN) - mass(ELECTRON)\r\n end",
"def size\n\n end",
"def size\n end",
"def size\n end",
"def size\n end",
"def size\n info[\"size\"]\n end",
"def compute_size(e)\n user_hash = user_hash(@message)\n mulligans = @redongs[user_hash]\n\n # Modify size by an increasing value - more redongs means more and more loss\n size_modifier = roll_penalty(mulligans)\n\n # Get size by using daily seed\n size = 0\n user_seed(user_hash, mulligans * 53) do\n # Is it MICROPENIS MONDAY?!?\n if Time.now.wday == 1\n size = [2, microdong_size + size_modifier].max\n else\n size = [2, fair_dong_size + size_modifier].max\n end\n end\n\n @size_data[user_hash] = {:size => size, :nick => @message.nick, :hash => user_hash}\n\n return size\nend",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def get_size\n\t\treturn @size\n\tend",
"def size_used\n info[\"size-used\"]\n end",
"def size\n @info[:size]\n end",
"def get_size\n\t\tend",
"def size\n\n\n end",
"def size\n Stal.solve(redis, [\"SCARD\", key])\n end",
"def edit_size\n\t\tif (self.type == SECT_TYPE::OUTPUT || self.type == SECT_TYPE::CODE || self.type == SECT_TYPE::NOTES)\n\t\t\treturn \"large\"\n\t\telse\n\t\t\treturn \"small\"\n\t\tend\n\tend",
"def d_size\n @capacity / @blockSize\n end",
"def size_mum_record\n 8\n end",
"def memsize\n end",
"def size\n @size\n end"
] | [
"0.57878757",
"0.5575106",
"0.55321246",
"0.5473021",
"0.5440884",
"0.53712577",
"0.5332179",
"0.5320834",
"0.5291731",
"0.52892774",
"0.5284819",
"0.52709997",
"0.52469873",
"0.5224993",
"0.5202173",
"0.5190677",
"0.51842785",
"0.51529473",
"0.51502836",
"0.5143533",
"0.5136697",
"0.5135455",
"0.5135455",
"0.5120986",
"0.5117752",
"0.51089334",
"0.510408",
"0.50930387",
"0.5091533",
"0.50908446",
"0.5080718",
"0.5040159",
"0.5032845",
"0.5026682",
"0.5022069",
"0.5020761",
"0.50144684",
"0.50136054",
"0.5003493",
"0.5001366",
"0.49931562",
"0.49924898",
"0.49887928",
"0.4982368",
"0.49740484",
"0.49706253",
"0.4969246",
"0.4969246",
"0.49643156",
"0.49600032",
"0.49533156",
"0.4947849",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49367157",
"0.49319342",
"0.49278343",
"0.49267098",
"0.49217647",
"0.49194553",
"0.490398",
"0.490398",
"0.490398",
"0.48982242",
"0.48934227",
"0.48918012",
"0.48918012",
"0.48918012",
"0.48918012",
"0.48918012",
"0.48918012",
"0.48841453",
"0.4883321",
"0.48801982",
"0.4873085",
"0.487119",
"0.48693758",
"0.48681206",
"0.48622146",
"0.48533973",
"0.48499042",
"0.48458314"
] | 0.55306536 | 3 |
SC Sequence comment, i. e. source of the protein sequence | def sc
field_fetch('SC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_line; end",
"def comment\n cyc.comment(self.to_sym)\n end",
"def source_line=(_); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def comment(string); end",
"def source_line\n @source_location[1]\n end",
"def diagn; \"; Src: #{@currentSource ? @currentSource : '<no source>'}\" end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def to_s\n format 'remark %s', tag_remark(@comment.to_s)\n end",
"def refseq_sequence\n \"NC_0000\" + chrom.sub(/X/, \"23\").sub(/Y/, \"24\")\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def comment_describing(line_number)\n self.class.comment_describing(raw, line_number)\n end",
"def comment_describing(line_number)\n self.class.comment_describing(raw, line_number)\n end",
"def preamble\n @preamble\n end",
"def comment\n decode_string_member(:comment)\n end",
"def lex_en_line_comment=(_arg0); end",
"def lex_en_line_comment=(_arg0); end",
"def lex_en_line_comment=(_arg0); end",
"def comment\n comment = buffer.options.comment_line.to_s\n indent = nil\n lines = []\n\n each_line do |line, fc, tc|\n line_fc = \"#{line}.#{fc}\"\n line_tc = \"#{line}.#{tc}\"\n\n next if buffer.at_end == line_tc\n\n lines << line\n\n next if indent == 0 # can't get lower\n\n line = buffer.get(\"#{line}.#{fc}\", \"#{line}.#{tc}\")\n\n next unless start = line =~ /\\S/\n\n indent ||= start\n indent = start if start < indent\n end\n\n indent ||= 0\n\n buffer.undo_record do |record|\n lines.each do |line|\n record.insert(\"#{line}.#{indent}\", comment)\n end\n end\n end",
"def c_generate_comment_header\nputs <<HERE\n/*\n * This file contains autogenerated routines for dispatching and disassembling\n * MIPS opcodes.\n *\n * The code has been generated by mipsgen.\n *\n * See scripts/mipsgen.rb for the code generator framework.\n * See codegen/cgen.rb for C specific information.\n */\n\nHERE\nend",
"def detail\n \"#{line}\\n#{' ' * line_offset}^\"\n end",
"def description\n initial_comment.try(:text) || \"\"\n end",
"def last_magic_comment(source); end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.count + 1\n end\n\n @document.source_lines[@line - 1...next_node_line]\n .join(\"\\n\")\n .gsub(/^\\s*\\z/m, '') # Remove blank lines at the end\n end",
"def synopsis_note\n note = @strip['note']\n syn = @strip['synopsis']\n if note.nil?\n syn\n else\n \"#{syn} #{note}\"\n end\n end",
"def one_line_description(opts={}) ; attributes['comments'] ; end",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def source_lines; end",
"def comment_string\n @comment_syntax.string_for_method_entity self\n end",
"def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def lex_en_line_comment; end",
"def lex_en_line_comment; end",
"def lex_en_line_comment; end",
"def source_line(lineno); end",
"def doc_comment(header: true)\n comps = \"\"\n self.components.each do |comp|\n case comp\n when Eddy::Summary::Segment then comps << \" - #{comp.id.upcase}\\n\"\n when Eddy::Summary::Loop then comps << \" - #{comp.id.upcase} (loop)\\n\"\n end\n end\n parts = []\n parts << \"### Loop Summary:\\n\" if header\n parts << <<~YARD.strip\n - Repeat: #{self.repeat_limit}\n - Components:\n #{comps}\n YARD\n return parts.compact.join(\"\\n\")\n end",
"def text source=nil\n header = read(source)\n\n # strip shebang and encoding comments\n header.sub! /\\A#!.+\\n?/, ''\n header.sub! /\\A#.*coding:.+\\n?/, ''\n\n # extract the embedded manpage source\n if header =~ /\\A\\s*^#/\n header.split(/^\\s*$/, 2).first.gsub(/^# ?/, '')\n else\n header[/^=begin\\b.*?$(.*?)^=end\\b.*?$/m, 1].to_s\n end.strip\n end",
"def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end",
"def start_comment(description = 'Description')\n str = \"#{@indent}/**\\n\"\n str += \"#{@indent} *\\t@brief\\t<##{description}#>\\n\"\n str \n end",
"def document_detail(node)\n node_data = node.data\n <<~DETAIL_SRC\n [[#{Giblish.to_valid_id(node.pathname.to_s, \"_\", \"_\", true)}]]\n === pass:[#{node_data.title.encode(\"utf-8\")}]\n\n #{\"Doc id::\\n_#{node_data.docid}_\" unless node_data.docid.nil?}\n\n #{\"Purpose::\\n#{node_data.purpose_str}\" unless node_data.purpose_str.to_s.empty?}\n\n #{if node_data.stderr.empty?\n \"\"\n else\n \"Conversion issues::\\n\"\\\n \"#{node_data.stderr.gsub(/^/, \" * \")}\"\n end\n }\n\n Source file::\n #{node_data.src_node.segment}\n\n '''\n\n DETAIL_SRC\n end",
"def comments\n @properties[\"C\"]\n end",
"def description\n comment_sections.first\n end",
"def metadata_comment_title(structure)\n \"#{(structure.highlighted_comment || structure.comments.last).title} (#{structure.comments_count} avis)\"\n end",
"def extract_magic_comments(processed_source); end",
"def document\n comment_code\n super\n end",
"def comment(str)\n @out.comment(str)\n end",
"def getComment(var)\n return \"@* \" << var.text << \" *@\\n\"\n end",
"def comments_from path\n path = File.expand_path(\"../lib/friendly_id/#{path}\", __FILE__)\n match = File.read(path).match(/\\n=begin(.*)\\n=end/m)[1].to_s\n match.split(\"\\n\").reject {|x| x =~ /^@/}.join(\"\\n\").strip\nend",
"def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_eol)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_eol)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end",
"def pn\n format(COMMENT_PN, index + 1)\n end",
"def comment(value)\n merge(comment: value.to_s)\n end",
"def source_title\n bib_source_title || get_item_data_by_name('TitleSource')\n end",
"def comment\n upgrade_to_v2 \n return read_attribute(:comment)\n end",
"def preamble=( val )\n @preamble = val\n end",
"def source=(src)\n @source = src\n @paragraphs = []\n lines = src.split(\"\\n\")\n\n # splitting stuff into lines and setting cursor into initial position\n i = 0\n source_lines_counter = 0\n while i < lines.size\n comment_lines = []\n # get single line comments\n if comment_symbols[:single_line]\n while i < lines.size && lines[i] =~ /^\\s*#{Regexp.escape(comment_symbols[:single_line])}(.*)/\n comment_lines << $1\n i += 1\n end\n end\n\n # getting multiline comments\n if comment_symbols[:multiline]\n begin_symbol = Regexp.escape(comment_symbols[:multiline][:begin])\n end_symbol = Regexp.escape(comment_symbols[:multiline][:end])\n if i < lines.size && lines[i] =~ /\\s*#{begin_symbol}/\n begin\n match = lines[i].match /\\s*(#{begin_symbol})?\\s?(.*?)(#{end_symbol}|$)/\n comment_lines << match[2]\n i += 1\n end while i < lines.size && !(lines[i-1] =~ /\\s*#{end_symbol}/)\n end\n end\n\n # getting source lines\n source_lines = []\n starting_line = if options[:do_not_count_comment_lines]\n source_lines_counter\n else\n i\n end\n\n while i < lines.size && !is_comment(lines[i])\n source_lines << lines[i]\n source_lines_counter += 1\n i += 1\n end\n\n # post-processing: stripping comments and removing empty strings from beginnings and ends\n starting_line += postprocess_source(source_lines)\n postprocess_comments(comment_lines)\n # clear comment lines if that's commented out code\n comment_lines.clear if comment_lines[0] =~ /^:code:$/\n\n # if we have comments or source\n if comment_lines.size > 0 || source_lines.size > 0\n @paragraphs << Paragraph.new(source_lines.join(\"\\n\"),\n comment_lines.join(\"\\n\"),\n starting_line,\n source_type,\n options)\n end\n end\n end",
"def header\n source_code.gsub /\\n^[^#].*/m, ''\n end",
"def document\n str = start_comment()\n str += arguments_comment()\n str += return_comment()\n str += end_comment()\n str += \"#{@code}\\n\"\n select_first_field(str)\n end",
"def get_comment(n, algebraic_structure)\n ret = <<EOS\n/**\n* Combine #{n} #{algebraic_structure}s into a product #{algebraic_structure}\n*/\nEOS\n ret.strip\nend",
"def comment_line?(line_source); end",
"def comment_line?(line_source); end",
"def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_utf8)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\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 :_comment unless _tmp\n return _tmp\n end",
"def parse_comments\n @data[4][0]\n end",
"def comment(prefix)\n lang_eval { @comment_prefix = prefix }\n nil\n end",
"def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 350:9: '#' (~ ( '\\\\n' | '\\\\r' ) )*\n match( 0x23 )\n # at line 350:13: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 13\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( 0x0, 0x9 ) || look_13_0.between?( 0xb, 0xc ) || look_13_0.between?( 0xe, 0xffff ) )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 350:13: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 13\n end\n end # loop for decision 13\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n end",
"def comment\n @name\n end",
"def generate_string(options = {})\n \"##{comment}\\n\"\n end",
"def description\n @sg.description\n end",
"def description\n @sg.description\n end",
"def getComment(var)\n return \"/* \" << var.text << \" */\\n\"\n end",
"def source_credit\n :\"source_credit_#{source}\" if source.present?\n end",
"def description\n comment_sections.reject do |section|\n section.modifiers.any? or section.section\n end.map(&:comment).join(\"\\n\\n\")\n end",
"def string_for_class_entity e\n comment = \n\"/** <#(brief description of #{e.name})#>\n\n <#(comprehensive description)#>\n*/\"\n end"
] | [
"0.64769065",
"0.61717236",
"0.60855395",
"0.6014314",
"0.6014314",
"0.6014314",
"0.6014314",
"0.5999302",
"0.5978063",
"0.58888775",
"0.58888775",
"0.58888775",
"0.58888775",
"0.58388036",
"0.58136594",
"0.57977796",
"0.57977796",
"0.57475305",
"0.57475305",
"0.5735703",
"0.5730968",
"0.5723058",
"0.5723058",
"0.5723058",
"0.5720473",
"0.5694683",
"0.5682274",
"0.5680786",
"0.5665575",
"0.5659398",
"0.5637305",
"0.5623362",
"0.5618621",
"0.5618621",
"0.5618621",
"0.5618621",
"0.56184226",
"0.56155735",
"0.5608107",
"0.5608107",
"0.5608107",
"0.5608107",
"0.5608107",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.5590027",
"0.55706364",
"0.55706364",
"0.55706364",
"0.5566108",
"0.5556385",
"0.5555795",
"0.5526315",
"0.5507351",
"0.5498109",
"0.5497232",
"0.5495782",
"0.54863787",
"0.5486347",
"0.5478709",
"0.5478484",
"0.54617906",
"0.54559934",
"0.5435755",
"0.5421177",
"0.542116",
"0.5420631",
"0.54182726",
"0.541116",
"0.5399745",
"0.5395914",
"0.53950673",
"0.53888357",
"0.5387495",
"0.5387495",
"0.5381042",
"0.5376842",
"0.53752625",
"0.53547734",
"0.5341488",
"0.5335393",
"0.53131604",
"0.53131604",
"0.5311263",
"0.53035915",
"0.5294814",
"0.52885777"
] | 0.0 | -1 |
FT Feature table (1st position last position feature) | def ft
field_fetch('FT')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ft\n\tFancifyTable.new([[1,2],[3,4]])\nend",
"def calculate_feature_vector\n fd = current_domain.dictionary\n fd_ids = fd.keys.sort\n\n @feature_vector = fd_ids.map do |fd_id|\n feature = fd[fd_id]\n @feature_set.member?( feature ) ? 1 : 0 # TODO: TF-IDF here -- Thu Mar 1 19:25:21 2012\n end\n end",
"def first\n @features.first\n end",
"def lttfindex\n end",
"def define_features\n @fvs.each do |vector, label|\n vector.each do |term, value|\n @features.add(term)\n end\n end\n end",
"def feature_vector\n out = []\n field_names.each { |f| out << @profile[f] }\n out\n end",
"def features\n []\n end",
"def ft_desc(feature)\n if hash = @data[feature]\n return hash[\"ft_desc\"]\n end\n end",
"def features\n []\n end",
"def create_feature(hits)\n # Initialize the entry\n query, subject = hits.first.query, hits.first.subject\n feature = IO::GFF::Feature.new(seqid: subject, source: 'BLATN', type: :nucleotide_match, attributes: { 'Name' => query })\n\n # Determine the orientation based on the query start/end positions\n feature.strand = hits.first.subject_start < hits.first.subject_end ? '+' : '-'\n\n # Add each of the hits to the entry\n hits.each do |hit|\n feature.regions.create(start: hit.subject_start, \n end: hit.subject_end, \n score: hit.bit_score, \n attributes: { 'EValue' => hit.e_value, 'Target' => \"#{query} #{hit.query_start} #{hit.query_end}\" })\n end\n \n feature\n end",
"def getFts\n puts \"CDS\\tLocation\\tGene\\tProduct\"\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n seqBeg = loc[0].from.to_s\n seqEnd = loc[0].to.to_s\n strand = loc[0].strand.to_s\n gene = []\n product = []\n protId = \"\"\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n puts \"#{@accession}\\t#{seqBeg}\\t#{seqEnd}\\t#{strand}\\t#{protId}\\t#{locustag}\\t#{gene[0]}\\t#{product[0]}\"\n end\n end",
"def sen_settg(row,column); det.table(:index, 12)[row][column]; end",
"def events(row,column); det.table(:index, 10)[row][column]; end",
"def gtfs_cols\n @@gtfs_cols[self]\n end",
"def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend",
"def loaded_features; end",
"def get_features(frag, model)\n w1 = (frag.cleaned.last or '')\n w2 = (frag.next or '')\n\n frag.features = [\"w1_#{w1}\", \"w2_#{w2}\", \"both_#{w1}_#{w2}\"]\n\n if not w2.empty?\n if w1.chop.is_alphabetic? \n frag.features.push \"w1length_#{[10, w1.length].min}\", \"w1abbr_#{model.non_abbrs[w1.chop]}\"\n end\n\n if w2.chop.is_alphabetic?\n frag.features.push \"w2cap_#{w2[0,1].is_upper_case?}\", \"w2lower_#{model.lower_words[w2.downcase]}\"\n end\n end\n end",
"def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend",
"def last\n @features.last\n end",
"def ftoc(temp)\n\t(temp - 32) * 5.0/9.0\nend",
"def tablefeaturetype(io)\n lt, id_list, crw_header, crw_totals, id_field_next, cb_fs_data, rup_build, _ = io.read(28).unpack('VVVVVVvv')\n\n result = {\n lt: lt, # lt (4 bytes): A SourceType that specifies the type of data source for the table.\n lt_d: sourcetype(lt),\n idList: id_list, # idList (4 bytes): An unsigned integer that specifies an identifier for the table. MUST be unique within the sheet. SHOULD<183> be unique within the workbook.\n crwHeader: crw_header == 1, # crwHeader (4 bytes): A Boolean (section 2.5.14) that specifies whether the table has a header row.\n crwTotals: crw_totals == 1, # crwTotals (4 bytes): A Boolean that specifies whether there is a total row.\n idFieldNext: id_field_next, # idFieldNext (4 bytes): An unsigned integer that specifies the next unique identifier to use when assigning unique identifiers to the fieldData.idField field of the table.\n cbFSData: cb_fs_data, # cbFSData (4 bytes): An unsigned integer that specifies the size, in bytes, of the fixed portion of this structure. The fixed portion starts at the lt field and ends at the rgbHashParam field. MUST be equal to 64.\n rupBuild: rup_build, # rupBuild (2 bytes): An unsigned integer that specifies the build number of the application that wrote the structure.\n # unused1 (2 bytes): Undefined, and MUST be ignored.\n }\n\n attrs = Unxls::BitOps.new(io.read(4).unpack('V').first)\n result.merge!({\n # A - unused2 (1 bit): Undefined, and MUST be ignored.\n fAutoFilter: attrs.set_at?(1), # B - fAutoFilter (1 bit): A bit that specifies whether the table has an AutoFilter. MUST be 1 when fPersistAutoFilter is 1.\n fPersistAutoFilter: attrs.set_at?(2), # C - fPersistAutoFilter (1 bit): A bit that specifies whether the AutoFilter is preserved for this table after data refresh operations.<184>\n fShowInsertRow: attrs.set_at?(3), # D - fShowInsertRow (1 bit): A bit that specifies whether the insert row is visible. MUST be 1 if fInsertRowInsCells is 1.\n fInsertRowInsCells: attrs.set_at?(4), # E - fInsertRowInsCells (1 bit): A bit that specifies whether rows below the table are shifted down because of the insert row being visible.\n fLoadPldwIdDeleted: attrs.set_at?(5), # F - fLoadPldwIdDeleted (1 bit): A bit that specifies whether the idDeleted field is present. MUST be zero if the lt field is not set to 0x00000001.\n fShownTotalRow: attrs.set_at?(6), # G - fShownTotalRow (1 bit): A bit that specifies whether the total row was ever visible.\n # H - reserved1 (1 bit): MUST be zero and MUST be ignored.\n fNeedsCommit: attrs.set_at?(8), # I - fNeedsCommit (1 bit): A bit that specifies whether table modifications were not synchronized with the data source. MUST be zero if the lt field is not set to 0x00000001.\n fSingleCell: attrs.set_at?(9), # J - fSingleCell (1 bit): A bit that specifies whether the table is limited to a single cell. The table cannot have header rows, total rows, or multiple columns. If fSingleCell equals 1, the lt field MUST be set to 0x00000002.\n # K - reserved2 (1 bit): MUST be zero and MUST be ignored.\n fApplyAutoFilter: attrs.set_at?(11), # L - fApplyAutoFilter (1 bit): A bit that specifies whether the AutoFilter is currently applied. MUST be 1 if the AutoFilter is currently applied<185>.\n fForceInsertToBeVis: attrs.set_at?(12), # M - fForceInsertToBeVis (1 bit): A bit that specifies whether the insert row is forced to be visible because the table has no data.\n fCompressedXml: attrs.set_at?(13), # N - fCompressedXml (1 bit): A bit that specifies whether the cached data for this table in the List Data stream is compressed. MUST be zero if the lt field is not set to 0x00000001.\n fLoadCSPName: attrs.set_at?(14), # O - fLoadCSPName (1 bit): A bit that specifies whether the cSPName field is present. MUST be zero if the lt field is not set to 0x00000001.\n fLoadPldwIdChanged: attrs.set_at?(15), # P - fLoadPldwIdChanged (1 bit): A bit that specifies whether idChanged field is present. MUST be zero if the lt field is not set to 0x00000001.\n verXL: attrs.value_at(16..19), # verXL (4 bits): An unsigned integer that specifies the application version under which the table was created. MUST be either 0xB or 0xC<186>.\n fLoadEntryId: attrs.set_at?(20), # Q - fLoadEntryId (1 bit): A bit that specifies whether the entryId field is present.\n fLoadPllstclInvalid: attrs.set_at?(21), # R - fLoadPllstclInvalid (1 bit): A bit that specifies whether the cellInvalid field is present. MUST be zero if the lt field is not set to 0x00000001.\n fGoodRupBld: attrs.set_at?(22), # S - fGoodRupBld (1 bit): A bit that specifies whether the rupBuild field is valid.\n # T - unused3 (1 bit): Undefined, and MUST be ignored.\n fPublished: attrs.set_at?(24), # U - fPublished (1 bit): A bit that specifies whether the table is published. This bit is ignored if the fPublishedBookItems field of the BookExt_Conditional12 structure is zero.\n # reserved3 (7 bits): Undefined, and MUST be ignored.\n })\n\n _, _, _, lem, _ = io.read(32).unpack('V3VC*')\n result.merge!({\n lPosStmCache: :not_implemented, # lPosStmCache (4 bytes): An unsigned integer that specifies the position of the cached data within the List Data stream. Undefined and MUST be ignored if the lt field is not set to 0x00000001.\n cbStmCache: :not_implemented, # cbStmCache (4 bytes): An unsigned integer that specifies the size, in bytes, of the cached data within the List Data stream. Undefined and MUST be ignored if the lt field is not set to 0x00000001.\n cchStmCache: :not_implemented, # cchStmCache (4 bytes): An unsigned integer that specifies the count of characters of the cached data within the List Data stream when the cached data is uncompressed. Undefined and MUST be ignored if the lt field is not set to 0x00000001.\n LEMMode: lemmode(lem), # lem (4 bytes): A LEMMode enumeration that specifies the table edit mode. If lt is set to 0x00000000, 0x00000002 or 0x00000003, this field MUST be set to 0x00000000.\n rgbHashParam: :not_implemented, # rgbHashParam (16 bytes): An array of bytes that specifies round-trip information. SHOULD<187> be ignored and MUST be preserved if the lt field is set to 0x00000001. Undefined and MUST be ignored if the lt field is not set to 0x00000001.\n })\n\n result[:rgbName] = xlunicodestring(io) # rgbName (variable): An XLUnicodeString that specifies the name of the table. MUST be unique per workbook, and case-sensitive in all locales.\n result[:cFieldData] = io.read(2).unpack('v').first # cFieldData (2 bytes): An unsigned integer that specifies the number of columns in the table. MUST be greater than or equal to 0x0001 and less than or equal to 0x0100.\n\n if result[:fLoadCSPName]\n result[:cSPName] = xlunicodestring(io) # cSPName (variable): An XLUnicodeString that specifies the name of the cryptographic service provider used to specify rgbHashParam. This field is present only if fLoadCSPName is set to 1.\n end\n\n if result[:fLoadEntryId]\n result[:entryId] = xlunicodestring(io) # entryId (variable): An XLUnicodeString that specifies a unique identifier for the table. The string equals the value of the idList field, represented in decimal format, without any leading zeros. It is used when lt equals 0x00000002 and ignored otherwise. This field is present only if fLoadEntryId is set to 1.\n end\n\n result[:fieldData] = result[:cFieldData].times.map { feat11fielddataitem(io, result) } # fieldData (variable): An array of Feat11FieldDataItem that contains the specification of the columns of the table. The number of items in this array is specified by the cFieldData field.\n\n if result[:fLoadPldwIdDeleted]\n result[:idDeleted] = :not_implemented # idDeleted (variable): A Feat11RgSharepointIdDel structure that specifies the identifiers of deleted rows. This information is used when synchronizing with the Web based data provider’s data source. This field is only present if the fLoadPldwIdDeleted field is set to 1.\n end\n\n if result[:fLoadPldwIdChanged]\n result[:idChanged] = :not_implemented # idChanged (variable): A Feat11RgSharepointIdChange structure that specifies the identifiers of the edited rows. This information is used when synchronizing with the Web based data provider’s data source. This field is only present if the fLoadPldwIdChanged field is set to 1.\n end\n\n if result[:fLoadPllstclInvalid]\n result[:cellInvalid] = :not_implemented # cellInvalid (variable): A Feat11RgInvalidCells structure that specifies the location of cells within the table that contain values that are invalid based on validation rules on the Web based data provider. This field is only present if the fLoadPllstclInvalid field is set to 1.\n end\n\n result\n end",
"def get_features(frag, model)\n w1 = (frag.cleaned.last or '')\n w2 = (frag.next or '')\n\n frag.features = [\"w1_#{w1}\", \"w2_#{w2}\", \"both_#{w1}_#{w2}\"]\n\n if not w2.empty?\n if w1.chop.is_alphabetic? \n frag.features.push \"w1length_#{[10, w1.length].min}\"\n frag.features.push \"w1abbr_#{model.non_abbrs[w1.chop]}\"\n end\n\n if w2.chop.is_alphabetic?\n frag.features.push \"w2cap_#{w2[0].is_upper_case?}\"\n frag.features.push \"w2lower_#{model.lower_words[w2.downcase]}\"\n end\n end\n end",
"def index\n @featuring = Featuring.all\n end",
"def test_get_feature_vect()\n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-A6-2671\",\"TCGA-A6-2672\"], \n [\"vital_status\", \"death_days_to\",\"percent_tumor_nuclei\"], \n false)\n followup = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_clinical_follow_up_v1.0_coad.txt\"\n tumor_sample = \"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/nationwidechildrens.org_biospecimen_slide_coad.txt\"\n rs.add_tcga_source(followup)\n rs.add_tcga_source(tumor_sample)\n \n h = Hash.new\n rs.get_feature_vector do |sample,fV|\n h[sample] = fV\n end\n\n assert_equal(h[\"TCGA-A6-2671\"], [\"Dead\", \"1331\", 35.0], \"returned unexpected result for TCGA-A6-2671\")\n assert_equal(h[\"TCGA-A6-2672\"], [\"Alive\", \"[Not Available]\", 40.0], \"returned unexpected result for TCGA-A6-2672\")\n end",
"def ftoc(temp)\n\t(temp - 32) * 5/9.0\nend",
"def get_sax_feature(feature)\n \n end",
"def getFts\n puts \"CDS\\tLocation\\tGene\\tProduct\"\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n seqBeg = loc[0].from.to_s\n seqEnd = loc[0].to.to_s\n strand = loc[0].strand.to_s\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n puts \"#{@accession}\\t#{seqBeg}\\t#{seqEnd}\\t#{strand}\\t#{protId}\\t#{gene[0]}\\t#{product[0]}\"\n end\nend",
"def to_fdf; end",
"def sen_events(row,column); det.table(:index, 11)[row][column]; end",
"def row_first\n\t\t\trow_value * 9\n\t\tend",
"def feature_flags\n 0\n end",
"def tf(superfamily_id)\n DocVector.tf(self.id, superfamily_id)\n end",
"def features\n @features ||= {}\n @features.keys\n end",
"def sen_status(row,column); det.table(:index, 10)[row][column]; end",
"def features\n model.instance_variable_get(\"@features\")\n end",
"def ftoc(f)\n\tf = f.to_f\n\t(f - 32) * 5.0/9.0 \nend",
"def create_features_ensembl_seq_obj(bioseq,targets)\r\n targets.each do |key,value|\r\n f1 = Bio::Feature.new(\"target_CTTCTT\",\"#{key[0]}..#{key[1]}\")\r\n #im no sure if it is a interior coding exon \r\n f1.append(Bio::Feature::Qualifier.new('interior coding exon', \"#{value[0]}\"))\r\n f1.append(Bio::Feature::Qualifier.new('strand', \"#{value[1]}\"))\r\n bioseq.features << f1\r\n end\r\nend",
"def do_float_tables(nTotalBits, nExpBits)\n nSignBits = 1\n nFracBits = nTotalBits - nSignBits - nExpBits\n\n expBias = 2**(nExpBits - 1) - 1\n fracScale = 2**nFracBits\n\n signField = [nTotalBits - 1, nTotalBits - 1 - nSignBits + 1]\n expField = [signField[1] - 1, signField[1] - 1 - nExpBits + 1]\n fracField = [expField[1] - 1, 0]\n\n heading = \"(#{nTotalBits}-#{nExpBits})-Bit Float Values Continued\"\n underline = '='*heading.size\n tableBegin = TABLE_BEGIN\n tableBegin['$HEADING'] = heading\n tableBegin['$UNDERLINE'] = underline\n\n did_nan = false\n (0...(2**nTotalBits)).each do |v|\n puts tableBegin if v % N_PER_TABLE == 0\n s = bit_field(v, *signField)\n e = bit_field(v, *expField)\n f = bit_field(v, *fracField)\n exp = e - expBias\n s1 = (s == 0) ? '' : ' - '\n sign = (s == 0) ? ' + ' : ' - '\n value_fmt = '%12.6f'\n if e == 0 #denormalized\n value = ((2**(exp+1)) * f / fracScale)*1.0\n computation = \"(#{s1}2^{#{exp + 1}}\\\\times(0 + #{f}/#{fracScale}))\"\n elsif e == (2**nExpBits) - 1 #infinities, nan\n value = (f == 0) ? 'infinity' : 'nan'\n value_fmt = '%s'\n computation = ''\n else #normalized\n value = (2**exp) * (1.0 + f*1.0/fracScale)\n computation = \"(#{s1}2^{#{exp}}\\\\times(1 + #{f}/#{fracScale}))\"\n end\n puts sprintf \"%1b\\\\;%0*b\\\\;%0*b & %6d & %6d & %s#{value_fmt} %s\\\\\\\\\", \n s, nExpBits, e, nFracBits, f, e, f, sign, value, computation\n puts TABLE_END if v % N_PER_TABLE == (N_PER_TABLE - 1)\n end\nend",
"def frtrefheader(io)\n result = frtheader(io.read(4)) # rt, grbitFrt\n result[:ref8] = ref8u(io.read(8)) # ref8 (8 bytes): A Ref8U that references the range of cells associated with the containing record.\n result\n end",
"def compute_df_tf\n @df_in_dataset = {}\n @tf_in_dataset = {}\n @df_in_corpus = {}\n \n @dataset.entries.each do |e|\n doc = Document.find_with_fulltext e.shasum\n tv = doc.term_vectors\n \n tv.each do |word, hash|\n # Oddly enough, you'll get weird bogus values for words that don't\n # appear in your document back from Solr. Not sure what's up with\n # that.\n @df_in_corpus[word] = hash[:df] unless hash[:df] == 0\n next if hash[:tf] == 0\n \n @tf_in_dataset[word] ||= 0\n @tf_in_dataset[word] += hash[:tf]\n\n @df_in_dataset[word] ||= 0\n @df_in_dataset[word] += 1\n end\n end\n\n @num_dataset_types ||= @tf_in_dataset.count\n @num_dataset_tokens ||= @tf_in_dataset.values.reduce(:+)\n end",
"def last\n @features.sort.last\n end",
"def ftoc(f)\n\tc = (f - 32).to_f * (5.0 / 9.0)\n\treturn c\nend",
"def get_feature_of_class(index, class_name)\r\n get_features = []\r\n features_of_class = @training_data[class_name]\r\n\r\n features_of_class.length.times do |i|\r\n get_features << features_of_class[i][index]\r\n end\r\n\r\n return get_features\r\n end",
"def get_point_order\n order = Array.new(@feature.length)\n @feature.each_with_index.sort_by(&:first).each_with_index { |f_and_index, i| order[f_and_index[1]] = i }\n order\n end",
"def getFt \n kword = ARGV[1]\n seq = @gbkObj.to_biosequence\n seqoptions = \"\" \n for c in 2..ARGV.length-1\n seqoptions += \"#{ARGV[c]},\"\n end\n # look through all features\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n gene = []\n product = []\n protId = \"\"\n if (!ftH[\"gene\"].nil? && ftH[\"gene\"][0].downcase.include?(kword.downcase)) or\n (!ftH[\"product\"].nil? && ftH[\"product\"][0].downcase.include?(kword.downcase))\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n position = \"c#{position}\"\n end\n pep = Bio::Sequence.new(fasta.translate)\n gene = ftH[\"gene\"][0] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"][0] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n if seqoptions.downcase.include?(\"pep\") or seqoptions.downcase.include?(\"prot\")\n puts pep.output_fasta(\"#{@accession}|#{position}|#{protId}|#{locustag}|#{gene}|#{product}\", 60)\n else\n dna = Bio::Sequence.auto(fasta)\n puts dna.output_fasta(\"#{@accession}|#{position}|#{protId}|#{locustag}|#{gene}|#{product}\",60)\n end\n end\n end\n end",
"def feature_objects\r\n states\r\n end",
"def get_required_features(features)\n end",
"def ftoc(f)\n c = (f - 32.0) * 5.0 / 9.0\nend",
"def encode_data(fdf); end",
"def fei\n\n @dict.fexp.fei\n end",
"def feature_columns\n ensure_full_data!\n Array(@gapi_json[:featureColumns]).map do |field_gapi_json|\n field_gapi = Google::Apis::BigqueryV2::StandardSqlField.from_json field_gapi_json.to_json\n StandardSql::Field.from_gapi field_gapi\n end\n end",
"def test_from_flame_setup\n fixture = File.open(File.dirname(__FILE__) + '/Flame_Smk2013_SubpixSample.stabilizer')\n t = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a[0]\n first_kf = t[0]\n assert_in_delta 0.5, first_kf.abs_x, DELTA\n assert_in_delta 0.5, first_kf.abs_y, DELTA\n end",
"def to_gtfs\n gtfs_feed_row = {}\n return gtfs_feed_row if self.class.gtfs_cols.nil?\n #rehash to gtfs feed\n self.class.gtfs_cols.each do |model_attr,feed_col|\n #call send because virt. attr can only be accessed like that\n col_value = self.send(model_attr)\n col_value = col_value.to_gtfs if (col_value.is_a?(Date) || col_value.is_a?(Time))\n gtfs_feed_row[feed_col] = col_value\n end\n self.after_to_gtfs(gtfs_feed_row)\n end",
"def add_zero_feature(features)\n features.map { |f| f.clone.unshift 1 }\n end",
"def settings(row,column); det.table(:index, 11)[row][column]; end",
"def flistf\n return $fframes.to_a\nend",
"def pos_fseg_header\n pos_index_header + size_index_header\n end",
"def all_features\r\n feature_objects.inject([]) {|r, obj| r + obj.features }\r\n end",
"def sen_ratg(row,column); det.table(:index, 13)[row][column]; end",
"def tf_idf\n tf_idf = tf.clone\n \n tf.each_with_index do |document, index|\n document.each_pair do |term, tf_score|\n tf_idf[index][term] = tf_score * idf[term]\n end\n end\n \n tf_idf\n end",
"def tf_idf\n tf_idf = tf.map(&:clone)\n\n tf.each_with_index do |document, index|\n document.each_pair do |term, tf_score|\n tf_idf[index][term] = tf_score * idf[term]\n end\n end\n\n tf_idf\n end",
"def ta_index\n end",
"def statistics_of_features(index)\r\n features_of_class = @dataset.collect{|d| d[index]}\r\n\r\n #statistical properties of the feature set\r\n f_std = features_of_class.standard_deviation\r\n f_mean = features_of_class.mean\r\n f_min = features_of_class.min\r\n f_max = features_of_class.max\r\n #f_var = features_of_class.variance \r\n\r\n return [f_min, f_max, f_mean, f_std]\r\n end",
"def ast\n feature(get_result) unless @feature\n @feature\n end",
"def tf_idf\n tf.each do |tf_k, tf_v|\n idf_v = idf[tf_k]\n tfidf[tf_k] = bigdecimal(tf_v * idf_v)\n end\n tfidf\n end",
"def index\n @featureds = Featured.all\n end",
"def features(code)\r\n all_features.select {|ft| ft.code == code }\r\n end",
"def get_statistics_of_features\r\n return @statistics if not @statistics.nil?\r\n\r\n # Statistics of features (min, max, mean, sd)\r\n @statistics = []\r\n\r\n count_features.times do |i|\r\n f_min, f_max, f_mean, f_std = statistics_of_features(i)\r\n\r\n @statistics[i] = [f_min, f_max, f_mean, f_std]\r\n end\r\n\r\n @statistics\r\n end",
"def band_structure\n freq_lines = @raw_data.scan(/freqs:, (.*)/).join \"\\n\"\n CSV.parse(freq_lines, :converters => :numeric).map do |nums|\n ::MEEP::KPoint.new nums[1..3], nums[4..-1]\n end\n end",
"def tf_idf(set_idf=nil)\n tf_idf = tf.map(&:clone)\n # idfを設定\n use_idf = set_idf.nil? ? idf : set_idf\n\n tf.each_with_index do |document, index|\n document.each_pair do |term, tf_score|\n \t# 構造がハッシュの配列であるため\n tf_idf[index][term] = tf_score * use_idf[term] unless use_idf[term].nil?\n end\n end\n \n tf_idf\n end",
"def display_features\n puts\n puts \"Features:\"\n @features.each { |feature| puts \" * #{feature}\"}\n puts\n end",
"def table; end",
"def table; end",
"def table; end",
"def table; end",
"def test_get_larger_feature_vect()\n feature_v = [\"percent_normal_cells\", \n \"percent_stromal_cells\", \n \"percent_tumor_cells\",\n \"percent_lymphocyte_infiltration\",\n \"vital_status\",\n \"death_days_to\",\n \"last_contact_days_to\", \n \"tumor_status\",\n \"ajcc_tumor_pathologic_pt\",\n \"ajcc_nodes_pathologic_pn\", \n \"ajcc_metastasis_pathologic_pm\", \n \"ajcc_pathologic_tumor_stage\"\n ]\n \n rs = ClinicalTCGA::RetrieveSamples.new([\"TCGA-QG-A5YW\", \"TCGA-A6-2676\"],\n feature_v,\n false)\n rs.add_all_sources(\"#{ENV['TCGA_CLINICAL_TEST_DATA']}/Biotab/\", false) # suppress progress bar for unit test\n \n h = Hash.new\n rs.get_feature_vector{|sample,fV| h[sample] = fV}\n \n assert_equal(h[\"TCGA-QG-A5YW\"][0], 10.0, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-A6-2676\"][0], 2.5, \"not expected value at index 0\")\n assert_equal(h[\"TCGA-QG-A5YW\"][-2],nil, \"not expected value at index -2\")\n assert_equal(h[\"TCGA-A6-2676\"][-2],\"M0\", \"not expected value at index -2\")\n end",
"def table_info(start,_end,col,idx,ws,fw=nil)\n # iterate through all rows and columns\n while (start <= _end)\n j = 1\n while (j <= col)\n case j\n when 1\n if fw == 1\n parameter = param_firmwrweb(idx,start,j).text\n else\n parameter = param_descr(idx,start,j).text\n end\n ws.Range(\"bc#{start+1}\")['Value'] = parameter\n when 2\n if fw == 1\n description = param_firmwrweb(idx,start,j).text\n else\n description = param_descr(idx,start,j).text\n end\n ws.Range(\"bd#{start+1}\")['Value'] = description\n end\n j += 1\n end\n start += 1\n end\n end",
"def ft( *args )\n form.ft( *args )\n end",
"def parse_sqft\n end",
"def parse_sqft\n end",
"def featurize(doc)\n frag = nil\n doc.frags.each do |frag|\n get_features(frag, self)\n end\n end",
"def getFt \n kword = ARGV[1]\n seq = @gb.to_biosequence\n seqoptions = \"\"\n\n for c in 2..ARGV.length-1\n seqoptions += \"#{ARGV[c]},\"\n end\n \n # look through all features\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n gene = []\n product = []\n if (!ftH[\"gene\"].nil? && ftH[\"gene\"][0].downcase.include?(kword.downcase)) or\n (!ftH[\"product\"].nil? && ftH[\"product\"][0].downcase.include?(kword.downcase)) \n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n position = \"c#{position}\"\n end\n pep = Bio::Sequence.new(fasta.translate)\n gene = ftH[\"gene\"][0] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"][0] if !ftH[\"product\"].nil?\n if seqoptions.downcase.include?(\"pep\") or seqoptions.downcase.include?(\"prot\")\n puts pep.output_fasta(\"#{@accession}|#{position}|#{ftH[\"protein_id\"][0]}|#{gene}|#{product}|#{@org}\", 60)\n else\n dna = Bio::Sequence.auto(fasta)\n puts dna.output_fasta(\"#{@accession}|#{position}|#{ftH[\"protein_id\"][0]}|#{gene}|#{product}|#{@org}\",60)\n end\n end\n end\nend",
"def features_set(code)\r\n features(code).inject([]) {|r, ft| r |= [ft.data_id] }\r\n end",
"def featurize(doc)\n frag = nil\n doc.frags.each do |frag|\n get_features(frag, self)\n end\n end",
"def status(row,param); det.table(:index, 9)[row][param]; end",
"def max_tb_rangeF; @max_sf; end",
"def f0\n fr(0)\n end",
"def processor_features\n data[:processor_features]\n end",
"def list_features *args\r\n puts \"not implemented yet\"\r\n end",
"def parse_font_table(src, current_pos)\n group = 1\n\n font = nil\n in_extra = nil\n\n while (true)\n case(src[current_pos])\n when '{' then\n font = RubyRTF::Font.new if group == 1\n in_extra = nil\n\n group += 1\n\n when '}' then\n group -= 1\n\n if group <= 1\n break if font.nil?\n font.cleanup_names\n @doc.font_table[font.number] = font\n end\n\n in_extra = nil\n\n break if group == 0\n\n when '\\\\' then\n ctrl, val, current_pos = parse_control(src, current_pos + 1)\n\n font = RubyRTF::Font.new if font.nil?\n\n case(ctrl)\n when :f then font.number = val\n when :fprq then font.pitch = val\n when :fcharset then font.character_set = val\n when *[:flomajor, :fhimajor, :fdbmajor, :fbimajor,\n :flominor, :fhiminor, :fdbminor, :fbiminor] then\n font.theme = ctrl.to_s[1..-1].to_sym\n\n when *[:falt, :fname, :panose] then in_extra = ctrl\n else\n cmd = ctrl.to_s[1..-1].to_sym\n if RubyRTF::Font::FAMILIES.include?(cmd)\n font.family_command = cmd\n end\n end\n\n # need to next as parse_control will leave current_pos at the\n # next character already so current_pos += 1 below would move us too far\n next\n when *[\"\\r\", \"\\n\"] then ;\n else\n case(in_extra)\n when :falt then font.alternate_name << src[current_pos]\n when :panose then font.panose << src[current_pos]\n when :fname then font.non_tagged_name << src[current_pos]\n when nil then font.name << src[current_pos]\n end\n end\n current_pos += 1\n end\n\n current_pos\n end",
"def feature_matrix(m=nil)\n m||=@m\n if @use_gsl\n omega_m=GSL::Matrix.zeros(@n_variables,m)\n ev=eigenvectors\n m.times do |i|\n omega_m.set_column(i,ev[i])\n end\n omega_m\n else\n omega_m=::Matrix.build(@n_variables, m) {0}\n m.times do |i|\n omega_m.column= i, @eigenpairs[i][1]\n end\n omega_m\n end\n end",
"def tableau index_tableau\n tableaux_in(resultat_final)[index_tableau]\n end",
"def generate_control_flow_count_feature\n control_flow_count_feature = Array.new(@indexes.length, 0) \n @indexes.each_with_index do |index, i|\n hash = JSON.parse(IO.read(@feature_dir + \"/control_flow/#{index.to_s}.json\"))\n control_flow_count_feature[i] = hash.values.reduce(0) { |accum, i| accum + i}\n end\n write_column_feature_to_file control_flow_count_feature, \"control_flow_count_feature.np\"\n end",
"def index\n @tariffs = Tariff.all\n\n connection = ActiveRecord::Base.connection\n quantitative = []\n categorical = []\n values = []\n Tariff.first.properties.each do |k,v|\n if v.is_a? String\n r1 = connection.select_all(\"SELECT properties->>'\" + k + \"' AS property FROM tariffs\").rows\n categorical << r1 if r1.uniq.length > 1\n else\n r2 = connection.select_all(\"SELECT properties->>'\" + k + \"' AS property FROM tariffs\").rows.flatten\n values << r2.collect{|s| s.to_i}\n quantitative << k\n end\n end\n\n temp = categorical.flatten.uniq\n rows = sequence(temp.length)\n\n @header = temp # | quantitative\n @rows = rows # | values\n\n # @test = values\n\n #data_set = Daru::DataFrame.from_csv \"logistic_mle.csv\"\n #glm = Statsample::GLM.compute data_set, :y, :logistic, {constant: 1, algorithm: :mle}\n\n # Options hash specifying addition of an extra constants\n # vector all of whose values is '1' and also specifying\n # that the MLE algorithm is to be used.\n\n #@test = glm.coefficients\n #=> [0.3270, 0.8147, -0.4031,-5.3658]\n #puts glm.standard_error\n #=> [0.4390, 0.4270, 0.3819,1.9045]\n #puts glm.log_likelihood\n\n\n #p sequence(3) #=>[[0, 0, 0], [0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]]\n end",
"def feature(name)\n features[name]\n end",
"def ftoc(temp)\n return (temp-32)*5/9\nend",
"def feature_set\n @inventory.features(self)\n end",
"def features_simple_real_modular(A=matrix)\n \n\nend",
"def next_tab\n @tab_stops.sort.each do |stop|\n if @col < stop\n return stop\n end\n end\n\n return @cols\n end",
"def features_set(code)\n features(code).inject([]) {|r, ft| r |= [ft.data_id] }\n end"
] | [
"0.61235964",
"0.5868039",
"0.57629263",
"0.56796837",
"0.5657534",
"0.56091475",
"0.5516785",
"0.5509059",
"0.54901123",
"0.5474284",
"0.5414695",
"0.5407043",
"0.540361",
"0.5379998",
"0.536345",
"0.53607684",
"0.53455347",
"0.53439337",
"0.5325341",
"0.53070337",
"0.5306609",
"0.52964586",
"0.52592325",
"0.5240809",
"0.52258223",
"0.5161262",
"0.5153365",
"0.5147517",
"0.5142928",
"0.51322186",
"0.5112084",
"0.5111259",
"0.51026434",
"0.51022243",
"0.5086579",
"0.507533",
"0.50610876",
"0.5059227",
"0.5056326",
"0.50422454",
"0.5034347",
"0.5032054",
"0.50280714",
"0.5025886",
"0.5024735",
"0.49974972",
"0.4991521",
"0.4983596",
"0.4973955",
"0.49616292",
"0.49526525",
"0.49295723",
"0.49266648",
"0.49141085",
"0.4911818",
"0.49092352",
"0.490796",
"0.48981622",
"0.4897899",
"0.48929694",
"0.48928955",
"0.48789927",
"0.48771057",
"0.48689273",
"0.48675445",
"0.48615435",
"0.48557022",
"0.4852157",
"0.48459062",
"0.4845242",
"0.48266283",
"0.48183846",
"0.48183846",
"0.48183846",
"0.48183846",
"0.48127174",
"0.4812538",
"0.4805978",
"0.48011166",
"0.48011166",
"0.47900584",
"0.47866943",
"0.47733718",
"0.4771869",
"0.4771304",
"0.4769938",
"0.47665855",
"0.475941",
"0.4756049",
"0.47511765",
"0.47424087",
"0.474115",
"0.47395834",
"0.47352895",
"0.4731847",
"0.473175",
"0.4731354",
"0.47272462",
"0.47266376",
"0.47156587"
] | 0.54810774 | 9 |
CP Cell specificity (positive) | def cp
field_fetch('CP')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x_in_cell?\n\n end",
"def o_in_cell?\n\n end",
"def can_take_value(cell_r,cell_c,num)\n\treturn num_in_row(cell_r, num) && num_in_col(cell_c, num) && num_in_region(cell_r - (cell_r % $n), cell_c - (cell_c % $n), num)\nend",
"def evaluate_cell(board)\n\t\tfind_neighbors(board)\n\t\tunder_population(board)\n\t\tovercrowding(board)\n\t\tzombify(board)\n\tend",
"def number_empty_cells_in_own_cube_column\n return 1\n end",
"def can_have_cells?\n definition['cells'].present?\n end",
"def count_valid_cell(row, col)\n if row == -1 || row == grid.row_count\n 0\n elsif col == -1 || col == grid.column_count\n 0\n elsif !grid[row, col]\n 0\n else\n 1\n end\n end",
"def unlabeled?() @positive.nil? end",
"def condition(cells)\n if cells[0][0]==cells[0][4] and cells[0][4]==cells[0][8] and cells[0][0]!=' '\n return 1\n elsif cells[1][0]==cells[1][4] and cells[1][4]==cells[1][8] and cells[1][4]!=' '\n return 1\n elsif cells[2][0]==cells[2][4] and cells[2][4]==cells[2][8] and cells[2][0]!=' '\n return 1\n elsif cells[0][0]==cells[1][4] and cells[1][4]==cells[2][8] and cells[0][0]!=' '\n return 1\n elsif cells[2][0]==cells[1][4] and cells[1][4]==cells[0][8] and cells[2][0]!=' '\n return 1\n elsif cells[0][0]==cells[1][0] and cells[1][0]==cells[2][0] and cells[0][0]!=' '\n return 1\n elsif cells[0][4]==cells[1][4] and cells[1][4]==cells[2][4] and cells[0][4]!=' '\n return 1\n elsif cells[0][8]==cells[1][8] and cells[1][8]==cells[2][8] and cells[0][8]!=' '\n return 1\n else\n return 0\n end\nend",
"def getTier(colIndex,rowIndex)\r\n if (colIndex > @columns-1 || colIndex < 0 || rowIndex > @rows-1 || rowIndex < 0)\r\n return 0 #Checks if the tile is in the bounds of the grid.\r\n else\r\n return @tile[colIndex][rowIndex].tier\r\n end\r\nend",
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def positive?\n @colt_property.isPositive(@colt_matrix)\n end",
"def test_that_cell_status_changes_when_hit\n c = Cell.new\n assert_equal(\"missed\", c.if_hit())\n end",
"def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end",
"def ismn; end",
"def check_cell_status(x_coord, y_coord)\n\t\treturn @state[x_coord][y_coord].content\n\tend",
"def empty_cell?(position)\n case @signs[position[0].to_i-1][position[1].to_i-1]\n when \"x \" \n return false\n when \"o \" \n return false\n else return true\n end\n end",
"def case_occupied?(row, column)\n @cases[row][column].played?\n end",
"def canAfford?(cost, character)\n return cost <= character.gp\n end",
"def num_in_region(cell_r, cell_c, num)\n\t(0..2).each do |row|\n\t\t(0..2).each do |col|\n\t\t\tif $value_grid[row+cell_r][col+cell_c].to_i == num\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\treturn true\nend",
"def newCellState(cellIndex, cellScore)\n newCellState = 0\n cellScore == 2 || cellScore == 3 && @board[cellIndex] ? newCellState = 1 : newCellState = 0\n if cellScore == 3 && @board[cellIndex] == 0\n newCellState = 1\n end\n return newCellState;\n end",
"def non_negative?\n @colt_property.isNonNegative(@colt_matrix)\n end",
"def celebrity; end",
"def celebrity; end",
"def set?(point, how=:over)\n @cells[point] & (how == :over ? 1 : 2) != 0\n end",
"def ordinary?\n\t\t\t@weight == 1\n\t\tend",
"def is_colrow?(); @type == GRT_COLROW; end",
"def new_cells\n self.cells.select {|x| !x.is_identical}\n end",
"def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end",
"def taken?(cells = @cells, location)\n @cells[location.to_i - 1] == \"X\" || @cells[location.to_i - 1] == \"O\"\n end",
"def internal_check(row, col)\n \n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n values\n \n end",
"def fate(cell)\n if cell.living \n if cell.neighbors < 2\n return -1\n elsif cell.neighbors == 2 || cell.neighbors == 3\n return 0\n else\n return -1\n end\n else # cell is not living\n if cell.neighbors == 3\n return 1\n else\n return -1\n end \n end\n end",
"def percolates?\n end",
"def active_cells; @cells.select(&:active?) end",
"def assign_or_cover(matrix)\n\t\t\trows = @size.times.to_a\n\t\t\tcols = @size.times.to_a\n\t\t\tcoordinates = []\n\t\t\trows_cover = []\n\t\t\tcols_cover = []\n\n\t\t\t# Temporary assignment\n\t\t\t# Also find blocks possible to assign.\n\t\t\tclassify = Hash.new{|hash, key| hash[key] = []}\n\t\t\tloop do\n\t\t\t\tassigned = false\n\n\t\t\t\t# Find zeros in each row\n\t\t\t\tclassify.clear\n\t\t\t\trows.dup.each do |i|\n\t\t\t\t\trow = matrix[i]\n\t\t\t\t\tzero_cols = cols.map {|j| row[j].zero?? j : nil}.compact\n\n\t\t\t\t\tcase zero_cols.size\n\t\t\t\t\twhen 0\n\t\t\t\t\t\trows_cover += rows.select do |i2|\n\t\t\t\t\t\t\tcols.map {|j| matrix[i2][j]}.include?(0)\n\t\t\t\t\t\tend\n\t\t\t\t\t\treturn nil, [rows_cover, cols_cover]\n\t\t\t\t\twhen 1\n\t\t\t\t\t\tj = zero_cols.first\n\t\t\t\t\t\trows.delete(i)\n\t\t\t\t\t\tcols.delete(j)\n\t\t\t\t\t\tcoordinates << [i, j]\n\t\t\t\t\t\tcols_cover << j\n\t\t\t\t\t\tassigned = true\n\t\t\t\t\telse\n\t\t\t\t\t\tclassify[zero_cols] << i\n\t\t\t\t\t\tif zero_cols.size <= classify[zero_cols].size\n\t\t\t\t\t\t\tzero_cols.zip(classify[zero_cols]) do |jj, ii|\n\t\t\t\t\t\t\t\trows.delete(ii)\n\t\t\t\t\t\t\t\tcols.delete(jj)\n\t\t\t\t\t\t\t\tcoordinates << [ii, jj]\n\t\t\t\t\t\t\t\tcols_cover << jj\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tassigned = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Find zeros in each col\n\t\t\t\tclassify.clear\n\t\t\t\tcols.dup.each do |j|\n\t\t\t\t\tzero_rows = rows.map {|i| matrix[i][j].zero?? i : nil}.compact\n\n\t\t\t\t\tcase zero_rows.size\n\t\t\t\t\twhen 0\n\t\t\t\t\t\tcols_cover += cols.select do |j2|\n\t\t\t\t\t\t\trows.map {|i| matrix[i][j2]}.include?(0)\n\t\t\t\t\t\tend\n\t\t\t\t\t\treturn nil, [rows_cover, cols_cover]\n\t\t\t\t\twhen 1\n\t\t\t\t\t\ti = zero_rows.first\n\t\t\t\t\t\trows.delete(i)\n\t\t\t\t\t\tcols.delete(j)\n\t\t\t\t\t\tcoordinates << [i, j]\n\t\t\t\t\t\trows_cover << i\n\t\t\t\t\t\tassigned = true\n\t\t\t\t\telse\n\t\t\t\t\t\tclassify[zero_rows] << j\n\t\t\t\t\t\tif zero_rows.size <= classify[zero_rows].size\n\t\t\t\t\t\t\tzero_rows.zip(classify[zero_rows]) do |ii, jj|\n\t\t\t\t\t\t\t\trows.delete(ii)\n\t\t\t\t\t\t\t\tcols.delete(jj)\n\t\t\t\t\t\t\t\tcoordinates << [ii, jj]\n\t\t\t\t\t\t\t\trows_cover << ii\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tassigned = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbreak unless assigned\n\t\t\tend\n\n\t\t\treturn coordinates, nil if rows.empty?\n\n\t\t\t# Try to completely assign\n\t\t\tsub_coordinates = assign(matrix, rows, cols)\n\t\t\t@assign_cache.clear\n\t\t\treturn coordinates + sub_coordinates, nil if sub_coordinates\n\n\t\t\t# Cover zeros by rows and cols\n\t\t\tr_cover, c_cover = cover(matrix, rows, cols)\n\t\t\treturn nil, [rows_cover + r_cover, cols_cover + c_cover]\n\t\tend",
"def cardinal; end",
"def score_cells!(entropy=nil)\n lambda_pos = @metadata[\"LambdaPositions\"]\n if lambda_pos.empty?\n lambda_pos = @metadata[\"LiftPositions\"]\n end\n\n heatmap = (@metadata[\"HeatMap\"] ||= {})\n\n @cells.each do |row|\n row.each do |cell|\n min_distance = lambda_pos.map {|x, y| (cell.x - x).abs + (cell.y - y).abs }.min\n current = heatmap[[cell.x, cell.y]]\n value = cell.get_heatmap_value(current, min_distance)\n value += (rand(entropy + 2) - entropy - 1) if entropy\n heatmap[[cell.x, cell.y]] = value\n end\n end\n end",
"def check_defaults\n if board.cells[4]\n rand < 0.51 ? possible_position(&:even?) : possible_position(&:odd?)\n else\n 5\n end\n end",
"def live_or_die(pos_x, pos_y)\n cell_neighbours = neighbours(pos_x, pos_y)\n\n case cell_neighbours\n when 0, 1 then return 0\n when 2\n return 1 if cell(pos_x, pos_y) == 1\n when 3 then return 1\n when cell_neighbours > 3 then return 0\n end\n\n 0\n end",
"def cell_flagger(row_num, col_num)\n\t\t@grid[row_num][col_num].flagger\n\tend",
"def actual_cells\n @cells.compact\n end",
"def contains_mine?(row, col)\n false\n end",
"def contains_mine?(row, col)\n false\n end",
"def threshold_emp\n return (1-(1/(1+0.5*@number_of_emp_ships)))\n end",
"def ==(cell)\n if @x == cell.x && @y == cell.y then\n true;\n else\n false;\n end\n end",
"def tie(cells)\n flag=0\n for i in 0..2 do\n for j in 0..2 do\n if cells[i][4*j]=='X' or cells[i][4*j]=='O'\n flag=flag+1\n end\n end\n end\n\n if flag==9 \n return 1\n else \n return 0\n end\nend",
"def possible_cell_solution(x, y)\n negation_solution(x, y) ||\n possibilities_minus_exclusions_solution(x, y) ||\n distant_neighbor_negations_solution(x, y)\n end",
"def covered?; end",
"def restriction_commutative?\n ! (partition_left_tautology? && partition_right_tautology?)\n end",
"def empty_cell?(grid, r, c)\n r < 0 || c < 0 || r >= grid.size || c >= grid[0].size || grid[r][c] == 0\nend",
"def apply_rules (x, y, cells_alive, new_generation)\n if ( (@current_generation[x][y] == 0 ) && (cells_alive == 3) ) #if cell is dead and number of cells alive is 3\n new_generation[x][y] = 1 #the cell revives for next generation\n elsif @current_generation[x][y] == 1 #else if cell is alive check the next conditions\n if cells_alive < 2 #if cells alive is greater than 2\n new_generation[x][y] = 0 #then the cell dies in the next generation \n elsif (cells_alive == 2) || (cells_alive == 3) #if there are 2 or 3 living cells surrounding\n new_generation[x][y] = 1 #then the cell lives on in the next generation\n elsif cells_alive > 3 #if cells alive is greater than 3 \n new_generation = 0 #cell dies in the next generation from overpopulation\n end\n end\n end",
"def cell_cleared?(row, col)\n if @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end",
"def fortress_status\n return false if fortress_cells.blank?\n return true\n end",
"def cell_alive?(column, row)\n @cell_state[(row % ROWS) * ROWS + (column % COLUMNS)] > 0\n end",
"def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end",
"def contains_mine?(row, col)\n grid[row][col].fill == 1\n end",
"def celltype(row,col,sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula[sheet][[row,col]]\n return :formula\n else\n @cell_type[sheet][[row,col]]\n end\n end",
"def consistent?\n ret = true\n # Check every row first\n @board.each_row do |row|\n row_numbers = Set.new\n row.each do |cell|\n n = cell.number\n if n and row_numbers.include? n\n ret = false\n end\n row_numbers << n\n end\n end\n # Check every column\n @board.each_column do |col|\n col_numbers = Set.new\n col.each do |cell|\n n = cell.number\n if n and col_numbers.include? n\n ret = false\n end\n col_numbers << n\n end\n end\n # Check every region\n @board.each_region do |reg|\n reg_numbers = Set.new\n reg.each do |cell|\n n = cell.number\n if n and reg_numbers.include? n\n ret = false\n end\n reg_numbers << n\n end\n end\n return ret\n end",
"def neighbor_mines_count\n neighbor_cells.count(&:mine?)\n end",
"def cell_cleared?(row, col)\n grid[row][col].uncovered\n\n end",
"def is_fixed?\n self.assignment_type_id == 2\n end",
"def block_perimeter\n\t\t(0..width).each do |i| \n\t\t\t@cells[i][0].type \t\t\t\t= Cell::BLOCKED\n\t\t\t@cells[i][height].type \t= Cell::BLOCKED\n\t\tend\n\t\t(0..height).each do |j| \n\t\t\t@cells[0][j].type \t\t\t\t= Cell::BLOCKED\n\t\t\t@cells[width][j].type \t= Cell::BLOCKED\n\t\tend\n\tend",
"def full?(cells = @cells)\n cells.all?{|taken| taken == \"X\" || taken == \"O\"}\n end",
"def test_live_cell_with_no_neighbors_dies\n refute @life.will_live?(true, 0)\n end",
"def cop_rule?; end",
"def victory?\n # Loop over all Nx1 lines in the board\n [*@board, *columns, *diagonals].each do |line|\n return :x if line.all?(:x)\n return :o if line.all?(:o)\n end\n\n false\n end",
"def suitable_for_any?\n \treturn self.disciplines.count > 0\n end",
"def only_cell_method\n @groups.each(&:only_cell_method)\n end",
"def full?\n cells.all?{|c| c == \"X\" || c == \"O\"}\n end",
"def regular?\n square? and rank == column_size\n end",
"def contains_mine?(row, col)\n @field[row][col].mined\n end",
"def primshape?(x)\n x.range1d? || x.range2d?\nend",
"def celltype(row, col, sheet = default_sheet)\n read_cells(sheet)\n row, col = normalize(row, col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end",
"def aceite\n 'N'\n end",
"def contains_mine?(row, col)\n @mines[row][col]\n end",
"def nonzero?; end",
"def give_cell_status\n cell = get_cell\n cell_status(cell)\n end",
"def contains_mine?(row, col)\n @value_grid[[row, col]][:mine]\n end",
"def evolved_cell_state(cell_x, cell_y)\n current_state = grid[cell_y][cell_x]\n neighbours_count, dominant_color = cell_neighbours(cell_x, cell_y)\n\n if !current_state && neighbours_count == 3\n dominant_color\n elsif neighbours_count < 2 || neighbours_count > 3\n nil\n else\n current_state\n end\n end",
"def full?\n self.cells.all? {|cell| cell == \"X\" || cell == \"O\"}\n end",
"def is_under_attack?(row = @row, col = @col)\n hypothetical_board = @board.get_copy\n hypothetical_board.move(@row, @col, row, col)\n enemy_color = ChessGame.get_enemy_color(@color)\n hypothetical_board.each_piece.any? do |piece|\n not piece.is_blank_space? and piece.color == enemy_color and\n ((piece.get_type != :king and piece.get_moves.include?({ row: row, col: col })) or\n (piece.get_type == :king and piece.get_adjacent_spaces.include?({ row: row, col: col })))\n end\n end",
"def candidate?(col, row)\n !visited?(col, row) && @blocks[row][col] == @tlc\n end",
"def maybe_promote\n if @color == :black && @position[0] == 0\n @king = true\n elsif @color == :red && @position[0] == 7\n @king = true\n end\n end",
"def min_c_cell\n @min_c_cell ||= Matrices::Cell.new(c.min_index)\n end",
"def label() @positive end",
"def notify_flagged(cell); end",
"def nonzero?() end",
"def valid_conc?(op, range)\n op.input_array(\"Input Array\").each do |field_value|\n conc = field_value.part.get(\"Stock Conc (ng/ul)\".to_sym)\n return false unless range.cover?(conc)\n end\n true\nend",
"def categorize_cell(cdscell, category)\r\n\r\n Category.where.not(name: category.name).each do |cat|\r\n #Only run if the cell is not tagged\r\n cdscell = category.cdscells.find_by(name: \"uncategorized\")\r\n if !cdscell\r\n user.tag(cdscell, :with => \"uncategorized\", :on => :categories)\r\n end\r\n end\r\n \r\n end",
"def special?\n return data.atk_class == 2\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def isValidMove(row, col)\n \treturn isValidMoveForDisc(row, col, @disc)\n end",
"def block_perimeter\n (0..width).each do |i|\n @cells[i][0].type = Cell::BLOCKED\n @cells[i][height].type = Cell::BLOCKED\n end\n (0..height).each do |j|\n @cells[0][j].type = Cell::BLOCKED\n @cells[width][j].type = Cell::BLOCKED\n end\n end",
"def coast_guard_rank; end",
"def cell_cleared?(row, col)\n !@field[row][col].covered\n end",
"def contact_with_ground?\n \n end",
"def full?\n @cells.all? do |mark|\n mark == 'X' || mark == 'O'\n end\n end",
"def neighAbove(cur_row,cur_col)\n if cur_row == 0\n return 0\n else\n neighbor_cell = getCell(cur_row-1,cur_col)\n if(neighbor_cell.living == true)\n return 1\n else\n return 0\n end\n end # end if statement\n\n end",
"def should_come_alive?(row, column)\n # Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\n @num_live_neighbors_by_dead_cells[[row, column]] == 3\n end",
"def can_occupy_cell?(pos=false)\n # p pos\n # # byebug\n return false if pos[0] < 0 || pos[0] >= @grid.length\n return false if pos[1] < 0 || pos[1] >= @grid[0].length\n empty?(pos)\n # return false if (pos[0] >= @grid.length || pos[1] >= @grid.length)\n # return true if pos && @grid[pos[0]][pos[1]] != nil\n # false\n end",
"def touched_a_mine?\n self.grid.flatten.any?{ |cell| cell.visible && cell.mine }\n end"
] | [
"0.57638335",
"0.56965137",
"0.5602215",
"0.55586374",
"0.54644156",
"0.54150444",
"0.53387165",
"0.5316762",
"0.53050476",
"0.5286818",
"0.5269541",
"0.52595824",
"0.522739",
"0.5225966",
"0.52237",
"0.51916325",
"0.51887417",
"0.51882714",
"0.5166894",
"0.51664805",
"0.51558924",
"0.5143341",
"0.5136492",
"0.5136492",
"0.5133678",
"0.5118488",
"0.51120794",
"0.509768",
"0.50974673",
"0.5095655",
"0.50956285",
"0.5094607",
"0.5094056",
"0.50733036",
"0.50721836",
"0.5068672",
"0.50481015",
"0.50215083",
"0.501713",
"0.5010394",
"0.5001687",
"0.49992794",
"0.49992794",
"0.49971905",
"0.49826327",
"0.49799117",
"0.4979521",
"0.49785268",
"0.4978032",
"0.49663103",
"0.49629754",
"0.49623072",
"0.4962141",
"0.4954251",
"0.4951127",
"0.49478835",
"0.49444285",
"0.49444172",
"0.49371523",
"0.49215537",
"0.49150547",
"0.4912428",
"0.4908522",
"0.48999116",
"0.4899604",
"0.48983654",
"0.489771",
"0.48976395",
"0.48948845",
"0.48932093",
"0.48903164",
"0.48851028",
"0.48763093",
"0.48749766",
"0.4866597",
"0.48637396",
"0.48623684",
"0.48557866",
"0.48519862",
"0.4850483",
"0.48494247",
"0.48471674",
"0.48445308",
"0.48410496",
"0.4840681",
"0.4837514",
"0.48373467",
"0.4830752",
"0.48284397",
"0.482567",
"0.482536",
"0.482536",
"0.48248932",
"0.48211077",
"0.48176947",
"0.48164383",
"0.48101166",
"0.4807359",
"0.48058417",
"0.4802047",
"0.47975165"
] | 0.0 | -1 |
CN Cell specificity (negative) | def cn
field_fetch('CN')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_negative?\n @colt_property.isNonNegative(@colt_matrix)\n end",
"def celebrity; end",
"def celebrity; end",
"def unlabeled?() @positive.nil? end",
"def number_empty_cells_in_own_cube_column\n return 1\n end",
"def valid_nbors board, dims, pos\n nbors( pos, dims ).reject {|i| is_wall(board, i[:node])}\nend",
"def restrict_neighbours()\n\t# The grid starts out with values already. \n\t# Need to change the domain_grid to reflect the neighbours that can't \n\t# be certain values due to starting values\n\n\t$domain_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tval = $value_grid[index_r][index_c]\n\t\t\t\n\t\t\tif val != 0 \n\t\t\t\tremove_from_neighbours(index_r,index_c,val)\n\t\t\tend\n\t\tend\n\tend\nend",
"def unassigned_cells\n grid.cells.to_a.reject { |cell| cell.value }\n end",
"def invalid_cell?(pos)\n pos[0] < 0 || pos[1] < 0 || pos[0] > MAXX || pos[1] > MAXY\n end",
"def unblocked_cells(options = {})\n cells.select {|c, v| v.empty? || v.content == 'R' || v.content == 'C' }\n end",
"def fate(cell)\n if cell.living \n if cell.neighbors < 2\n return -1\n elsif cell.neighbors == 2 || cell.neighbors == 3\n return 0\n else\n return -1\n end\n else # cell is not living\n if cell.neighbors == 3\n return 1\n else\n return -1\n end \n end\n end",
"def cardinal; end",
"def possible_cell_solution(x, y)\n negation_solution(x, y) ||\n possibilities_minus_exclusions_solution(x, y) ||\n distant_neighbor_negations_solution(x, y)\n end",
"def new_apnf_rules_for_negated_implication\n end",
"def negative?; end",
"def get_misclass(data, weights)\n # Take data and remove any Sample which are correctly classified\n data.reject do |point|\n point.calc_class(weights) == point.classification\n end\nend",
"def evolved_cell_state(cell_x, cell_y)\n current_state = grid[cell_y][cell_x]\n neighbours_count, dominant_color = cell_neighbours(cell_x, cell_y)\n\n if !current_state && neighbours_count == 3\n dominant_color\n elsif neighbours_count < 2 || neighbours_count > 3\n nil\n else\n current_state\n end\n end",
"def count_valid_cell(row, col)\n if row == -1 || row == grid.row_count\n 0\n elsif col == -1 || col == grid.column_count\n 0\n elsif !grid[row, col]\n 0\n else\n 1\n end\n end",
"def map_tile_nocavern(tile)\n (-1..1).all? { |dx| (-1..1).all? { |dy|\n next if not t = tile.offset(dx, dy)\n tm = t.tilemat\n if !t.designation.hidden\n t.designation.flow_size < 4 and tm != :FROZEN_LIQUID\n else\n t.shape_basic == :Wall and (tm == :STONE or tm == :MINERAL or tm == :SOIL or tm == :ROOT)\n end\n } }\n end",
"def ismn; end",
"def cost\r\n\t\[email protected]_cost.class != NaN\r\n\tend",
"def aceite\n 'N'\n end",
"def positive?\n @colt_property.isPositive(@colt_matrix)\n end",
"def no_learn\n 8\n end",
"def negation_solution(x, y)\n negation_value(coords_of_square_neighbors(x, y), x, y) ||\n negation_value(coords_of_row_neighbors(x, y), x, y) ||\n negation_value(coords_of_column_neighbors(x, y), x, y)\n end",
"def tick!\n @cells.each do |cell|\n if cell.neighbors.count < 2\n cell.die!\n end\n end\n end",
"def masking?; false; end",
"def celebration; end",
"def test_live_cell_with_no_neighbors_dies\n refute @life.will_live?(true, 0)\n end",
"def getTier(colIndex,rowIndex)\r\n if (colIndex > @columns-1 || colIndex < 0 || rowIndex > @rows-1 || rowIndex < 0)\r\n return 0 #Checks if the tile is in the bounds of the grid.\r\n else\r\n return @tile[colIndex][rowIndex].tier\r\n end\r\nend",
"def empty_cell?(grid, r, c)\n r < 0 || c < 0 || r >= grid.size || c >= grid[0].size || grid[r][c] == 0\nend",
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def generate_non_singular!\n @colt_property.generateNonSingular(@colt_matrix)\n end",
"def categorize_cell(cdscell, category)\r\n\r\n Category.where.not(name: category.name).each do |cat|\r\n #Only run if the cell is not tagged\r\n cdscell = category.cdscells.find_by(name: \"uncategorized\")\r\n if !cdscell\r\n user.tag(cdscell, :with => \"uncategorized\", :on => :categories)\r\n end\r\n end\r\n \r\n end",
"def opposite_style_detected; end",
"def opposite_style_detected; end",
"def opposite_style_detected; end",
"def cell_cleared?(row, col)\n grid[row][col].uncovered\n\n end",
"def attacking_diagonal?\n false\n end",
"def test_for_cell_out_of_range\n grid = Grid.new\n grid.set_cell(0,1, true)\n\n assert_equal 0, grid.neighbours(11,30) #How to raise an exception?\n\n end",
"def assign_or_cover(matrix)\n\t\t\trows = @size.times.to_a\n\t\t\tcols = @size.times.to_a\n\t\t\tcoordinates = []\n\t\t\trows_cover = []\n\t\t\tcols_cover = []\n\n\t\t\t# Temporary assignment\n\t\t\t# Also find blocks possible to assign.\n\t\t\tclassify = Hash.new{|hash, key| hash[key] = []}\n\t\t\tloop do\n\t\t\t\tassigned = false\n\n\t\t\t\t# Find zeros in each row\n\t\t\t\tclassify.clear\n\t\t\t\trows.dup.each do |i|\n\t\t\t\t\trow = matrix[i]\n\t\t\t\t\tzero_cols = cols.map {|j| row[j].zero?? j : nil}.compact\n\n\t\t\t\t\tcase zero_cols.size\n\t\t\t\t\twhen 0\n\t\t\t\t\t\trows_cover += rows.select do |i2|\n\t\t\t\t\t\t\tcols.map {|j| matrix[i2][j]}.include?(0)\n\t\t\t\t\t\tend\n\t\t\t\t\t\treturn nil, [rows_cover, cols_cover]\n\t\t\t\t\twhen 1\n\t\t\t\t\t\tj = zero_cols.first\n\t\t\t\t\t\trows.delete(i)\n\t\t\t\t\t\tcols.delete(j)\n\t\t\t\t\t\tcoordinates << [i, j]\n\t\t\t\t\t\tcols_cover << j\n\t\t\t\t\t\tassigned = true\n\t\t\t\t\telse\n\t\t\t\t\t\tclassify[zero_cols] << i\n\t\t\t\t\t\tif zero_cols.size <= classify[zero_cols].size\n\t\t\t\t\t\t\tzero_cols.zip(classify[zero_cols]) do |jj, ii|\n\t\t\t\t\t\t\t\trows.delete(ii)\n\t\t\t\t\t\t\t\tcols.delete(jj)\n\t\t\t\t\t\t\t\tcoordinates << [ii, jj]\n\t\t\t\t\t\t\t\tcols_cover << jj\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tassigned = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Find zeros in each col\n\t\t\t\tclassify.clear\n\t\t\t\tcols.dup.each do |j|\n\t\t\t\t\tzero_rows = rows.map {|i| matrix[i][j].zero?? i : nil}.compact\n\n\t\t\t\t\tcase zero_rows.size\n\t\t\t\t\twhen 0\n\t\t\t\t\t\tcols_cover += cols.select do |j2|\n\t\t\t\t\t\t\trows.map {|i| matrix[i][j2]}.include?(0)\n\t\t\t\t\t\tend\n\t\t\t\t\t\treturn nil, [rows_cover, cols_cover]\n\t\t\t\t\twhen 1\n\t\t\t\t\t\ti = zero_rows.first\n\t\t\t\t\t\trows.delete(i)\n\t\t\t\t\t\tcols.delete(j)\n\t\t\t\t\t\tcoordinates << [i, j]\n\t\t\t\t\t\trows_cover << i\n\t\t\t\t\t\tassigned = true\n\t\t\t\t\telse\n\t\t\t\t\t\tclassify[zero_rows] << j\n\t\t\t\t\t\tif zero_rows.size <= classify[zero_rows].size\n\t\t\t\t\t\t\tzero_rows.zip(classify[zero_rows]) do |ii, jj|\n\t\t\t\t\t\t\t\trows.delete(ii)\n\t\t\t\t\t\t\t\tcols.delete(jj)\n\t\t\t\t\t\t\t\tcoordinates << [ii, jj]\n\t\t\t\t\t\t\t\trows_cover << ii\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tassigned = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tbreak unless assigned\n\t\t\tend\n\n\t\t\treturn coordinates, nil if rows.empty?\n\n\t\t\t# Try to completely assign\n\t\t\tsub_coordinates = assign(matrix, rows, cols)\n\t\t\t@assign_cache.clear\n\t\t\treturn coordinates + sub_coordinates, nil if sub_coordinates\n\n\t\t\t# Cover zeros by rows and cols\n\t\t\tr_cover, c_cover = cover(matrix, rows, cols)\n\t\t\treturn nil, [rows_cover + r_cover, cols_cover + c_cover]\n\t\tend",
"def nonzero?() end",
"def nonzero?; end",
"def allowed_numbers\n allowed = @board.map { |n| n.nil? ? 511 : 0 }\n coordinate_systems.each do |c|\n (0..8).each do |x|\n bits = axis_missing(x, c)\n (0..8).each { |y| allowed[index_for(x, y, c)] &= bits }\n end\n end\n allowed\n end",
"def C\n @nb\n end",
"def C\n @nb\n end",
"def x_in_cell?\n\n end",
"def negative?() @positive==false end",
"def only_cell_method\n @groups.each(&:only_cell_method)\n end",
"def is_dimensionless?\n @index == 0\n end",
"def evaluate_cell(board)\n\t\tfind_neighbors(board)\n\t\tunder_population(board)\n\t\tovercrowding(board)\n\t\tzombify(board)\n\tend",
"def cell_cleared?(row, col)\n if @mine_field[:cover][col][row] == true\n return true\n else\n return false\n end\n end",
"def negate!\n negate self\n end",
"def negate?\n @negate\n end",
"def new_cells\n self.cells.select {|x| !x.is_identical}\n end",
"def cell_cleared?(row, col)\n !@field[row][col].covered\n end",
"def coloring(connections)\n @n = connections.length\n\n for i in 0..@n-1 do\n for j in 0..@n-1 do\n if i != j and connections[i][j] > 0 then\n self[i].must_not == self[j]\n end\n end\n end\n \n end",
"def negate?\n @negate\n end",
"def scoreExclusivity\n covered = 0\n xor = 0\n colSums.each{|sum|\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n return xor.to_f/covered.to_f\n end",
"def included_in_cost\n false\n end",
"def can_take_value(cell_r,cell_c,num)\n\treturn num_in_row(cell_r, num) && num_in_col(cell_c, num) && num_in_region(cell_r - (cell_r % $n), cell_c - (cell_c % $n), num)\nend",
"def nonuniformcellarray(x, y, dimx, dimy, color)\n raise ArgumentError unless x.length == dimx + 1 && y.length == dimy + 1\n\n nx = dimx == x.length ? -dimx : dimx\n ny = dimy == y.length ? -dimy : dimy\n super(x, y, nx, ny, 1, 1, dimx, dimy, int(color))\n end",
"def cellular_data_blocked\n return @cellular_data_blocked\n end",
"def allowed(index)\n bits = 511\n coordinate_systems.each do |c|\n axis_index = first_axis_index(index)\n bits &= axis_missing(axis_index, c)\n end\n bits\n end",
"def cell_flagger(row_num, col_num)\n\t\t@grid[row_num][col_num].flagger\n\tend",
"def ordinary?\n\t\t\t@weight == 1\n\t\tend",
"def can_clear? ( x, y )\n !self[x][y].visible && \n !self[x][y].mine && \n self[x][y].nearby_mines == 0\n end",
"def live_or_die(pos_x, pos_y)\n cell_neighbours = neighbours(pos_x, pos_y)\n\n case cell_neighbours\n when 0, 1 then return 0\n when 2\n return 1 if cell(pos_x, pos_y) == 1\n when 3 then return 1\n when cell_neighbours > 3 then return 0\n end\n\n 0\n end",
"def find_single_hidden\n before = self.entropy\n reduce_hidden_single_line\n reduce_hidden_single_col\n reduce_hidden_single_grid\n reduce_solved if before > self.entropy\n end",
"def masking?; true; end",
"def no_scale_mask?\n end",
"def negation\n \"not\" if negate?\n end",
"def label() @positive end",
"def bce(n)\n return -n\n end",
"def negation\n attr_val('./@inversionInd') == \"true\"\n end",
"def negate\n scale(-1.0)\n end",
"def cluster_netmask(opts)\n opts = check_params(opts,[:cluster_ips])\n super(opts)\n end",
"def neighbor_mines_count\n neighbor_cells.count(&:mine?)\n end",
"def actual_cells\n @cells.compact\n end",
"def empty_cell?(position)\n case @signs[position[0].to_i-1][position[1].to_i-1]\n when \"x \" \n return false\n when \"o \" \n return false\n else return true\n end\n end",
"def nil_check\n @health ||= MAX_HEALTH\n # @direction ||= :left\n # @left_covered ||= 0\n # @right_covered ||= 0\n # may need to add a pivot left here in the future\n end",
"def cell_cleared?(row, col)\n @grid[row][col].uncovered\n end",
"def coast_guard_rank; end",
"def newCellState(cellIndex, cellScore)\n newCellState = 0\n cellScore == 2 || cellScore == 3 && @board[cellIndex] ? newCellState = 1 : newCellState = 0\n if cellScore == 3 && @board[cellIndex] == 0\n newCellState = 1\n end\n return newCellState;\n end",
"def life_in_cell row_index, col_index\n row_index = 0 if row_index == @size\n col_index = 0 if col_index == @size\n row_index = @size-1 if row_index == -1\n col_index = @size-1 if col_index == -1\n return @universe[row_index][col_index] || 0\n end",
"def get_other_col_cells cell\n\t\treturn get_col_cells(get_col cell) - [cell]\n\tend",
"def nonpositive?\n return self <= 0\n end",
"def garbage?\n return self.cluster_targeting_id == \"garbage\"\n end",
"def garbage?\n return self.cluster_targeting_id == \"garbage\"\n end",
"def nonuniformcellarray(x, y, dimx, dimy, color)\n raise ArgumentError unless x.length == dimx + 1 && y.length == dimy + 1\n\n super(x, y, dimx, dimy, 1, 1, dimx, dimy, int(color))\n end",
"def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"def no_negatives?\n @sides.all? { |side| side > 0 }\n end",
"def feature_category_not_owned!\n worker_attributes[:feature_category] = :not_owned\n end",
"def cac2\n 0\n end",
"def winner_mark\n check_columns ||\n check_rows ||\n check_left_diagonal ||\n check_right_diagonal\n end",
"def not_x\n x = @x.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = (x[i] == 1) ? 0 : 1 } \n\n @z.content = z\n end",
"def is_accessible?(x, y)\n cell = @matrix[x, y]\n cell.type != Cell::TYPES[:wall]\n end",
"def random_open_nonedge_cell\n open_cells.reject {|c, v| [1,6].include?(v.x) || [1,6].include?(v.y) }.keys.shuffle.first\n end",
"def o_in_cell?\n\n end",
"def min_cost?\n false\n end",
"def critical_nodes\n select do |node|\n node.critical?\n end\n end"
] | [
"0.60779554",
"0.5708832",
"0.5708832",
"0.5673291",
"0.56141615",
"0.5582083",
"0.53284425",
"0.5319189",
"0.5275769",
"0.5272517",
"0.5267791",
"0.5251485",
"0.52413523",
"0.52410424",
"0.52369595",
"0.5232148",
"0.52172387",
"0.52024025",
"0.5173192",
"0.5159704",
"0.51532423",
"0.51482385",
"0.51297593",
"0.5125678",
"0.5125412",
"0.5120391",
"0.5112503",
"0.5108733",
"0.50919306",
"0.508052",
"0.50775707",
"0.5071705",
"0.50398374",
"0.50366944",
"0.5022646",
"0.5022646",
"0.5022646",
"0.5017607",
"0.50030476",
"0.5002185",
"0.49990544",
"0.4992925",
"0.49853277",
"0.49814385",
"0.49812585",
"0.49812585",
"0.49707115",
"0.49687162",
"0.49607265",
"0.49460563",
"0.49440518",
"0.49322778",
"0.49302518",
"0.49273634",
"0.49264956",
"0.49250144",
"0.4924386",
"0.49168697",
"0.49163377",
"0.49113762",
"0.4910879",
"0.48989198",
"0.48912412",
"0.48867083",
"0.48834684",
"0.4880061",
"0.4878467",
"0.4875661",
"0.4869873",
"0.4866426",
"0.4856819",
"0.48568174",
"0.4847689",
"0.4846488",
"0.4845844",
"0.4842279",
"0.48399723",
"0.48388645",
"0.4838281",
"0.48298842",
"0.48152158",
"0.4814688",
"0.48129633",
"0.48119405",
"0.48102683",
"0.4808665",
"0.47996676",
"0.4785609",
"0.4785609",
"0.47855204",
"0.47850436",
"0.47767773",
"0.47763073",
"0.47729903",
"0.4772375",
"0.47685722",
"0.4767615",
"0.47658703",
"0.4761101",
"0.47592282",
"0.47529516"
] | 0.0 | -1 |
IN Interacting factors (factor accession no.; factor name; IN biological species.) | def in
field_fetch('IN')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concept_influences\n find_related_frbr_objects( :is_influenced_by, :which_concepts?) \n end",
"def concept_influences\n find_related_frbr_objects( :is_influenced_by, :which_concepts?) \n end",
"def incode\n sector && unit && [sector, unit].join\n end",
"def int_in\n [\"Women\", \"Men\", \"Women and Men\"][self.interested_in - 1]\n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def number_of_concept_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_concepts?) \n end",
"def count_factors\n factors.count\n end",
"def genera_incertae_sedis_in\n Genus.incertae_sedis_in_family\n end",
"def incf(f,cat)\n @fc[f] ||= {}\n @fc[f][cat] ||= 0\n @fc[f][cat] += 1\n end",
"def superwork_influences\n find_related_frbr_objects( :is_influenced_by, :which_superworks?) \n end",
"def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend",
"def known_identities; end",
"def current_diagnoses\n self.encounters.current.all(:include => [:observations]).map{|encounter| \n encounter.observations.active.all(\n :conditions => [\"obs.concept_id = ? OR obs.concept_id = ?\", \n ConceptName.find_by_name(\"OUTPATIENT DIAGNOSIS\").concept_id,\n ConceptName.find_by_name(\"OUTPATIENT DIAGNOSIS, NON-CODED\").concept_id])\n }.flatten.compact\n end",
"def instance_name(i)\n if i.is_a?(ActiveFacts::Metamodel::Fact)\n fact = i\n reading = fact.fact_type.preferred_reading\n reading_roles = reading.role_sequence.all_role_ref.sort_by{|rr| rr.ordinal}.map{|rr| rr.role }\n role_values_in_reading_order = fact.all_role_value.sort_by{|rv| reading_roles.index(rv.role) }\n instance_verbalisations = role_values_in_reading_order.map do |rv|\n next nil unless v = rv.instance.value\n render_value(v)\n end\n return reading.expand([], false, instance_verbalisations)\n # REVISIT: Include the instance_names of all role players\n end\n\n if i.object_type.is_a?(ActiveFacts::Metamodel::ValueType)\n return \"#{i.object_type.name} #{render_value(i.value)}\"\n end\n\n if i.object_type.fact_type # An instance of an objectified fact type\n return \"#{i.object_type.name} where #{instance_name(i.fact)}\"\n end\n\n # It's an entity that's not an objectified fact type\n # REVISIT: If it has a simple identifier, there's no need to fully verbalise the identifying facts\n pi = i.object_type.preferred_identifier\n identifying_role_refs = pi.role_sequence.all_role_ref.sort_by{|rr| rr.ordinal}\n return \"#{i.object_type.name}\" +\n \" is identified by \" +\n identifying_role_refs.map do |rr|\n [ (l = rr.leading_adjective) ? l+\"-\" : nil,\n rr.role.role_name || rr.role.object_type.name,\n (t = rr.trailing_adjective) ? l+\"-\" : nil\n ].compact*\"\"\n end * \" and \" +\n \" where \" +\n identifying_role_refs.map do |rr| # Go through the identifying roles and emit the facts that define them\n instance_role = i.object_type.all_role.detect{|r| r.fact_type == rr.role.fact_type}\n identifying_fact = i.all_role_value.detect{|rv| rv.fact.fact_type == rr.role.fact_type}.fact\n #counterpart_role = (rr.role.fact_type.all_role.to_a-[instance_role])[0]\n #identifying_instance = counterpart_role.all_role_value.detect{|rv| rv.fact == identifying_fact}.instance\n instance_name(identifying_fact)\n end*\", \"\n end",
"def prime_factors\n return self.prime_factorization.uniq\n end",
"def number_of_superwork_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_superworks?) \n end",
"def set_infraction\n @infraction = Infraction.find(params[:id])\n end",
"def alien_species\n # 2. for those Colonies, get the information about the species\n self.colonies.map do |colony_instance|\n colony_instance.alien_species\n end\n end",
"def _lex_indicies; end",
"def _lex_indicies; end",
"def _lex_indicies; end",
"def _lex_indicies; end",
"def infection \n\n return @extra_infection + @patient.infection\n\n end",
"def prime_factorization_to_factors(factorization)\n\tif factorization.empty?\n\t\t[1]\n\telse\n\t\tprime_factor, multiplicity = factorization[0]\n\t\tfactors = prime_factorization_to_factors(factorization.drop(1))\n\t\tmultiplicity_array = Array.new(multiplicity + 1) { |i| prime_factor ** i }\n\t\tfactors.map { |factor| multiplicity_array.map { |multiple| multiple * factor } }.flatten\n\tend\nend",
"def number_of_influences_these_works(login=nil)\n count_by_frbr(login, :is_an_influence_on, :how_many_works?) \n end",
"def guardian_factors\n get(guardian_factors_path)\n end",
"def faculty?\n\t\tmember_of.downcase.include? \"faculty\"\n\tend",
"def enumerate( char )\n raise \"An illegal character (\" + char + \") was entered!\" unless RomanNumeral.equivalents.has_key?(char)\n RomanNumeral.equivalents[char]\n end",
"def is_lichen?\n lifeform.include?(\"lichen\")\n end",
"def set_fac_code_terms\n FAC_CODE_TERMS.each_pair do |c, v|\n # self[c] = (issue =~ Regexp.new(v, true)).nil? ? 0 : 1\n self[c] = Complaint.match(v, issue) ? 1 : 0\n end\n end",
"def medir_indicador_res_tipo_3(idacs, mind, fini, ffin)\n datosint = []\n mujeres = asistencia_por_sexo(\n idacs, Msip::Persona::convecion_sexo[:sexo_femenino], false)\n hombres = asistencia_por_sexo(\n idacs, Msip::Persona::convecion_sexo[:sexo_masculino], false)\n sinsexo = asistencia_por_sexo(\n idacs, Msip::Persona::convecion_sexo[:sexo_sininformacion], false)\n resind = mujeres.count + hombres.count + sinsexo.count\n datosint << { valor: mujeres.count, rutaevidencia: \"#\" }\n datosint << { valor: hombres.count, rutaevidencia: \"#\" }\n datosint << { valor: sinsexo.count, rutaevidencia: \"#\" }\n if datosint[0][:valor] > 0 # mujeres\n datosint[0][:rutaevidencia] = msip.personas_path + \"?filtro[busid]=\" +\n mujeres.join(\",\")\n end\n if datosint[1][:valor] > 0 # hombres\n datosint[1][:rutaevidencia] = msip.personas_path +\n \"?filtro[busid]=\" + hombres.join(\",\")\n end\n if datosint[2][:valor] > 0 # sin sexo nac\n datosint[2][:rutaevidencia] = msip.personas_path +\n \"?filtro[busid]=\" + sinsexo.join(\",\")\n end\n\n { resind: resind, datosint: datosint }\n end",
"def accidentals(input) # Integer or symbol\n key_name = get_key_name(input)\n circle_of_fifths = [:Gb,:Cs,:Ab,:Eb,:Bb,:F,:C,:G,:D,:A,:E,:B,:Fs]\n idx = circle_of_fifths.index(key_name)\n idx-6\n end",
"def icla?\n @icla || ICLA.availids.include?(name)\n end",
"def mat_index_vein\n v = vein\n v.inorganic_mat if v\n end",
"def select_inicia_ABC(names)\n imp= names.count{|contar|contar if contar[0] =='A'|| contar[0] =='B'|| contar[0] =='C'} \n print \"La cantidad de nombres en que inician con A,B o C es #{imp} \\n\"\nend",
"def number_of_work_influences(login=nil)\n count_by_frbr(login, :is_influenced_by, :how_many_works?) \n end",
"def identifier_code\n 'ICN'\n end",
"def mechanics\n Mechanic.all.select{|mechanic|mechanic.specialty == self.classification}\n end",
"def invention; end",
"def imei; end",
"def ident_viol_candidates?\n @ident_viol_candidates\n end",
"def number_of_improvisors(login=nil)\n count_by_frbr(login, :is_improvised_by, :how_many_roles?) \n end",
"def number_of_improvisors(login=nil)\n count_by_frbr(login, :is_improvised_by, :how_many_roles?) \n end",
"def proper_divisors\n self.factors << 1\n end",
"def if_ins(i,spl); end",
"def initialize(state_territory=5, ilf_factor=6)\n @state_territory, @ilf_factor = state_territory, ilf_factor # internal instance variablesj\n end",
"def electromechanical; end",
"def indoors?\n @info.indoors\n end",
"def igual (mat)\n end",
"def biodiversity_index(specimens)\n species = Hash.new(0)\n specimens.each do |specimen|\n species[specimen] += 1\n end\n return ((species.size)**2)*(species.values.max / species.values.min)\nend",
"def significance_factor ingredients\n size_of_intersection = (ingredients[0] & ingredients[1]).length\n total = (ingredients[0].length + ingredients[1].length - size_of_intersection)\n size_of_intersection.to_f/total\n end",
"def incc(cat)\n @cc[cat] ||= 0\n @cc[cat] += 1\n end",
"def indicators\n INDICATORS\nend",
"def info(inf = '1110')\n infarray = []\n infarray.push(\"ID-#{@user_id}\") unless inf[0].to_i.zero?\n infarray.push(\"ФИО-#{@usr_fio.values.join(' ')}\") unless inf[1].to_i.zero?\n infarray.push(\"Rate-#{rate}\") unless inf[2].to_i.zero?\n infarray.push(\"Occupation-#{occupation}\") unless inf[3].to_i.zero?\n infarray.compact.join(' ').to_s\n end",
"def identifier_value\n user.icn\n end",
"def in_law; end",
"def custom_authentication_factors\n return @custom_authentication_factors\n end",
"def biome; end",
"def parse_factor()\n\t\tcase @next_token[0]\n\t\t\twhen /\\d+/ #factor\n\t\t\t\tputs \"Integer Hit.\"\n\t\t\t\tadvance()\n\t\t\t\ttrue\n\t\t\twhen \"EOF\" #CAF End of file!\n\t\t\t\tputs \"End of File Hit!\"\n\t\t\t\tfalse\n\t\t\twhen /[a-zA-Z]+[\\w]*/ \n\t\t\t\tputs \"Identifier Hit.\"\n\t\t\t\tadvance()\n\t\t\t\ttrue\n\t\t\twhen \"(\"\n\t\t\t\tputs \"Open Paren Hit.\"\n\t\t\t\tadvance()\n\t\t\t\tif parse_expr()\n\t\t\t\t\tif next_TokenGrabbed(\")\")\n\t\t\t\t\tputs \"Close Paren Hit.\"\n\t\t\t\t\t\ttrue\n\t\t\t\t\telse\n\t\t\t\t\t\tfalse\n\t\t\t\t\tend\n\t\t\t\telse \n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\tend\n\tend",
"def work_influences\n find_related_frbr_objects( :is_influenced_by, :which_works?) \n end",
"def custom_authentication_factors=(value)\n @custom_authentication_factors = value\n end",
"def instability_index\n @instability_index ||=\n begin\n instability_sum = 0.0\n i = 0\n while @seq[i+1] != nil\n aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym]\n if DIWV.key?(aa) && DIWV[aa].key?(next_aa)\n instability_sum += DIWV[aa][next_aa]\n end\n i += 1\n end\n round((10.0/amino_acid_number.to_f) * instability_sum, 2)\n end\n end",
"def lifters\n # binding.pry\n memberships.map { |membership| membership.lifter }.uniq\n end",
"def medicinal_uses\n self.object.medicinal_uses.map{|mu| mu.name}.join(', ')\n end",
"def factor eot\r\n eot.ajd = Date.parse(\"2000-01-01\").jd \r\n tlaa = eot.tl_Aries()\r\n eot.ajd = eot.ajd + 1\r\n tlab = eot.tl_Aries()\r\n dif = (tlab - tlaa) * Eot::R2D \r\n f1 = dif / 360.0 + 1 \r\n 1 / f1\r\nend",
"def persons\n if self.infos.sex == \"Couple\"\n 2\n else\n 1\n end\n end",
"def mutual_factors(*nums)\n all_factors = Hash.new\n nums.each { |num| all_factors[num] = find_factors(num) }\n all_factors.values[0].intersection(*all_factors.values[1..-1])\nend",
"def insurance_fields\n [\n :pension_personal,\n :unemployment_personal,\n :medical_personal,\n :house_accumulation_personal,\n\n :pension_company,\n :unemployment_company,\n :medical_company,\n :injury_company,\n :birth_company,\n :house_accumulation_company\n ]\n end",
"def medir_indicador_res_tipo_6(idacs, mind, fini, ffin)\n r = 0\n if idacs && idacs.count > 0\n puts \"idacs=#{idacs.inspect}\"\n r = Cor1440Gen::Actividad.connection.execute(\n \"SELECT COUNT(DISTINCT orgsocial_id) \"\\\n \"FROM cor1440_gen_actividad_orgsocial \"\\\n \"WHERE actividad_id IN (#{idacs.join(\",\")})\",\n ).count\n end\n { resind: r, datosint: [] }\n end",
"def input_of_fossil_carriers\n fetch(:input_of_fossil_carriers) do\n input_of_coal +\n input_of_crude_oil +\n input_of_natural_gas +\n input_of_diesel +\n input_of_gasoline\n end\n end",
"def acting_for_self\r\n self.names &&\r\n self.names.count == 1 &&\r\n self.names[0] == enactor_name\r\n end",
"def FT_IS_NAMED_INSTANCE(face)\n face.face_index & 0x7FFF0000\n end",
"def number_of_superwork_evidences(login=nil)\n count_by_frbr(login, :is_evidence_of, :how_many_superworks?) \n end",
"def factoring_enabled\n [\n self.CustomerProfileNo == VISMA_CONFIG['factoring_customer_profile_number'],\n self.FormProfileCustNo == VISMA_CONFIG['factoring_form_profile_number'],\n self.RemittanceProfileNo == VISMA_CONFIG['factoring_remittance_profile_number'],\n self.CustomerNo == self.FactCustomerNo.to_i\n ].all?\n end",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend",
"def risk_factors_to_levels\n {\n mcas_math_risk_level: mcas_math_risk_level,\n star_math_risk_level: star_math_risk_level,\n mcas_ela_risk_level: mcas_ela_risk_level,\n star_reading_risk_level: star_reading_risk_level,\n limited_english_proficiency_risk_level: limited_english_proficiency_risk_level\n }\n end",
"def risk_factors_to_levels\n {\n mcas_math_risk_level: mcas_math_risk_level,\n star_math_risk_level: star_math_risk_level,\n mcas_ela_risk_level: mcas_ela_risk_level,\n star_reading_risk_level: star_reading_risk_level,\n limited_english_proficiency_risk_level: limited_english_proficiency_risk_level\n }\n end",
"def biodiversity_index(specimens)\n uniques = specimens.uniq\n species_count = {}\n\n specimens.each do |species|\n species_count[species] = specimens.count(species)\n end\n\n calculate_index(uniques, species_count)\nend",
"def find_factors(num)\n\t# type here\n\t# change return\n\treturn false\nend",
"def print_factoids\n factoid_input = gets.strip.downcase\n\n case factoid_input\n when \"most\"\n puts \"The country/countries with the most cases are: \".light_magenta\n CovidTracking::CountrySummary.most_cases\n when \"least\"\n puts \"The country/countries with the least cases are: \".light_magenta\n CovidTracking::CountrySummary.least_cases\n when \"most new\"\n puts \"The country/countries with the most new cases are: \".light_magenta\n CovidTracking::CountrySummary.most_new_cases\n when \"most recovered\"\n puts \"The country/countries with the most recovered cases are: \".light_magenta\n CovidTracking::CountrySummary.most_recovered_cases\n else\n puts \"I didn't understand that command.\".red\n sleep(1)\n end\n end",
"def colonies\n # look at the single src of truth for the colonies\n Colony.all.select do |colony_instance|\n # pick the ones that belong to me\n colony_instance.alien_species == self\n end\n end",
"def iin(pan)\n \t\tpan[0..5]\n \tend",
"def species\n # taxonomy sentence:\n # TODO: this assumes perfect coverage of A1 and A2 for all species, which is a bad idea. Have contingencies.\n what = a1\n family = a2\n species_parts = []\n\n if match = growth_habit_matches.by_type(:x_species)\n species_parts << trait_sentence_part(\n \"#{name_clause} is \"\\\n \"#{a_or_an(match.trait[:object_term][:name])} %s \"\\\n \"species of #{what}\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:species_of_x)\n species_parts << trait_sentence_part(\n \"#{name_clause} is a species of %s\",\n match.trait\n )\n else\n species_parts << \"#{name_clause} is a species of #{what}\"\n end\n\n if family\n species_parts << \" in the family #{a2}\"\n end\n\n if match = growth_habit_matches.by_type(:and_a_x)\n species_parts << trait_sentence_part(\n \", and #{a_or_an(match.trait[:object_term][:name])} %s\",\n match.trait\n )\n elsif match = growth_habit_matches.by_type(:x_growth_habit)\n species_parts << trait_sentence_part(\n \", with #{a_or_an(match.trait[:object_term][:name])} %s growth habit\",\n match.trait\n )\n end\n\n species_parts << \".\"\n @sentences << species_parts.join(\"\")\n\n if is_it_extinct?\n term_sentence(\"This species is %s.\", \"extinct\", Eol::Uris.extinction, Eol::Uris.extinct)\n elsif @page.iucn_status_key && IucnKeys.include?(@page.iucn_status_key.to_sym)\n handle_iucn @page.iucn_status_key.to_sym\n end\n\n # If the species [is extinct], insert an extinction status sentence between the taxonomy sentence\n # and the distribution sentence. extinction status sentence: This species is extinct.\n\n # If the species [is marine], insert an environment sentence between the taxonomy sentence and the distribution\n # sentence. environment sentence: \"It is marine.\" If the species is both marine and extinct, insert both the\n # extinction status sentence and the environment sentence, with the extinction status sentence first.\n term_sentence(\"It is found in %s.\", \"marine habitat\", Eol::Uris.environment, Eol::Uris.marine) if is_it_marine?\n\n # Distribution sentence: It is found in [G1].\n @sentences << \"It is found in #{g1}.\" if g1\n end",
"def lifters\n memberships.map{|membership|\n membership.lifter\n }\n end",
"def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end",
"def in_feat_corr_of_uf(uf_feat_inst)\n @corr_router.in_feat_corr_of_uf(uf_feat_inst)\n end",
"def prime_factors(num)\n facs = factors(num)\n p_facs = []\n facs.each{|n| p_facs.push(n) if prime?(n)}\n p_facs\nend",
"def list_factors(n)\r\n m = 0\r\n #even\r\n if (n % 2 == 0)\r\n for i in 1..n\r\n if (n%i == 0)\r\n m+=1\r\n end\r\n end\r\n #odd\r\n else\r\n for i in (1..n).step(2) do\r\n if (n%i == 0)\r\n m+=1\r\n end\r\n end\r\n end \r\n return m\r\nend",
"def associated_involvement_types\n\t\tCashBank::InvolvementType.all(:conditions => [\"is_debit = ?\",is_debit])\n\tend",
"def number_of_exhibitors(login=nil)\n count_by_frbr(login, :is_exhibited_by, :how_many_roles?) \n end",
"def intensifier; end",
"def unit_citizens\n world.units.active.find_all { |u| \n unit_iscitizen(u)\n }\n end",
"def prime_factors(n)\n return factors(n) & primes(n)\nend",
"def prime_factors (n)\n return factors(n) & primes(n)\nend",
"def in\n\t\t@in\n\tend",
"def print_factoids_options\n puts \"Available factoids are: \".light_magenta\n puts \" Country/countries with the MOST cases\".light_red\n puts \" Country/countries with the LEAST cases\".light_red\n puts \" Country/countries with the MOST NEW cases\".light_red\n puts \" Country/countries with the MOST RECOVERED cases\".light_red\n puts \"Which factoid would you like to see?\".light_magenta\n puts \"Please enter MOST, LEAST, MOST NEW, or MOST RECOVERED\".green\n end",
"def enable_factoring\n self.CustomerProfileNo = VISMA_CONFIG['factoring_customer_profile_number']\n self.FormProfileCustNo = VISMA_CONFIG['factoring_form_profile_number']\n self.RemittanceProfileNo = VISMA_CONFIG['factoring_remittance_profile_number']\n self.FactCustomerNo = self.CustomerNo.to_s\n end"
] | [
"0.53414404",
"0.53414404",
"0.5323444",
"0.530009",
"0.52645695",
"0.52645695",
"0.5184923",
"0.50860536",
"0.50489855",
"0.50379145",
"0.49221203",
"0.4906715",
"0.48363715",
"0.48269582",
"0.4817923",
"0.4801826",
"0.47944573",
"0.47849238",
"0.47837734",
"0.47837734",
"0.47837734",
"0.47837734",
"0.47694588",
"0.47606528",
"0.4738574",
"0.47381413",
"0.47122765",
"0.46987042",
"0.46907598",
"0.46894053",
"0.46849647",
"0.46772498",
"0.46689737",
"0.46640992",
"0.4663406",
"0.46608955",
"0.4655261",
"0.46433684",
"0.46426857",
"0.4640825",
"0.46309176",
"0.46272698",
"0.46272698",
"0.46217257",
"0.4613388",
"0.4610708",
"0.46073103",
"0.45925367",
"0.4564661",
"0.4562848",
"0.455127",
"0.45418835",
"0.45388362",
"0.45378163",
"0.4529621",
"0.45278388",
"0.45261168",
"0.45220417",
"0.45201245",
"0.45030293",
"0.45014516",
"0.44993842",
"0.4492887",
"0.44914043",
"0.4475178",
"0.44690084",
"0.4467302",
"0.4463412",
"0.44630653",
"0.44532007",
"0.44519258",
"0.44428873",
"0.44404173",
"0.44399583",
"0.44182175",
"0.44182175",
"0.44182175",
"0.44178268",
"0.4415813",
"0.4415813",
"0.44119337",
"0.44034997",
"0.43948358",
"0.43925196",
"0.43826646",
"0.43825167",
"0.4382137",
"0.43799204",
"0.43762815",
"0.43733373",
"0.43702435",
"0.43657583",
"0.43650797",
"0.4364116",
"0.43631524",
"0.435893",
"0.43513688",
"0.43505472",
"0.4346477",
"0.43461978"
] | 0.47195792 | 26 |
MX Matrix (matrix accession no.; matrix identifier) | def mx
field_fetch('MX')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix\n end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def matz; end",
"def get_matrix\n matrix = SnekMath::Matrix.new(area[0].length, area.length, 'empty')\n area.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n matrix.set(x, y, cell)\n end\n end\n matrix\n end",
"def matrix_of(parse_result)\n\t\tif parse_result.nil? || parse_result.empty?\n\t\t\treturn Matrix.I(3)\n\t\tend\n\t\t\n#\t\tp parse_result # debug\n\t\t\n\t\tmatrix = (parse_result.map { |key_values|\n\t\t\t@_matrix_factory.create(key_values)\n\t\t}).reduce(:*)\n\t\t\n#\t\tp matrix # debug\n\t\t\n\t\tmatrix\n\tend",
"def component_matrix(m=nil)\n if m!=@m or @clean\n iterate(m)\n end\n @component_matrix\n end",
"def get_data_matrix(data_matrix = DATAMATRIX_KEY)\n Matrix.rows(@map[data_matrix])\n end",
"def mat_index\n mat_index_vein or stone_layer.mat_index\n end",
"def matrix(arg); return Matrix::new(arg); end",
"def mat_info\n MaterialInfo.new(0, mat_index)\n end",
"def __write_matrix(name, mx, dict)\n __write_with_log(name) do |io| \n i = -1\n mx.each_value do |v|\n io.puts \"result__[#{i += 1}] = #{v.subs(dict)};\"\n end\n end\n end",
"def exercise_1113 (matrix)\n end",
"def feature_matrix(m=nil)\n m||=@m\n if @use_gsl\n omega_m=GSL::Matrix.zeros(@n_variables,m)\n ev=eigenvectors\n m.times do |i|\n omega_m.set_column(i,ev[i])\n end\n omega_m\n else\n omega_m=::Matrix.build(@n_variables, m) {0}\n m.times do |i|\n omega_m.column= i, @eigenpairs[i][1]\n end\n omega_m\n end\n end",
"def [](i)\r\n\t\t@m_Matrix[i]\r\n\tend",
"def createMatrix()\n #matriks = Matrix.new\n @matriks_data = Matrix.zero(@jumlah_node)\n for i in 0..@jumlah_node-1\n for j in 0..@jumlah_node-1\n @matriks_data[i,j] = @file_data[i*@jumlah_node+ j]\n end\n end\n end",
"def [](i)\n\t\t@matrix[i]\n\tend",
"def expression_matrix_file(name)\n expression_matrices.find_by(name:)\n end",
"def matrix\n (follow_object ? follow_object.matrix.inverse : Matrix.identity(4)) * rotation.matrix + rotation.translate(0,0,-@zoom)\n end",
"def with_matrices\n @m = Matrix.identity 2\n self.math_pow(@n - 1)\n\n #puts \"answer is %d\" % @m.element(0, 0)\n end",
"def show\n # Get matrix info from the params\n matrix_id, group, name = params.values_at(:matrix_id, :group, :name)\n\n @matrix = nil;\n\n if matrix_id.nil?\n # If no matrix_id is given, search for the matrix by group/name\n @matrix = CollectionMatrix.find_by(name: name, group: group)\n else\n # If we have an id number, use that (it's faster)\n @matrix = CollectionMatrix.find_by(matrix_id: matrix_id)\n end\n\n if !@matrix\n # If we couldn't find the matrix, render the matrix not found page\n return render :not_found, status: 404, content_type: 'text/html', template: 'collection_matrices/not_found.html.haml'\n end\n end",
"def adj_matrix n\n Matrix.zero n\nend",
"def create_matrix\n @data_target.each_with_index do |target, index|\n index_target = @header_target_attribute.index(target)\n index_class_label = @header_class_label.index(@data_class_label[index])\n @values[index_target][index_class_label] += 1\n end\n end",
"def normal_matrix_at_point(point)\n MSPhysics::Newton::CurvySlider.get_normal_martix_at_point(@address, point)\n end",
"def a_matrix\n rowNames = (1..4).collect { |i| \"row\" + i.to_s }\n colNames = (1..4).collect { |i| \"col\" + i.to_s }\n TripletRep.new(\n [0,0,1,2,2], \n [0,2,0,0,2],\n [1.0,1.0,2.0,3.0,2.0], \n rowNames, colNames)\n end",
"def *(m) # m is matrix or vector or number\n matrix_cls = Matrix\n array_cls = Array\n if m._isNumeric\n # rows = @rows.collect { |row|\n # row.collect { |e| e * m }\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n row = my_rows[i]\n r_size = row.size\n res_row = array_cls.new(r_size)\n for j in 0..r_size-1 do\n res_row[j] = row[j] * m\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n elsif m._kind_of?( Vector )\n m = matrix_cls.column_vector(m)\n r = self * m\n return r.column(0)\n elsif m._kind_of?( matrix_cls )\n # Matrix.Raise ErrDimensionMismatch if column_size != m.row_size\n # rows = (0 .. row_size - 1).collect { |i|\n # (0 .. m.column_size - 1).collect { |j|\n # vij = 0\n # 0.upto(column_size - 1) { |k| vij += self[i, k] * m[k, j] }\n # vij\n # }\n # }\n my_column_size = self.column_size\n other_column_size = m.column_size\n matrix_cls.Raise ErrDimensionMismatch if my_column_size != m.row_size\n my_rows = @rows\n my_rows_size = my_rows.size\n rows = array_cls.new(my_rows_size)\n for i in 0..my_rows_size-1 do\n res_row = array_cls.new(other_column_size)\n for j in 0..other_column_size-1 do\n vij = 0\n for k in 0..my_column_size-1 do\n vij += self[i, k] * m[k, j]\t\n end\n vij\n res_row[j] = vij\n end\n rows[i] = res_row\n end\n return matrix_cls.rows(rows, false)\n else\n cr = m.coerce(self)\n return cr[0] * cr[1]\n end\n end",
"def [](index)\n\n @rowSize = (index >= @rowSize) ? index + 1 : @rowSize\n @matrix[index] = [] if (@matrix[index] == nil)\n @matrix[index]\n\n end",
"def set_matrixspecy\n @matrixspecy = Matrixspecy.find(params[:id])\n end",
"def column2matrix(c)\n a = self.send(:column, c).to_a\n if c.is_a?(Range) and c.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[*a.collect{|x| [x]}]\n end\n end",
"def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end",
"def matrix(fill_value = -1)\n Matrix[*@stats.pad(fill_value).each_slice(7).to_a.transpose]\n end",
"def latex_matrix\n if @type == \"controlled\"\n @matrix.map { |value, matrix| [value, latex_matrix_for(matrix)] }\n else\n latex_matrix_for @matrix\n end\n end",
"def matrix_for(config)\n config.blank? ? matrix : matrix.select { |task| task.matrix_config?(config) }\n end",
"def d; Matrix.new(RAtlas.vec2diag(@storage)); end",
"def to_matrix\n rows = Matrix.zero(@row_size, @column_size).to_a\n DelegateMatrix.iterate_matrix(rows, Proc.new do |x,y,v|\n rows[y][x] = self[x,y]\n end)\n Matrix.rows(rows)\n end",
"def container_matrix\n cm = Array.new(container_type.y_dimension, Array.new(container_type.x_dimension, nil))\n children.each do |c|\n cm[c.container_y][c.container_x] = container_x\n end\n samples.each do |s|\n cm[s.container_y][container_x] = s\n end\n return cm\n end",
"def mat_frm\n @matr_format[[@calc_type]]\n end",
"def set_ad_matrix_category\n @ad_matrix_category = AdMatrixCategory.find(params[:id])\n end",
"def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end",
"def Matrix3dIdentity\n ret = _invoke(1610743889, [], [])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def mat_index_vein\n v = vein\n v.inorganic_mat if v\n end",
"def minor(*param)\n psz = param.size\n matrix_cls = Matrix\n if psz == 2\n from_row = param[0].first\n size_row = param[0].end - from_row\n size_row += 1 unless param[0].exclude_end?\n from_col = param[1].first\n size_col = param[1].end - from_col\n size_col += 1 unless param[1].exclude_end?\n elsif psz == 4\n from_row = param[0]\n size_row = param[1]\n from_col = param[2]\n size_col = param[3]\n else\n matrix_cls.Raise ArgumentError, param.inspect\n end\n # rows = @rows[from_row, size_row].collect{ |row|\n # row[from_col, size_col]\n # }\n my_rows = @rows\n my_rows_size = my_rows.size\n ridx = from_row\n# if (ridx >= my_rows_size)\n# raise ArgumentError, 'start_row out of bounds'\n# end\n r_lim = (ridx + size_row).__min(my_rows_size)\n res_rows = Array.new(r_lim - ridx)\n res_idx = 0 \n while ridx < r_lim\n a_row = my_rows[ridx]\n res_rows[res_idx] = a_row[from_col, size_col]\t\n res_idx += 1\n ridx += 1\n end\n matrix_cls.rows(res_rows, false)\n end",
"def fml (m)\n\tend",
"def __mul_matrix(other)\n\t\tm = Memory.new(other.column_count) { |j|\n\t\t\t__inner_product(other.column(j))\n\t\t}\n\t\treturn MemoryVector.__new__(m)\n\tend",
"def matrix_find(row, column)\n self[row*9 + column]\n end",
"def make_matrixarray\n\t\tmatrix = []\n\t\[email protected] do |this_speaker|\n\t\t\tmatrix << row(this_speaker)\n\t\tend\n\t\t#return matrix array\n\t\treturn matrix\n\tend",
"def normal_matrix_at_position(distance)\n MSPhysics::Newton::CurvySlider.get_normal_martix_at_position(@address, distance)\n end",
"def matricula\n end",
"def zero_matrix(matrix)\n\nend",
"def t\n return Matrix.new(@rows, @cols) {|i,j| self[j,i]}\n end",
"def setVariable(name, var)\n\n # Since this code was already written for three separate values,\n # I'm just splitting it back up for now.\n\n arg_names = var.old_args\n cells = Array.new\n var.cells.each do |cell|\n c = Array.new\n c << cell.onset\n c << cell.offset\n c << Array.new\n var.arglist.each do |arg|\n t = eval \"cell.#{arg}\"\n c[2] << t.to_s()\n end\n cells << c\n end\n print \"creating column\"\n # If the column already exists, delete it and build a new one.\n # If it doesn't, just add a new one.\n if not $db.col_name_in_use(name)\n col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n $db.add_column(col)\n else\n oldcol = $db.get_column(name)\n numcells = oldcol.get_num_cells\n numcells.downto(1) do |i|\n $db.remove_cell($db.get_cell(oldcol.get_id, i).get_id)\n end\n #$db.remove_column(oldcol.get_id)\n\n #col = DataColumn.new($db, name, MatrixVocabElement::MatrixType::MATRIX)\n #$db.add_column(col)\n end\n # Check if matrix already defined\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n if mve0.get_num_formal_args() == 1\n # Setup structure of matrix column\n mve0 = MatrixVocabElement.new(mve0)\n\n mve0.delete_formal_arg(0)\n arg_names.each do |arg|\n farg = NominalFormalArg.new($db, arg)\n mve0.append_formal_arg(farg)\n end\n\n $db.replace_matrix_ve(mve0)\n end\n col = $db.get_column(name)\n mve0 = $db.get_matrix_ve(col.its_mve_id)\n matID0 = mve0.get_id()\n cells.each do |cell|\n #print \"writing cell\"\n c = DataCell.new($db, col.get_id, matID0)\n mat = Matrix.new($db, matID0)\n\n if cell[0].to_i > 0\n c.onset = TimeStamp.new(1000, cell[0].to_i)\n end\n if cell[1].to_i > 0\n c.offset = TimeStamp.new(1000, cell[1].to_i)\n end\n\n narg = 0\n cell[2].each do |dv|\n argid = mve0.get_formal_arg(narg).get_id()\n if dv == \"\" or dv == nil\n a = arg_names[narg]\n fdv = NominalDataValue.new($db, argid)\n fdv.clearValue()\n else\n fdv = NominalDataValue.new($db, argid, dv)\n end\n\n mat.replaceArg(narg,fdv)\n narg += 1\n end\n c.set_val(mat)\n $db.append_cell(c)\n end\nend",
"def generate_sparse_mx_files\n @ocproblem.sparse_mxs.each do |mx|\n __write_matrix(\"#{mx.label}.c_code\", mx, @dict)\n end\n end",
"def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend",
"def t\n return Matrix.new(@cols, @rows) {|i,j| self[j,i]}\n end",
"def render_matrix\n Matrix.rows render_rows\n end",
"def layer(layer_number, get_by = :copy)\n layer = rank(2, layer_number, get_by)\n\n if jruby?\n nmatrix = NMatrix.new :copy\n nmatrix.shape = layer.shape\n nmatrix.s = layer.s\n return nmatrix\n else\n layer\n end\n\n end",
"def zeros_like(nm)\n NMatrix.zeros(nm.shape, dtype: nm.dtype, stype: nm.stype, capacity: nm.capacity, default: 0)\n end",
"def generate_matrix\n [].tap { |a| 25.times { a << 'X' } }.each_slice(5).to_a\n end",
"def get_matrix\n\t\tnum_categories = Category.all.length\n\t\tf = File.open('matrix.txt', 'w')\n\t\tActiveIngredient.find_each do |ingredient|\n\t\t\tdataset = ingredient.categories.pluck(:id)\n\t\t\tingredient.indications.pluck(:id).each do |indication_id|\n\t\t\t\tdataset << (indication_id + num_categories)\n\t\t\tend\n\t\t\tf.puts \"#{ingredient.id}\\t#{dataset.join(\",\")}\"\n\t\tend\n\t\tf.close()\n\tend",
"def set_mata_matum\n @mata_matum = MataMatum.find(params[:id])\n end",
"def []=(x, y, mark)\n @matrix[y][x] = mark\n end",
"def data\n @data ||= load_matrix\n end",
"def test_determinant\n f = YaleSparseMatrixFactory.new()\n c = f.Create([1,2,3,4,5],[0,0,2,4,5],[0,2,1,1,1],[3,4,5,9,9],[2,5,6,7,8])\n result = c.determinant()\n assert_equal(result,15)\n # assert_equal(result , )\n\n\n end",
"def m2\n\t\t\t\t\t:m2\n\t\t\t\tend",
"def normal_matrices\n MSPhysics::Newton::CurvySlider.get_normal_matrices(@address)\n end",
"def create_matrix\n (0...@height).to_a.map {|element| [0]*@width}\n end",
"def dmul!(arg)\n case arg\n when RNum::Matrix\n RAtlas::damul!(arg.storage, @storage)\n return arg\n else\n raise ArgumentError, \"Expected Matrix.\"\n end\n end",
"def hash\n @matrix\n end",
"def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end",
"def cols(j)\r\n\t\tc = {}\r\n\t\tfor r in @m_Matrix.keys do \r\n\t\t\tc[r] = @m_Matrix[r].vector[j] if @m_Matrix[r].vector.keys.include? j\r\n\t\tend\r\n\t\tSparseVector.new c\r\n\tend",
"def row2matrix(r)\n a = self.send(:row, r).to_a\n if r.is_a?(Range) and r.entries.size > 1\n return Matrix[*a]\n else\n return Matrix[a]\n end\n end",
"def ones_like(nm)\n NMatrix.ones(nm.shape, dtype: nm.dtype, stype: nm.stype, capacity: nm.capacity, default: 1)\n end",
"def m(x) x end",
"def matrix (*args, &block)\r\n add_new_transform(SVGMatrix.new(*args), &block)\r\n end",
"def expression_matrices\n study_files.any_of(\n { :file_type.in => ['Expression Matrix', 'MM Coordinate Matrix'] },\n { file_type: 'AnnData', 'ann_data_file_info.has_expression' => true }\n )\n end",
"def subMatrix(rows,cols)\n newDelegate = @delegate.clone\n newDelegate.subMatrix(rows,cols)\n newMatrix = SparseMatrix.new(newDelegate)\n return newMatrix\n end",
"def get_column(column)\n validate_pos(0, column)\n\n new_matrix_contents = [] #for a column, this should be a list of single item arrays to create a column vector later.\n\n # iterate through each column index in the internal array and add that as a column to the new_matrix_contents.\n (column ... @fm.length).step(@cols) do |index|\n new_matrix_contents << [@fm[index]]\n end\n\n FMatrix.new(new_matrix_contents)\n end",
"def set_mx_assessment\n @mx_assessment = MxAssessment.find(params[:id])\n end",
"def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end",
"def Transform3dGetMatrixComponentByRowAndColumn(arg0, arg1, arg2)\n ret = _invoke(1610743920, [arg0, arg1, arg2], [VT_BYREF | VT_DISPATCH, VT_I4, VT_I4])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def keys\n\t\[email protected]\n\tend",
"def [](i,j) \n @matriz[i][j]\nend",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def set_data_matrix(matrix, data_matrix = DATAMATRIX_KEY)\n @map[data_matrix] = matrix.to_a\n end",
"def get_transformation_matrix\n return self.get_rotation_matrix() * self.get_translation_matrix()\n end",
"def to_mm\n to_m * FACTOR_BY_UNIT['mm']\n end",
"def set_matriculacion\n @matriculacion = Matriculacion.find(params[:id])\n end",
"def set_matriculacion\n @matriculacion = Matriculacion.find(params[:id])\n end",
"def input_matrix(file_name)\n\t\tc_arr = []\n\t\tFile.open(file_name, \"r\").each_line do |line|\n\t\t\t#If this is the first line, initialize each strain and add it to the array\n\t\t\tif $. == 1\n\t\t\t\tline.split.each do |strain|\n\t\t\t\t\tc_arr.push(PA_vector.new(strain)) unless strain == 'cluster_names'\n\t\t\t\tend\n\t\t\t\t#otherwise, add the cluster to each strain vector\n\t\t\telse\n\t\t\t\tcluster = line.split\n\t\t\t\t(1..cluster.length-1).each do |i|\n\t\t\t\t\tc_arr[i-1].clusters[cluster[0]] = cluster[i].to_i\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tc_arr\n\tend",
"def to_immut_matrix()\n return Matrix.rows self\n end",
"def m3; 3 end",
"def cp_matrix_data\n data = ::Api::Charts::CPMatrix.new(@bank).matrix_data\n\n render json: data.as_json\n end",
"def dump_matrix(*arg)\n matrix = self.to_matrix(*arg)\n sorted = @index.sort {|a,b| a[1] <=> b[1]}\n \"[# \" + sorted.collect{|x| x[0]}.join(\", \") + \"\\n\" +\n matrix.to_a.collect{|row| ' ' + row.inspect}.join(\",\\n\") + \"\\n]\"\n end",
"def [] index\n if index.class != Fixnum or index >= 2**(@mar.length) or index < 0\n raise ArgumentError.new \"wrong address #{ index.inspect }\"\n end\n\n return Array.new(@mdr.length, 0) if @memory[index].nil?\n @memory[index]\n end",
"def cur_normal_matrix\n MSPhysics::Newton::CurvySlider.get_cur_normal_matrix(@address)\n end",
"def _fetch_counts_matrix(int_id)\n counts = {}\n\n DNA.letters.each do |base|\n base_counts = []\n cur = @dbh.query(\"SELECT VAL FROM MATRIX_DATA WHERE ID=#{int_id}\" \\\n \" and ROW='#{base}' ORDER BY COL\")\n cur.each { |r| base_counts << r[\"VAL\"] }\n counts[base] = base_counts.map(&:to_f)\n end\n\n return Bio::Motifs::GenericPositionMatrix.new(DNA, counts)\n end",
"def matrix_convert_to_0(matrix)\n\nend",
"def set_maturi\n @maturi = Maturi.find(params[:id])\n end",
"def create \n @matrix = Matrix.new(matrix_params)\n\n respond_to do |format|\n if @matrix.save\n format.html { redirect_to @matrix, notice: 'Matrix was successfully created.' }\n format.json { render :show, status: :created, location: @matrix }\n else\n format.html { render :new }\n format.json { render json: @matrix.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_matrix\n generator = Rubystats::NormalDistribution.new(0, 3)\n numbers = (MATRIX_DIMENSION * (MATRIX_DIMENSION + 1))\n .times\n .map { Rational(generator.rng.to_i) }\n .each_slice(MATRIX_DIMENSION)\n .to_a\n\n matrix = numbers[0...-1]\n answer = numbers[-1]\n\n vector = solve_equation(matrix, answer)\n\n [matrix, vector]\nend"
] | [
"0.65508616",
"0.6291915",
"0.62186897",
"0.61988",
"0.61667347",
"0.60984546",
"0.603009",
"0.600114",
"0.59912866",
"0.59662324",
"0.59286",
"0.5911337",
"0.58295506",
"0.5821453",
"0.58063203",
"0.57757026",
"0.5773396",
"0.56515896",
"0.56438845",
"0.56037647",
"0.5546456",
"0.554002",
"0.5457836",
"0.5455412",
"0.5453189",
"0.5442962",
"0.5423701",
"0.5352774",
"0.53426516",
"0.5313684",
"0.5311443",
"0.5273926",
"0.5264205",
"0.52546585",
"0.5231754",
"0.5220029",
"0.5213076",
"0.5187171",
"0.5185834",
"0.51805997",
"0.5179769",
"0.51789784",
"0.51771295",
"0.517691",
"0.5170395",
"0.51629853",
"0.5156684",
"0.51473165",
"0.51374304",
"0.5133647",
"0.512967",
"0.51295686",
"0.51272047",
"0.5115315",
"0.5113553",
"0.5110063",
"0.51072526",
"0.50959754",
"0.5088946",
"0.50792277",
"0.50726366",
"0.50718594",
"0.50643617",
"0.506401",
"0.5046158",
"0.50355506",
"0.5034748",
"0.50309175",
"0.50283575",
"0.50282156",
"0.5019925",
"0.50187135",
"0.5007914",
"0.5000619",
"0.49962837",
"0.4994219",
"0.49916366",
"0.4987498",
"0.49812785",
"0.4979525",
"0.49761355",
"0.49684653",
"0.49559864",
"0.49547535",
"0.49531117",
"0.49451742",
"0.49247852",
"0.49247852",
"0.49191728",
"0.4902321",
"0.48962474",
"0.48819345",
"0.48806474",
"0.48791707",
"0.48789427",
"0.48749956",
"0.48713693",
"0.48697317",
"0.4863401",
"0.48524934"
] | 0.6148335 | 5 |
BS Bound sites (site accession no.; site ID; quality: N; biological BS species) | def bs
field_fetch('BS')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def all_site_details\r\n @nsc.sites\r\n end",
"def bs\n \"#{fetch_sample(BS_PRE)} #{fetch_sample(BS_MID)} #{fetch_sample(BS_POS)}\"\n end",
"def find_protein_binding_sites!(genes)\n if genes && genes.size > 0\n genes.each do |gene|\n gene.transcripts.each do |trans_id, trans|\n fasta = nil\n if trans.utr3 && trans.utr3.size >= 300\n fasta = trans.utr3\n elsif trans.downstream\n fasta = trans.downstream\n else\n fasta = trans.utr3\n end\n trans.proteins = find_transcript_pbs(fasta) if fasta\n end\n end\n end\n genes\n end",
"def get_band()\n return(get_cmd('BN;',0.1,0.5,3).gsub(/^BN/,'').gsub(/;$/,'').to_i)\nend",
"def process_site(site); end",
"def band\n\t\tdata = query(\"AT+WMBS?\")\n\t\tif m = data.match(/^\\+WMBS: (\\d+),/)\n\t\t\treturn Bands[m.captures[0].to_i]\n\t\t\t\n\t\telse\n\t\t\t# Todo: Recover from this exception\n\t\t\terr = \"Not WMBS data: #{data.inspect}\"\n\t\t\traise RuntimeError.new(err)\n\t\tend\n\tend",
"def bps(basis_points)\n basis_points * 0.0001\n end",
"def bands_available\n\t\tdata = query(\"AT+WMBS=?\")\n\t\t\n\t\t# wmbs data is returned as something like:\n\t\t# +WMBS: (0,1,2,3,4,5,6),(0-1)\n\t\t# +WMBS: (0,3,4),(0-1)\n\t\t# extract the numbers with a regex, and\n\t\t# iterate each to resolve it to a more\n\t\t# readable description\n\t\tif m = data.match(/^\\+WMBS: \\(([\\d,]+)\\),/)\n\t\t\treturn m.captures[0].split(\",\").collect do |index|\n\t\t\t\tBands[index.to_i]\n\t\t\tend\n\t\t\n\t\telse\n\t\t\t# Todo: Recover from this exception\n\t\t\terr = \"Not WMBS data: #{data.inspect}\"\n\t\t\traise RuntimeError.new(err)\n\t\tend\n\tend",
"def bs; end",
"def number_of_splice_sites\n unless defined?(@number_of_splice_sites)\n @number_of_splice_sites = \n field_fetch('Number of splice sites', @d0).to_i\n end\n @number_of_splice_sites\n end",
"def bands\n Vips.vips_image_get_bands self\n end",
"def study_bulbs\n\t\tstudy_bulbs = [\n\t\t\tHuebulb.new(2),\n\t\t\tHuebulb.new(3),\n\t\t\tHuebulb.new(4)\n\t\t]\n\tend",
"def sites\n @sites ||= []\n end",
"def bs\n translate('faker.company.bs').collect { |list| sample(list) }.join(' ')\n end",
"def isbns\n subfield(\"020\", \"a\").map{|s| s.value}\n end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def num_sites\n if permission.value.positive?\n 'All sites'\n elsif connections.count.zero?\n 'No sites'\n elsif connections.count == 1\n '1 site'\n else\n \"#{connections.count} sites\"\n end\n end",
"def bw_by_uri(uri)\n unless bws_by_uri[uri]\n options = { _properties: DETAILED_BW_PROPERTIES }\n url = relative_url(uri)\n bws_by_uri[uri] = api_get_resources(url, :item, BathingWater, options)\n end\n\n bws_by_uri[uri]\n end",
"def siteName(sample)\n s = sample\n s = s.gsub(\"GS0\",\"GS\")\n s = s.gsub(\"GS-\",\"GS\")\n s = s.gsub(\"GOS\", \"GS\")\n s = s.gsub(/^0[0-9]+-/,\"\")\n s = s.gsub(\"IOSM\",\"\")\n s = s.gsub(\"IOLG\",\"\") \n s = s.gsub(\"IOVIR\",\"\")\n s = s.gsub(\"XLRVAL\",\"\")\n s = s.gsub(\"viral\",\"\")\n s = s.gsub(\"LG\",\"\") \n return s.split(\"-\").first\nend",
"def include_buried\n @must_nots.delete([Item::IndexFields::STAGE, Item::Stages::BURIED])\n self\n end",
"def bands\n self.concerts.map do |concert|\n concert.band\n end\n end",
"def biodiversity_index(specimens)\n number_of_species = specimens.uniq.length\n hsh = Hash.new(0)\n specimens.each do |el|\n hsh[el] += 1\n end\n smallest_population_size = hsh.values.min\n largest_population_size = hsh.values.max\n number_of_species**2 * smallest_population_size / largest_population_size\nend",
"def bs\n translate('faker.company.bs').collect {|list| list.sample }.join(' ')\n end",
"def site_data; end",
"def biodiversity_index(specimens)\n all_species = specimens.uniq\n count = {}\n\n all_species.each do |species|\n count[species] = specimens.count(species)\n end\n\n number_of_species = all_species.length\n smallest_population_size = count.values.min \n largest_population_size = count.values.max\n\n number_of_species ** 2 * smallest_population_size / largest_population_size\n \nend",
"def biodiversity_index(specimens)\n hsh = Hash.new(0)\n\n specimens.each { |ani| hsh[ani] += 1 }\n\n number_of_species = hsh.length\n smallest_population_size = hsh.min.last\n largest_population_size = hsh.max.last\n\n (number_of_species ** 2) * (smallest_population_size / largest_population_size)\n\nend",
"def bsb_test\n bsb = BSB.new\n bsb.read(\"!Copyright 1999, Maptech Inc. All Rights Reserved.\nCRR/CERTIFICATE OF AUTHENTICITY\n This electronic chart was produced under the authority of the National\n Oceanic and Atmospheric Administration (NOAA). NOAA is the hydrographic\n office for the United States of America. The digital data provided by NOAA\n from which this electronic chart was produced has been certified by NOAA\n for navigation. 'NOAA' and the NOAA emblem are registered trademarks of\n the National Oceanic and Atmospheric Administration. 'Maptech' and the\n Maptech emblem are registered trademarks of Maptech, Inc. Copyright 1999\n Maptech, Inc. All rights reserved.\nCHT/NA=CHESAPEAKE BAY ENTRANCE,NU=12221\nCHF/COASTAL\nCED/SE=70,RE=01,ED=09/12/1998\nNTM/NE=70.00,ND=10/30/1999,BF=ON,BD=10/26/1999\nVER/3.0\nCHK/1,558\nCGD/5\nORG/USA-NOAA/NOS\nMFR/MAPTECH\nRGN/4,6\nK01/NA=CHESAPEAKE BAY ENTRANCE,NU=558,TY=BASE,FN=12221_1.KAP\")\n \n puts bsb\nend",
"def site_params\n params.require(:site).permit(:site, :location, :contacts, :email, :installed, :FSE, :PQandTraining, :FAS, :TrainedOn, :SxSerialNumber, :MappingTool, :RGQSN, :RgqSoftware, :SAReporter, :AssayPackage, :NGS, :NGSassay, :NGSSXSN, :ST401i, :ST401e, :SQ301, :SQSuite, :SQreporter, :NGSInstall, :NGSFSE, :NGSPQandTraining, :FAS, :Notes)\n end",
"def bsb_number; end",
"def sib_boundary(port)\n mi = port.ports.find { |p| p.parent.is_a?(Origen::Models::Mux) && p.id.to_s =~ /^input\\d+$/ }\n if mi && mi.parent.number_of_options == 2 &&\n mi.parent.select.connections.size == 1\n if r = mi.parent.select.connections[0].send(:cleaned_nodes)[0][:obj]\n if r.is_a?(Origen::Registers::Reg) &&\n r.parent.is_a?(IJTAG::ScanRegister) && r.size == 1\n { mux: mi.parent, sr: r.parent }\n end\n end\n end\n end",
"def enhance_with_bing(main_site = nil)\n search_service = SearchService.new\n\n Organization.where(is_active: true).all.each_with_index do |org, i|\n break if (i >= 100)\n p '--------------------------------------------'\n p i\n p '--------------------------------------------'\n # First: try to determine the organizations main website\n org.retrieve_main_site(search_service) if main_site\n\n # Second: Search for the impressum of the organization on its main site, as well its career page\n org.retrieve_legal_notice(search_service)\n org.retrieve_career_page(search_service)\n\n # Third: Search for links at kununu and glassdoor\n org.retrieve_links(search_service, \"kununu.com\", \"Kununu\")\n org.retrieve_links(search_service, \"glassdoor.de\", \"Glassdoor\")\n\n sleep 1\n end\n end",
"def biodiversity_index(specimens)\n population_size = Hash.new(0)\n specimens.each do |specimen|\n population_size[specimen] += 1\n end\n\n number_of_species = specimens.uniq.length\n smallest_population_size = population_size.values.min\n largest_population_size = population_size.values.max\n\n number_of_species ** 2 * smallest_population_size / largest_population_size\nend",
"def snps(sig_count=150)\n\n Snp.where(\"chromosome = ? and position between ? and ?\",\n chromosome, start, stop)\n .order(\"position ASC\")\n\n end",
"def calc_slg\n # slugging_percentage = total_bases % at_bats\n singles = hits - (doubles + triples + hr)\n slg = (singles + (2*doubles + 3*triples + 4*hr))\n end",
"def bsa\n Math.sqrt( height.to_f * weight.to_f / 3131.0 )\n end",
"def bf\n field_fetch('bf')\n end",
"def sites(*values)\n values.inject(self) { |res, val| res._sites(val) or fail ArgumentError, \"Unknown value for sites: #{val}\" }\n end",
"def biodiversity_index(specimens)\n hash = Hash.new(0)\n specimens.uniq.each do |sp|\n hash[sp] = specimens.count(sp) \n end\n num_species = specimens.uniq.length\n smallest_pop = hash.values.min \n largest_pop = hash.values.max\n num_species**2 * smallest_pop / largest_pop\nend",
"def band; end",
"def band; end",
"def priority\n sites = %w[\n Pixiv Twitter\n ArtStation BCY Deviant\\ Art Hentai\\ Foundry Nico\\ Seiga Nijie pawoo.net Pixiv\\ Fanbox Pixiv\\ Sketch Tinami Tumblr\n Ask.fm Booth.pm Facebook Fantia FC2 Gumroad Instagram Ko-fi Livedoor Lofter Mihuashi Mixi.jp Patreon Piapro.jp Picarto Privatter Sakura.ne.jp Stickam Skeb Twitch Weibo Youtube\n Amazon Circle.ms DLSite Doujinshi.org Erogamescape Mangaupdates Melonbooks Toranoana Wikipedia\n ]\n\n sites.index(site_name) || 1000\n end",
"def site_params\n params.require(:site).permit(:address, :city, :county, :loc_page, :loc_longitude, :loc_latitude, :apn, :tombrobox, :fault_id)\n end",
"def get_site_count\r\n site_name ? 1 : 0\r\n end",
"def boundary \n \"An43094fu\"\n end",
"def turbo_sites\n deep_values(\"turbo_sites\")\n end",
"def max_sites\n @sites.map { |s| s.length }.max\n end",
"def sites\n @list.map {|partition_name, partition| partition.sites.map {|site| {site => partition_name} }}.flatten(1)\n end",
"def site=(_arg0); end",
"def site=(_arg0); end",
"def site=(_arg0); end",
"def clans_with_site\n (sites.collect {|s| s.clan}).compact\n end",
"def isbn; end",
"def total_sites\n @sites.flatten.length - sites.length\n end",
"def bf\n field_fetch('BF')\n end",
"def getB72bandNums(bandsArray)\n b7_2bandNumsArray = bandsArray.collect {|x| x.newBandNumbsb7_2} \nend",
"def site_list\n @sites = Haiwet::Site.list\n @sites.each.with_index(1) do |site, i|\n puts \"\\n #{i}- #{site.name}\"\n end\n end",
"def place_bombs\n range = ([email protected]).to_a\n total_bombs = (@grid.length ** 2) / 4\n @grid[range.sample][range.sample].value = BOMB until @grid.flatten.map(&:value).count(BOMB) == total_bombs\n end",
"def db_update\n brands_site = Nokogiri::HTML(open(MAIN_URI))\n @brands = []\n brands_site.css('div.cb-marks').each{|entry| @brands << Brand.new(entry.text, correct_link(entry.css('a')[0]['href'], MAIN_URI))}\n\n end",
"def biodiversity_index(specimens)\n distribution = Hash.new(0)\n specimens.each do |specimen|\n distribution[specimen] += 1\n end\n smallest_population_size = distribution.values.min\n largest_population_size = distribution.values.max\n index = distribution.length ** 2 * smallest_population_size / largest_population_size\nend",
"def sites_arg sites\n sites.nil? ? all_sites : sites.split(\",\")\n end",
"def load_bparam_notetags\n @base_bparam = [6,6,5]\n @growth_bparam = [0.4,0.3,0.5]\n self.note.split(/[\\r\\n]+/).each do |line|\n if line =~ /<base[ _]bparams[:?]\\s*(\\d+),?[\\s?](\\d+),?[\\s?](\\d+)>/i\n @base_bparam[0] = $1.to_i\n @base_bparam[1] = $2.to_i\n @base_bparam[2] = $3.to_i\n end\n if line =~ /<growth[ _]bparams[:?]\\s*(\\d+),?[\\s?](\\d+),?[\\s?](\\d+)>/i\n @growth_bparam[0] = $1.to_i\n @growth_bparam[1] = $2.to_i\n @growth_bparam[2] = $3.to_i\n end\n end\n #puts(@base_bparam)\n #puts(@growth_bparam)\n end",
"def site(value)\n define_singleton_method(:site_value) { value }\n private_class_method :site_value\n end",
"def as_bp bp_100\n info = self.info.reject{|k,v| k == :units}\n\n scaled = Hash.new\n info.each do |k, v|\n scaled[k] = v\n scaled[k] = v / bp_100.to_f if k == :quantity\n end\n Ingredient.new(self.name, scaled)\n end",
"def show_site_stats # :nologin: :norobots:\n store_location\n @site_data = SiteData.new.get_site_data\n\n # Add some extra stats.\n @site_data[:observed_taxa] = Name.connection.select_value %(\n SELECT COUNT(DISTINCT name_id) FROM observations\n )\n @site_data[:listed_taxa] = Name.connection.select_value %(\n SELECT COUNT(*) FROM names\n )\n\n # Get the last six observations whose thumbnails are highly rated.\n query = Query.lookup(:Observation, :all,\n by: :updated_at,\n where: \"images.vote_cache >= 3\",\n join: :\"images.thumb_image\")\n @observations = query.results(limit: 6,\n include: { thumb_image: :image_votes })\n end",
"def body_site_params\n params.require(:body_site).permit(:identifier, :name, :region)\n end",
"def set_band(band)\n puts \"Setting band to #{band}\" if $verbose\n b='BN'+(('00'+band.to_s)[-2..-1])+';'\n puts b if $verbose\n ret=send_cmd(b,'BN;',b,0.5,1.5,3)\n if(ret)\n return(ret.gsub(/^BN/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend",
"def biodiversity_index(specimens)\n species = Hash.new(0)\n specimens.each do |specimen|\n species[specimen] += 1\n end\n return ((species.size)**2)*(species.values.max / species.values.min)\nend",
"def scotch_blended\n puts \"Let's explore blended Scotch whiskies\"\n #call method to list whiskies for this particular type\n list_whiskies('c/304/blended-scotch-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end"
] | [
"0.5791628",
"0.5791628",
"0.5791628",
"0.5791628",
"0.5791628",
"0.54099673",
"0.5388314",
"0.53193897",
"0.52722645",
"0.5260862",
"0.5202046",
"0.5182359",
"0.51044023",
"0.50617635",
"0.501173",
"0.501117",
"0.49988052",
"0.49902472",
"0.49749443",
"0.49455792",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49394336",
"0.49262258",
"0.4919513",
"0.4912669",
"0.49063808",
"0.4904354",
"0.49012986",
"0.48917195",
"0.4871103",
"0.48602667",
"0.4848267",
"0.48430866",
"0.48318517",
"0.4826917",
"0.48252428",
"0.48184583",
"0.48105314",
"0.48049563",
"0.48046654",
"0.4797467",
"0.47747344",
"0.4763334",
"0.47563443",
"0.4754453",
"0.4754453",
"0.47213063",
"0.4710713",
"0.47005954",
"0.46860525",
"0.46781957",
"0.46742755",
"0.46736783",
"0.4666124",
"0.4666124",
"0.4666124",
"0.4641005",
"0.46405846",
"0.46363673",
"0.46284464",
"0.46155733",
"0.460953",
"0.46063456",
"0.4605992",
"0.46055627",
"0.45931256",
"0.45903662",
"0.45884174",
"0.45858032",
"0.458166",
"0.45737994",
"0.45707795",
"0.45688266",
"0.45645484"
] | 0.5742659 | 5 |
BF Factors belonging to this class | def bf
field_fetch('BF')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bf\n field_fetch('bf')\n end",
"def bfs\n\n end",
"def faction; end",
"def faction; end",
"def faction; end",
"def bfs\n\n\n end",
"def * f\n result = Factorization.new(@factorbase)\n @factors.each do |b,e|\n result.add(b,e)\n end\n f.factors.each do |b,e|\n result.add(b,e)\n end\n result\n end",
"def factor\n raise NotImplementedError, \"The #factor method should be implemented for each subclass\"\n end",
"def ccf\n end",
"def bfs\n # raise NotImplementedError\n end",
"def to_foorth_fiber\n self\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def bfs\n raise NotImplementedError\n end",
"def factor\n FACTOR_ERROR.call unless @factor.respond_to? :call\n @_factor ||= @factor.call(self)\n end",
"def isFacile? \n return @facile\n end",
"def fiber_obj\n $game_temp.actors_fiber[id]\n end",
"def factor_max_labs\n \tfactors.map do |factor|\n \t\tfactor.max_score\n \tend\n end",
"def name\n \"#{@namespace}:bf\"\n end",
"def count_factors\n factors.count\n end",
"def key\n :perc_actors\n end",
"def beta_features\n @attributes[:beta_features]\n end",
"def factor\n @factor if valid?\n end",
"def classifier(*args, &block)\n Classifier::Bayes.new(*args, &block)\n end",
"def factor\n fail NotImplementedError,\n \"The #factor method should be implemented by each subclass\"\n end",
"def calculate_ffck_category\n season_year = Date.today.year\n user_birth_year = birth_date.year rescue Date.today.year\n case season_year - user_birth_year\n when 0..8; 'Pitchoun'\n when 9; 'Poussin 1'\n when 10; 'Poussin 2'\n when 11; 'Benjamin 1'\n when 12; 'Benjamin 2'\n when 13; 'Minime 1'\n when 14; 'Minime 2'\n when 15; 'Cadet 1'\n when 16; 'Cadet 2'\n when 17; 'Junior 1'\n when 18; 'Junior 2'\n when 19..34; 'Senior'\n when 35..39; 'Veteran 1'\n when 40..44; 'Veteran 2'\n when 45..49; 'Veteran 3'\n when 50..999; 'Veteran +'\n else 'Inconnu'\n end\n end",
"def fcount(f,cat)\n if @fc[f] && @fc[f][cat]\n Float(@fc[f][cat])\n else\n 0\n end\n end",
"def winner_factor_score\n \t@winner = Decision.find(id).rank_options.first\n\n \tfactors.map do |factor|\n \t\[email protected]_by_factor_id(factor.id).score\n \tend\n end",
"def nbf(m = 2880, k = 20)\n BloomFilter.new(m: m, k: k)\n end",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def factors(num)\n\nend",
"def features\n\t\tcollection = []\n\t\tclasses.each do |_class|\n\t\t\t_class.features.each do |feature|\n\t\t\t\tcollection << feature\n\t\t\tend\n\t\tend\n\t\trace.features.each do |feature|\n\t\t\tcollection << feature\n\t\tend\n\t\tfeats.each do |feat|\n\t\t\tcollection << feat\n\t\tend\n\t\tcollection\n\tend",
"def bizet; end",
"def cmbnation(m)\n factrl(m) / ( factrl(m - 5) * factrl(5) )\nend",
"def icc_2_f\n Statsample::Test::F.new(bms, ems, @df_bt, @df_residual)\n end",
"def channel_factor(num)\n\t\tregexp = /^FACTOR#{num}=(.*)\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn $1.to_f if e =~ regexp\n\t\t}\n\t\tputs \"WARNING: Cannot find channel #{num} factor. Assigning a default value\"\n\t\treturn 1.0\n\tend",
"def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end",
"def set_factors_amount(f_amount)\r\n amount_now=Factor.count\r\n if amount_now==f_amount\r\n return\r\n elsif amount_now>f_amount\r\n factors=Factor.all\r\n count=0\r\n factors.each do |factor|\r\n if count>=f_amount\r\n factor.destroy\r\n end\r\n count+=1\r\n end\r\n else\r\n f_amount.to_i.times do |i|\r\n if i>=amount_now\r\n factor=Factor.new\r\n\r\n factor.name=\"factor \" + i.to_s\r\n factor.save\r\n end\r\n end\r\n end\r\n end",
"def factors_of(num)\n # Write your code here\nend",
"def energy_pcf\n energy_from_protein +\n energy_from_carbs +\n energy_from_fat\n end",
"def index\n @form_factors = FormFactor.all\n end",
"def factions\n \n end",
"def divisors\n [self] + self.factors << 1\n end",
"def bfs_for(coords)\n end",
"def boost_all(factor)\n all.each do |hit|\n hit.score *= factor\n end\n end",
"def get_fibra\n @_100=((@fibra*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@fibra*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @fibra , @_100 , 0 , @porcion , 0 ]\n end",
"def incf(f,cat)\n @fc[f] ||= {}\n @fc[f][cat] ||= 0\n @fc[f][cat] += 1\n end",
"def forehead\n @forehead ||= self[:FOREHEAD_GLABELLA]\n end",
"def cut_factor=(factor)\r\n end",
"def bmr\n n = Bubs::BloodMagic::BASE_BMR\n if actor?\n n += Bubs::BloodMagic::ACTOR_BMR_BONUS\n n += self.actor.blood_magic_bonus\n n += self.class.blood_magic_bonus\n for equip in equips\n next if equip.nil?\n n += equip.blood_magic_bonus\n end\n else\n n += Bubs::BloodMagic::ENEMY_BMR_BONUS\n n += self.enemy.blood_magic_bonus\n end\n for state in states\n next if state.nil?\n n += state.blood_magic_bonus\n end\n # determine minimum blood ratio\n n = [n, Bubs::BloodMagic::MIN_BMR].max\n # determine maximum blood ratio cap\n n = [n, Bubs::BloodMagic::MAX_BMR].min if Bubs::BloodMagic::USE_MAX_BMR\n return n\n end",
"def max_tb_rangeF; @max_sf; end",
"def set_Floors(value)\n set_input(\"Floors\", value)\n end",
"def set_Floors(value)\n set_input(\"Floors\", value)\n end",
"def boost\n 1.0\n end",
"def proper_divisors\n self.factors << 1\n end",
"def getFees(airplane, fbo, timeUnit = nil, timeLength = 0, landingTime = nil)\n\n\t\tif !landingTime.nil?\n\t\t\tlandingTime = timeToMinutes(landingTime)\n\t\tend\n\n\t\tfees = Fee.where( :fbo => fbo )\n\t\tisEstimate = false\n\n\t\tfees.each do |curFee|\n\n\t\t\tclassificationDesc = curFee.classification.classification_description\n\t\t\tcurCategory = curFee.category.category_description\n\n\t# Figure out if categories are missing so that the data retrieval is more complete\n\t# WWWWHHHEEEEEEEEE\n\t\t\tif classificationDesc == \"engine type\"\n\t# doesn't have piston multi light\n\t\t\t\tif !hasCategory(fees, \"piston multi light\") and hasCategory(fees, \"piston multi heavy\") and airplane.engine_class == \"piston multi light\"\n\t\t\t\t\tairplane.engine_class = \"piston multi heavy\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have piston multi heavy\n\t\t\t\telsif !hasCategory(fees, \"piston multi heavy\") and hasCategory(fees, \"piston multi light\") and airplane.engine_class == \"piston multi heavy\"\n\t\t\t\t\tairplane.engine_class = \"piston multi light\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have turboprop single heavy\n\t\t\t\telsif !hasCategory(fees, \"turboprop single heavy\") and hasCategory(fees, \"turboprop single light\") and airplane.engine_class == \"turboprop single heavy\"\n\t\t\t\t\tairplane.engine_class = \"turboprop single light\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have turboprop single light\n\t\t\t\telsif !hasCategory(fees, \"turboprop single light\") and hasCategory(fees, \"turboprop single heavy\") and airplane.engine_class == \"turboprop single light\"\n\t\t\t\t\tairplane.engine_class = \"turboprop single heavy\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have turboprop twin light\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin light\") and hasCategory(fees, \"turboprop twin medium\") and airplane.engine_class == \"turboprop twin light\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin medium\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin light\") and hasCategory(fees, \"turboprop twin heavy\") and airplane.engine_class == \"turboprop twin light\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin heavy\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have turboprop twin medium\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin medium\") and hasCategory(fees, \"turboprop twin heavy\") and airplane.engine_class == \"turboprop twin medium\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin heavy\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin medium\") and hasCategory(fees, \"turboprop twin light\") and airplane.engine_class == \"turboprop twin medium\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin light\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have turboprop twin heavy\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin heavy\") and hasCategory(fees, \"turboprop twin medium\") and airplane.engine_class == \"turboprop twin heavy\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin medium\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"turboprop twin heavy\") and hasCategory(fees, \"turboprop twin light\") and airplane.engine_class == \"turboprop twin heavy\"\n\t\t\t\t\tairplane.engine_class = \"turboprop twin light\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have light jet\n\t\t\t\telsif !hasCategory(fees, \"light jet\") and hasCategory(fees, \"midsize jet\") and airplane.engine_class == \"light jet\"\n\t\t\t\t\tairplane.engine_class = \"midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"light jet\") and hasCategory(fees, \"super midsize jet\") and airplane.engine_class == \"light jet\"\n\t\t\t\t\tairplane.engine_class = \"super midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"light jet\") and hasCategory(fees, \"heavy jet\") and airplane.engine_class == \"light jet\"\n\t\t\t\t\tairplane.engine_class = \"heavy jet\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have midsize jet\n\t\t\t\telsif !hasCategory(fees, \"midsize jet\") and hasCategory(fees, \"super midsize jet\") and airplane.engine_class == \"midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"super midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"midsize jet\") and hasCategory(fees, \"light jet\") and airplane.engine_class == \"midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"light jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"midsize jet\") and hasCategory(fees, \"heavy jet\") and airplane.engine_class == \"midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"heavy jet\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have super midsize jet\n\t\t\t\telsif !hasCategory(fees, \"super midsize jet\") and hasCategory(fees, \"heavy jet\") and airplane.engine_class == \"super midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"heavy jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"super midsize jet\") and hasCategory(fees, \"midsize jet\") and airplane.engine_class == \"super midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"super midsize jet\") and hasCategory(fees, \"light jet\") and airplane.engine_class == \"super midsize jet\"\n\t\t\t\t\tairplane.engine_class = \"light jet\"\n\t\t\t\t\tisEstimate = true\n\t# doesn't have heavy jet\n\t\t\t\telsif !hasCategory(fees, \"heavy jet\") and hasCategory(fees, \"super midsize jet\") and airplane.engine_class == \"heavy jet\"\n\t\t\t\t\tairplane.engine_class = \"super midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"heavy jet\") and hasCategory(fees, \"midsize jet\") and airplane.engine_class == \"heavy jet\"\n\t\t\t\t\tairplane.engine_class = \"midsize jet\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\telsif !hasCategory(fees, \"heavy jet\") and hasCategory(fees, \"light jet\") and airplane.engine_class == \"heavy jet\"\n\t\t\t\t\tairplane.engine_class = \"light\"\n\t\t\t\t\tisEstimate = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tfees = fees.reject do |curFee|\n\t\t\tclassificationDesc = curFee.classification.classification_description\n\t\t\tcurCategory = curFee.category.category_description\n\n\t\t\tif classificationDesc == \"engine type\" and curCategory != \"flat rate\" and curCategory != \"no fee\" and curCategory != \"weight\" and curCategory != \"weight range\"\n\t\t\t\tif curCategory == \"jet\"\n\t\t\t\t\t!airplane.engine_class =~ /jet/\n\t\t\t\telsif curCategory == \"turboprop\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop/\n\t\t\t\telsif curCategory == \"turboprop single\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop single/\n\t\t\t\telsif curCategory == \"turboprop multi\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop multi/\n\n\t\t\t\telsif curCategory == \"piston\"\n\t\t\t\t\t!airplane.engine_class =~ /piston/\n\t\t\t\telsif curCategory == \"piston multi\"\n\t\t\t\t\t!airplane.engine_class =~ /piston multi/\n\n\t\t\t\telse\n\t\t\t\t\tcurCategory != airplane.engine_class\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t# For fees with the wrong engine type\n\t\tfees = fees.reject do |curFee|\t\n\t\t\tif isEstimate\n\t\t\t\tcurFee.is_estimate = true\n\t\t\tend\n\t\t\tcurCategory = curFee.category.category_description\n\t\t\tclassificationDesc = curFee.classification.classification_description\n\n\t\t\tif classificationDesc == \"engine type\" and curCategory != \"flat rate\" and curCategory != \"no fee\" and curCategory != \"weight\" and curCategory != \"weight range\"\n\t\t\t\tif curCategory == \"jet\"\n\t\t\t\t\t!airplane.engine_class =~ /jet/\n\n\t\t\t\telsif curCategory == \"turboprop\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop/\n\t\t\t\telsif curCategory == \"turboprop single\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop single/\n\t\t\t\telsif curCategory == \"turboprop multi\"\n\t\t\t\t\t!airplane.engine_class =~ /turboprop multi/\n\n\t\t\t\telsif curCategory == \"piston\"\n\t\t\t\t\t!airplane.engine_class =~ /piston/\n\t\t\t\telsif curCategory == \"piston multi\"\n\t\t\t\t\t!airplane.engine_class =~ /piston multi/\n\n\t\t\t\telse\n\t\t\t\t\tcurCategory != airplane.engine_class\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# For fees that have a start time and end time that are in the wrong range\n\t\tfees = fees.reject do |curFee|\n\t\t\tcurCategory = curFee.category.category_description\n\t\t\tclassificationDesc = curFee.classification.classification_description\n\n\t\t\tif !curFee.start_time.nil? and !curFee.end_time.nil? and !landingTime.nil? # If the fee has a start time and an end time, make sure it falls in the right time period.\n\t\t\t\t\n\t\t\t\tstartTime = curFee.start_time\n\t\t\t\tendTime = curFee.end_time\n\t\t\t\t# If the fee skips over midnight, add 1440 minutes (1 day) to the end time so the comparison works properly\n\t\t\t\tif startTime > endTime\n\t\t\t\t\tendTime += 1440\n\t\t\t\tend\n\n\t\t\t\tlandingTime < startTime or landingTime > endTime\n\t\t\tend\n\t\tend\n\n\t\t# For fees that use the wrong time unit\n\t\tfees = fees.reject do |curFee|\n\t\t\tif !curFee.time_unit.nil? # reject fees that use the wrong time unit\n\t\t\t\tcurFee.time_unit != timeUnit\n\t\t\tend\n\t\tend\n\n\t\t# For fees that are the wrong make/model\n\t\tfees = fees.reject do |curFee|\n\t\t\tcurCategory = curFee.category.category_description\n\t\t\tclassificationDesc = curFee.classification.classification_description\n\n\t\t\tif classificationDesc == \"make and model\" and curCategory != \"flat rate\" and curCategory != \"no fee\" and curCategory != \"weight\" and curCategory != \"weight range\"\n\t\t\t\tcurCategory != airplane.model\n\t\t\tend\n\t\tend\n\n\t\t# For fees where the airplane weight doesn't fall in the weight range\n\t\tfees = fees.reject do |curFee|\n\t\t\tcurCategory = curFee.category.category_description\n\n\t\t\tif curCategory == \"weight range\" and !curFee.unit_minimum.nil? and !curFee.unit_maximum.nil?\n\t\t\t\tairplane.weight < curFee.unit_minimum or airplane.weight > curFee.unit_maximum # reject fees if the airplane weight is less than the minimum or greater than the maximum\n\t\t\tend\n\t\tend\n\n\t\tfees = applyConditionalFees(airplane, fees, timeUnit, timeLength, landingTime)\n\t\tif fees.nil? or fees.length == 0\n\t\t\tputs \"check\"\n\t\t\treturn nil\n\t\telse\n\t\t\treturn fees\n\t\tend\n\tend",
"def factor(units)\n factor_item = Factor.first(:from.lte => units, :to.gte => units)\n factor_item.nil? ? 1 : factor_item.factor\n end",
"def define_features\n @fvs.each do |vector, label|\n vector.each do |term, value|\n @features.add(term)\n end\n end\n end",
"def fees\n raise Sibit::NotSupportedError, 'Blockchair doesn\\'t implement fees()'\n end",
"def factors\n k = 1\n max = Math.sqrt(self).ceil\n lofacs = []\n hifacs = []\n while k <= max.ceil\n if (self.to_f/k) == (self.to_i/k)\n lofacs << k\n hifacs << self/k unless self/k == k\n end\n k += 1\n end\n lofacs + hifacs.reverse\n end",
"def set_valores_fracc\n a = 1\n b = 2\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n @matrix[i][j] = Fraccion.new(a,b)\n a += 1\n b += 1\n j += 1\n end\n i += 1\n end\n end",
"def initialize (value=10, face=-1) # CONSTRUCTOR\n self.value = value\n self.face = face\n end",
"def compute_basal_metabolism(weight, height, age, sex)\n case sex\n when :m, :male\n 66.5 + 13.7 * weight + 5.0 * height - 6.8 * age\n when :f, :female\n 655 + 9.6 * weight + 1.8 * height - 4.7 * age\n else\n 0\n end\nend",
"def factors\n all_factors = []\n (1..Math.sqrt(self).to_i).each do |x|\n all_factors.push(x, self/x) if (self % x == 0)\n end\n\n all_factors.sort.uniq\n end",
"def C\n @nb\n end",
"def C\n @nb\n end",
"def calc_contribution(f)\n each_class do |k|\n set_feature_score(f, k, rand)\n end\n end",
"def find_faces\n end",
"def find_faces\n end",
"def feruchemist; end",
"def fscore(beta)\n b2 = Float(beta**2)\n ((b2 + 1) * precision * recall) / (b2 * precision + recall)\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def factors() (1..self).select { |n| (self % n).zero? } end",
"def farmies(data)\nend",
"def getInF()\n if @myScale == 'F' or @myScale == 'f'\n return self\n else\n degreeF = 0.0\n if @myScale == 'C' or @myScale == 'c'\n degreeF = ((9.0/5.0) * @myDegree) + 32.0\n else\n degreeF = (@myDegree - 273.15) * (9.0/5.0) + 32.0\n end\n myTemp = Temperature.new(degreeF, 'F')\n return myTemp\n end\n end",
"def find_factors(num)\n\t# type here\n\t# change return\n\treturn false\nend",
"def factor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n __IDENTIFIER13__ = nil\n __IDENTIFIER14__ = nil\n __INTEGER15__ = nil\n __FLOAT16__ = nil\n __CHAR17__ = nil\n __BOOL18__ = nil\n t = nil\n\n begin\n # at line 777:2: ( 'this' '.' IDENTIFIER | IDENTIFIER | INTEGER | FLOAT | CHAR | BOOL | NULL | read | t= invocation | arrayaccess | '(' expression ')' )\n alt_29 = 11\n alt_29 = @dfa29.predict( @input )\n case alt_29\n when 1\n # at line 778:5: 'this' '.' IDENTIFIER\n match( T__41, TOKENS_FOLLOWING_T__41_IN_factor_1256 )\n match( T__40, TOKENS_FOLLOWING_T__40_IN_factor_1258 )\n __IDENTIFIER13__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_factor_1260 )\n # --> action\n\n \t\t if( not @current_class.instance_variables[__IDENTIFIER13__.text].nil?)\n \t\t\t @stack_operands.push(@current_class.instance_variables[__IDENTIFIER13__.text].address)\n \t\t\t @stack_types.push(@current_class.instance_variables[__IDENTIFIER13__.text].type)\n \t\t\t else\n \t\t raise \"Variable #{__IDENTIFIER13__.text} not declared as instance of #{@current_class.name}\"\n \t\t end\n \t\t \n # <-- action\n\n when 2\n # at line 787:6: IDENTIFIER\n __IDENTIFIER14__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_factor_1273 )\n # --> action\n #Regla 1 GC / Regla 1 VS\n \t\t\t # Verificar que exista en algun scope y meterlo en pila de operandos\n \t\t\t if(not @current_method.nil?)\n \t\t\t if(not @current_method.local_variables[__IDENTIFIER14__.text].nil?)\n \t\t\t @stack_operands.push(@current_method.local_variables[__IDENTIFIER14__.text].address)\n \t\t\t @stack_types.push(@current_method.local_variables[__IDENTIFIER14__.text].type)\n \t\t\t elsif( not @current_class.instance_variables[__IDENTIFIER14__.text].nil?)\n \t\t\t @stack_operands.push(@current_class.instance_variables[__IDENTIFIER14__.text].address)\n \t\t\t @stack_types.push(@current_class.instance_variables[__IDENTIFIER14__.text].type)\n \t\t\t else\n \t\t\t raise \"Variable #{__IDENTIFIER14__.text} not declared neither in #{@current_class.name} or its method #{@current_method.name}\"\n \t\t\t end\n \t\t\t else\n \t\t\t \tif( not @current_class.instance_variables[__IDENTIFIER14__.text].nil?)\n \t\t\t \t @stack_operands.push(@current_class.instance_variables[__IDENTIFIER14__.text].address)\n \t\t\t \t @stack_types.push(@current_class.instance_variables[__IDENTIFIER14__.text].type)\n \t\t\t else\n \t\t\t raise \"Variable #{__IDENTIFIER14__.text} not declared as instance of #{@current_class.name}\"\n \t\t\t end\n \t\t\t end\n \t\t\t\n # <-- action\n\n when 3\n # at line 809:5: INTEGER\n __INTEGER15__ = match( INTEGER, TOKENS_FOLLOWING_INTEGER_IN_factor_1284 )\n # --> action\n #Regla 1 GC\n \t\t dir_const = get_avail_const\n \t\t generate('ict', __INTEGER15__.text, nil, dir_const )\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push('int')\n \t\t \n # <-- action\n\n when 4\n # at line 816:5: FLOAT\n __FLOAT16__ = match( FLOAT, TOKENS_FOLLOWING_FLOAT_IN_factor_1297 )\n # --> action\n #Regla 1 GC\n \t\t dir_const = get_avail_const\n \t\t generate('fct', __FLOAT16__.text, nil, dir_const )\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push('float')\n \t\t \n # <-- action\n\n when 5\n # at line 823:5: CHAR\n __CHAR17__ = match( CHAR, TOKENS_FOLLOWING_CHAR_IN_factor_1309 )\n # --> action\n #Regla 1 GC\n \t\t dir_const = get_avail_const\n \t\t generate('cct', __CHAR17__.text, nil, dir_const )\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push('char')\n \t\t \n # <-- action\n\n when 6\n # at line 831:5: BOOL\n __BOOL18__ = match( BOOL, TOKENS_FOLLOWING_BOOL_IN_factor_1325 )\n # --> action\n\n \t\t dir_const = get_avail_const\n \t\t generate('bct', __BOOL18__.text, nil, dir_const )\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push('boolean')\n \t\t \n # <-- action\n\n when 7\n # at line 840:5: NULL\n match( NULL, TOKENS_FOLLOWING_NULL_IN_factor_1346 )\n # --> action\n\n \t\t dir_const = get_avail_const\n \t\t generate('nct', nil, nil, dir_const )\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push('null')\n \t\t \n # <-- action\n\n when 8\n # at line 847:5: read\n @state.following.push( TOKENS_FOLLOWING_read_IN_factor_1358 )\n read\n @state.following.pop\n\n when 9\n # at line 848:5: t= invocation\n @state.following.push( TOKENS_FOLLOWING_invocation_IN_factor_1368 )\n t = invocation\n @state.following.pop\n # --> action\n\n \t\t \tdir_const = get_avail_const\n \t\t generate('get', nil, nil, dir_const)\n \t\t\t\t@stack_operands.push(dir_const)\n \t\t\t\t@stack_types.push(t)\n \t\t \n # <-- action\n\n when 10\n # at line 855:5: arrayaccess\n @state.following.push( TOKENS_FOLLOWING_arrayaccess_IN_factor_1380 )\n arrayaccess\n @state.following.pop\n\n when 11\n # at line 857:5: '(' expression ')'\n match( T__28, TOKENS_FOLLOWING_T__28_IN_factor_1391 )\n # --> action\n #Regla 6 GC\n \t\t @stack_operators.push('(')\n \t\t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_expression_IN_factor_1403 )\n expression\n @state.following.pop\n match( T__29, TOKENS_FOLLOWING_T__29_IN_factor_1410 )\n # --> action\n #Regla 7 GC\n \t\t @stack_operators.pop\n\n \t\t \n # <-- action\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 26 )\n\n end\n \n return \n end",
"def cp_b\n end",
"def basal_metabolic_rate(age)\n if sex == \"male\"\n # male\n male_BMR(age)\n else\n # female\n female_BMR(age)\n end\n end",
"def backness\n features.intersection(Features::BACKNESS)\n end",
"def calc_contribution(f)\n if not get_classes.size == 2\n abort \"[#{__FILE__}@#{__LINE__}]: \\n\"+\n \" Relief applicable only to two-class problems without missing data\"\n end\n \n ## use all samples if @m not provided\n #@m = get_sample_size if not @m\n \n k1, k2 = get_classes\n score = 0.0\n \n @m.times do \n # pick a sample at random\n rs, rk = pick_a_sample_at_random\n \n # find the nearest neighbor for each class\n nbrs = find_nearest_nb(rs, rk)\n \n # calc contribution from neighbors\n score += calc_score(f, rs, rk, nbrs)\n end\n \n s = score / @m\n \n set_feature_score(f, :BEST, s)\n end",
"def find_prime_factors(numb)\n\tfactors = []\n\n\twhile numb > 1\n\t\ttest_num = 2\n\t\twhile true\n\t\t\tif is_factor?(numb,test_num)\n\t\t\t\tfactors << test_num\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ttest_num += 1\n\t\tend\n\t\tnumb = numb/test_num\n\tend\n\n\treturn factors\nend",
"def face_values\n @face_values ||= self.class.face_values\n end",
"def bicipital\n\t\t(@bicipital[0] + @bicipital[1] + @bicipital[2])/3\n\tend",
"def fact_attributes\n @fact_attributes ||= Array.new.tap do |fa|\n fact_class.aggregate_fields.each { |field| fa << field }\n fact_class.calculated_fields.each { |field| fa << field }\n end\n end"
] | [
"0.61245716",
"0.5847045",
"0.5842221",
"0.5842221",
"0.5842221",
"0.5749514",
"0.5730077",
"0.5612473",
"0.5602094",
"0.55718267",
"0.5518438",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53888685",
"0.53868747",
"0.53700614",
"0.52543885",
"0.5184307",
"0.5171602",
"0.51575804",
"0.5157549",
"0.5153937",
"0.5148678",
"0.51358557",
"0.513233",
"0.5122844",
"0.5091347",
"0.5081304",
"0.50627565",
"0.506168",
"0.506168",
"0.506168",
"0.5059825",
"0.4986848",
"0.49582767",
"0.49516025",
"0.49209905",
"0.4919654",
"0.4918155",
"0.49130085",
"0.49097604",
"0.4902566",
"0.4899933",
"0.48884523",
"0.4880507",
"0.4880208",
"0.4879328",
"0.48704532",
"0.4850291",
"0.4833723",
"0.482551",
"0.48252207",
"0.4823675",
"0.4823675",
"0.48222274",
"0.48139843",
"0.4808696",
"0.4806679",
"0.47971985",
"0.47852185",
"0.47804585",
"0.4778364",
"0.47766754",
"0.47547638",
"0.4745279",
"0.47399208",
"0.47399208",
"0.47335362",
"0.471606",
"0.471606",
"0.47128484",
"0.4706214",
"0.47037205",
"0.46962926",
"0.46943796",
"0.46932948",
"0.46921587",
"0.46878043",
"0.46875778",
"0.46782702",
"0.46759668",
"0.46623453",
"0.4661221",
"0.46561316",
"0.46556336",
"0.4655619"
] | 0.62236863 | 0 |
DR PROSITE accession numbers | def dr
field_fetch('DR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def south_african_trust_registration_number; end",
"def south_african_listed_company_registration_number; end",
"def social_security\n @num = 12345\n end",
"def south_african_pty_ltd_registration_number; end",
"def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].join(\"\")\n end",
"def south_african_trust_registration_number\n generate(:string) do |g|\n g.lit('IT')\n g.int(ranges: [10..9999])\n g.lit('/')\n g.int(ranges: [10..9_999_999_999])\n end\n end",
"def listed_company_registration_number; end",
"def access_expression\n setup_register_objs if @user.nil? || @publisher.nil? || @ad.nil?\n \"#{@publisher.id}-#{@ad.id}-#{@access.token}\"\n end",
"def increment_password_reset_page_access_counter\n sorcery_adapter.increment(sorcery_config.reset_password_page_access_count_attribute_name)\n end",
"def south_african_close_corporation_registration_number; end",
"def south_african_id_number; end",
"def trust_registration_number; end",
"def increment_password_reset_page_access_counter\n sorcery_adapter.increment(\n sorcery_config.reset_password_page_access_count_attr_name\n )\n end",
"def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend",
"def routing_number; end",
"def capturar_prox_indece_pdd_adm\n\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n uri = URI( 'http://162.243.215.24/PDV/COUNTERS_get_next')\n resp = Net::HTTP.post_form(uri,'counter'=>\"pdd\" )\n @record=JSON.parse(resp.body)\n @record['id']\n #metodo ok\n end",
"def extract_access_code_from_link\n \turi = URI(\"#{request.protocol}#{request.host_with_port}#{request.fullpath}\")\n \taccess_code = uri.query.split('&')[0].split('=')[1]\n end",
"def polish_taxpayer_identification_number; end",
"def ndp_code; self[:ndp_code].to_i; end",
"def swedish_organisation_number; end",
"def autonomous_system_number; end",
"def num_sites\n if permission.value.positive?\n 'All sites'\n elsif connections.count.zero?\n 'No sites'\n elsif connections.count == 1\n '1 site'\n else\n \"#{connections.count} sites\"\n end\n end",
"def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end",
"def page access tokens_connections\n end",
"def setup_access_list (cfg )\n @access_list = []\n for ip in @cfg[\"controller\"][\"ips_allowed\"]\n @access_list << ip_to_nip(ip)\n end\n end",
"def accounts\n (ENV['RESIDENTS'] || \"tompng gliese035 hanachin_ kimihito_\").split(\" \")\n end",
"def south_african_listed_company_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/06')\n end\n end",
"def pty_ltd_registration_number; end",
"def set_agency_provider\n data = CareerAdvisorWebServices.new(\"admin\",\"nagashri1\").get_code_for_title(params[:id])\n @key = data.present? ? data[0][\"onetsoc_code\"] : '00.000.00'\n\n end",
"def gadz_ans\n (user.gadz_proms_principale.to_i - 1800).to_s\n end",
"def admin_privilages\n @reset_passwords=(admin_params[:can_reset_password]==\"1\") ? \"1\" : \"0\"\n @generate_codes=(admin_params[:can_generate_code]==\"1\") ? \"2\" : \"0\"\n @add_products=(admin_params[:can_add_product]==\"1\") ? \"3\" : \"0\"\n @add_places=(admin_params[:can_add_place]==\"1\") ? \"4\" : \"0\"\n privilages =@reset_passwords+\",\"+@generate_codes+\",\"+@add_products+\",\"+@add_places\n return privilages\n end",
"def proxyusage\r\n\t\t\t`#{BITS::BITSADMIN} /getproxyusage {#{@id}}`\r\n\t\tend",
"def get_unique_accessCode\n code = generate_accessCode\n while Room.exists?(accessCode: code) do\n code = generate_accessCode\n end\n return code\n end",
"def ssn\n safe_attr('va_eauth_pnid')&.delete('-') if safe_attr('va_eauth_pnidtype') == 'SSN'\n end",
"def get_site_count\r\n site_name ? 1 : 0\r\n end",
"def reset_password_reset_page_access_counter\n send(:\"#{sorcery_config.reset_password_page_access_count_attribute_name}=\", 0)\n sorcery_adapter.save\n end",
"def AccessRights=(arg0)",
"def r_key_auth_code\n \"auth_code:#{telephone}\"\n end",
"def index \n#http://libserver3.yale.edu:3000/auth?oid=10590515&type=jpg150&ip=130.132.80.210\n#http://lbdev.library.yale.edu/xml_accesscondition.aspx?a=s_lib_ladybird&b=E8F3FF02-A65A-4A20-B7B1-A9E35969A0B7&c=10590515'\n oid = params[:oid] || \"\"\n\ttype = params[:type] || \"\"\n\tip = params[:ip] || \"\"\n\tnetid = params[:netid] || \"\"\n\t\n\tif oid==\"\" || type==\"\" || ip==\"\"\n\t\trender :text => \"missing parameters - oid:\"+oid+\" type:\"+type+\" ip:\"+ip\n\t\treturn\n end \n\tbase_url = 'http://lbdev.library.yale.edu/xml_accesscondition.aspx?'\n\tparam_a = 'a=s_lib_ladybird'\n\tparam_b = 'b=E8F3FF02-A65A-4A20-B7B1-A9E35969A0B7'\n\tparam_c = 'c=' + oid\n\tfull_url = base_url+param_a+\"&\"+param_b+\"&\"+param_c\n\tlogger.info full_url\n doc = Nokogiri::XML(open(full_url))\n\trule = doc.xpath(\"//schema//object//rule[@type='\"+type+\"']//@code\")\n\tlogger.info rule.to_s\n\treturn_msg = \"default\"\n\tif rule.to_s == \"Yale Only\"\n\t\tif ip_check(ip) == true\n\t\t\treturn_msg = \"authorized\"\n\t\telse\n\t\t\t#if cas netid ok then return_msg = \"authorized\"\n\t\t\t#elsf no cas netid then return_msg = \"try cas\"\n\t\t\t#else unauthorized\n\t\t\tif netid.size == 0\n\t\t\t\treturn_msg = \"unauthorized\"\n\t\t\telse\n\t\t\t\treturn_msg = \"authorized\"\n\t\t\tend\n\t\tend \n\tend\n\tif rule.to_s == \"AD Group Restriction\"\n\t\tgroup = doc.xpath(\"//schema//object//rule[@type='\"+type+\"']//value\")\n\t\treturn_msg = group.to_s\t\n\tend\n\t#TODO other rules here\n\n\t#logger.info \"IP:\"+ip\n\t#logger.info ip_check(ip)\n logger.info \"Host:\"+ request.host_with_port\t\n\trender :text => return_msg\n\treturn\n end",
"def reset_password_reset_page_access_counter\n send(\n :\"#{sorcery_config.reset_password_page_access_count_attr_name}=\", 0\n )\n sorcery_adapter.save\n end",
"def auth_inst_id\n auth[:institution_id]\n end",
"def account_src\n account_src_id\n end",
"def site_data; end",
"def get_grant_info\n # See https://help.nla.gov.au/trove/becoming-partner/for-content-partners/adding-NHMRC-ARC\n # - Funder: Upper case for consistency (in both Funder & PURL)\n # - Grant Num: Upper case for consistency (in both Grant Num & PURL)\n grant_info = []\t\t\t# Ordered list of unique funders & grant numbers\n gwarnings = []\t\t\t# List of warnings\n\n grant_info_rel = {}\t\t\t# Hash for dc.relation\n @dc[:relation].each{|s|\t\t# Format: URL_PREFIX/funder/grant_num\n s.strip.match(PURL_REGEX)\n if [$1, $2, $3].all?{|o| !o.to_s.empty?}\n funder, grant_num = $2.upcase, $3.upcase\n next unless process_grant(funder, grant_num, grant_info, gwarnings, \"dc.relation\", grant_info_rel)\n\n else\n gwarnings << \"dc.relation purl format\"\n end\n }\n\n grant_info_gn = {}\t\t\t# Hash for dc.relation.grantnumber\n @dc[:grantnumber].each{|s|\t\t# Format: funder/grant_num\n s.strip.match(FUNDER_GRANTNUM_REGEX)\n if [$1, $2].all?{|o| !o.to_s.empty?}\n funder, grant_num = $1.upcase, $2.upcase\n next unless process_grant(funder, grant_num, grant_info, gwarnings, \"dc.relation.grantnumber\", grant_info_gn, grant_info_rel)\n\n else\n gwarnings << \"dc.relation.grantnumber format\"\n end\n }\n\n gwarnings << \"dc.relation/dc.relation.grantnumber grants differ\" unless grant_info_rel == grant_info_gn\n [gwarnings, grant_info]\n end",
"def setup4dashboard\n # DST\n count = 0\n count += 1 if @is_unclear_dst == true\n # Guard\n count += 1 if @is_unclear_guard == true\n count += 1 if @inconsistent_policy == true\n\n return count\n end",
"def external_id; end",
"def new_account_number\n return rand(99999999)\n end",
"def new_account_number\n return rand(99999999)\n end",
"def get_access_rank\n guest_user_rank = 4\n user = get_user()\n if user != nil\n current_user = User.find_by user_id: \"#{user}\"\n user_rank = current_user.access_rank\n\n #Handler if user access rank missing\n if user_rank === nil\n flash[:notice] = \"Problem getting user access level.\n Please contact site administrator.\"\n user_rank = guest_user_rank\n end\n\n user_rank\n\n else\n user_rank = guest_user_rank\n end\n end",
"def get_protID(my_gene)\n address=\"http://togows.org/entry/ebi-uniprot/#{my_gene}/accessions.json\"\n response = fetch(address) \n if response # if there is a response to calling that URI\n body = response.body # get the \"body\" of the response\n data = JSON.parse(response.body)\n return data[0]\n end\nend",
"def clientid\n @data['clientid'].to_i\n end",
"def all_site_details\r\n @nsc.sites\r\n end",
"def new_netid\n if Rails.env.development? || Rails.env.test?\n redirect_to \"/auth/developer\"\n else\n target = \"https://#{current_institution.fqdn}/auth/shibboleth/callback\"\n redirect_to \"/Shibboleth.sso/Login?target=#{target}\"\n end\n end",
"def url_visit\n par = case $url.upcase\n when \"LMX\" then \"https://www.linio.com.mx\"\n when \"LCO\" then \"https://www.linio.com.co\"\n when \"LCL\" then \"https://www.linio.cl\"\n when \"LVE\" then \"https://www.linio.com.ve\"\n when \"LAR\" then \"https://www.linio.com.ar\"\n when \"LEC\" then \"https://www.linio.com.ec\"\n when \"LPA\" then \"https://www.linio.com.pa\" \n when \"LPE\" then \"https://www.linio.com.pe\" \n when \"HPMX\" then \"https://www.hponline.com.mx\"\n when \"HPCL\" then \"https://www.hponline.cl\"\n when \"WLCP\" then \"https://tienda.clubpremier.com\"\n when \"AVCO\" then \"http://co.catalog.lifemiles.com/\"\n when \"AVPE\" then \"http://pe.catalog.lifemiles.com/\"\n#batman\n when \"A01_MX\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-mx.linio-staging.com\"\n when \"A01_CO\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-co.linio-staging.com\"\n when \"A01_CL\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-cl.linio-staging.com\"\n when \"A01_VE\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ve.linio-staging.com\"\n when \"A01_AR\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ar.linio-staging.com\"\n when \"A01_EC\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-ec.linio-staging.com\"\n when \"A01_PA\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-pa.linio-staging.com\" \n when \"A01_PE\" then \"http://#{$user_alice01}:#{$pass_alice01}@alice01-pe.linio-staging.com\" \n #cobra\n when \"A02_MX\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-mx.linio-staging.com\"\n when \"A02_CO\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-co.linio-staging.com\"\n when \"A02_CL\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-cl.linio-staging.com\"\n when \"A02_VE\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ve.linio-staging.com\"\n when \"A02_AR\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ar.linio-staging.com\"\n when \"A02_EC\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-ec.linio-staging.com\"\n when \"A02_PA\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-pa.linio-staging.com\" \n when \"A02_PE\" then \"http://#{$user_alice02}:#{$pass_alice02}@alice02-pe.linio-staging.com\" \n #mobile\n when \"A03_MX\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-mx.linio-staging.com\"\n when \"A03_CO\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-co.linio-staging.com\"\n when \"A03_CL\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-cl.linio-staging.com\"\n when \"A03_VE\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ve.linio-staging.com\"\n when \"A03_AR\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ar.linio-staging.com\"\n when \"A03_EC\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-ec.linio-staging.com\"\n when \"A03_PA\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-pa.linio-staging.com\" \n when \"A03_PE\" then \"http://#{$user_alice03}:#{$pass_alice03}@alice03-pe.linio-staging.com\" \n #shop-launch\n when \"A04_MX\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-mx.linio-staging.com\"\n when \"A04_CO\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-co.linio-staging.com\"\n when \"A04_CL\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-cl.linio-staging.com\"\n when \"A04_VE\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ve.linio-staging.com\"\n when \"A04_AR\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ar.linio-staging.com\"\n when \"A04_EC\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-ec.linio-staging.com\"\n when \"A04_PA\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-pa.linio-staging.com\" \n when \"A04_PE\" then \"http://#{$user_alice04}:#{$pass_alice04}@alice04-pe.linio-staging.com\" \n\n when \"A06_MX\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-mx.linio-staging.com\"\n when \"A06_EC\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-ec.linio-staging.com\"\n when \"A06_CL\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-cl.linio-staging.com\"\n when \"A06_CO\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-co.linio-staging.com\"\n when \"A06_PA\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-pa.linio-staging.com\"\n when \"A06_PE\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-pe.linio-staging.com\"\n when \"A06_AR\" then \"https://#{$user_alice06}:#{$pass_alice06}@shop-front06-ar.linio-staging.com\"\n \n else \"Error country\"\n end\n return par\nrescue\n puts \"Error\"\nend",
"def company_number\n 1\n end",
"def gdpr_policy\n end",
"def number_of_internal_links_to_page(link)\n @ilps[link]\n end",
"def ndp_reserved; self[:ndp_reserved].to_i; end",
"def south_african_pty_ltd_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/07')\n end\n end",
"def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end",
"def api_nonce\n\t\t\t8.times.map { [*'0'..'9'].sample }.join\n\t\tend",
"def access_control\n \n end",
"def get_account_number\n @acct_num\n end",
"def access_code=(value)\n\t\t\tcounter = 2\n\t\t\toriginal_value = value\n\t\t\twhile( ( survey = Survey.find_by_access_code(value) ) && \n\t\t\t\t( self.id != survey.id ) )\n\t\t\t\tvalue = [original_value,\"_\",counter].join\n\t\t\t\tcounter += 1\n\t\t\tend\n\t\t\tsuper\t\t#(value)\n\t\tend",
"def js_rpts_2_acct(rpt)\n return rpt.split('/')[-3]\n end",
"def id_cliente\n SystemConfiguration::SecureVariable.get_value('payments.santander.id_cliente')\n end",
"def cert_num\n \t# training_id = params[:training_id]\n \tdb = Mdb.open(\"/Users/corrinasthename/Desktop/cs169/BCGC.mdb\")\n trainings = db[:tblTraining]\n end",
"def accounts_with_usage; end",
"def rp_id; end",
"def openid_client_id; end",
"def counter_key\n \"/url_shortener/#{App.environment}/counter1\"\n end",
"def admin_final_page_count_list\n %w( [email protected] )\n end",
"def test_access\n oid = 10590515\n\ttype = \"jpg150\"\n\tip = request.remote_ip\n\thost = request.host_with_port\n\tfull_url = \"http://\"+host+\"/auth?oid=\"+oid.to_s+\"&type=\"+type+\"&ip=\"+ip\n\tlogger.info \"auth path:\"+full_url\n\tresource = RestClient::Resource.new(full_url)\n\tpage = resource.get()\n\tpage = page.to_s\n\tlogger.info page\n\treturn_msg = \"default\"\n\tif page == \"authorized\"\n\t\treturn_msg = \"you we able to pass the test access conditions\"\n\telsif page == \"unauthorized\"\n\t\treturn_msg = \"try cas\"\n\telse \n\t\treturn_msg = \"last else condition, this shouldn't happen\"\n\tend\t\n\trender :text => return_msg\n\treturn\n end",
"def numid; end",
"def admin_id\n 9\n end",
"def private_ip_v4_address; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def grants_gov_pi\n self.find_all { |user| !user[1][:primary_department_code].nil? &&\n !user[1][:phones].find{|phone| phone[:type]=='Work'}.nil? &&\n !user[1][:emails].find{|email| email[:type]=='Work'}.nil? &&\n !user[1][:era_commons_user_name].nil?\n }.shuffle[0][0]\n end",
"def site_usage\n BrickFTP::API::SiteUsage.find\n end",
"def site_usage\n BrickFTP::API::SiteUsage.find\n end",
"def cap_ids\n CAP_CLIENT.profile_ids\nend",
"def segmentation_anonymous_id_cookie\n \"sanmid\"\n end",
"def index \n @sims_biga_licenses = SimsBigaLicense.order(cnh_pes_id: :asc).page(params[:page]).per(20) \n authorize @sims_biga_licenses \n end",
"def moreLicenses\n unless current_user.clearance>=2&¤t_user.organization.numLicenses-current_user.organization.users.length+1>=3\n store_location\n redirect_to current_user\n end\n end",
"def renewal_eligiblity_determination\n end",
"def access_key\n configatron.ramazon.access_key\n end",
"def get_access_url(app_id)\n return sprintf(REDIRECT_URL, app_id)\n end",
"def index\n @devis = current_user.devis\n end",
"def id_site\n @id_site ||= (user_configuration_from_key('id_site') || 1)\n end",
"def set_auth_id(node)\n siblings = node.search(\"./preceding-sibling::*[not(@code='0' or @code='2')]\")\n\n auth_id = node.parent.at_xpath(\"subfield[@code='0']\").inner_text if siblings.empty?\n\n auth_id\n end",
"def link\n id = session[:id].to_s\n url =\"http://ourco2.org/dopplr/?userid=\"+id\n redirect_to \"https://www.dopplr.com/api/AuthSubRequest?scope=http://www.dopplr.com&next=\"+url+\"&session=1\"\n end",
"def calc_access\n perf_acc = performances.collect{|p| p.access_determination }\n # FIXME: for some inexplicable reason this hangs indefinitely\n # track_acc = tracks.collect{|t| t.access_determination }\n tracks = performances.collect{|p| p.tracks}.flatten\n track_acc = tracks.collect{|t| t.access_determination}.flatten\n work_acc = tracks.collect{|t| t.works }.flatten.uniq.collect{|w| w.access_determination }\n all = (perf_acc + track_acc + work_acc).uniq\n if all.include? AccessDeterminationHelper::RESTRICTED_ACCESS\n AccessDeterminationHelper::RESTRICTED_ACCESS\n elsif all.include? AccessDeterminationHelper::IU_ACCESS\n AccessDeterminationHelper::IU_ACCESS\n elsif all.include? AccessDeterminationHelper::DEFAULT_ACCESS\n AccessDeterminationHelper::DEFAULT_ACCESS\n elsif all.include? AccessDeterminationHelper::WORLD_WIDE_ACCESS\n AccessDeterminationHelper::WORLD_WIDE_ACCESS\n else\n AccessDeterminationHelper::DEFAULT_ACCESS\n end\n end",
"def site_data_hash; end",
"def validate_accession_number(accession_no,seq_type)\n is_valid_accession_no = false\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=AEE34859.1&api_key=e2eded7b94c28c0734a03b44d4a2d5a15308\n # check NCBI. to determine the accession_no is correct, grap the origin aa sequence and compare\n # documents about ncbi api\n # https://www.ncbi.nlm.nih.gov/books/NBK25500/#_chapter1_Downloading_Document_Summaries_\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&api_key=db1a6c70014467857721f83996c2c9d4a207&db=protein&id=AEE34859.1\n api_key = \"db1a6c70014467857721f83996c2c9d4a207\"\n ncbi_api = nil\n if seq_type == \"aa\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?api_key=#{api_key}&db=protein&id=#{accession_no}\"\n elsif seq_type == \"nt\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?api_key=#{api_key}&db=nuccore&id=#{accession_no}\"\n end\n\n ncbi_res = open(ncbi_api) # StringIO object\n if ncbi_res.status.include? \"200\"\n doc = Nokogiri::XML(ncbi_res.read)\n if doc.xpath('//ERROR').length == 0\n\n is_valid_accession_no = true\n\n end\n end\n\n return is_valid_accession_no\n\n end",
"def current_access_level\n @wfd_current_fal + 1\n end",
"def decide\n @site = current_account.sites.find_or_initialize_by_url(checkid_request.trust_root)\n @site.persona = current_account.personas.find(params[:persona_id] || :first) if sreg_request || ax_store_request || ax_fetch_request\n end",
"def show\n @PUBLIC_AGENCY = find_agency_by_id( params[ :id ] )\n increment_views_amount( @PUBLIC_AGENCY )\n end"
] | [
"0.6247935",
"0.5839503",
"0.57684594",
"0.5742776",
"0.55309343",
"0.5496852",
"0.54824",
"0.5463048",
"0.5459243",
"0.5455945",
"0.54446405",
"0.54314387",
"0.54140896",
"0.539779",
"0.5333654",
"0.5308027",
"0.5291795",
"0.52478707",
"0.52414477",
"0.5237498",
"0.5215116",
"0.5204445",
"0.5190792",
"0.5182709",
"0.5175629",
"0.5172566",
"0.5139818",
"0.51354885",
"0.51251155",
"0.5115832",
"0.51069105",
"0.51018965",
"0.50795215",
"0.5034533",
"0.50166625",
"0.4984146",
"0.49757552",
"0.4973478",
"0.49635756",
"0.4962882",
"0.4957802",
"0.49560574",
"0.49554518",
"0.49346852",
"0.49296817",
"0.49169874",
"0.49120548",
"0.49120548",
"0.49115625",
"0.49090886",
"0.49040294",
"0.490099",
"0.48936215",
"0.48914093",
"0.4884905",
"0.4883514",
"0.48777103",
"0.48700076",
"0.48694968",
"0.48693034",
"0.4867029",
"0.485461",
"0.48535487",
"0.48465613",
"0.48451808",
"0.48416588",
"0.48372796",
"0.48319504",
"0.48272288",
"0.48266342",
"0.4824629",
"0.48231527",
"0.48223907",
"0.48221496",
"0.48199102",
"0.4819897",
"0.48157686",
"0.48157686",
"0.48157686",
"0.48157686",
"0.48157686",
"0.48149458",
"0.4812489",
"0.4812489",
"0.48112977",
"0.48097542",
"0.48066342",
"0.48033348",
"0.48030728",
"0.48000267",
"0.47998077",
"0.47861093",
"0.47827244",
"0.47789982",
"0.4773141",
"0.47638947",
"0.47630665",
"0.4762187",
"0.47569638",
"0.4754486",
"0.47506127"
] | 0.0 | -1 |
SD Short description/name of the gene | def sd
field_fetch('SD')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_description\n description\n end",
"def description\n @sg.description\n end",
"def description\n @sg.description\n end",
"def shortdesc\n @obj['shortdesc']\n end",
"def shortname\n attributes['shortName']\n end",
"def shortdesc\n @data['shortdesc']\n end",
"def short_description\n if respond_to?(:short_desc)\n short_desc\n else\n tag.to_s\n end\n end",
"def name; nutrdesc; end",
"def name\n short_code\n end",
"def gene_d(floc)\n \"#{compart_d(floc)}/#{@gene.name}\"\n end",
"def short_name\n puts \"Jai shree mahakal\"\n end",
"def description\n pricing_db_hp_short_description.description\n end",
"def to_s\n short || name[0]\n end",
"def short_description\n object.description[0..40] if object.description.present?\n end",
"def to_s\n short_name\n end",
"def detailed_name\n \"#{label} ( #{name}_V#{version} )\"\n end",
"def indefinite_short_description\n return \"something\"\n end",
"def display_name\n\t\tself.short_name\n\tend",
"def name\n description\n end",
"def name\n description\n end",
"def gene_id\n description.andand.match(/ GN=(\\w+) ?/)[1]\n end",
"def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def shortName\n self.short_name\n end",
"def rolf_desc\n name_descriptions(:peltigera_alt_desc)\n end",
"def long_name\n if @description\n @name + ' ' + @description\n else\n @name\n end\n end",
"def display_description\n @name.capitalize + \" stands here\" + ((item_for :weapon) ? (\", wielding \" + item_for(:weapon).short_display_string) : \"\") + \".\"\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def short_description\n if @model\n return (@short_description || @model.short_description.to_s)\n end\n return @short_description.to_s\n end",
"def get_meta_description(include_color, include_defaults)\n \"Soletron, which is owned by Superbowl MVP Santonio Holmes, offers the finest #{self.name_from_taxon} Products\"\n end",
"def description\n return summary\n end",
"def name\n return 'AedgSmallToMediumOfficeExteriorLighting'\n end",
"def short_name\n short.to_s.sub(/^(-.).*$/, \"\\\\1\")\n end",
"def short_description\n\t\tself.description[0..200] + '...'\n\tend",
"def name\n return 'AedgSmallToMediumOfficeExteriorDoorConstruction'\n end",
"def descriptive_label\n @attributes[:descriptive_label]\n end",
"def short\n rid\n end",
"def short_name\n self.get_column(\"Entry_ID/Short_Name\")\n end",
"def info\n title + \" (\" + genotype_info + ' / ' + phenotype_info + ')'\n end",
"def short_name(how_short = 55)\n\t\tstr = self.name\n\t\tshortname = (str.length > how_short) ? (str[0..how_short] + \"...\") : str\n\t\treturn shortname\n\tend",
"def description\n end",
"def description\n end",
"def description\n \"#{sku.product.name} (#{sku.short_desc})\"\n end",
"def text_name\n summary.to_s\n end",
"def name\r\n descr.sub(/\\n.*/m, '')\r\n end",
"def to_s\n descr\n end",
"def description\n \"SES #{self.class.format(name)} (v#{version})\"\n end",
"def og_desc(desc)\n\t\tbase_desc = \"Informing and entertaining the global internet generation.\"\n\t\tif desc.empty?\n\t\t\tbase_desc\n\t\telse\n\t\t\tdesc.to_s\n\t\tend\n\tend",
"def name\n source.longname\n end",
"def heading\n\t\t\"Character Descriptors\"\n\tend",
"def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end",
"def briefingName \n \"briefingName\" \n end",
"def description\n reading = @pinyin.empty? ? @pinyin_diacritic : @pinyin\n desc_str = \"%s %s [%s], %s\" % [@headword_trad, @headword_simp, reading, meaning_txt]\n end",
"def descr\n return text_get(2, id)\n end",
"def get_name(somegeneID)\n if self.gene_id.include? somegeneID\n return self.gene_name[self.gene_id.index(somegeneID)]\n end\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return 'Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.'\n end",
"def modeler_description\n return \"Replace this text with an explanation for the energy modeler specifically. It should explain how the measure is modeled, including any requirements about how the baseline model must be set up, major assumptions, citations of references to applicable modeling resources, etc. The energy modeler should be able to read this description and understand what changes the measure is making to the model and why these changes are being made. Because the Modeler Description is written for an expert audience, using common abbreviations for brevity is good practice.\"\n end",
"def gensped_oneoption\n\t @gallery_title = \"$pr for $va for \" << @first_input.longer_descriptor\n\t\t@title = \"$pr for $va Worth of \" << @first_input.longer_descriptor << \" from \" << @first_input.biz_name\n\t\t@descriptor = @first_input.longer_descriptor\n\t\t@short_descriptor = @first_input.longer_descriptor\n\t\t@writeupheader = \"####The Deal\"\n\t\t@writeup = \" * $pr for $val worth of \" << @first_input.longer_descriptor.downcase\n\tend",
"def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end",
"def get_full_name\n self.description.to_s\n end",
"def name\n return item_info.name + quality_txt\n end",
"def title\n @descriptive_detail.title\n end",
"def main_description; end",
"def description\n zombie_check\n @metadata.description(@name)\n end",
"def get_full_name\n description\n end",
"def name\n return \"Set Residential Hot Water Distribution\"\n end",
"def description\n end",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_drug.details\n end",
"def description\n \"\"\n end",
"def short\n @short\n end",
"def display_id\n organism_name = self.dnafrag.genome_db.taxon_id\n genomedb = self.dnafrag.genome_db.genome_db_id\n coord = self.dnafrag.slice.seq_region.coord_system.name\n dna_name = self.dnafrag.name\n start = self.dnafrag_start\n stop = self.dnafrag_end\n \n return \"#{organism_name}:#{genomedb}:#{coord}:#{dna_name}:#{start}:#{stop}:#{self.dnafrag_strand}\"\n \n end",
"def description\n \"have #{@name.inspect} tag #{extra_description}\".strip\n end",
"def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end",
"def get_full_name\n description.to_s\n end",
"def display_name\n phylum_name\n end",
"def base_description(_); end",
"def shortname\n @shortname.nil? ? @name : @shortname\n end",
"def description\n ensure_full_data!\n @gapi[\"description\"]\n end",
"def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end",
"def display_name\n NAME\n end",
"def display_name\n NAME\n end",
"def description\n \"Derelict::VirtualMachine '#{name}' from #{connection.description}\"\n end",
"def get_full_name\n \"#{self.name} (desc.: #{self.description})\"\n end",
"def species\n return \"human\"\n end",
"def description\n @description ||= 'Test Kitchen ec2-net-utils secondary ENI ' \\\n \"for #{instance.id}\"\n end",
"def name\n self.species\n end",
"def name\n metadata.fetch(:example_name, example.description)\n end",
"def gi_digital_mag_label\n $tracer.trace(__method__)\n return ToolTag.new(h2(\"/Game Informer, Digital/\"), __method__)\n end",
"def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end",
"def name\n return 'AedgSmallToMediumOfficeRoofConstruction'\n end"
] | [
"0.6871859",
"0.67059684",
"0.67059684",
"0.66508013",
"0.6635181",
"0.65627384",
"0.6555399",
"0.65425926",
"0.6536048",
"0.65080106",
"0.65027714",
"0.64793545",
"0.6476851",
"0.6422271",
"0.6399634",
"0.63917613",
"0.6390918",
"0.6358564",
"0.635655",
"0.635655",
"0.63550234",
"0.63499504",
"0.63364",
"0.6294778",
"0.62774867",
"0.62749535",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6270532",
"0.6258358",
"0.62438494",
"0.62225115",
"0.6215949",
"0.6207732",
"0.61936605",
"0.6172567",
"0.6169002",
"0.61624736",
"0.61613894",
"0.61405313",
"0.6139344",
"0.6130473",
"0.6130473",
"0.6125556",
"0.60962397",
"0.60907555",
"0.60890067",
"0.6076382",
"0.607563",
"0.6075099",
"0.6070797",
"0.60677445",
"0.603507",
"0.60292304",
"0.6025836",
"0.60256976",
"0.6022979",
"0.6022979",
"0.60215",
"0.6021395",
"0.6020672",
"0.60129267",
"0.60075253",
"0.6000802",
"0.60005957",
"0.5994535",
"0.59928834",
"0.59921074",
"0.5988782",
"0.59840846",
"0.59840846",
"0.5983601",
"0.5973932",
"0.59605825",
"0.5955034",
"0.5952263",
"0.59401095",
"0.5935791",
"0.5915885",
"0.5904601",
"0.59044164",
"0.5903802",
"0.589939",
"0.58988994",
"0.58988994",
"0.5896922",
"0.58878416",
"0.5886059",
"0.5885817",
"0.5883658",
"0.5876203",
"0.5875966",
"0.58684945",
"0.586681"
] | 0.0 | -1 |
BS TRANSFAC SITE positions and accession numbers | def bs
field_fetch('BS')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swedish_organisation_number; end",
"def spanish_citizen_number; end",
"def all_site_details\r\n @nsc.sites\r\n end",
"def site_data; end",
"def st_members \n @st_members = SiteText.second\n end",
"def snv_position_in_site_1_pwm\n if orientation_1 == :direct\n - pos_1\n else\n pos_1 + length - 1\n end\n end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def sites; end",
"def spanish_foreign_citizen_number; end",
"def process_site(site); end",
"def position_address\n \"#{@data['SIDO']} #{@data['L_SIGUN_GU']} #{@data['L_DONG']} #{@data['GIBUN']}\"\n end",
"def czech_organisation_number; end",
"def get_site_info\n @welcome = TextContent.welcome\n @footer_text = TextContent.footer_text\n @menu = 'home'\n# @product_lines = ProductLine.order('title asc')\n @product_lines = ProductLine.show_in_menu.order('title asc')\n\n\n end",
"def site=(_arg0); end",
"def site=(_arg0); end",
"def site=(_arg0); end",
"def pos_index_header\n pos_page_body\n end",
"def links_iev2iec60050part(xmldoc)\n parts = Set.new\n xmldoc.xpath(IEVPATH).each do |x|\n m = x&.at(\".//locality[@type = 'clause']/referenceFrom\")&.text\n &.sub(/^(\\d+).*$/, \"\\\\1\") or next\n\n parts << m\n x[\"citeas\"] = @c.decode(x[\"citeas\"]).sub(/60050/, \"60050-#{m}\")\n x[\"bibitemid\"] = \"IEC60050-#{m}\"\n end\n parts\n end",
"def clans_with_site\n (sites.collect {|s| s.clan}).compact\n end",
"def site_data_hash; end",
"def locusize\n LocusNom.new(self).parsed\n end",
"def get_site_count\r\n site_name ? 1 : 0\r\n end",
"def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend",
"def num_sites\n if permission.value.positive?\n 'All sites'\n elsif connections.count.zero?\n 'No sites'\n elsif connections.count == 1\n '1 site'\n else\n \"#{connections.count} sites\"\n end\n end",
"def deco_pos; end",
"def number_of_splice_sites\n unless defined?(@number_of_splice_sites)\n @number_of_splice_sites = \n field_fetch('Number of splice sites', @d0).to_i\n end\n @number_of_splice_sites\n end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def print_int_sites\n\t\tputs \"\\nSummary Report of the Internal Hosted Site\"\n\t\tsites=get_int_sites\n\t\tsites.each do |site|\n\t\t\tputs site\n\t\tend\n\t\treturn nil\n\tend",
"def page_sys_data_dictionary\n 7\n end",
"def locale_idx; end",
"def import_bien b\n \n # Good location\n good_address = {}\n\tif b['LOCALISATION']['VISIBLE'].to_s == \"true\"\n\t\tloc = BienEmplacement.new\n\t\tloc.pays = \"France\"\n\t\tloc.code_postal = b['LOCALISATION']['CODE_POSTAL']\n\t\tloc.ville = b['LOCALISATION']['VILLE']\n\telse\n\t\tloc = nil\n\tend\n\n\t# Category & Transaction type\n\tcat_text = find_cat(b)\n if(cat_text.nil? or b[cat_text].nil?)\n\t Logger.send(\"warn\",\"[AC3] Categorie non connue pour le bien ref : #{b[\"INFO_GENERALES\"][\"AFF_NUM\"]}\")\n\t @result[:description] << \"[AC3] Categorie non connue pour le bien ref : #{b[\"INFO_GENERALES\"][\"AFF_NUM\"]}\"\n return\n end\n\tcat_root = b[cat_text]\n\tcat = BienType.find_or_create cat_text.up_first\n\t\n\tLogger.send(\"warn\",\"Categorie : #{cat_text}\")\n\t\n\tif !(b[\"VENTE\"].nil?)\n\t transaction_type = BienTransaction.where(:nom => 'Vente').first\n transactionTypeIndex = \"VENTE\"\n price = b[\"VENTE\"][\"PRIX\"]\n elsif !(b[\"LOCATION\"].nil?)\n transaction_type = BienTransaction.where(:nom => 'Location').first\n transactionTypeIndex = \"LOCATION\"\n b[\"LOCATION\"][\"PROVISION_SUR_CHARGES\"] ||= 0\n price = b[\"LOCATION\"][\"LOYER\"].to_i + b[\"LOCATION\"][\"PROVISION_SUR_CHARGES\"].to_i\n # elsif !(b[\"SAISONNIER\"].nil?)\n # transaction_type = Immo::TransactionType.get 'Saisonnier'\n # transactionTypeIndex = \"SAISONNIER\"\n # price = 0\n else\n\t Logger.send(\"warn\",\"[AC3] Type de transaction nul pour le bien ref : #{b[\"INFO_GENERALES\"][\"AFF_NUM\"]}\")\n\t @result[:description] << \"[AC3] Type de transaction nul pour le bien ref : #{b[\"INFO_GENERALES\"][\"AFF_NUM\"]}\"\n return\n end\n\n\t# find if good already exist, unless create it\n\tref = b[\"INFO_GENERALES\"][\"AFF_NUM\"] \n\tnb = Bien.where(:reference => ref).select{ |b| b.passerelle.installation == @passerelle.installation }.first\n nb = Bien.new if nb.nil?\n\n\tnb.is_accueil = false\n\t#nb.is_accueil = true if b[\"TEXTE_MAILING\"] && (b[\"TEXTE_MAILING\"].to_s.downcase =~ /.*virtual.*touch.*/)\n\t\n\t# update attributes\n\tnb.passerelle = @passerelle\n\tnb.reference = ref\n nb.bien_type = cat\n nb.bien_transaction = transaction_type\n nb.bien_emplacement = loc\n\t\n\tnb.nb_piece = cat_root['NBRE_PIECES'].to_i\n nb.nb_chambre = cat_root['NBRE_CHAMBRES'].to_i\n nb.surface = cat_root['SURFACE_HABITABLE'].to_i\n nb.surface_terrain = cat_root['SURFACE_TERRAIN'].to_i\n nb.titre = b['INTITULE']['FR']\n\t\n nb.prix = price\n nb.description = b['COMMENTAIRES']['FR']\n nb.valeur_dpe = cat_root['CONSO_ANNUEL_ENERGIE']\n\tnb.classe_dpe = cat_root['CONSOMMATIONENERGETIQUE']\n\tnb.valeur_ges = cat_root['VALEUR_GES']\n\tnb.class_ges = cat_root['GAZEFFETDESERRE']\n nb.statut = 'new'\n nb.save!\n\t\n\t# If new images : Drop old images, add current images\n if b['IMAGES'] && b['IMAGES']['IMG']\n # un-attach old\n\t nb.bien_photos.each{ |photo|\n\t\t photo.bien = nil\n\t\t photo.save!\n\t }\n pl = b['IMAGES']['IMG']\n \n # When there only exists a single image, +pl+ will directly be the hash\n pl = [pl] unless pl.kind_of? Array\n # Map photo-hashes to medias, filter out failures, and add medias to good\n\t number = 0\n pl.map { |p| import_remote_media(p,(number += 1),nb) }\n end\n nb.save!\n\n return true\n\n return\n end",
"def satellitenumber\n @line1[02...07].to_i\n end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def site; end",
"def nasa_space_craft; end",
"def autonomous_system_number; end",
"def sitemap_index_links\n each_sitemap_index_link.to_a\n end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def summary_site\n \t\tAPI.get_site_wordcount\n \tend",
"def setup_abst_info(record)\n text = []\n record.find_all{|f| f.tag === \"520\" }.each do |field|\n textstr = ''\n field.each do |sf|\n textstr << sf.value + ' ' unless [\"c\", \"2\",\"3\",\"6\"].include?(sf.code)\n end\n text << textstr\n end\n Rails.logger.debug \"********es287_dev #{__FILE__} #{__LINE__} #{__method__} #{text[0]}\"\n text\n end",
"def site_info\n # @project.project_site_informations.map do |psi|\n # move_down 20\n # start_new_page\n # si = [[\"Project Site Information\"]]\n # si = si +\n # [ [\"Project Name\",psi.project.project_name, \"Site Name\",psi.project_site.site_name],\n # [\"Area Length\",psi.area_length,\"Area_Width\",psi.area_width],\n # [\"Area Description\",psi.area_description,\"Surface Protection?\",psi.surface_protection_required.to_s],\n # [\"Underground Obstacles?\",psi.under_ground_obstacles_yn.to_s,\"Structural Removal?\",psi.structural_removal_required.to_s],\n # [\"Bobcat Accessible?\",psi.bobcat_accessible.to_s,\"PVT Locator?\",psi.pvt_locator_required.to_s],\n # [\"Construction Fence?\",psi.construction_fence_required.to_s,\"Soil Condition\",psi.soil_condition],\n # [\"Client Fence Reinstall?\",psi.client_fence_dismantle_reinstall_required.to_s,\"Drill Rig Access?\",psi.drill_rig_access.to_s],\n # [\"Rock Excavation?\",psi.rock_excavation_required.to_s,\"Skytrack Boomlift Access?\",psi.skytrack_boomlift_access.to_s],\n # [\"Hang Dig?\",psi.hand_dig_required.to_s,\"Geotech Report Possessed?\",psi.geotech_report_in_possession.to_s],\n # [\"Dirt Haul Off?\", psi.dirt_haul_off_required.to_s,\"Crane Access?\",psi.crane_access.to_s],\n # [\"Tree Vegetation?\", psi.tree_vegetation_removal_required.to_s,\"Concrete Truck Access?\",psi.concrete_truck_access.to_s],\n # [\"Sloped Area?\",psi.area_is_sloped.to_s,\"Site Survey Required?\", psi.site_survey_required.to_s]\n # ]\n # table si do\n # columns(0..3).rows(1..-1).width = 135\n # column(0).font_style = :bold\n # column(2).font_style = :bold\n # rows(0..-1).size = 10\n # column(0).background_color = \"55b9fc\"\n # column(1).background_color = \"92d2fc\"\n # column(2).background_color = \"55b9fc\"\n # column(3).background_color = \"92d2fc\"\n # end\n # end\n end",
"def anatomic_site_params\n params[:anatomic_site]\n end",
"def siteName(sample)\n s = sample\n s = s.gsub(\"GS0\",\"GS\")\n s = s.gsub(\"GS-\",\"GS\")\n s = s.gsub(\"GOS\", \"GS\")\n s = s.gsub(/^0[0-9]+-/,\"\")\n s = s.gsub(\"IOSM\",\"\")\n s = s.gsub(\"IOLG\",\"\") \n s = s.gsub(\"IOVIR\",\"\")\n s = s.gsub(\"XLRVAL\",\"\")\n s = s.gsub(\"viral\",\"\")\n s = s.gsub(\"LG\",\"\") \n return s.split(\"-\").first\nend",
"def priority\n sites = %w[\n Pixiv Twitter\n ArtStation BCY Deviant\\ Art Hentai\\ Foundry Nico\\ Seiga Nijie pawoo.net Pixiv\\ Fanbox Pixiv\\ Sketch Tinami Tumblr\n Ask.fm Booth.pm Facebook Fantia FC2 Gumroad Instagram Ko-fi Livedoor Lofter Mihuashi Mixi.jp Patreon Piapro.jp Picarto Privatter Sakura.ne.jp Stickam Skeb Twitch Weibo Youtube\n Amazon Circle.ms DLSite Doujinshi.org Erogamescape Mangaupdates Melonbooks Toranoana Wikipedia\n ]\n\n sites.index(site_name) || 1000\n end",
"def pos_rseg_header\n pos_page_body\n end",
"def schumann; end",
"def layover_codes\n %w[ATL ORD DFW DEN]\n end",
"def site_header\n @attributes[:site_header]\n end",
"def instability_index\n @instability_index ||=\n begin\n instability_sum = 0.0\n i = 0\n while @seq[i+1] != nil\n aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym]\n if DIWV.key?(aa) && DIWV[aa].key?(next_aa)\n instability_sum += DIWV[aa][next_aa]\n end\n i += 1\n end\n round((10.0/amino_acid_number.to_f) * instability_sum, 2)\n end\n end",
"def mambo_no_5; end",
"def alpha3_bibliographic\n self[0]\n end",
"def alpha3_bibliographic\n self[0]\n end",
"def pos_header\n @position - 2\n end",
"def variants_idx; end",
"def isbn; end",
"def addresses; end",
"def getPosATL _args\n \"getPosATL _args;\" \n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end",
"def current_comic_number\r\n \tcomic_number = Array.new(sorted_articles.reverse)\r\n \tcomic_number.index(item) + 1\r\n end",
"def admin_final_page_count_list\n %w( [email protected] )\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 2\n # conta corrente 5\n # digito da conta 1\n # complemento 8\n \"#{agencia}#{codigo_beneficiario}#{''.rjust(uso_exclusivo_header, ' ')}\"\n end",
"def pos_partial_page_header\n pos_fil_header + 4\n end",
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def obtain_target_from_seq(bioseq_seq)\r\n #we are going to keep all the targets from each gene,\r\n #hash of hashes :)\r\n targets=Hash.new\r\n len_bioseq = bioseq_seq.length + 1\r\n nstrand_targets = []\r\n pstrand_targets = []\r\n for i in (0..bioseq_seq.length-5)\r\n if bioseq_seq.complement[i..i+5] == \"cttctt\"\r\n nstrand_targets << [i,i+5]\r\n end\r\n if bioseq_seq[i..i+5] == \"cttctt\"\r\n pstrand_targets << [i,i+5]\r\n end\r\n end\r\n #im going to obtein the exon sites\r\n bioseq_seq.features.each do |feature|\r\n position = feature.position\r\n #not remote entries\r\n next unless (feature.feature == 'exon' ) && (not position =~ /[A-Z]/)\r\n exon_id = feature.qualifiers[0].value.gsub('exon_id=', '')\r\n #we can find exons in the the complement or the postive strand, so the way for obtaining the data is different\r\n #i wanna keep the strand forward or reverse\r\n if position =~/complement/\r\n exon_site_negative=position.tr('complement()',\"\")\r\n aux=exon_site_negative =~ /\\./ \r\n #we have to change the start and final point, the ebi documentation shows --> x..y, y is the start point and x is the final point\r\n #location 1 --> l1 \r\n #location 2 --> l2\r\n l1= len_bioseq - exon_site_negative[0,aux].to_i\r\n l2= len_bioseq - exon_site_negative[aux+2,exon_site_negative.length].to_i\r\n exon_site_negative=[l2,l1] # they are the location of the exons\r\n #we are going to check if the target that we did before is in the exon site\r\n is_inside_exon = check_target_in_exon(exon_id,nstrand_targets,'reverse',len_bioseq,exon_site_negative)\r\n #is_inside_exon will be a hash with positions, exon_id and the strand for the gff file\r\n unless is_inside_exon.nil? #if the hash is not nil i could keep it in other hash\r\n targets = targets.merge(is_inside_exon)\r\n end\r\n else\r\n exon_site_positive=position\r\n aux=exon_site_positive =~ /\\./ \r\n l1= exon_site_positive[0,aux].to_i\r\n l2= exon_site_positive[aux+2,exon_site_positive.length].to_i\r\n exon_site_positive=[l1,l2]\r\n is_inside_exon = check_target_in_exon(exon_id,pstrand_targets,'forward',len_bioseq,exon_site_positive)\r\n #is_inside_exon will be a hash with positions, exon_id and the strand for the gff file\r\n unless is_inside_exon.nil? #if the hash is not nil i could keep it in other hash\r\n targets = targets.merge(is_inside_exon)\r\n end\r\n end\r\n end\r\n return targets\r\nend",
"def tip_site\n self.tips[0]\n end"
] | [
"0.55317426",
"0.5526681",
"0.55208826",
"0.5506148",
"0.5449337",
"0.54483455",
"0.54230267",
"0.54230267",
"0.54230267",
"0.54230267",
"0.54230267",
"0.5302657",
"0.5225737",
"0.52257025",
"0.5176966",
"0.5107558",
"0.510054",
"0.510054",
"0.510054",
"0.50657296",
"0.5050069",
"0.5044616",
"0.5036025",
"0.5026539",
"0.5015753",
"0.49835718",
"0.4969683",
"0.49663308",
"0.4962527",
"0.49563128",
"0.49563128",
"0.49563128",
"0.49563128",
"0.49563128",
"0.49563128",
"0.49520013",
"0.495014",
"0.4943747",
"0.49325225",
"0.49288607",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49257994",
"0.49206927",
"0.49178174",
"0.48946467",
"0.48910266",
"0.48910266",
"0.48910266",
"0.48910266",
"0.488993",
"0.48899055",
"0.4870003",
"0.4856109",
"0.4855208",
"0.4837295",
"0.48319605",
"0.48290205",
"0.4828205",
"0.4825694",
"0.48237503",
"0.481855",
"0.48011962",
"0.48011962",
"0.48006952",
"0.47956142",
"0.4794842",
"0.47817057",
"0.4780944",
"0.4778663",
"0.4776632",
"0.47747585",
"0.47721893",
"0.47700155",
"0.4767248",
"0.47668102",
"0.47590747"
] | 0.0 | -1 |
CO COMPEL accession number | def co
field_fetch('CO')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def an_numeric_component\n @record.eds_accession_number.split('.').last\n end",
"def south_african_close_corporation_registration_number; end",
"def disc_number\n @ole.DiscNumber\n end",
"def company_number\n 1\n end",
"def south_african_listed_company_registration_number; end",
"def south_african_id_number; end",
"def numid; end",
"def autonomous_system_number; end",
"def czech_organisation_number; end",
"def ndp_code; self[:ndp_code].to_i; end",
"def number_for_citation_node(xref_node)\n refid = xref_node['rid']\n ref = reference_by_id(refid)\n ref && ref[:number]\n end",
"def south_african_pty_ltd_registration_number; end",
"def claim_number\n @eob.claim_number.to_s\n end",
"def polish_taxpayer_identification_number; end",
"def identifier_value\n user.icn\n end",
"def listed_company_registration_number; end",
"def number\n\t\tname.gsub(/^rfc/i, '').to_i\n\tend",
"def oclcnum(extract_fields = \"035a\")\n extractor = MarcExtractor.new(extract_fields, :separator => nil)\n\n lambda do |record, accumulator|\n list = extractor.extract(record).collect! do |o|\n Marc21Semantics.oclcnum_extract(o)\n end.compact\n\n accumulator.concat list.uniq if list\n end\n end",
"def identifier\n num\n end",
"def sort_by_accession_number(model)\n return unless model.column_names.include?(\"accession_number\")\n\n \"#{model.table_name}.accession_number ASC\"\n end",
"def swedish_organisation_number; end",
"def read_number\n return 0 if @crl_number_file.nil?\n\n read_data(@crl_number_file).to_i\n end",
"def identifier_code\n 'ICN'\n end",
"def acces_nome\r\n @nome\r\n end",
"def tc_number(accounting_element)\n\t\t\t\t payment_form = accounting_element[:payment_info][:payment][:form]\n\t\t\t\t if payment_form == \"CC\" then\n\t\t\t\t return accounting_element[:payment_info][:payment][:cc_info][:payment_card][:@number]\n\t\t\t\t else\n return \"\"\n\t\t\t\t end\n\t\t\t end",
"def getinvoicenumber\r\n @invoicenumber\r\n end",
"def read_number\n @db.get_first_value 'SELECT number from crl_number'\n end",
"def ticket_number(accounting_element)\n\t \taccounting_element[:document_info][:document][:@number]\n\t end",
"def bib_number\n get_id_from_lane_assignment(competition, heat, lane) || 0\n end",
"def po_num\n unescape params['x_po_num']\n end",
"def credit_card_number; end",
"def id_number; end",
"def number\n apartment_information[:number]\n end",
"def ace_count\n buf = 0.chr * 12 # sizeof(ACL_SIZE_INFORMATION)\n\n unless GetAclInformation(@acl, buf, buf.size, AclSizeInformation)\n raise Error, get_last_error\n end\n\n buf[0, 4].unpack('L')[0]\n end",
"def south_african_trust_registration_number; end",
"def nombre_comun_a_id_referencia(num_nombre)\n # El 9 inicial es apra identificarlo, despues se forza el ID a 6 digitos y el numero de nombre comun a 2 digitos\n \"1#{id.to_s.rjust(6,'0')}#{num_nombre.to_s.rjust(3,'0')}\".to_i\n end",
"def bookcover_oclc(document)\n if document['oclc_id_display'].nil?\n oclc_id = ''\n else\n oclc_id = document['oclc_id_display'][0]\n end\n return oclc_id\n end",
"def lccn\n s = subfield(\"010\", \"a\")\n return nil if s.empty?\n s.first.value\n end",
"def south_african_close_corporation_registration_number\n generate(:string) do |g|\n g.oneof do |one|\n one.group do |g_|\n g_.lit('CK')\n g_.int(length: 2)\n end\n one.int(length: 4)\n end\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/23')\n end\n end",
"def validate_accession_number(accession_no,seq_type)\n is_valid_accession_no = false\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=AEE34859.1&api_key=e2eded7b94c28c0734a03b44d4a2d5a15308\n # check NCBI. to determine the accession_no is correct, grap the origin aa sequence and compare\n # documents about ncbi api\n # https://www.ncbi.nlm.nih.gov/books/NBK25500/#_chapter1_Downloading_Document_Summaries_\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&api_key=db1a6c70014467857721f83996c2c9d4a207&db=protein&id=AEE34859.1\n api_key = \"db1a6c70014467857721f83996c2c9d4a207\"\n ncbi_api = nil\n if seq_type == \"aa\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?api_key=#{api_key}&db=protein&id=#{accession_no}\"\n elsif seq_type == \"nt\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?api_key=#{api_key}&db=nuccore&id=#{accession_no}\"\n end\n\n ncbi_res = open(ncbi_api) # StringIO object\n if ncbi_res.status.include? \"200\"\n doc = Nokogiri::XML(ncbi_res.read)\n if doc.xpath('//ERROR').length == 0\n\n is_valid_accession_no = true\n\n end\n end\n\n return is_valid_accession_no\n\n end",
"def idref\n \"c#{rank}\"\n end",
"def get_account_number\n @acct_num\n end",
"def cl\n field_fetch('CL')\n end",
"def claim_number\n str = eob.check_information.check_number.to_s if eob.check_information\n (str += '_' + eob.claim_number) if !eob.claim_number.blank?\n str\n end",
"def call_number\n call['dispCallNumber'] || fields['dispCallNumber']\n end",
"def number\n @number ||= (num = name.match(/([0-9]{4})$/) and num[1].to_i)\n end",
"def c0_index\n c0_r(0, 0)\n end",
"def office_phone_number\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"phoneNumber\")\n end",
"def mapping(value)\n case value\n when :accession_number\n :identifier\n when :reference\n :part_of\n else\n value\n end\n end",
"def part_number\n productnum\n end",
"def Com6 # Recuperation Info\n \n end",
"def accion_num\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n\n return_value = AccionNumReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_NUM168__ = nil\n __LPAR169__ = nil\n __Identificador170__ = nil\n __COMA172__ = nil\n __RPAR174__ = nil\n __EOL175__ = nil\n var_local171 = nil\n valor173 = nil\n\n\n tree_for_K_NUM168 = nil\n tree_for_LPAR169 = nil\n tree_for_Identificador170 = nil\n tree_for_COMA172 = nil\n tree_for_RPAR174 = nil\n tree_for_EOL175 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 168:4: K_NUM LPAR ( Identificador | var_local ) COMA valor RPAR EOL\n __K_NUM168__ = match( K_NUM, TOKENS_FOLLOWING_K_NUM_IN_accion_num_768 )\n if @state.backtracking == 0\n tree_for_K_NUM168 = @adaptor.create_with_payload( __K_NUM168__ )\n @adaptor.add_child( root_0, tree_for_K_NUM168 )\n\n end\n\n __LPAR169__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_accion_num_770 )\n if @state.backtracking == 0\n tree_for_LPAR169 = @adaptor.create_with_payload( __LPAR169__ )\n @adaptor.add_child( root_0, tree_for_LPAR169 )\n\n end\n\n # at line 168:15: ( Identificador | var_local )\n alt_23 = 2\n look_23_0 = @input.peek( 1 )\n\n if ( look_23_0 == Identificador )\n alt_23 = 1\n elsif ( look_23_0 == DOUBLEDOT )\n alt_23 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 23, 0 )\n\n end\n case alt_23\n when 1\n # at line 168:16: Identificador\n __Identificador170__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_accion_num_773 )\n if @state.backtracking == 0\n tree_for_Identificador170 = @adaptor.create_with_payload( __Identificador170__ )\n @adaptor.add_child( root_0, tree_for_Identificador170 )\n\n end\n\n\n when 2\n # at line 168:30: var_local\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_accion_num_775 )\n var_local171 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local171.tree )\n end\n\n\n end\n __COMA172__ = match( COMA, TOKENS_FOLLOWING_COMA_IN_accion_num_778 )\n if @state.backtracking == 0\n tree_for_COMA172 = @adaptor.create_with_payload( __COMA172__ )\n @adaptor.add_child( root_0, tree_for_COMA172 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_accion_num_780 )\n valor173 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor173.tree )\n end\n\n __RPAR174__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_accion_num_782 )\n if @state.backtracking == 0\n tree_for_RPAR174 = @adaptor.create_with_payload( __RPAR174__ )\n @adaptor.add_child( root_0, tree_for_RPAR174 )\n\n end\n\n __EOL175__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_accion_num_784 )\n if @state.backtracking == 0\n tree_for_EOL175 = @adaptor.create_with_payload( __EOL175__ )\n @adaptor.add_child( root_0, tree_for_EOL175 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n\n end\n\n return return_value\n end",
"def satellitenumber\n @line1[02...07].to_i\n end",
"def get_nbre_connexion\n session[:sos_note_nbre_connexion]? session[:sos_note_nbre_connexion] : 0\n end",
"def catalog_number\n model.labels.first.catno\n end",
"def generate_callout_id(list_index, co_index)\n \"CO#{list_index}-#{co_index}\"\n end",
"def dn_index\n return 0 if d_dn < 1\n\n d_dn - 1\n end",
"def dn_index\n return 0 if d_dn < 1\n\n d_dn - 1\n end",
"def num\n name\n end",
"def pcos_get_number(*args)\n @p.pcos_get_number(self, *args)\n end",
"def caz_id\n payment_data[:caz_id]\n end",
"def orcid_field\n generate 'sufia:orcid_field'\n end",
"def amino_acid_number\n @seq.length\n end",
"def serialnumber\r\n\r\n @@serial +=1 ;\r\n \r\n id = request.object_id.to_i;\r\n if(id < 0 )\r\n \r\n id *= -1;\r\n end\r\n \r\n id %= 103; # mod by prime to keep the digits down.\r\n \r\n return(\"o\"+id.to_s+\"s\"+@@serial.to_s)\r\n \r\n end",
"def cac2\n 0\n end",
"def reference_number\n @session_id\n end",
"def ncolazione\n self.attributes_before_type_cast['colazione'].to_i\n end",
"def elementnumber\n @line1[64...68].to_i\n end",
"def to_s() designation_number; end",
"def numid=(_); end",
"def nobasicas_indice_seq_con_id\n Msip::Ability::NOBASICAS_INDSEQID +\n Mr519Gen::Ability::NOBASICAS_INDSEQID +\n Heb412Gen::Ability::NOBASICAS_INDSEQID +\n Cor1440Gen::Ability::NOBASICAS_INDSEQID\n end",
"def getNbRecompense\n return 0\n end",
"def getDailyLoanAccrualObjName\r\n\t\t\treturn \"mfiforce__Daily_Loan_Accrual__c\"\r\n\t\tend",
"def serial_number; Common.serial_number(@handle); end",
"def current_comic_number\r\n \tcomic_number = Array.new(sorted_articles.reverse)\r\n \tcomic_number.index(item) + 1\r\n end",
"def segundoDigitoMenor(clave)\n\tcadena_digito = clave.to_s\n\treturn (cadena_digito[1]).to_i\nend",
"def phone_number; end",
"def phone_number; end",
"def dialNumber\n\t\tprint countryCode\n\t\tprint cityCode\n\t\tprint phoneNumber\n\tend",
"def pcba_unique_number\n self.pcba_prefix + '-' + self.pcba_number\n end",
"def spanish_citizen_number; end",
"def aliphatic_index\n aa_map = aa_comp_map\n @aliphatic_index ||= round(aa_map[:A] +\n 2.9 * aa_map[:V] +\n (3.9 * (aa_map[:I] + aa_map[:L])), 2)\n end",
"def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend",
"def spanish_foreign_citizen_number; end",
"def cert_num\n \t# training_id = params[:training_id]\n \tdb = Mdb.open(\"/Users/corrinasthename/Desktop/cs169/BCGC.mdb\")\n trainings = db[:tblTraining]\n end",
"def _sc_akey( number )\n\t\t\"#{Search_control_prefix}.agent#{number.to_i > 0 ? number : ''}\"\n\tend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end",
"def sequence_number; end",
"def get_unique_accessCode\n code = generate_accessCode\n while Room.exists?(accessCode: code) do\n code = generate_accessCode\n end\n return code\n end",
"def vat_number; end",
"def assign_control_doc_number\n\t\tself.control_doc_number = Time.now.strftime(\"%Y\") + \"/\" + Time.now.to_i.to_s\n\t\tself.control_doc_number\n\tend",
"def disc_number(value)\n @ole.DiscNumber = value\n nil\n end",
"def area_code\n number[0..2]\n end",
"def close_corporation_registration_number; end",
"def reference_number_prefix\n nil\n end",
"def C\n @nb\n end",
"def C\n @nb\n end",
"def south_african_listed_company_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/06')\n end\n end",
"def disc_count\n @ole.DiscCount\n end",
"def current_access_level\n @wfd_current_fal + 1\n end"
] | [
"0.6884209",
"0.63327724",
"0.6220748",
"0.6083833",
"0.60711426",
"0.6032158",
"0.5969113",
"0.59678364",
"0.5965524",
"0.5863042",
"0.5821906",
"0.57863045",
"0.5776457",
"0.5750504",
"0.5748248",
"0.5744068",
"0.5702035",
"0.56996685",
"0.569783",
"0.56902415",
"0.5679606",
"0.5676261",
"0.5673959",
"0.5645825",
"0.5629671",
"0.5627934",
"0.56205314",
"0.5592875",
"0.55893934",
"0.5584619",
"0.5580083",
"0.5577778",
"0.5573818",
"0.55483115",
"0.5541721",
"0.5523828",
"0.5519008",
"0.55161357",
"0.55141354",
"0.5498361",
"0.54872376",
"0.5482038",
"0.5471059",
"0.5466399",
"0.5465889",
"0.54538864",
"0.5437438",
"0.54295427",
"0.5413509",
"0.5410208",
"0.5408629",
"0.53996104",
"0.5394692",
"0.538891",
"0.5383881",
"0.53740644",
"0.5369871",
"0.5369871",
"0.53677374",
"0.5345822",
"0.5342863",
"0.5335756",
"0.5333345",
"0.53304",
"0.532407",
"0.53214335",
"0.53191525",
"0.53182393",
"0.5311685",
"0.5307169",
"0.5302931",
"0.5301719",
"0.5292752",
"0.528857",
"0.5286098",
"0.5279022",
"0.5276237",
"0.5276237",
"0.52735156",
"0.5272466",
"0.5270094",
"0.52675945",
"0.5263246",
"0.52624375",
"0.5256886",
"0.52528447",
"0.52518123",
"0.5239585",
"0.52389336",
"0.5233157",
"0.5231469",
"0.52229875",
"0.5221308",
"0.5213135",
"0.52129245",
"0.52107567",
"0.52107567",
"0.5205952",
"0.52002585",
"0.5196482"
] | 0.59875953 | 6 |
TR TRRD accession number | def tr
field_fetch('TR')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rid\n \"rId#{ndx + 1}\"\n end",
"def south_african_pty_ltd_registration_number; end",
"def rnat\n self[:rnat]\n end",
"def rnat\n self[:rnat]\n end",
"def get_trans_id()\n return @RESPONSE_HASH['RRNO']\n end",
"def pty_ltd_registration_number; end",
"def tde_credential_arn\n @dbi.tde_credential_arn\n end",
"def tde_credential_arn\n @dbi.tde_credential_arn\n end",
"def auth_id\n params['TxAuthNo']\n end",
"def south_african_trust_registration_number; end",
"def tde_credential_arn\n data[:tde_credential_arn]\n end",
"def get_account_number\n @acct_num\n end",
"def last_trx_number\n @trx_number\n end",
"def rdn\n dn && dn.rdn\n end",
"def south_african_pty_ltd_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/07')\n end\n end",
"def rid\n begin\n \"#{@metadata[:cluster]}:#{@metadata[:record]}\"\n rescue\n \"0:0\"\n end\n end",
"def DTR=(value)",
"def polish_taxpayer_identification_number; end",
"def serial_number; Common.serial_number(@handle); end",
"def rdir_head_name\n @header_data.read_int(HDR_RECYCLEINDEX_)\n end",
"def txn_id\n authorization\n end",
"def routing_number; end",
"def flight_number\n @raw_data[:FlightNumber]\n end",
"def pad_rtnumber rtnumber\n if rtnumber =~ /[A-Z]/\n \"0#{rtnumber}\"\n else\n rtnumber\n end\n end",
"def rcrt\n arm = Speacial_Status['Armor']\n return arm[@id] != nil && arm[@id]['rcrt'] != nil ? arm[@id]['rcrt'] : 0\n end",
"def next_rid; end",
"def autonomous_system_number; end",
"def js_rpts_2_acct(rpt)\n return rpt.split('/')[-3]\n end",
"def next_uid()\n\t\t\treturn @metadata.attributes[:next_uid].to_i\n\t\tend",
"def rdn\n\t\treturn self.split_dn( 2 ).first\n\tend",
"def read_number\n return 0 if @crl_number_file.nil?\n\n read_data(@crl_number_file).to_i\n end",
"def serial_number\n return @serial_number\n end",
"def td_number_before_saison\n return 3\n end",
"def rrid\n \"#\" + rid\n end",
"def reference_number\n @session_id\n end",
"def numid; end",
"def ctid\n\t\tif tmp = vzlist('--no-header', '-a','-N',resource[:name]).split(\" \")[0]\n\t\t\tid = tmp\n\t\telsif !id = resource[:id]\n\t\t\tout = vzlist('--no-header', '-a', '-o','ctid')\n\t\t\ttmp = out.empty? ? 100 : Integer(out.split.last)\n\t\t\tid = tmp <= 100 ? 101 : tmp + 1\n\t\tend\n\t\tif id\n\t\t\treturn id\n\t\telse\n\t\t\tfail \"CTID not specified\"\n\t\tend\n\tend",
"def ctpid\n nspid[1]\n end",
"def default_ttr\n @@default_ttr ||= 120\n end",
"def vrn\n data['vrn']\n end",
"def uid_next\n uid_last = execute(\"dscl . -list /Users UniqueID | sort -k 2 -g | tail -1 | awk '{print $2}'\")\n uid_last.to_i + 1\n end",
"def get_drug_rxcui(client)\n # if get_drug_info(client).length\n get_drug_info(client)[:rxcui].to_i\n end",
"def rp_id; end",
"def trainer_id\n return @trainer_id % 100_000\n end",
"def trd; end",
"def wn_dmtr\n get_link(link='dmtr')\n end",
"def account_number\n return @account_number if @account_number\n\n begin\n my_arn = AWS::IAM.new(\n :access_key_id => @access_key_id,\n :secret_access_key => @secret_access_key).client.get_user()[:user][:arn]\n rescue AWS::IAM::Errors::AccessDenied => e\n my_arn = e.message.split[1]\n end\n\n @account_number = my_arn.split(':')[4]\n end",
"def ticket_number(accounting_element)\n\t \taccounting_element[:document_info][:document][:@number]\n\t end",
"def rrtype\n @attributes[:rrtype]\n end",
"def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend",
"def rid\n\t\treturn get_tlv_value(TLV_TYPE_REQUEST_ID)\n\tend",
"def tc_number(accounting_element)\n\t\t\t\t payment_form = accounting_element[:payment_info][:payment][:form]\n\t\t\t\t if payment_form == \"CC\" then\n\t\t\t\t return accounting_element[:payment_info][:payment][:cc_info][:payment_card][:@number]\n\t\t\t\t else\n return \"\"\n\t\t\t\t end\n\t\t\t end",
"def index\n @raw_data[:FlightIndex].to_i\n end",
"def south_african_trust_registration_number\n generate(:string) do |g|\n g.lit('IT')\n g.int(ranges: [10..9999])\n g.lit('/')\n g.int(ranges: [10..9_999_999_999])\n end\n end",
"def rid(prefix = '')\n page_hash = Digest::MD5.hexdigest(request.path)\n @rid_seq ||= 0\n @rid_seq += 1\n \"rid#{page_hash}#{@rid_seq}\"\n end",
"def rent_percept_for_renter\n rent_value = 0\n self.accessories.each{|accessory|\n rent_value += ((accessory.base + accessory.tarif)*( 1 + (accessory.tax/100) ))\n }\n return rent_value\n end",
"def an_numeric_component\n @record.eds_accession_number.split('.').last\n end",
"def page_trx_sys\n 5\n end",
"def thnum()\n #This is a stub, used for indexing\n end",
"def account_number\n return @account_number\n end",
"def serialnumber\r\n\r\n @@serial +=1 ;\r\n \r\n id = request.object_id.to_i;\r\n if(id < 0 )\r\n \r\n id *= -1;\r\n end\r\n \r\n id %= 103; # mod by prime to keep the digits down.\r\n \r\n return(\"o\"+id.to_s+\"s\"+@@serial.to_s)\r\n \r\n end",
"def local_rid; end",
"def dn_index\n return 0 if d_dn < 1\n\n d_dn - 1\n end",
"def dn_index\n return 0 if d_dn < 1\n\n d_dn - 1\n end",
"def rut\n value = Number.number(digits: 8).to_s\n vd = rut_verificator_digit(value)\n value << \"-#{vd}\"\n end",
"def transaction_id\n params['PNREF']\n end",
"def rrca\n end",
"def current_access_level\n @wfd_current_fal + 1\n end",
"def teacher_number\n return @teacher_number\n end",
"def number_for_citation_node(xref_node)\n refid = xref_node['rid']\n ref = reference_by_id(refid)\n ref && ref[:number]\n end",
"def trainer_id_text\n return sprintf(\"%05d\", self.trainer_id)\n end",
"def rn_custom; @rn_custom; end",
"def next_uid\n LdapUser.all(limit: 1, sort_by: :uidnumber, order: :desc).first[:uidnumber]+1\n end",
"def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end",
"def access_key\n configatron.ramazon.access_key\n end",
"def getterminalid()\r\n return getvalue(SVTags::TERMINAL_ID)\r\n end",
"def rich_privilege\n Math.atan(balance / 10) + (Math::PI / 2)\n end",
"def ndp_code; self[:ndp_code].to_i; end",
"def rowid()\n #This is a stub, used for indexing\n end",
"def idref\n \"c#{rank}\"\n end",
"def trace_id\n @trace_data.trace_id\n end",
"def south_african_id_number; end",
"def ndp_taddr\n self[:ndp_tgt].to_x\n end",
"def net_id\n $test_logger.log(\"Get serial net Id\")\n begin\n n = @transport.net_id\n rescue Exception => e\n $test_logger.log_e(\"Error while getting current serial net Id\", e)\n end\n n\n end",
"def ndp_tgt; self[:ndp_tgt].to_i; end",
"def error\n rrd_get_error\n end",
"def reassociation_trace\n ['TRN', '1', output_check_number, (@payer.payid.to_s.rjust(10, '0') if @payer),\"999999999\"].trim_segment.join(@element_seperator)\n end",
"def t_dist_r_t()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::T_Dist_RT::TDistRTRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def generate_webpay_trx_id\n Digest::MD5.hexdigest(\"#{self.order.number}#{self.order.payments.count}\")\n end",
"def satellitenumber\n @line1[02...07].to_i\n end",
"def dr\n field_fetch('DR')\n end",
"def dr\n field_fetch('DR')\n end",
"def dr\n field_fetch('DR')\n end",
"def rid\n @rid ||= @node.search('RID/listEntry').map(&:inner_text)\n end",
"def transaction_id\n read('transaction_id')\n end",
"def transaction_id\n @ipn['txn_id']\n end",
"def random_account_number\n acct_num = rand(10**11).to_s.rjust(11, '1')\n return acct_num\n end",
"def cert_num\n \t# training_id = params[:training_id]\n \tdb = Mdb.open(\"/Users/corrinasthename/Desktop/cs169/BCGC.mdb\")\n trainings = db[:tblTraining]\n end",
"def arn\n data.arn\n end",
"def arn\n data.arn\n end",
"def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end"
] | [
"0.607118",
"0.58838135",
"0.56551355",
"0.56551355",
"0.5647259",
"0.563468",
"0.5621219",
"0.5621219",
"0.55628616",
"0.55144817",
"0.5452194",
"0.53832716",
"0.53777003",
"0.53289396",
"0.5310879",
"0.5304047",
"0.52479553",
"0.5246209",
"0.5241327",
"0.5230625",
"0.51917106",
"0.517729",
"0.5174385",
"0.5173795",
"0.51706684",
"0.5163876",
"0.5159628",
"0.5146567",
"0.5135854",
"0.51060563",
"0.5079553",
"0.5059892",
"0.5048454",
"0.5030407",
"0.50277543",
"0.50213945",
"0.50179315",
"0.50158876",
"0.50142145",
"0.5012763",
"0.500486",
"0.49902645",
"0.49821877",
"0.4981901",
"0.4966158",
"0.49643674",
"0.49483135",
"0.49455062",
"0.4940933",
"0.49291435",
"0.49291435",
"0.49280223",
"0.4927841",
"0.49197376",
"0.49172375",
"0.4906239",
"0.49036923",
"0.4902478",
"0.4897768",
"0.48888263",
"0.48726818",
"0.48725912",
"0.48703825",
"0.48703825",
"0.4870374",
"0.48576587",
"0.4852708",
"0.485122",
"0.48509884",
"0.48506278",
"0.48469216",
"0.48436123",
"0.4836357",
"0.48343801",
"0.48319808",
"0.48294422",
"0.4823761",
"0.48205915",
"0.48129052",
"0.4809035",
"0.48077527",
"0.4805828",
"0.48044464",
"0.47989443",
"0.4783372",
"0.47815767",
"0.47815728",
"0.47803584",
"0.47768533",
"0.47738677",
"0.47730622",
"0.47730622",
"0.47730622",
"0.47717205",
"0.47674295",
"0.4762445",
"0.47575718",
"0.4757288",
"0.4756144",
"0.4756144",
"0.47518256"
] | 0.0 | -1 |
GET /displays GET /displays.json | def index
@displays = Display.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end",
"def index\n @attribute_displays = AttributeDisplay.all\n end",
"def index\n @displaydata = Displaydatum.all\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def index\n @report_displays = ReportDisplay.all\n end",
"def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def show\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @display_item }\n end\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def index\n json_response(@board.lists)\n end",
"def show\n render json: UserBoards.find(params[\"id\"])\n end",
"def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end",
"def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end",
"def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end",
"def show\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def index\n json_response(@device.browsers)\n end",
"def show\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gather }\n end\n end",
"def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end",
"def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n @shows = Show.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @shows, status: 200}\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n render json: @host\n end",
"def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n stats = @mode.stats.map(&:to_simple)\n render json: stats, status: :ok\n end\n end\n end",
"def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @host }\n end\n end",
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def show\n @registry = Registry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registry }\n end\n end",
"def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end",
"def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end",
"def index\n @chargers = Charger.all\n render json: @chargers\n end",
"def show\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board_info }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end",
"def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end",
"def index\n @devices = Device.all.includes(:browsers)\n json_response(@devices, :ok, [:browsers])\n end",
"def show\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_source }\n end\n end",
"def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @site }\n end\n end",
"def index\n @presents = Present.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @presents }\n end\n end",
"def show\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostela }\n end\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @camera_catalogue = CameraCatalogue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camera_catalogue }\n end\n end",
"def index\n @system_configs = SystemConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @system_configs }\n end\n end",
"def show\n render json: @laboratory\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def show\n render json: @parsed_site\n end",
"def show\n @screening = Screening.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screening }\n end\n end",
"def show\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hydraulic_system }\n end\n end",
"def show\n @content_explore = ContentExplore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_explore }\n end\n end",
"def show\n @visual_fidelity = VisualFidelity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visual_fidelity }\n end\n end",
"def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end",
"def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @monitor_profile }\n end\n end",
"def show\n @board = Board.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def index\n @mirrors = Mirror.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mirrors }\n end\n end",
"def index\n @game_systems = GameSystem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_systems }\n end\n end",
"def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end",
"def show\n @drive_system = DriveSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drive_system }\n end\n end",
"def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monitor_profile }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end",
"def show\n @capture = Capture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capture }\n end\n end",
"def index\n render json: UserBoards.all\n end",
"def shows\n res = call(\n 'shows',\n {}\n )\n res.body['Itasa_Rest2_Server_Shows']['direct']['shows'].values\n end",
"def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end",
"def index\n colorizers = Colorizer.all\n\n render json: colorizers\n end",
"def show\n @systemadmin = Systemadmin.find(params[:id])\n @pSAdmins = Host.find_all_by_primary_sadmin_id(params[:id])\n @secSAdmins = Host.find_all_by_secondary_sadmin_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @systemadmin }\n end\n end",
"def index\n @screens = Screen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screens }\n end\n end",
"def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def show\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dash_type }\n end\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def show\n render json: @disponible\n end",
"def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n render json: @measure\n end",
"def index\n @databases = Database.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @databases }\n end\n end",
"def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end",
"def show\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_site_map }\n end\n end",
"def show\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metric_type }\n end\n end",
"def index\n user = current_user\n @cameras = Camera.where(:user_id => user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cameras }\n end\n end"
] | [
"0.68759215",
"0.65153104",
"0.6434051",
"0.642243",
"0.640952",
"0.634131",
"0.62547076",
"0.6244456",
"0.62403166",
"0.62333804",
"0.62201595",
"0.6198984",
"0.6198984",
"0.61810094",
"0.61743945",
"0.6168888",
"0.6162346",
"0.6162151",
"0.61588985",
"0.6157689",
"0.6157689",
"0.6154425",
"0.6154425",
"0.6148187",
"0.61429226",
"0.61387664",
"0.61335504",
"0.6128465",
"0.61278355",
"0.61264443",
"0.60923755",
"0.60874474",
"0.60865724",
"0.60847896",
"0.6081387",
"0.607632",
"0.60627437",
"0.6056146",
"0.6053524",
"0.6053524",
"0.6048125",
"0.6039579",
"0.602632",
"0.6016484",
"0.60113627",
"0.60059696",
"0.6003753",
"0.60012734",
"0.6000079",
"0.59923697",
"0.598735",
"0.5986513",
"0.5985927",
"0.5981993",
"0.597981",
"0.59778106",
"0.5974722",
"0.5965918",
"0.5958773",
"0.595769",
"0.5957205",
"0.59515774",
"0.59512985",
"0.5949589",
"0.59494114",
"0.5949346",
"0.59467024",
"0.5936737",
"0.59334296",
"0.59331757",
"0.5930904",
"0.5926231",
"0.5925742",
"0.5924638",
"0.5920306",
"0.5917154",
"0.5916868",
"0.59166265",
"0.5915778",
"0.59157246",
"0.59098047",
"0.5908848",
"0.590864",
"0.59077203",
"0.59064573",
"0.5905905",
"0.5905631",
"0.5905507",
"0.59050405",
"0.5900052",
"0.5899666",
"0.5898824",
"0.5898496",
"0.5898496",
"0.5894065",
"0.5893339",
"0.5892848",
"0.58914316",
"0.5890738",
"0.58872604"
] | 0.76689947 | 0 |
GET /displays/1 GET /displays/1.json | def show
@templates = SkinTemplate.where(active: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end",
"def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end",
"def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end",
"def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def show\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @display_item }\n end\n end",
"def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end",
"def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end",
"def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end",
"def show\n @host = Host.find(params[:id])\n\n render json: @host\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def show\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hydraulic_system }\n end\n end",
"def show\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metric_type }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @host }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def show\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dash_type }\n end\n end",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def show\n @registry = Registry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registry }\n end\n end",
"def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end",
"def show\n @visual_fidelity = VisualFidelity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visual_fidelity }\n end\n end",
"def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end",
"def show\n render json: UserBoards.find(params[\"id\"])\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_source }\n end\n end",
"def show\n @drive_system = DriveSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drive_system }\n end\n end",
"def show\n @width = Width.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @width }\n end\n end",
"def show\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gather }\n end\n end",
"def show\n @lab_device = LabDevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_device }\n end\n end",
"def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def index\n @attribute_displays = AttributeDisplay.all\n end",
"def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @monitor_profile }\n end\n end",
"def show\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostela }\n end\n end",
"def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end",
"def show\n @capture = Capture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capture }\n end\n end",
"def show\n @medium = OnlineResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @online_resource }\n format.ris\n end\n end",
"def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monitor_profile }\n end\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end",
"def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end",
"def show\n @standard_measurement = StandardMeasurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @standard_measurement }\n end\n end",
"def show\r\n @machine = Machine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end",
"def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end",
"def show\n @server = Server.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end",
"def show\n @dimension = Dimension.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dimension }\n end\n end",
"def show\n @media_type = MediaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_type }\n end\n end",
"def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end",
"def show\n @availablity = Availablity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @availablity }\n end\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end",
"def show\n @url = Url.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end",
"def show\n @game_system = GameSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_system }\n end\n end",
"def builder\n @display = Display.find(params[:id])\n @displays = Display.all\n end",
"def show\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board_info }\n end\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def show\n @camera_catalogue = CameraCatalogue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camera_catalogue }\n end\n end",
"def show\n @screen_setting = ScreenSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screen_setting }\n end\n end",
"def index\n @report_displays = ReportDisplay.all\n end",
"def show\n @watch_site = WatchSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watch_site }\n end\n end",
"def show\n @col = Col.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @col }\n end\n end",
"def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end",
"def show\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_type }\n end\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def show\n @screening = Screening.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screening }\n end\n end",
"def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end",
"def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end",
"def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end",
"def show\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => 'collab'}# show.html.erb\n format.json { render json: @collab }\n end\n end",
"def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end",
"def show\n @machine_id_standard = MachineIdStandard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine_id_standard }\n end\n end",
"def show\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @color_saturation }\n end\n end",
"def show\n @camera = Camera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camera }\n end\n end",
"def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @display }\n end\n end",
"def show\n @core_machine = Core::Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_machine }\n end\n end",
"def show\n puts \"=================show=================\"\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end",
"def show\n @medium = Medium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium }\n end\n end",
"def show\n @medium = Medium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium }\n end\n end",
"def show\n @content_url = ContentUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_url }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end",
"def show\n @systemadmin = Systemadmin.find(params[:id])\n @pSAdmins = Host.find_all_by_primary_sadmin_id(params[:id])\n @secSAdmins = Host.find_all_by_secondary_sadmin_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @systemadmin }\n end\n end",
"def show\n @platform = Platform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @platform }\n end\n end",
"def index\n @displaydata = Displaydatum.all\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end"
] | [
"0.7406387",
"0.7049758",
"0.67018",
"0.65529764",
"0.6539569",
"0.6536577",
"0.6519089",
"0.6515544",
"0.64929235",
"0.6418445",
"0.64058226",
"0.64058226",
"0.6384856",
"0.63755006",
"0.637004",
"0.6350795",
"0.63322103",
"0.6331071",
"0.6294739",
"0.6294739",
"0.62918437",
"0.6291266",
"0.6286383",
"0.62692636",
"0.62670445",
"0.626582",
"0.6265147",
"0.6257318",
"0.6237762",
"0.6231677",
"0.6231677",
"0.62273705",
"0.62247473",
"0.6219364",
"0.6209996",
"0.620088",
"0.620088",
"0.620088",
"0.620088",
"0.61897093",
"0.6188918",
"0.6170593",
"0.616505",
"0.61599916",
"0.61527133",
"0.6151619",
"0.61485535",
"0.61473596",
"0.6142939",
"0.6135963",
"0.6132332",
"0.6125669",
"0.6121364",
"0.6116329",
"0.61158615",
"0.610751",
"0.610751",
"0.61074406",
"0.6106047",
"0.61056066",
"0.6099683",
"0.6098631",
"0.6093626",
"0.60812014",
"0.6076647",
"0.60710245",
"0.60710245",
"0.60708106",
"0.6055393",
"0.60421604",
"0.6041089",
"0.6040233",
"0.6034976",
"0.60319185",
"0.6022615",
"0.60199714",
"0.601702",
"0.6016055",
"0.60143477",
"0.6014191",
"0.60141766",
"0.6014114",
"0.6013185",
"0.6011491",
"0.6010457",
"0.6009757",
"0.60063046",
"0.6006232",
"0.60049886",
"0.60031986",
"0.59987617",
"0.5995131",
"0.59947366",
"0.59947366",
"0.5993826",
"0.5992928",
"0.5986114",
"0.5985261",
"0.59851855",
"0.5985075",
"0.5983515"
] | 0.0 | -1 |
POST /displays POST /displays.json | def create
@display = Display.new(display_params)
screens_num = params[:split_in];
# creamos las screens necesarias
saved = @display.save
create_screens(screens_num)
respond_to do |format|
if saved
format.html {
flash[:success]= 'Display was successfully created.'
redirect_to displays_path
}
format.json { render :show, status: :created, location: @display }
else
format.html { render :new }
format.json { render json: @display.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, :notice => 'Display was successfully created.' }\n format.json { render :json => @display, :status => :created, :location => @display }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @display.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @display }\n end\n end",
"def index\n @displaydata = Displaydatum.all\n end",
"def create\n @displaydatum = Displaydatum.new(displaydatum_params)\n\n respond_to do |format|\n if @displaydatum.save\n format.html { redirect_to @displaydatum, notice: 'Displaydatum was successfully created.' }\n format.json { render :show, status: :created, location: @displaydatum }\n else\n format.html { render :new }\n format.json { render json: @displaydatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def builder\n @display = Display.find(params[:id])\n @displays = Display.all\n end",
"def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n flash[:notice] = 'Display was successfully created.'\n format.html { redirect_to(@display) }\n format.xml { render :xml => @display, :status => :created, :location => @display }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @display.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @attribute_display = AttributeDisplay.new(attribute_display_params)\n\n respond_to do |format|\n if @attribute_display.save\n format.html { redirect_to @attribute_display, notice: 'Attribute Display was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attribute_display }\n else\n format.html { render action: 'new' }\n format.json { render json: @attribute_display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end",
"def create\n @report_display = ReportDisplay.new(report_display_params)\n\n respond_to do |format|\n if @report_display.save\n format.html { redirect_to @report_display, notice: 'Report display was successfully created.' }\n format.json { render :show, status: :created, location: @report_display }\n else\n format.html { render :new }\n format.json { render json: @report_display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @report_displays = ReportDisplay.all\n end",
"def display_params\n params.require(:display).permit(:name, :active, :order, :resolution)\n end",
"def create\n @display_unit = DisplayUnit.new(display_unit_params)\n\n if @display_unit.save\n render :show, status: :created, location: @display_unit\n else\n render json: @display_unit.errors, status: :unprocessable_entity\n end\n end",
"def index\n @attribute_displays = AttributeDisplay.all\n end",
"def scaffold\n response_json = RestClient.post(api_path, params.except(:action, :controller))\n\n render template: \"rspec/show\", locals: JSON.parse(response_json)\n end",
"def visualize\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n add_breadcrumb \"visualizing\", [:visualize, @server]\n\n wp_service = VisualizationService.new(@server, :wordpress)\n dp_service = VisualizationService.new(@server, :drupal)\n @wordpress_data = wp_service.gather\n @drupal_data = dp_service.gather\n\n respond_to do |format|\n format.html\n format.json { render json: { server: @server,\n wp_data: @wordpress_data, dp_data: @drupal_data} }\n end\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def display_params\n params.require(:display).permit(:Price, :name, :resolution, :brand, :aspect_ratio, :size, :ports,\n :response_time, :refresh_rate, :speakers, :dimensions, :panel, \n :release, :stand_misc, :gpu_sync,:image)\n end",
"def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def new\n @printing_screen = PrintingScreen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @printing_screen }\n end\n end",
"def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end",
"def new\n @hardware = Hardware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hardware }\n end\n end",
"def show\n render json: @capture\n end",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end",
"def create\n @system_overview = SystemOverview.new(system_overview_params)\n\n respond_to do |format|\n if @system_overview.save\n format.html { redirect_to @system_overview, notice: 'System overview was successfully created.' }\n format.json { render :show, status: :created, location: @system_overview }\n else\n format.html { render :new }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @stage\n end",
"def update\n respond_to do |format|\n if @display.update(display_params)\n format.html { redirect_to @display, notice: 'Display was successfully updated.' }\n format.json { render :show, status: :ok, location: @display }\n else\n format.html { render :edit }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @measure\n end",
"def show\n render json: @assign_stage\n end",
"def set_display\n @display = Display.find(params[:id])\n end",
"def set_display\n @display = Display.find(params[:id])\n end",
"def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end",
"def new\n @screening = Screening.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screening }\n end\n end",
"def show\n render json: @disponible\n end",
"def show\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @display_item }\n end\n end",
"def index \n ip_addr = request.env['REMOTE_ADDR'] \n @browse_by = [[\"Browse By\",''],[\"Guides\",'1'],[\"Places\",'2']]\n @characteristics = [\"Latest\",'1'],[\"Most Popular\",'2'],[\"Highest Rated\",'3'],[\"Stress Factor\",'4']\n @notice = notice\n @guides = Guide.where(\"publish=?\",true).order(\"CREATED_AT DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def show\n render json: @laboratory\n end",
"def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end",
"def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def new\n @screenshot = Screenshot.new\n @screenshot.sizes.build(height: 900, width: 1200)\n @screenshot.sizes.build(height: 600, width: 768)\n @screenshot.sizes.build(height: 480, width: 320)\n @button = \"Send\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @display }\n end\n end",
"def setup\n allow_cors unless !ConcertoConfig[:public_concerto]\n @preview = params.has_key?(:preview) && params[:preview] == \"true\"\n begin\n @screen = Screen.find(params[:id])\n allow_screen_if_unsecured @screen\n auth! action: (@preview ? :preview : :display)\n rescue ActiveRecord::ActiveRecordError\n render json: {}, status: 404\n rescue CanCan::AccessDenied\n render json: {}, status: 403\n else\n # If we got the dimensions then keep them so we can indicate its orientation in the screen list.\n if params['width'].present? and params['height'].present? and !@preview\n height = params['height'].to_i rescue nil\n width = params['width'].to_i rescue nil\n @screen.update_columns(height: height, width: width)\n Rails.logger.debug(\"updated screen #{@screen.id} dimensions #{width}w x #{height} h\")\n end\n\n # field_configs = [] # Cache the field_configs\n @screen.run_callbacks(:frontend_display) do\n # Inject paths into fake attribute so they gets sent with the setup info.\n # Pretend that it's better not to change the format of the image, so we detect it's upload extension.\n if [email protected]?\n template_format = File.extname(@screen.template.media.preferred.first.file_name)[1..-1]\n @screen.template.path = frontend_screen_template_path(@screen, @screen.template, format: template_format)\n else\n template_format = nil\n @screen.template.path = nil\n end\n css_media = @screen.template.media.where({key: 'css'})\n if !css_media.empty?\n @screen.template.css_path = media_path(css_media.first)\n end\n @screen.template.positions.each do |p|\n p.field_contents_path = frontend_screen_field_contents_path(@screen, p.field, format: :json)\n p.field.config = {}\n FieldConfig.default.where(field_id: p.field_id).each do |d_fc|\n p.field.config[d_fc.key] = d_fc.value\n # field_configs << d_fc\n end\n @screen.field_configs.where(field_id: p.field_id).each do |fc|\n p.field.config[fc.key] = fc.value\n # field_configs << fc\n end\n # add how to handle when content cannot be loaded or has run out\n p.field.config['screens_clear_last_content'] = ConcertoConfig['screens_clear_last_content']\n end\n end\n\n frontend_cache_key = @screen.frontend_cache_key\n response.headers[\"X-Concerto-Frontend-Setup-Key\"] = frontend_cache_key\n\n @screen.time_zone = ActiveSupport::TimeZone::MAPPING[@screen.time_zone]\n if stale?(etag: frontend_cache_key, public: true)\n respond_to do |format|\n format.json {\n render json: @screen.to_json(\n only: [:name, :id, :time_zone, :locale],\n include: {\n template: {\n include: {\n positions: {\n except: [:created_at, :updated_at, :template_id, :field_id],\n methods: [:field_contents_path],\n include: {\n field: {\n methods: [:config],\n only: [:id, :name, :config]\n }\n }\n },\n },\n only: [:id, :name],\n methods: [:path, :css_path]\n }\n }\n )\n }\n end\n end\n\n unless @preview\n @screen.mark_updated\n end\n end\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def show\n @capture = Capture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capture }\n end\n end",
"def new\n @screeninginfo = Screeninginfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screeninginfo }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_records }\n end\n end",
"def new\n @experiment_software = ExperimentSoftware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @experiment_software }\n end\n end",
"def show\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.add_missing_hosts # TODO: Does this need to be here???\n @schema = self.schema\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physical_rack }\n format.csv {export_csv @physical_rack}\n end\n end",
"def create\n params.permit!\n @display_item = DisplayItem.new(params[:display_item])\n @page_version = PageVersion.new\n @page_version.name = \"Display item create\"\n respond_to do |format|\n if @display_item.save && @page_version.save\n #format.html { redirect_to @display_item, notice: 'Display item was successfully created.' }\n #format.json { render json: @display_item, status: :created, location: @display_item }\n format.html { redirect_to edit_page_path(@display_item.page_id)}\n else\n format.html { render action: \"new\" }\n format.json { render json: @display_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n json_response(@board.lists)\n end",
"def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end",
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end",
"def new\n @heat_type = HeatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def create\n @overview = Overview.new(overview_params)\n\n respond_to do |format|\n if @overview.save\n format.html { redirect_to @overview, notice: 'Overview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @overview }\n else\n format.html { render action: 'new' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end",
"def show\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unsigned_columns_test }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataset }\n end\n end",
"def new\n @experiment_control = ExperimentControl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment_control }\n end\n end",
"def new\n @page_id = params[:id]\n @display_item = DisplayItem.new\n @display_item.page_id = @page_id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @display_item }\n end\n end",
"def new\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def destroy\n @display.destroy\n respond_to do |format|\n format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end",
"def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end",
"def show\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gather }\n end\n end",
"def show\n json_response(@browser)\n end",
"def new\n @hardware_type = HardwareType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end",
"def show\n @screenshot = Screenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end",
"def index\n @lab_flows = LabFlow.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lab_flows }\n end\n end",
"def index\n @builds = Build.all\n render json: @builds\n end",
"def new\n @screen_setting = ScreenSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screen_setting }\n end\n end",
"def new\n @show_house = ShowHouse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show_house }\n end\n end",
"def index\n @screens = Screen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screens }\n end\n end",
"def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n stats = @mode.stats.map(&:to_simple)\n render json: stats, status: :ok\n end\n end\n end",
"def new\n @hostela = Hostela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hostela }\n end\n end",
"def index\n @manuals = Manual.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manuals }\n end\n end",
"def show\n render json: @processo\n end",
"def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end",
"def index\n @blood_pressures = BloodPressure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blood_pressures }\n end\n end",
"def index\n @datasets = Dataset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datasets }\n end\n end"
] | [
"0.68363756",
"0.6692318",
"0.6659832",
"0.6213844",
"0.6070459",
"0.606196",
"0.6028984",
"0.5990749",
"0.5957427",
"0.5944486",
"0.58046305",
"0.57835656",
"0.57029563",
"0.56858665",
"0.5659081",
"0.5645538",
"0.5641492",
"0.5513693",
"0.54994106",
"0.5495769",
"0.54893327",
"0.54746836",
"0.5454847",
"0.5451983",
"0.5451389",
"0.5433473",
"0.5425062",
"0.5421794",
"0.54099333",
"0.5384405",
"0.53805184",
"0.53759116",
"0.53416055",
"0.53416055",
"0.5334184",
"0.52974117",
"0.52951187",
"0.52942866",
"0.5281279",
"0.52799517",
"0.52745956",
"0.52724123",
"0.52655554",
"0.52598137",
"0.5248208",
"0.52427495",
"0.52402365",
"0.52395153",
"0.5239411",
"0.5238723",
"0.5237033",
"0.523597",
"0.5229631",
"0.52257025",
"0.52256984",
"0.5225196",
"0.5224054",
"0.5221533",
"0.5214165",
"0.5212425",
"0.5209259",
"0.52049917",
"0.5203549",
"0.5201873",
"0.5190348",
"0.51883835",
"0.51761234",
"0.51740855",
"0.5166584",
"0.516518",
"0.5165158",
"0.5150565",
"0.5146093",
"0.5146093",
"0.51432574",
"0.514229",
"0.51419604",
"0.51403433",
"0.51403433",
"0.5138001",
"0.5135207",
"0.51304823",
"0.5128556",
"0.51205575",
"0.5116581",
"0.5116121",
"0.5112802",
"0.5112467",
"0.51118296",
"0.51048976",
"0.51007795",
"0.50987554",
"0.50955987",
"0.50952125",
"0.50940335",
"0.50860244",
"0.5084587",
"0.5078735",
"0.50771904",
"0.507568"
] | 0.6619302 | 3 |
PATCH/PUT /displays/1 PATCH/PUT /displays/1.json | def update
respond_to do |format|
if @display.update(display_params)
format.html {
flash[:success]= 'Display was successfully updated.'
redirect_to displays_path
}
format.json { render :show, status: :ok, location: @display }
else
format.html { render :edit }
format.json { render json: @display.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n format.html { redirect_to @display, :notice => 'Display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @display.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @display.update(display_params)\n format.html { redirect_to @display, notice: 'Display was successfully updated.' }\n format.json { render :show, status: :ok, location: @display }\n else\n format.html { render :edit }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @attribute_display.update(attribute_display_params)\n format.html { redirect_to @attribute_display, notice: 'attribute_display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n if @display_item.update_attributes(params[:display_item])\n format.html { redirect_to @display_item, notice: 'Display item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @display_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n if @heat_type.update_attributes(params[:heat_type])\n format.html { redirect_to @heat_type, notice: 'Heat type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n flash[:notice] = 'Display was successfully updated.'\n format.html { redirect_to(@display) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @display.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_overview.update(system_overview_params)\n format.html { redirect_to @system_overview, notice: 'System overview was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_overview }\n else\n format.html { render :edit }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @swatch.update(swatch_params)\n format.html { redirect_to @swatch, notice: 'Swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @swatch }\n else\n format.html { render :edit }\n format.json { render json: @swatch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n @resource.saved_by(current_admin)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @overview.update(overview_params)\n format.html { redirect_to @overview, notice: 'Overview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource.host, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource.host }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n @resource.eval_description\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n get_resource_types\n format.html { render action: :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n if @collab.update_attributes(params[:collab])\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @master_spec = Master::Spec.find(params[:id])\n\n respond_to do |format|\n if @master_spec.update_attributes(params[:master_spec])\n format.html { redirect_to(@master_spec, :notice => 'Spec was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @master_spec.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n flash.now[:success] = \"System was successfully updated.\"\n format.html { redirect_to @system }\n #proper response to http PUT is also no_content\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.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 @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @matrixspecy.update(matrixspecy_params)\n format.html { redirect_to @matrixspecy, notice: 'Matrixspecy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @matrixspecy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n if @hardware.update_attributes(params[:hardware])\n format.html { redirect_to @hardware, :notice => 'Hardware was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hardware.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @displaydatum.update(displaydatum_params)\n format.html { redirect_to @displaydatum, notice: 'Displaydatum was successfully updated.' }\n format.json { render :show, status: :ok, location: @displaydatum }\n else\n format.html { render :edit }\n format.json { render json: @displaydatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n if @specification.update_attributes(params[:specification])\n format.html { redirect_to @specification, notice: 'Specification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n if @microplst.update_attributes(params[:microplst])\n format.html { redirect_to @microplst, notice: 'Microplst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microplst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'[email protected]_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n if @gather.update_attributes(params[:gather])\n format.html { redirect_to @gather, notice: 'Gather was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gather.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_resource.update(api_v1_resource_params)\n format.html { redirect_to @api_v1_resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_resource }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dishtype.update(dishtype_params)\n format.html { redirect_to @dishtype, notice: 'Dishtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dishtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_stat.update(system_stat_params)\n format.html { redirect_to @system_stat, notice: 'System stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end",
"def update\n respond_to do |format|\n if @species.update(species_params)\n format.html { redirect_to @species, notice: 'Species was successfully updated.' }\n format.json { render :show, status: :ok, location: @species }\n else\n format.html { render :edit }\n format.json { render json: @species.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html {redirect_to systems_url, flash[:info]='System was successfully updated.' }\n format.js { flash[:info]='System was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def update\n respond_to do |format|\n if @report_display.update(report_display_params)\n format.html { redirect_to @report_display, notice: 'Report display was successfully updated.' }\n format.json { render :show, status: :ok, location: @report_display }\n else\n format.html { render :edit }\n format.json { render json: @report_display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @external_supplied.update(external_supplied_params)\n format.html { redirect_to @external_supplied, notice: 'External supplied was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @external_supplied.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end",
"def update\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n if @experiment_control.update_attributes(params[:experiment_control])\n format.html { redirect_to @experiment_control, notice: 'Experiment control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_control.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end",
"def update\n respond_to do |format|\n if @watch.update(watch_params)\n format.html { redirect_to @watch, notice: 'Watch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @watch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n if @mostsmallresource.update_attributes(params[:mostsmallresource])\n format.html { redirect_to @mostsmallresource, notice: 'Mostsmallresource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallresource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @show.update(show_params)\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @presented_testimony.update(presented_testimony_params)\n format.html { redirect_to @presented_testimony, notice: 'Presented testimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @presented_testimony }\n else\n format.html { render :edit }\n format.json { render json: @presented_testimony.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n binding.pry\n respond_to do |format|\n if @sets_and_rep.update(sets_and_rep_params)\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully updated.' }\n format.json { render :show, status: :ok, location: @sets_and_rep }\n else\n format.html { render :edit }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n if @lab_rack.update_attributes(params[:lab_rack])\n format.html { redirect_to(@lab_rack, :notice => 'Lab rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_rack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to polymorphic_path(complex_namespace_helper + [@resource]), notice: \"#{@resource_class} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n if @hardware_type.update_attributes(params[:hardware_type])\n format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hardware_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @standard_measurement = StandardMeasurement.find(params[:id])\n\n respond_to do |format|\n if @standard_measurement.update_attributes(params[:standard_measurement])\n format.html { redirect_to @standard_measurement, notice: 'Standard measurement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @standard_measurement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n @resource.assetable_id = 1\n @resource.assetable_type = 'User'\n\n if image_types.include? params[:resource][:data].content_type\n @resource.type = 'Ckeditor::Picture'\n else\n @resource.type = 'Ckeditor::AttachmentFile'\n end\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to admin_resources_path, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :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 resource.update(params_for_update)\n format.html { redirect_to resource, notice: \"#{resource_class_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: resource }\n else\n format.html { render :edit }\n format.json { render json: resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metadata_schema = MetadataSchema.find(params[:id])\n\n respond_to do |format|\n if @metadata_schema.update_attributes(params[:metadata_schema])\n @metadata_schemas = MetadataSchema.arrange(:order => :created_at)\n format.html { redirect_to @metadata_schema, notice: 'Metadata schema was successfully updated.' }\n format.json { head :no_content }\n format.js { render 'create.js'}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metadata_schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @objects_info = ObjectsInfo.find(params[:id])\n\n respond_to do |format|\n if @objects_info.update_attributes(params[:objects_info])\n format.html { redirect_to @objects_info, notice: 'Objects info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objects_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @users_management.update(users_management_params)\n format.html { redirect_to @users_management, notice: 'Management was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @users_management.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_admin_user\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @actum.update(actum_params)\n format.html { redirect_to @actum, notice: 'Actum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @actum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thickness.update(thickness_params)\n format.html { redirect_to @thickness, notice: 'Thickness was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thickness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cpu.update(cpu_params)\n format.html { redirect_to cpus_url }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n if @heat_source.update_attributes(params[:heat_source])\n format.html { redirect_to @heat_source, notice: 'Heat source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n if @experiment_biomechanical.update_attributes(params[:experiment_biomechanical])\n format.html { redirect_to @experiment_biomechanical, notice: 'Experiment biomechanical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_biomechanical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @visual_fidelity = VisualFidelity.find(params[:id])\n\n respond_to do |format|\n if @visual_fidelity.update_attributes(params[:visual_fidelity])\n format.html { redirect_to @visual_fidelity, notice: 'Visual fidelity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @visual_fidelity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :index, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6690989",
"0.6496534",
"0.6292571",
"0.6181971",
"0.6115013",
"0.60987264",
"0.6069684",
"0.60292166",
"0.602119",
"0.5978606",
"0.59749645",
"0.59725356",
"0.5967943",
"0.5943815",
"0.5939818",
"0.5937225",
"0.5930951",
"0.59201676",
"0.5919893",
"0.591337",
"0.5903632",
"0.5893395",
"0.588107",
"0.5869816",
"0.58675176",
"0.5863816",
"0.5861802",
"0.5858568",
"0.58541065",
"0.5827525",
"0.5827281",
"0.5822302",
"0.5822302",
"0.58158875",
"0.58128256",
"0.5812619",
"0.5811777",
"0.5805926",
"0.58024406",
"0.5800587",
"0.58002037",
"0.5799895",
"0.5797417",
"0.5795511",
"0.57919574",
"0.57908016",
"0.5788585",
"0.57868874",
"0.5785809",
"0.5784667",
"0.57709676",
"0.57675314",
"0.5765805",
"0.576474",
"0.5759776",
"0.57501376",
"0.57488024",
"0.5747011",
"0.5738435",
"0.57367325",
"0.5731959",
"0.57286274",
"0.5726968",
"0.5724182",
"0.57233983",
"0.57199323",
"0.5716897",
"0.5716133",
"0.5712703",
"0.57115996",
"0.57115996",
"0.57103693",
"0.5707988",
"0.57075197",
"0.5706995",
"0.5705849",
"0.5704744",
"0.56940204",
"0.5692451",
"0.569228",
"0.56913036",
"0.56888044",
"0.56872797",
"0.56862307",
"0.56811225",
"0.5677183",
"0.5676819",
"0.5675251",
"0.5673666",
"0.5673348",
"0.5670852",
"0.5669348",
"0.5664907",
"0.5664842",
"0.56638676",
"0.5662864",
"0.5662408",
"0.5659701",
"0.56584406",
"0.56550825"
] | 0.6203021 | 3 |
DELETE /displays/1 DELETE /displays/1.json | def destroy
@display.destroy
respond_to do |format|
format.html {
redirect_to displays_url
flash[:warning]= 'Display was successfully destroyed.'
}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to(displays_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @display.destroy\n respond_to do |format|\n format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heat_type = HeatType.find(params[:id])\n @heat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @displaydatum.destroy\n respond_to do |format|\n format.html { redirect_to displaydata_url, notice: 'Displaydatum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @display_item = DisplayItem.find(params[:id])\n @display_item.destroy\n\n respond_to do |format|\n format.html { redirect_to display_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute_display.destroy\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humen_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to metric_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report_display.destroy\n respond_to do |format|\n format.html { redirect_to report_displays_url, notice: 'Report display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @absent.destroy\n\n respond_to do |format|\n format.html { redirect_to absents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n @unsigned_columns_test.destroy\n\n respond_to do |format|\n format.html { redirect_to unsigned_columns_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @display_type = DISPLAY_TYPE_SIMPLE\n\n begin\n @database = set_ar(params).find(params[:id])\n\n @database.destroy\n\n flash[:notice] = t(:success_deleted, :id => @database.id)\n redirect_to(:action => :index)\n rescue => e\n flash[:error] = t(:error_default, :message => e.message)\n render :action => :index\n end\n end",
"def destroy\n @matrixspecy.destroy\n respond_to do |format|\n format.html { redirect_to matrixspecies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capture = Capture.find(params[:id])\n @capture.destroy\n\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hydraulic_system = HydraulicSystem.find(params[:id])\n @hydraulic_system.destroy\n\n respond_to do |format|\n format.html { redirect_to hydraulic_systems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hardware_type = HardwareType.find(params[:id])\n @hardware_type.destroy\n\n respond_to do |format|\n format.html { redirect_to hardware_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ami = Ami.find(params[:id])\n @ami.destroy\n\n respond_to do |format|\n format.html { redirect_to amis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @hardware = Hardware.find(params[:id])\n @hardware.destroy\n\n respond_to do |format|\n format.html { redirect_to hardwares_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to autos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human_condition = HumanCondition.find(params[:id])\n @human_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to human_conditions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to \"/dynamics/#{@board.dynamic_id}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dispatch = Dispatch.find(params[:id])\n @dispatch.destroy\n\n respond_to do |format|\n format.html { redirect_to dispatches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visual.destroy\n respond_to do |format|\n format.html { redirect_to visuals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { render :action => :admin_dash, :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @standard_measurement = StandardMeasurement.find(params[:id])\n @standard_measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to standard_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_stat.destroy\n respond_to do |format|\n format.html { redirect_to system_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_overview.destroy\n respond_to do |format|\n format.html { redirect_to system_overviews_url, notice: 'System overview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset = WirelessDevice.find(params[:id])\n asset_destroy(wireless_url)\n end",
"def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n @experiment_biomechanical.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_biomechanicals_url }\n format.json { head :no_content }\n end\n end",
"def test_del\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 id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @heat_source = HeatSource.find(params[:id])\n @heat_source.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_admin_user\n @tablet = Tablet.find(params[:id])\n @tablet.destroy\n\n respond_to do |format|\n format.html { redirect_to tablets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @matchsindiv = Matchsindiv.find(params[:id])\n @matchsindiv.destroy\n\n respond_to do |format|\n format.html { redirect_to matchsindivs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capture.destroy\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @automovile.destroy\n respond_to do |format|\n format.html { redirect_to automoviles_url, notice: \"Automovile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visual_fidelity = VisualFidelity.find(params[:id])\n @visual_fidelity.destroy\n\n respond_to do |format|\n format.html { redirect_to visual_fidelities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_device = LabDevice.find(params[:id])\n @lab_device.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_devices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @width = Width.find(params[:id])\n @width.destroy\n\n respond_to do |format|\n format.html { redirect_to widths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @band.destroy\n respond_to do |format|\n format.html { redirect_to bands_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to onecolumnmodels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'[email protected]_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dbh_measurement.destroy\n respond_to do |format|\n format.html { redirect_to dbh_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gather = Gather.find(params[:id])\n @gather.destroy\n\n respond_to do |format|\n format.html { redirect_to gathers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host_tpl = HostTpl.find(params[:id])\n @host_tpl.destroy\n\n respond_to do |format|\n format.html { redirect_to host_tpls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_hardware_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_hardware_types_url, notice: 'Hardware type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host = Host.find(params[:id])\n @host.destroy\n\n head :no_content\n end",
"def destroy\n @screenshot = Screenshot.find(params[:id])\n @screenshot.destroy\n\n respond_to do |format|\n format.html { redirect_to screenshots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @host = Host.find_by(hostname: params[:id])\n @host.destroy\n\n head :no_content\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_houses_url(:realty_type => params[:realty_type]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @show = Show.find(params[:id])\n @show.destroy\n\n respond_to do |format|\n format.html { redirect_to shows_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.748138",
"0.7295277",
"0.7247227",
"0.6883154",
"0.68739027",
"0.68485904",
"0.6832466",
"0.68199867",
"0.67659575",
"0.67593324",
"0.66454387",
"0.66435814",
"0.66037893",
"0.66037893",
"0.6603657",
"0.66025704",
"0.66011417",
"0.6591571",
"0.65859663",
"0.654852",
"0.6547301",
"0.6539368",
"0.65370345",
"0.653463",
"0.65177315",
"0.65098584",
"0.6500602",
"0.65005946",
"0.65001744",
"0.6499055",
"0.6498172",
"0.6496811",
"0.6494762",
"0.6488702",
"0.6486984",
"0.6479335",
"0.647856",
"0.647633",
"0.647549",
"0.64725953",
"0.6469588",
"0.64663666",
"0.64626807",
"0.6462259",
"0.64601827",
"0.64574164",
"0.6456481",
"0.6456301",
"0.64532655",
"0.64530164",
"0.645289",
"0.644847",
"0.6447398",
"0.6436605",
"0.6433558",
"0.6430735",
"0.6421653",
"0.64212275",
"0.6421089",
"0.6420256",
"0.6413673",
"0.64081687",
"0.64081556",
"0.64067644",
"0.6406413",
"0.6405786",
"0.6405407",
"0.640348",
"0.64008456",
"0.6400495",
"0.6394211",
"0.6392525",
"0.6390567",
"0.6387759",
"0.63870436",
"0.6385801",
"0.6384105",
"0.63805944",
"0.6375608",
"0.6374974",
"0.6374461",
"0.6372629",
"0.63706034",
"0.6366839",
"0.6365866",
"0.6362469",
"0.63620794",
"0.6361788",
"0.6359617",
"0.6354654",
"0.6354016",
"0.6353142",
"0.6352521",
"0.634964",
"0.63495064",
"0.634833",
"0.6347253",
"0.6343705",
"0.6343146",
"0.63411695"
] | 0.68277794 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_display
@display = Display.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 display_params
params.require(:display).permit(:name, :active, :order, :resolution)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end"
] | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915146",
"0.6290595",
"0.62824667",
"0.62420255",
"0.62403506",
"0.6217174",
"0.6213706",
"0.62112075",
"0.6194868",
"0.6178784",
"0.6174678",
"0.6172499",
"0.61630744",
"0.61544263",
"0.615248",
"0.6147727",
"0.61221075",
"0.6119646",
"0.61076134",
"0.6106584",
"0.6094013",
"0.6081423",
"0.6071337",
"0.6063637",
"0.6021453",
"0.6018253",
"0.60161054",
"0.60112554",
"0.60071784",
"0.60071784",
"0.60004836",
"0.6000254",
"0.5999255",
"0.59930664",
"0.59919107",
"0.5991741",
"0.5980763",
"0.59663844",
"0.59605104",
"0.5960486",
"0.5959414",
"0.5957901",
"0.59538954",
"0.5953327",
"0.59450173",
"0.59391475",
"0.59391475",
"0.59386194",
"0.59351885",
"0.593139",
"0.5926316",
"0.5925927",
"0.59176016",
"0.59119296",
"0.5909275",
"0.5908221",
"0.59053046",
"0.58983994",
"0.58980995",
"0.58964473",
"0.5895902",
"0.5893993",
"0.58927304",
"0.5887752",
"0.58841616",
"0.5880381",
"0.58752084",
"0.586956",
"0.5868584",
"0.58679324",
"0.5867004",
"0.58667004",
"0.58642864",
"0.5863347",
"0.58626384",
"0.58615845",
"0.58594906",
"0.5854959",
"0.5854423",
"0.58506453",
"0.5850135"
] | 0.0 | -1 |
Create a new dispatcher. Must be initialized with an Acoustic::Router object. | def initialize(router)
@router = router
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @router = Router.new(ROUTES)\n end",
"def initialize(dispatcher = Dispatcher.new)\n @dispatcher = dispatcher\n\n yield self if block_given?\n end",
"def setup_router\n self.router = Fastr::Router.new(self)\n self.router.load\n end",
"def initialize(router)\n @router = router\n end",
"def connect_to_dispatcher( url )\n @dispatcher_connections ||= {}\n @dispatcher_connections[url] ||= Client::Dispatcher.new( opts, url )\n end",
"def initialize( name, config )\n\t\t@name = name\n\t\t@config = config\n\n\t\t@broker = Arrow::Broker.new( config )\n\t\tself.configure( config )\n\trescue ::Exception => err\n\t\tmsg = \"%s while creating dispatcher: %s\\n%s\" %\n\t\t\t[ err.class.name, err.message, err.backtrace.join(\"\\n\\t\") ]\n\t\tself.log.error( msg )\n\t\tmsg.gsub!( /%/, '%%' )\n\t\tApache.request.server.log_crit( msg ) unless !defined?( Apache )\n\tend",
"def create_dispatcher(version, framework)\n command = RpcCommandFactory.create(version, framework)\n dispatcher = Dispatcher.new(framework)\n dispatcher.set_command(command)\n\n dispatcher\n end",
"def dispatcher()\n require 'dispatch/dispatch'\n @dispatch = Dispatch.new\n @dispatch.start\n sleep\n end",
"def set_admin_dispatcher\n @admin_dispatcher = Admin::Dispatcher.find(params[:id])\n end",
"def initialize\n @router = Router.new\n add_head_not_allowed_methods_and_options_methods\n self.class.endpoints.each do |endpoint|\n endpoint.mount_in(@router)\n end\n\n @router.compile!\n @router.freeze\n end",
"def initialize(name, signature, routing, controller, method)\n @name, @signature, @routing = name, signature, routing\n @controller, @method = controller, method\n @routing = ::Waw::Routing::ActionRouting.new unless @routing\n end",
"def routes(routes_def)\n RouterDefinition.new(routes_def)\n end",
"def initialize(resource_creator = method(:create_resource))\n @routes = []\n @resource_creator = resource_creator\n end",
"def child_init( req )\n\t\treq.server.log_info( \"Loading dispatcher configs from \" + @hostsfile + \".\" )\n\t\tArrow::Dispatcher.create_from_hosts_file( @hostsfile )\n\n\t\treturn Apache::OK\n\trescue ::Exception => err\n\t\terrmsg = \"%s failed to load dispatchers (%s): %s: %s\" % [\n\t\t\tself.class.name,\n\t\t\terr.class.name,\n\t\t\terr.message,\n\t\t\terr.backtrace.join(\"\\n \")\n\t\t]\n\n\t\tlogfile = Pathname.new( Dir.tmpdir ) + 'arrow-dispatcher-failure.log'\n\t\tlogfile.open( IO::WRONLY|IO::TRUNC|IO::CREAT ) do |ofh|\n\t\t\tofh.puts( errmsg )\n\t\t\tofh.flush\n\t\tend\n\n\t\tApache.request.server.log_crit( errmsg )\n\t\traise\n\tend",
"def router\n @router ||= PathRouter.new\n block_given? ? yield(@router) : @router\n end",
"def initialize(pattern, http_method, controller_class, action_name)\n #these come from the Router which comes from the request\n @pattern = pattern\n @http_method = http_method\n @controller_class = controller_class\n @action_name = action_name\n #?\n end",
"def initialize args={}\n @args = args\n\n @context = @args[:context]\n @route_context = @args[:route_context]\n\n @router = @args[:router] || method(:df_route)\n @router_type = @args[:router_type]\n\n @proxies = OpenStruct.new\n @station = MailStation.new args\n\n @state = :state_inited\n end",
"def create\n @group = Group.find(params[:group_id])\n @dispatcher = Dispatcher.new(params[:dispatcher])\n @group.dispatcher = @dispatcher\n \n respond_to do |format|\n if @dispatcher.save\n format.html { redirect_to :root }\n format.json { render :json => @dispatcher, :status => :created, :location => @dispatcher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @dispatcher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def log_dispatcher\n dispatcher_name = Agent.config[:dispatcher].to_s\n\n if dispatcher_name.empty?\n ::NewRelic::Agent.logger.info('No known dispatcher detected.')\n else\n ::NewRelic::Agent.logger.info(\"Dispatcher: #{dispatcher_name}\")\n end\n end",
"def router\n @router ||= Router.new(method(:page404))\n end",
"def router; end",
"def to(params)\n set(:controller, params[:controller])\n set(:action, params[:action])\n # We now have all the properties we really need to create a route.\n route = Route.new(@routes.pop)\n @routes << route\n self\n end",
"def router=(_arg0); end",
"def initialize automount = false, &proc\n @routes = []\n @controllers, @subcontrollers = {}, []\n @hosts, @controllers_hosts = {}, {}\n @automount = automount\n proc && self.instance_exec(&proc)\n use ExtendedRack\n compiler_pool(Hash.new)\n end",
"def setup_router(scope); end",
"def initialize\n @routes = {}\n end",
"def dispatcher\n endpoint_dispatch(params[:address])\n end",
"def create\n @user = Dispatcher.new(admin_dispatcher_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to admin_dispatchers_path, notice: 'Dispatcher was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(shell)\n super\n\n Dispatchers.each { |d|\n shell.enstack_dispatcher(d)\n }\n end",
"def route(*args)\n Route.new(self, *args)\n end",
"def initialize(routes)\n @routes = routes\n end",
"def initialize(routes)\n @routes = routes\n end",
"def initialize(routes)\n @routes = routes\n end",
"def dispatcher\n @dispatcher ||= blank_context(:this => self) do\n def method_missing(sym, *args, &block)\n @this.doc_ready!\n [@this, @this.doc].each do |context|\n next unless context.respond_to?(sym)\n return context.send(sym, *args, &block)\n end\n super # raise NoMethodError if no context can handle\n end\n end\n end",
"def create\n @router = Router.new(router_params)\n\n respond_to do |format|\n if @router.save\n format.html { redirect_to admin_routers_url, notice: 'Router was successfully created.' }\n format.json { render :show, status: :created, location: @router }\n else\n format.html { render :new }\n format.json { render json: @router.errors, status: :unprocessable_entity }\n end\n end\n end",
"def route(&block)\n @router ||= Router.new\n @router.instance_eval(&block)\n end",
"def set_router\n @router = Router.find(params[:id])\n end",
"def register\n @index = Router.routes.size\n Router.routes << self\n self\n end",
"def initialize\n #load_config\n load_routes\n end",
"def to(params = {}, &block)\n if block_given?\n new_behavior = self.class.new({}, params, self)\n yield new_behavior if block_given?\n new_behavior\n else\n to_route(params).register\n end\n end",
"def initialize(params={})\n @application = Aurita::Main::Application\n @decorator = Aurita::Main::Default_Decorator.new\n @logger = params[:logger]\n @logger ||= Aurita::Log::Class_Logger.new('Dispatcher')\n @benchmark_time = 0\n @num_dispatches = 0 \n end",
"def initialize(config)\n @reactor = config.reactor\n incoming = Address.from_string(config.incoming_endpoint.to_s)\n outgoing = Address.from_string(config.outgoing_endpoint.to_s)\n\n # setup the handlers for processing messages\n @handler_in = Handler.new(config, incoming)\n @handler_out = Handler.new(config, outgoing)\n\n # create each socket and pass in the appropriate handler\n @incoming_sock = @reactor.sub_socket(@handler_in)\n @outgoing_sock = @reactor.pub_socket(@handler_out)\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing_sock\n @handler_out.socket_out = @incoming_sock\n end",
"def roar\n if @roar_instance.nil?\n opts = roar_options[request.subdomains.first]\n opts ||= roar_options[roar_options.keys.sort.reverse.detect { |key| request.path.match(/^\\/#{key}/) }]\n @roar_instance = Roar::Base.new(self, opts, &opts[:roar_definition]) unless opts.nil?\n end \n @roar_instance\n end",
"def ensure_dispatcher\n if dispatchers.all.empty?\n async_redirect '/dispatchers/edit'\n else\n dispatchers.first_alive {\n |dispatcher|\n async_redirect '/dispatchers/edit' if !dispatcher\n }\n end\n end",
"def current_dispatcher\n @current_dispatcher ||= Dispatcher.find(session[:dispatcher_id]) if session[:dispatcher_id]\n end",
"def initialize reactor, incoming, outgoing, debug = false\n incoming = Address.from_string incoming if incoming.kind_of? String\n outgoing = Address.from_string outgoing if outgoing.kind_of? String\n\n # setup the handlers for processing messages\n @handler_in = Handler.new reactor, incoming, debug, :in\n @handler_out = Handler.new reactor, outgoing, debug, :out\n\n # create each socket and pass in the appropriate handler\n @incoming = reactor.xrep_socket @handler_in\n @outgoing = reactor.xreq_socket @handler_out\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing\n @handler_out.socket_out = @incoming\n end",
"def configure( config )\n\t\tself.log.notice \"Configuring a dispatcher for '%s' from '%s': child server %d\" %\n\t\t\t[ Apache.request.server.hostname, config.name, Process.pid ]\n\n # Configure any modules that have mixed in Configurability\n\t\tif defined?( Apache )\n\t\t\trequire 'apache/logger'\n\t\t\tConfigurability.logger = Logger.new( Apache::LogDevice.new )\n\t\t\tConfigurability.logger.formatter = Apache::LogFormatter.new\n\t\telse\n\t\t\tConfigurability.reset_logger\n\t\tend\n\n \tConfigurability.configure_objects( config )\n\tend",
"def inherited klass\n new_dispatchers = {}\n @double_dispatchers.each do |name, dispatcher|\n new_dispatchers[name] = Dispatcher.new{|o| instance_exec(o, &dispatcher[o]) }\n end\n\n klass.instance_variable_set(:@double_dispatchers, new_dispatchers)\n end",
"def generate_routes!\n Router.new(self).generate(@app)\n end",
"def ldap_dispatcher\n # Scooter doesn't support custom settings yet.\n #@ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389, \n # :auth => { :method => :simple, :username => \"cn=admin,dc=example,dc=com\", :password => \"puppetlabs\" } })\n @ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389 })\nend",
"def create\n feature_enable unless feature_enabled\n X__RESOURCE_NAME__X_router\n end",
"def initialize(pattern, http_method, controller_class, action_name)\n @pattern = pattern\n @http_method = http_method\n @controller_class = controller_class\n @action_name = action_name\n end",
"def compile\n robot.handlers.each do |handler|\n next unless handler.respond_to?(:http_routes)\n\n handler.http_routes.each { |route| router.add_route(route) }\n end\n end",
"def Controller(matcher)\n make(matcher)\n end",
"def initialize(controller_uri,use_acl,front_prober,port,proberoute_dir,output_dir=Prober::DEFAULT_TMP_OUTPUT_DIR)\n\t\tsuper(proberoute_dir,output_dir)\n\t\t@pid2fn = {}\n\t\t@front_prober=front_prober\n\t\t@port=port\n\t\t# setting in case we can't get the controller uri below\n\t\t# and it doesn't get set properly\n\t\t# need it set to something true so we know to use acl in the\n\t\t# future\n\t\t@acl=use_acl\n\t\t@controller_uri=nil\n\t\tbegin\n\t\t\tif controller_uri.nil?\n\t\t\t\tcontroller_uri = Prober::get_default_controller_uri\n\t\t\tend\n\t\trescue Exception\n\t\t\tself.log(\"Unable to fetch controller uri:\",$!)\n\t\tend\n\t\tbegin\n\t\t\tif controller_uri.nil?\n\t\t\t\tself.register\n\t\t\telse\n\t\t\t\tupdate_controller(controller_uri)\n\t\t\tend\n\t\trescue Exception\n\t\t\tself.log(\"Unable to register:\",$!)\n\t\tend\n\tend",
"def initialize(pattern, http_method, controller_class, action_name)\n @pattern, @http_method, @controller_class, @action_name =\n pattern, http_method, controller_class, action_name\n end",
"def initialize(routes)\n @routes = routes.map { |r| '/' + r }\n @captures = Match.new []\n end",
"def init_message_source(root_router, default_collector)\n @root_router = root_router\n\n @message_router = MessageRouter.new(default_collector)\n\n nil\n end",
"def initialize(routing_rules)\n @rule_evaluators = parse_routing_rules(routing_rules)\n end",
"def dispatcher(session,context,dispatch_destination = nil)\n @myclass.Dispatcher.dispatch(session,context,dispatch_destination)\n end",
"def new(*args)\n Fleet::Controller.new(*args)\n end",
"def initialize(app, path_info, request_conditions, segment_conditions, params, mount_point = true)\n @app = app\n @path_info = path_info\n @request_conditions = request_conditions\n @segment_conditions = segment_conditions\n @params = params\n @mount_point = mount_point\n \n # For route generation only\n # TODO: Move this into Routable\n if mount_point?\n @app.mount_at(self)\n end\n \n raise ArgumentError, \"You must specify a valid rack application\" unless app.respond_to?(:call)\n end",
"def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end",
"def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end",
"def dispatch_to(dispatcher)\n @jr_method_args.each { |args|\n # copy args so original is preserved\n handler_method, jr_methods =\n extract_handler_method(Array.new(args))\n jr_methods.map! { |m| m.to_s }\n\n handler = has_handler_for?(handler_method) ?\n handler_for(handler_method) :\n create_handler_for(handler_method)\n\n dispatcher.handle jr_methods, handler\n }\n end",
"def initialize(config)\n @reactor = config.reactor\n incoming = Address.from_string(config.incoming_endpoint.to_s)\n outgoing = Address.from_string(config.outgoing_endpoint.to_s)\n\n # setup the handlers for processing messages\n @handler_in = Handler.new(config, incoming, :in)\n @handler_out = Handler.new(config, outgoing, :out)\n\n # create each socket and pass in the appropriate handler\n @incoming_sock = @reactor.xrep_socket(@handler_in)\n @outgoing_sock = @reactor.xreq_socket(@handler_out)\n\n # set each handler's outgoing socket\n @handler_in.socket_out = @outgoing_sock\n @handler_out.socket_out = @incoming_sock\n end",
"def build(clazz)\n\n # Tell each worker class you are about to create it. This will allow for worker init.\n worker = clazz.new\n worker.create if worker.respond_to?('create')\n\n # Set up the queues for this class\n routing = self.class.new\n methods = clazz.instance_methods(false)\n methods.each do |method|\n next if method == 'create' # Skip the create method\n queue = queue_for(clazz, method)\n routing[queue] = clazz.new\n end\n \n return routing\n end",
"def initialize(env) #:nodoc:\n @env = env.dup\n # a parent router may be assuming a successful match\n # but this subrouter may not, so we explicitly set it to not matched\n # on creation\n not_matched\n @rules = []\n # Actually create the rules so that the procs we create are in the\n # context of an instance of this object. This is most important when the\n # rule is based on a symbol. We need that symbol to resolve to an\n # instance method; however, instance methods are not available until\n # after an instance is created.\n self.class.rules.each {|rule| match *rule }\n\n @prerequisites = []\n self.class.prerequisites.each do |prerequisite|\n @prerequisites << normalize_match_params(prerequisite)\n end\n end",
"def route(controller, action, **args)\n klass = Object.const_get(klass_for(controller)).new(**args)\n klass.send(action)\n end",
"def serve(obj, accept = obj.public_methods)\n\t\tif obj.is_a?(Dispatcher)\n\t\t\t# 2.\n\t\t\t@dispatcher = obj\n\t\telse\n\t\t\t# 1.\n\t\t\t@dispatcher = ObjectDispatcher.new(obj, accept)\n\t\tend\n\t\tself\n\tend",
"def initialize configuration\n @queue=Queue.new\n @parser=instantiate_class(configuration.parser,configuration) if configuration.parser\n if configuration.runner\n if configuration.runner[:class]\n @runner=configuration.runner[:class].new(configuration.context,@queue)\n else\n raise RutemaError,\"Runner settting overriden, but missing :class\"\n end\n else\n @runner=Rutema::Runners::Default.new(configuration.context,@queue)\n end\n raise RutemaError,\"Could not instantiate parser\" unless @parser\n @dispatcher=Dispatcher.new(@queue,configuration)\n @configuration=configuration\n end",
"def construct_app_stack\n @framework_instance ||= framework.new\n top_app = @framework_instance\n\n middleware.each do |mw_class|\n top_app = mw_class.new(top_app)\n end\n\n top_app\n end",
"def instance\n @instance ||= Fleet::Controller.new\n end",
"def initialize(*args) #:nodoc:\n super\n @controller_name = name.pluralize\n\n base_name, @controller_class_path, @controller_file_path, class_nesting, class_nesting_depth = extract_modules(@controller_name)\n class_name_without_nesting, @controller_file_name, controller_plural_name = inflect_names(base_name)\n\n @controller_class_name = if class_nesting.empty?\n class_name_without_nesting\n else\n \"#{class_nesting}::#{class_name_without_nesting}\"\n end\n end",
"def service(request, response)\n params = @router.resolve_uri(request.request_uri)\n controller = Acoustic::Controller.from_symbol(params[:controller])\n action = params[:action]\n controller.process(action, params, request, response)\n rescue Acoustic::UnresolvableUri, Acoustic::ControllerNameError\n raise Acoustic::NotFound.new(request.request_uri)\n end",
"def initialize( routes=[], options={} )\n\t\troutes.each do |tuple|\n\t\t\tself.log.debug \" adding route: %p\" % [ tuple ]\n\t\t\tself.add_route( *tuple )\n\t\tend\n\tend",
"def route(path, controller = nil, &block)\n\t\tunless @active_router\n\t\t\tGReactor.warn \"You should define a listener before adding a route - use `Plezi.listen`.\\nCreating a default (empty) listener.\"\n\t\t\tPlezi.listen\n\t\tend\n\t\t@routers_locker.synchronize { @active_router.add_route path, controller, &block }\n\tend",
"def initialize(controllers, lights)\n #start_scheduler\n\n @controllers = controllers\n @devices = lights\n\n # this variable is used to\n @rh_context ||= {}\n end",
"def initialize(options)\n unless (@logger = options[:logger])\n raise ::ArgumentError, \"options[:logger] is required: #{@logger.inspect}\"\n end\n unless (@mode = options[:mode].to_s) && MODES.include?(@mode)\n raise ::ArgumentError, \"options[:mode] must be one of #{MODES.inspect}: #{@mode.inspect}\"\n end\n unless (@kind = options[:kind].to_s) && KINDS.include?(@kind)\n raise ::ArgumentError, \"options[:kind] must be one of #{KINDS.inspect}: #{@kind.inspect}\"\n end\n unless (@uri = options[:uri]) && @uri.respond_to?(:path)\n raise ::ArgumentError, \"options[:uri] must be a valid parsed URI: #{@uri.inspect}\"\n end\n unless (@verb = options[:verb]) && VERBS.include?(@verb)\n raise ::ArgumentError, \"options[:verb] must be one of #{VERBS.inspect}: #{@verb.inspect}\"\n end\n unless (@headers = options[:headers]).kind_of?(::Hash)\n raise ::ArgumentError, \"options[:headers] must be a hash: #{@headers.inspect}\"\n end\n unless (@route_data = options[:route_data]).kind_of?(::Hash)\n raise ::ArgumentError, \"options[:route_data] must be a hash: #{@route_data.inspect}\"\n end\n @http_status = options[:http_status]\n if @kind == 'response'\n @http_status = Integer(@http_status)\n elsif !@http_status.nil?\n raise ::ArgumentError, \"options[:http_status] is unexpected for #{@kind}.\"\n end\n unless (@variables = options[:variables]).kind_of?(::Hash)\n raise ::ArgumentError, \"options[:variables] must be a hash: #{@variables.inspect}\"\n end\n if (@effective_route_config = options[:effective_route_config]) && !@effective_route_config.kind_of?(::Hash)\n raise ::ArgumentError, \"options[:effective_route_config] is not a hash: #{@effective_route_config.inspect}\"\n end\n @body = options[:body] # not required\n\n # merge one or more wildcard configurations matching the current uri and\n # parameters.\n @headers = normalize_headers(@headers)\n @typenames_to_values = compute_typenames_to_values\n\n # effective route config may already have been computed for request\n # (on record) or not (on playback).\n @effective_route_config ||= compute_effective_route_config\n\n # apply the configuration by substituting for variables in the request and\n # by obfuscating wherever a variable name is nil.\n erck = @effective_route_config[@kind]\n case @mode\n when 'validate'\n # used to validate the fixtures before playback; no variable\n # substitution should be performed.\n else\n if effective_variables = erck && erck[VARIABLES_KEY]\n recursive_replace_variables(\n [@kind, VARIABLES_KEY],\n @typenames_to_values,\n effective_variables,\n erck[TRANSFORM_KEY])\n end\n end\n if logger.debug?\n logger.debug(\"#{@kind} effective_route_config = #{@effective_route_config[@kind].inspect}\")\n logger.debug(\"#{@kind} typenames_to_values = #{@typenames_to_values.inspect}\")\n end\n\n # recreate headers and body from data using variable substitutions and\n # obfuscations.\n @headers = @typenames_to_values[:header]\n @body = normalize_body(@headers, @typenames_to_values[:body] || @body)\n end",
"def initialize dir\n @ilog = logger\n @controllers = {} # fqname=> instance \n @load_dir = dir\n load_controllers dir if @load_dir\n end",
"def dispatch\n Engine.instance.dispatch([self])\n end",
"def _init\n unless @_initialized\n @_initialized = true\n self.routes = Array.new\n self.mutex = Mutex.new\n end\n end",
"def initialize(app_class, env)\n\t\t\t@app_class = app_class\n\t\t\t@env = env\n\t\t\t@request = Flame::Dispatcher::Request.new(env)\n\t\t\t@response = Flame::Dispatcher::Response.new\n\t\tend",
"def get_dispather_instance(dispatch_mode, message, conf_per_targets)\r\n klass = @@subclasses[dispatch_mode]\r\n raise \"undefined dispatch mode #{message.headers[:mode]}\" unless klass\r\n klass.new(message, conf_per_targets)\r\n end",
"def set_controller(controller)\n @routes = ::Rails.application.routes\n @controller = controller.new\n end",
"def initialize\n @mailers = {}\n\n self.namespace = Object\n self.root = DEFAULT_ROOT\n self.delivery_method = DEFAULT_DELIVERY_METHOD\n self.default_charset = DEFAULT_CHARSET\n\n yield(self) if block_given?\n @finder = TemplatesFinder.new(root)\n end",
"def build\n route.controller.new.tap do |ctrl|\n Karafka::Routing::Route::ATTRIBUTES.each do |attr|\n ctrl.public_send(:\"#{attr}=\", route.public_send(attr))\n end\n end\n end",
"def map_onto(router)\n app_data = self\n app_obj = @app_obj\n\n uri_root = app_data.uri_root\n public_folder_exists = File.exist?(app_obj.public_folder)\n\n if padrino_application?\n app_obj.set :uri_root, uri_root\n app_obj.set :app_name, app_obj.app_name.to_s\n app_obj.set :root, app_data.app_root\n app_obj.set :public_folder, Padrino.root('public', uri_root) unless public_folder_exists\n app_obj.set :static, public_folder_exists\n app_obj.set :cascade, app_data.cascade\n else\n app_obj.cascade = app_data.cascade\n app_obj.uri_root = uri_root\n app_obj.public_folder = Padrino.root('public', uri_root) unless public_folder_exists\n end\n app_obj.setup_application! # Initializes the app here with above settings.\n router.map(:to => app_obj, :path => uri_root, :host => app_data.app_host)\n end",
"def initialize(params={})\n @logger = Logger.new(STDOUT)\n establish_main_container(params)\n if main?\n @ams = AgentManagementSystem.new(\n :addresses => agent_transport_addresses,\n :logger => logger\n )\n @df = DirectoryFacilitator.new(\n :logger => logger\n )\n @acc = AgentCommunicationChannel.new(\n :logger => logger,\n :ams => ams\n )\n else\n logger.debug \"Obtaining reference to main container AMS...\"\n @ams = main_container.ams\n logger.debug \"Done obtaining reference to main container AMS.\"\n logger.debug \"Obtaining reference to main container DF...\"\n @df = main_container.df # FIXME: broken as of JRuby 0.9.8: see http://jira.codehaus.org/browse/JRUBY-572\n logger.debug \"Done obtaining reference to main container DF.\"\n logger.debug \"Obtaining reference to main container ACC...\"\n @acc = main_container.acc\n logger.debug \"Done obtaining reference to main container ACC.\"\n end\n @config = params[:config] || \"rage.yaml\"\n end",
"def initialize_routing\n configuration.add_controller_paths(extension_loader.paths(:controller))\n configuration.add_eager_load_paths(extension_loader.paths(:eager_load))\n super\n end",
"def initialize(uri=nil, front=nil, config_or_acl=nil)\n if Hash === config_or_acl\n config = config_or_acl.dup\n else\n acl = config_or_acl || @@acl\n config = {\n :tcp_acl => acl\n }\n end\n\n @config = self.class.make_config(config)\n\n @protocol = DRbProtocol.open_server(uri, @config)\n @uri = @protocol.uri\n @exported_uri = [@uri]\n\n @front = front\n @idconv = @config[:idconv]\n @safe_level = @config[:safe_level]\n\n @grp = ThreadGroup.new\n @thread = run\n\n DRb.regist_server(self)\n end",
"def apply(router)\n router.send(:get, {:elfinder => 'elfinder#connector', :as => 'elfinder_connector'})\n end",
"def index\n @dispatchers = Dispatcher.all\n end",
"def dispatch(name = :default, &block)\n target_queue = @dispatcher[name] ||= Pigeon::Dispatcher.new(name == :default ? nil : 1)\n \n target_queue.perform(&block)\n end",
"def show\n @dispatcher = Dispatcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dispatcher }\n end\n end",
"def route(agi, params=nil)\n request = {\n :uri => @uri,\n :controller => @controller,\n :method => @method,\n :id => @id,\n :options => @options\n }\n\n return if !@controller\n\n controller_name = if !@controller[/controller/]\n \"#{@controller}_controller\"\n else\n \"#{@controller}\"\n end\n\n controller_name = controller_name.classify\n controller = get_controller(controller_name)\n\n @@logger.info \"Processing Route to #{controller_name}##{@method}\"\n @@logger.info \"#{@uri}\"\n\n unless controller\n @@logger.warn(\"Nonexistant controller\")\n return set_invalid_extension(agi)\n end\n\n unless check_controller(controller)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n unless check_route(controller, @method)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n ctrl_instance = controller.new({\n :agi => agi,\n :params => params,\n :request => request\n })\n\n begin\n ctrl_instance.run_filter_chain :before\n ctrl_instance.method(@method).call()\n ctrl_instance.run_filter_chain :after\n rescue AGIFilterHalt => e\n LOGGER.warn e.message\n end\n end",
"def new(*args)\n my = self.init\n my.connect(*args)\n end",
"def child_init( req ) # :nodoc\n self.log.notice \"Dispatcher configured for %s\" % [ req.server.hostname ]\n return Apache::OK\n end",
"def mount *roots, &setup\n return @app if @app\n\n self.map(*roots) if roots.size > 0\n self.class_exec(&setup) if setup\n\n setup!\n map!\n\n builder, app = ::Rack::Builder.new, self\n use?.each { |w| builder.use w[:ware], *w[:args], &w[:proc] }\n url_map.each_key do |route|\n builder.map route do\n run lambda { |env| app.new.call env }\n end\n end\n \n freeze!\n lock!\n\n @app = rewrite_rules.size > 0 ?\n ::AppetiteRewriter.new(rewrite_rules, builder.to_app, self) :\n builder.to_app\n end",
"def initialize( config, template_factory, uri )\n\t\t@config\t\t\t\t= config\n\t\t@template_factory\t= template_factory\n\t\t@uri\t\t\t\t= uri\n\n\t\t@signature\t\t\t= self.class.signature.dup\n\t\t@run_count\t\t\t= 0\n\t\t@total_utime\t\t= 0\n\t\t@total_stime\t\t= 0\n\n\t\t# Make a regexp out of all public <something>_action methods\n\t\t@actions = self.public_methods( true ).\n\t\t\tselect {|meth| /^(\\w+)_action$/ =~ meth }.\n\t\t\tcollect {|meth| meth.gsub(/_action/, '') }\n\t\t@actions_regexp\t= Regexp.new( \"^(\" + actions.join( '|' ) + \")$\" )\n\tend"
] | [
"0.6645551",
"0.6325097",
"0.61795986",
"0.6178408",
"0.6123979",
"0.60822535",
"0.5996235",
"0.5900043",
"0.5629779",
"0.5618047",
"0.5517224",
"0.5487449",
"0.54611844",
"0.54611075",
"0.537196",
"0.53694046",
"0.5297103",
"0.5288517",
"0.5249094",
"0.5211732",
"0.51907396",
"0.5189162",
"0.5151754",
"0.51503813",
"0.51402223",
"0.51018417",
"0.5099901",
"0.5061072",
"0.50606024",
"0.506038",
"0.50555825",
"0.50555825",
"0.50555825",
"0.5036454",
"0.5012367",
"0.5006608",
"0.4995177",
"0.49854165",
"0.497195",
"0.49567652",
"0.49559325",
"0.49316618",
"0.49258974",
"0.4919163",
"0.4918874",
"0.49188584",
"0.48880988",
"0.4872186",
"0.48677135",
"0.48625618",
"0.4860654",
"0.48412073",
"0.48281568",
"0.48227748",
"0.48209503",
"0.48103783",
"0.4807623",
"0.48055258",
"0.47886005",
"0.4782272",
"0.4769082",
"0.47636947",
"0.47594622",
"0.47594622",
"0.47562402",
"0.47534266",
"0.47414908",
"0.4740157",
"0.47367182",
"0.4736046",
"0.47288764",
"0.4706498",
"0.46916708",
"0.4691473",
"0.46730933",
"0.46608993",
"0.46580318",
"0.4655625",
"0.46403623",
"0.46372882",
"0.46315736",
"0.46232525",
"0.46205243",
"0.46122283",
"0.46118334",
"0.46064764",
"0.4599031",
"0.45896098",
"0.4585314",
"0.45824423",
"0.4578395",
"0.45759463",
"0.45718077",
"0.45707467",
"0.45649937",
"0.4563252",
"0.45626011",
"0.45623255",
"0.45609173",
"0.45563155"
] | 0.6211882 | 2 |
Service a request and response. Use the router to extract the params from the URL, create the appropriate controller, and had control over to the controller. | def service(request, response)
params = @router.resolve_uri(request.request_uri)
controller = Acoustic::Controller.from_symbol(params[:controller])
action = params[:action]
controller.process(action, params, request, response)
rescue Acoustic::UnresolvableUri, Acoustic::ControllerNameError
raise Acoustic::NotFound.new(request.request_uri)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(req, res)\n # The #run method will figure out what URL was requested, match it to\n # the path regex of one Route object, and finally ask the Route to\n # instantiate the appropriate controller, and call the appropriate method.\n end",
"def run(req, res)\n route_params = self.make_match_hash(req)\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end",
"def run(req, res)\n @route_params = {}\n\n # I need to build route_params from the URL params\n # @pattern is the regexp\n match_data = @pattern.match(req.path)\n # * @pattern is the regexp given in the router.draw block in\n # p06_router_server.rb\n # * req.path is the url we are matching against\n # match_data gives us the MatchData object\n match_data.names.each do |name|\n @route_params[name] = match_data[name]\n end\n #this loop creates the params!\n\n controller_instance = @controller_class.new(req, res, @route_params)\n controller_instance.invoke_action(@action_name)\n end",
"def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end",
"def run(req, res)\n if matches?(req)\n controller_instance = controller_class.new(req, res, route_params(req))\n controller_instance.invoke_action(action_name)\n else\n # extra precaution! won't be hit if `Router#run` is used\n res.status = 404\n res.write(\"No route matches for #{http_method} on #{controller_class}\")\n end\n end",
"def run(req, res)\n if matches?(req)\n controller = @controller_class.new(req, res)\n controller.send(@action_name)\n end\n end",
"def run(req, res)\n match_data = @pattern.match(req.path)\n route_params = (match_data) ?\n match_data.names.zip(match_data.captures).to_h\n : {}\n\n controller_instance = @controller_class.new(req, res, route_params)\n\n controller_instance.invoke_action(@action_name)\n end",
"def run(request, response)\n\n match_data = @pattern.match(request.path)\n\n route_params = Hash[match_data.names.zip(match_data.captures)]\n\n @controller_class\n .new(request, response, route_params)\n .invoke_action(action_name)\n end",
"def run(req, res)\n route_params = {}\n\n match_data = @pattern.match(req.path)\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n\n controller = @controller_class.new(req, res, route_params)\n controller.invoke_action(@action_name)\n end",
"def run(req, res)\n regex = Regexp.new(@pattern.to_s)\n match_data = regex.match(req.path)\n route_params = {}\n match_data.names.each do |key|\n route_params[key] = match_data[key]\n end\n control = @controller_class.new(req, res, route_params)\n control.invoke_action(@action_name)\n end",
"def run(req, res)\n match_data = @pattern.match(req.path)\n\n route_params = {}\n match_data.names.each do |name|\n route_params[name] = match_data[name]\n end\n\n @controller_class.new(req, res, route_params).invoke_action(action_name)\n end",
"def do_GET(request, response)\n @request = request\n @response = response\n \n controller = nil\n\n controller = @klass.new\n controller.run(@request, @response)\n \n response.header.replace(controller.headers)\n response.body = controller.body.to_s\n end",
"def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end",
"def call(env)\n Rango::Router.set_rack_env(env) # See rango/router/adapters/*\n request = Rango::Request.new(env)\n options = env[\"rango.router.params\"] || raise(\"rango.router.params property has to be setup at least to empty hash\")\n method = env[\"rango.controller.action\"].to_sym\n controller = self.new(env, options.merge(request.params))\n begin\n unless controller.respond_to?(method) # TODO: what about method_missing?\n raise NotFound, \"Controller #{self.name} doesn't have method #{method}\"\n end\n controller.run_filters(:before, method.to_sym)\n # If you don't care about arguments or if you prefer usage of params.\n if controller.method(method).arity.eql?(0)\n Rango.logger.debug(\"Calling method #{self.name}##{method} without arguments\")\n controller.response.body = controller.method(method).call\n else\n args = controller.params.values\n Rango.logger.debug(\"Calling method #{self.name}##{method} with arguments #{args.inspect}\")\n controller.response.body = controller.method(method).call(*args)\n end\n controller.run_filters(:after, method)\n return controller.response.finish\n rescue HttpError => exception\n controller.rescue_http_error(exception)\n end\n end",
"def perform(request, response); end",
"def run url\n # We need to tell Micon about the `:request` scope, so the `:request` component will be\n # destroyed automatically.\n micon.activate :request, {} do\n self.request = Request.new url\n\n # Using router to get controller class and method from the url.\n # Note that You using the `:router` component as if it's just an attribute.\n controller_class, method = router.decode url\n\n # Creating controller and calling it to generate output.\n controller = controller_class.new\n\n # Note we don't need to explicitly pass the `request` to controller, it will be automatically injected.\n controller.send method\n end\n end",
"def handle(http_request, response)\n start = Time.now\n request = Merb::Request.new(http_request)\n Merb.logger.info(\"Params: #{request.params.inspect}\")\n Merb.logger.info(\"Cookies: #{request.cookies.inspect}\")\n # user friendly error messages\n if request.route_params.empty?\n raise ControllerExceptions::BadRequest, \"No routes match the request\"\n elsif request.controller_name.nil?\n raise ControllerExceptions::BadRequest, \"Route matched, but route did not specify a controller\" \n end\n Merb.logger.debug(\"Routed to: #{request.route_params.inspect}\")\n # set controller class and the action to call\n klass = request.controller_class\n dispatch_action(klass, request.action, request, response)\n rescue => exception\n Merb.logger.error(Merb.exception(exception))\n exception = controller_exception(exception)\n dispatch_exception(request, response, exception)\n end",
"def run(req, res)\n #@action = :index\n #@method = :get\n #@pattern = /^\\/users$/\n #@class = DummyController\n \n @params = req.path\n #route_params = @params\n ControllerBase.new(req, res, @params).invoke_action(@method, @pattern, @class, @action)\n end",
"def run(req, res)\n match_data = pattern.match(req.path)\n # hash = {}\n # match_data.names.each do |name|\n # hash[name] = match_data[name]\n # end\n hash = match_data.names.each_with_object({}) do |name, h|\n h[name] = match_data[name]\n end\n controller_class.new(req, res, hash).invoke_action(action_name)\n end",
"def call(env)\n request = Rack::Request.new(env)\n if redirect_trailing_slash? && (request.head? || request.get?) && request.path_info[-1] == ?/\n response = Rack::Response.new\n response.redirect(request.path_info[0, request.path_info.size - 1], 302)\n response.finish\n else\n response = recognize(request)\n env['router'] = self\n if response.is_a?(RoutingResponse)\n [response.status, response.headers, []]\n elsif response && response.route.dest && response.route.dest.respond_to?(:call)\n process_params(env, response)\n consume_path!(request, response) if response.partial_match?\n response.route.dest.call(env)\n else\n @default_app.call(env)\n end\n end\n end",
"def call(env)\n @request = Dolphy::Request.new(env)\n @response = Dolphy::Response.new\n\n router.find_route_for(request).each do |matcher, block|\n if match = router.find_match_data_for(request, with: matcher)\n response.body = [block.call(*match.captures)]\n end\n end\n\n response.status = 404 if response.body.empty?\n response.body << \"Page not found.\" if response.body.empty?\n response.finish\n end",
"def dispatch(request)\n # {{{\n benchmark_start_time = Time.now \n\n params = Aurita::Attributes.new(request)\n params[:_request] = request\n params[:_session] = Aurita::Session.new(request)\n params[:_logger] = @logger\n params[:_application] = @application\n status = 200\n response_body = ''\n response_header = {}\n\n controller = params[:controller]\n action = params[:action]\n mode = params[:mode]\n controller ||= 'App_Main'\n action ||= 'start'\n mode ||= 'default'\n\n Thread.current['request'] = params\n\n Lore::Connection.reset_query_count()\n Lore::Connection.reset_result_row_count()\n\n begin\n raise ::Exception.new('No controller given') if(controller.nil? || controller == '') \n\n model_klass = @application.get_model_klass(controller)\n controller_klass = @application.get_controller_klass(controller)\n\n raise ::Exception.new('Unknown controller: ' << controller.inspect) unless controller_klass\n \n controller_instance = controller_klass.new(params, model_klass)\n\n response = false\n @logger.debug(\"Calling model interface method #{controller}.#{action}\")\n\n element = controller_instance.call_guarded(action)\n response = controller_instance.response\n if response[:html] == '' then\n if element.is_a?(Aurita::GUI::XML::Document) then\n # Don't use default decorator for XML documents: \n response[:mode] = :none if (!response[:mode] || response[:mode] == :default)\n response[:html] = element.string \n elsif element.respond_to?(:string) then\n # Response is an instance of Aurita::GUI::Element\n response[:html] = element.string \n response[:script] << element.script if element.respond_to?(:script) && element.script\n elsif element.is_a?(Array) then\n element.each { |e|\n response[:html] << e.to_s\n }\n end\n end\n\n response_header.update(response[:http_header]) if response[:http_header]\n if response_header['status_code'] then\n status = response_header['status_code'].to_i \n response_header.delete('status_code')\n end\n\n mode = response[:mode].to_sym if response && response[:mode]\n mode ||= :default \n response[:mode] = mode\n params[:_controller] = controller_instance\n\n response_body = @decorator.render(model_klass, response, params)\n\n @num_dispatches += 1\n\n @benchmark_time = Time.now-benchmark_start_time\n @num_queries = Lore::Connection.query_count\n @num_tuples = Lore::Connection.result_row_count\n Aurita::Plugin_Register.call(Hook.dispatcher.request_finished, \n controller_instance, \n :dispatcher => self, \n :controller => controller_instance, \n :action => action, \n :time => @benchmark_time, \n :num_queries => @num_queries, \n :num_tuples => @num_tuples)\n @logger.debug(\"Num queries: #{@num_queries}\")\n rescue Exception => excep\n @logger.error(excep.message)\n @logger.error(excep.backtrace.join(\"\\n\"))\n response_body = GUI::Error_Page.new(excep).string\n response_body = ''\n end\n\n return [ status, response_header, response_body ]\n end",
"def call(env)\n @request = Rack::Request.new(env)\n @params = @path_params.merge(@request.params.symbolize_keys)\n process_response(instance_exec(self, params, request, &@block))\n end",
"def service(request, response)\n if @valid_ip\n raise WEBrick::HTTPStatus::Forbidden unless @valid_ip.any? { |ip| request.peeraddr[3] =~ ip }\n end\n\n if request.request_method != \"POST\"\n raise WEBrick::HTTPStatus::MethodNotAllowed,\n \"unsupported method `#{request.request_method}'.\"\n end\n\n raise WEBrick::HTTPStatus::BadRequest if parse_content_type(request['Content-type']).first != \"text/xml\"\n\n length = (request['Content-length'] || 0).to_i\n\n raise WEBrick::HTTPStatus::LengthRequired unless length > 0\n\n data = request.body\n\n raise WEBrick::HTTPStatus::BadRequest if data.nil? or data.size != length\n\n resp = process(data, client_request(request))\n raise WEBrick::HTTPStatus::InternalServerError if resp.nil? or resp.size <= 0\n\n response.status = 200\n response['Content-Length'] = resp.size\n response['Content-Type'] = \"text/xml; charset=utf-8\"\n response.body = resp\n end",
"def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req.path, req_headers, req_body,\n req_query)\n res_headers, res_status, res_body = Oaf::HTTPServer.parse_response out\n Oaf::HTTPServer.set_response! res, res_headers, res_body, res_status\n end",
"def make_request(request)\n puts \"\\n\\n\"\n puts \"==> Request, action='#{request.path}', params = #{request.query}...\"\n\n action = request.path.to_s.split(\"/\")[-1]\n\n if action && @app.valid?(action) then\n response = @app.send(action.to_sym, request.query)\n\n return response\n end\n\n return \"Error: Unrecognised action: #{action}\"\n rescue Exception => e\n $stderr.puts \"*** [E]: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n return \"Error: #{e}\"\n end",
"def dispatch(name, req, res); end",
"def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end",
"def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end",
"def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end",
"def call(path)\n log(path)\n\n catch(:respond) {\n body = Controller.handle(path)\n Response.current.build(body)\n }\n\n FILTER.each{|f| f.call(response)}\n response\n rescue Ramaze::Error => ex\n ex\n end",
"def run(request)\n @request = request\n @response = request.response\n validate\n extract\n end",
"def call(env)\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # give handler access to all of the methods, on the instance of Nancy::Base\n result = instance_eval(&handler)\n # If a handler returns a string, assume that it is a successful response, and so we construct a successful Rack response\n # otherwise, we return the result of the block as-is\n # [status, header, body]\n if result.class == String\n [200, {}, [result]]\n else\n result\n end\n else\n [404, {}, [\"Oops! No route for #{verb} #{requested_path}\"]]\n end\n end",
"def run\n make_request(@path)\n end",
"def call(env)\n # p env.inspect\n # [200, {\"Content-Type\" => \"text/html\"}, \"DOH!!!\"]\n path = env[\"PATH_INFO\"]\n # match env.path_info against the route compile\n #p env.inspect\n route = Doozer::Routing::Routes::match(path)\n # p \"path: #{path}\"\n # p \"route: #{route.inspect}\"\n app = nil\n \n if not route.nil?\n if route.app.nil?\n extra_params = route.extra_params(path)\n controller_klass = handler(route.controller.to_sym)\n controller = controller_klass.new({:env=>env, :route=>route, :extra_params=>extra_params, :port=>@options[:Port]})\n \n # call after_initialize test for excludes\n #execution_time('controller.after_initialize',:start)\n controller.after_initialize if not controller_klass.after_initialize_exclude.include?(route.action.to_sym)\n #execution_time(nil, :end)\n \n begin\n\n # call before_filter test for excludes\n #execution_time('controller.before_filter',:start)\n controller.before_filter if not controller_klass.before_filter_exclude.include?(route.action.to_sym)\n #execution_time(nil,:end)\n \n # call the action method\n #execution_time('controller.method(route.action).call',:start)\n controller.method(route.action).call()\n #execution_time(nil,:end)\n \n # call after_filter test for excludes\n #execution_time('controller.after_filter',:start)\n controller.after_filter if not controller_klass.after_filter_exclude.include?(route.action.to_sym)\n #execution_time(nil, :end)\n \n # render controller...\n #execution_time('controller.render_result',:start)\n r = Rack::Response.new(controller.render_result, route.status, {\"Content-Type\" => route.content_type})\n #execution_time(nil,:end)\n r.set_cookie('flash',{:value=>nil, :path=>'/'})\n r.set_cookie('session',{:value=>controller.session_to_cookie(), :path=>'/'})\n r = controller.write_response_cookies(r)\n \n # finalize the request\n controller.finished!\n controller = nil\n app = r.to_a\n\n rescue Doozer::Redirect => redirect\n # set the status to the one defined in the route which type of redirect do we need to handle?\n status = (route.status==301) ? 301 : 302\n # check to make sure the status wasn't manually changed in the controller\n status = redirect.status if not redirect.status.nil?\n \n r = Rack::Response.new(\"redirect...\", status, {\"Content-Type\" => \"text/html\", \"Location\"=>redirect.url})\n # if we get a redirect we need to do something with the flash messages...\n r.set_cookie('flash',{:value=>controller.flash_to_cookie(), :path=>'/'}) # might need to set the domain from config app_name value\n r.set_cookie('session',{:value=>controller.session_to_cookie(), :path=>'/'})\n \n # finalize the request \n controller.finished!\n controller = nil\n app = r.to_a\n rescue => e\n # finalize the request\n controller.finished!\n controller = nil\n \n if Doozer::Configs.rack_env == :deployment\n logger.error(\"RuntimeError: #{e.to_s}\")\n for line in e.backtrace\n logger.error(\" #{line}\")\n end\n logger.error(\"Printing env variables:\")\n logger.error(env.inspect)\n app = [500, {\"Content-Type\" => \"text/html\"}, @@errors[500]]\n else\n raise e\n end\n end\n else\n app = route.app.call(env)\n end\n else\n app = [404, {\"Content-Type\" => \"text/html\"}, @@errors[404]]\n end\n \n # pass the app through route.middleware_after if defined\n app = route.middleware_after.new(app, {:config=>Doozer::Configs, :route=>route}).call(env) if route.middleware_after\n \n return app\n end",
"def run(req, res)\n end",
"def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def proxy_service(req, res)\n # Proxy Authentication\n proxy_auth(req, res)\n\n # Request modifier handler\n intercept_request(@config[:request_interceptor], req, @config[:ritm_conf].intercept.request)\n\n begin\n send(\"do_#{req.request_method}\", req, res)\n rescue NoMethodError\n raise WEBrick::HTTPStatus::MethodNotAllowed, \"unsupported method `#{req.request_method}'.\"\n rescue StandardError => err\n raise WEBrick::HTTPStatus::ServiceUnavailable, err.message\n end\n\n # Response modifier handler\n intercept_response(@config[:response_interceptor], req, res, @config[:ritm_conf].intercept.response)\n end",
"def process_http_request\n route_http_request\n end",
"def execute!\n validate_request!\n perform_request!\n\n build_response\n end",
"def do_request\n\t\t\tself.response = post_request(options)\n\t\tend",
"def run(req, res)\n parse_http_methods!(req)\n matching_route = match(req)\n if matching_route\n matching_route.run(req, res)\n else\n res.status = 404\n res.write \"404 route not found\"\n end\n end",
"def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end",
"def serve! request, response, client, vhost\n kernel_prepare\n serve request, response, client, vhost\n end",
"def service(req, res)\n method_name = \"do_\" + req.request_method.gsub(/-/, \"_\")\n if respond_to?(method_name)\n __send__(method_name, req, res)\n else\n raise HTTPStatus::MethodNotAllowed,\n \"unsupported method `#{req.request_method}'.\"\n end\n end",
"def call(params)\n @params = params\n unincluded_error unless required_params?\n \n HttpRequest.new(params) do |request|\n @response = request.start\n end\n\n self\n end",
"def proxy_service(req, res)\n # Proxy Authentication\n proxy_auth(req, res)\n\n # Request modifier handler\n intercept_request(@config[:request_interceptor], req)\n\n begin\n send(\"do_#{req.request_method}\", req, res)\n rescue NoMethodError\n raise WEBrick::HTTPStatus::MethodNotAllowed, \"unsupported method `#{req.request_method}'.\"\n rescue => err\n raise WEBrick::HTTPStatus::ServiceUnavailable, err.message\n end\n\n # Response modifier handler\n intercept_response(@config[:response_interceptor], req, res)\n end",
"def handle( request )\n\t\tresponse = nil\n\n\t\t# Dispatch the request after allowing plugins to to their thing\n\t\tstatus_info = catch( :finish ) do\n\t\t\tself.log.debug \"Starting dispatch of request %p\" % [ request ]\n\n\t\t\t# Run fixup hooks on the request\n\t\t\trequest = self.fixup_request( request )\n\t\t\tself.log.debug \" done with request fixup\"\n\t\t\tresponse = self.handle_request( request )\n\t\t\tself.log.debug \" done with handler\"\n\t\t\tresponse = self.fixup_response( response )\n\t\t\tself.log.debug \" done with response fixup\"\n\n\t\t\tnil # rvalue for the catch\n\t\tend\n\n\t\t# Status response\n\t\tif status_info\n\t\t\tself.log.debug \"Preparing a status response: %p\" % [ status_info ]\n\t\t\treturn self.prepare_status_response( request, status_info )\n\t\tend\n\n\t\treturn response\n\trescue => err\n\t\tself.log.error \"%s: %s %s\" % [ err.class.name, err.message, err.backtrace.first ]\n\t\terr.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }\n\n\t\tstatus_info = { :status => HTTP::SERVER_ERROR, :message => 'internal server error' }\n\t\treturn self.prepare_status_response( request, status_info )\n\tend",
"def request\n self.response = prepare_response(http_communication.content)\n end",
"def call\n conn = http_setup\n res = set_up_response(method.to_sym, uri, conn, headers ,body)\n\n response = HttpResponse.new(res)\n response.uri = uri\n raise response.error if !response.success? && !@has_retry_filter\n response\n end",
"def call request, response\n\t\t\t\tbegin\n\t\t\t\t\thost = get_host(request[:host_name].to_s.downcase) || @hosts[:default]\n\t\t\t\t\treturn false unless host\n\t\t\t\t\trequest[:host_settings] = host.params\n\t\t\t\t\t# render any assets?\n\t\t\t\t\treturn true if render_assets request, response, host.params\n\t\t\t\t\t# send static file, if exists and root is set.\n\t\t\t\t\treturn true if Base::HTTPSender.send_static_file request, response\n\t\t\t\t\t# return if a route answered the request\n\t\t\t\t\thost.routes.each {|r| a = r.on_request(request, response); return a if a}\n\t\t\t\t\t#return error code or 404 not found\n\t\t\t\t\treturn Base::HTTPSender.send_by_code request, response, 404 unless ( @avoid_404 ||= ( Iodine::Http.on_http == ::Iodine::Http::Rack ? 1 : 0 ) ) == 1\n\t\t\t\trescue => e\t\t\t\t\n\t\t\t\t\t# return 500 internal server error.\n\t\t\t\t\tIodine.error e\n\t\t\t\t\tBase::HTTPSender.send_by_code request, response, 500\n\t\t\t\tend\n\t\t\tend",
"def run(request, response)\n matching_route = match(request)\n\n if matching_route.nil?\n response.status = 404\n\n response.write(\"Sorry! The requested URL #{request.path} was not not found!\")\n else\n matching_route.run(request, response)\n end\n end",
"def run(req, res)\n route = match(req)\n if route\n route.run(req, res)\n else\n res.status = 404\n controller = Controller::Base.new(req, res)\n controller.render_content(\"404: Unable to find page '#{req.path}' \", 'text/html')\n end\n end",
"def execute!\n validate_request!\n\n build_response!\n end",
"def call(env)\n # Grab the verb and requested path from the env parameter\n @request = Rack::Request.new(env)\n verb = @request.request_method\n requested_path = @request.path_info\n\n # Grab the handler block from @routes if it exists\n handler = @routes.fetch(verb, {}).fetch(requested_path, nil)\n\n if handler\n # Evaluate our route handler block in the context of that instance,\n # to give it access to all of the methods (Compare: handler.call)\n result = instance_eval(&handler)\n\n if result.class == String\n # For convenience, if a handler returns a string,\n # assume that it is a successful response.\n [200, {}, [result]]\n else\n # Otherwise, return the result of the block as-is.\n result\n end\n else\n # Return a 404 with a custom error message\n # instead of the default Internal Server Error\n [404, {}, [\"Oops! No routes for #{verb} #{requested_path}\"]]\n end\n end",
"def call(env)\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n handle_request\n @res.finish\n end",
"def call(request); end",
"def invoke\n resp = nil\n ms = Benchmark.realtime do\n resp = @http.post @url, @req.to_s\n end\n @logger.info 'SmartView request %s completed in %.1fs' % [@req.method, ms]\n doc = Hpricot::XML(resp.body.content)\n if !doc.at(\"//res_#{@req.method}\")\n @logger.error \"Error invoking SmartView method #{@req.method}\"\n @logger.debug \"Request was:\\n#{@req}\"\n @logger.debug \"Response was:\\n#{resp.body.content}\"\n if ex = doc.at('//exception')\n ex = SmartViewException.new(ex)\n @logger.error \"An exception occurred in #{@req.method}\"\n @logger.error ex\n raise ex\n else\n @logger.error \"Unexpected response from SmartView provider:\\n#{doc.to_plain_text}\"\n raise RuntimeError, \"Unexpected response from SmartView provider: #{doc.to_plain_text}\"\n end\n end\n doc\n end",
"def invoke\n\t\tbegin\n\t @service = Object.const_get(@amfbody.service_name).new #handle on service\n\t RequestStore.available_services[@amfbody.service_name] = @service\n\t\trescue LoadError => e\n\t\t\traise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"The file #{@amfbody.class_file_uri}#{@amfbody.class_file} was not loaded. Check to make sure it exists in: #{RequestStore.service_path}\")\n\t\trescue Exception => e\n\t\t raise RUBYAMFException.new(RUBYAMFException.LOAD_CLASS_FILE, \"There was an error loading file #{@amfbody.class_file_uri}#{@amfbody.class_file}.\")\n\t\tend\n\t\t\n\t\tif @service.private_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is declared as private, it must be defined as public to access it.\")\n\t\telsif [email protected]_methods.include?(@amfbody.service_method_name)\n\t\t\traise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.class_file_uri}#{@amfbody.class_file}} is not declared.\")\n\t\tend\n\t\t\t\t\n\t\t#clone the request and response and alter it for the target controller/method\n\t\treq = RequestStore.rails_request.clone\n\t\tres = RequestStore.rails_response.clone\n\t\t\n\t\t#change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n\t ct = @amfbody.target_uri.clone.split('Controller')[0].downcase\n\t sm = @amfbody.service_method_name\n\t\treq.parameters['controller'] = ct\n\t\treq.parameters['action'] = sm\n\t\treq.request_parameters['controller'] = ct\n\t\treq.request_parameters['action'] = sm\n\t\treq.request_parameters['amf'] = 'hello world'\n\t\treq.path_parameters['controller'] = ct\n\t\treq.path_parameters['action'] = ct\n\t\treq.env['PATH_INFO'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_PATH'] = \"#{ct}/#{sm}\"\n\t\treq.env['REQUEST_URI'] = \"#{ct}/#{sm}\"\n\t\treq.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n\t\t\n\t\t#set conditional helper\n\t\[email protected]_amf = true\n\t\[email protected]_rubyamf = true\n \n #process the request\n\t\tif @amfbody.value.empty? || @amfbody.value.nil?\n\t\t @service.process(req,res)\n\t\telse\n\t\t @amfbody.value.each_with_index do |item,i|\t\t \n\t\t req.parameters[i] = item\n\t\t if item.class.superclass.to_s == 'ActiveRecord::Base'\n\t\t req.parameters[i] = item.original_vo_from_deserialization.to_hash\n if i < 1 #Only the first parameter will be \n req.parameters.merge!(item.original_vo_from_deserialization.to_hash) #merge in properties into the params hash\n #have to specifically check for id here, as it doesn't show up in any object members.\n if item.original_vo_from_deserialization.id != nil\n #This will override the above params[:id] attempt, because it's the original deserialized values.\n req.parameters[:id] = item.original_vo_from_deserialization.id\n end\n end\n\t req.parameters[item.class.to_s.downcase.to_sym] = item.original_vo_from_deserialization.to_hash\n\t \n\t\t elsif !item._explicitType.nil?\n\t\t t = item._explicitType\n\t\t if t.include?('.')\n\t\t t = t.split('.').last.downcase.to_s\n\t\t end\n \t\t req.parameters[t.to_sym] = item.to_hash\n \t\t if i < 1\n \t\t if item.class.to_s == 'Object' || item.class.to_s == 'OpenStruct'\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end\n \t\t \n \t\t elsif item.class.to_s == 'OpenStruct' || item.class.to_s == \"Object\"\n\t\t if i < 1\n \t\t if item.id != nil && item.id.to_s != 'NaN' && item.id != 0\n \t\t req.parameters[:id] = item.id\n \t\t end\n \t\t req.parameters.merge!(item.to_hash)\n \t\t end \t\t \n\t\t end\n end\n\t @service.process(req,res)\n end\n \n #unset conditional helper\n @service.is_amf = false\n\t\[email protected]_rubyamf = false\n \n\t\t#handle FaultObjects\n\t\tif @service.amf_content.class.to_s == 'FaultObject' #catch returned FaultObjects\n raise RUBYAMFException.new(@service.amf_content.code, @service.amf_content.message)\n\t\tend\n\t\t\n\t\t#amf3\n\t\[email protected] = @service.amf_content\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper.body = @service.amf_content\n @amfbody.results = @wrapper\n\t\tend\n\t @amfbody.success! #set the success response uri flag (/onResult)\n\tend",
"def initialize(req, res, route_params = {})\n @request, @response = req, res\n @params = Params.new(@request, route_params)\n @already_built_response = false\n end",
"def call(env)\n if env[\"PATH_INFO\"] =~ @config[:endpoint_path]\n begin\n req = Rack::Request.new(env)\n # find service\n service = KingSoa.find(req.params[\"name\"])\n # TODO rescue service class not found\n raise \"The service: #{req.params[\"name\"]} could not be found\" unless service\n # authenticate\n authenticated?(service, req.params[\"auth\"])\n # perform method with decoded params\n result = service.perform(*service.decode( req.params[\"args\"] ))\n # encode result\n encoded_result = service.encode({\"result\" => result})\n # and return\n [\n 200,\n {'Content-Type' => 'application/json', 'Content-Length' => \"#{encoded_result.length}\"},\n [encoded_result]\n ]\n\n rescue Exception => e\n if service\n encoded_error = service.encode({\"error\" => e})\n [500, {'Content-Type' => 'application/json', 'Content-Length' => \"#{encoded_error.length}\"}, [encoded_error]]\n else\n encoded_error = {\"error\" => \"An error occurred => #{e.message}\"}.to_json\n [500, {'Content-Type' => \"application/json\", 'Content-Length' => \"#{encoded_error.length}\"}, [encoded_error]]\n end\n end\n else\n @app.call(env)\n end\n end",
"def call\n\n catch(:KenjiRespondControlFlowInterrupt) do\n path = @env['PATH_INFO']\n\n # deal with static files\n static = \"#{@root}public#{path}\"\n return Rack::File.new(\"#{@root}public\").call(@env) if File.file?(static)\n\n\n # new routing code\n method = @env['REQUEST_METHOD'].downcase.to_sym\n\n segments = path.split('/')\n # ensure existence of leading /'s empty segment\n segments = segments.unshift('') unless segments.first == ''\n\n out = ''; success = false\n catch(:KenjiPass404) do\n if @options[:root_controller]\n controller = controller_instance(@options[:root_controller])\n subpath = segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n else\n acc = ''; out = ''; success = false\n while (head = segments.shift)\n acc = \"#{acc}/#{head}\"\n # if we have a valid controller\n if (controller = controller_for(acc))\n subpath = '/' + segments.join('/')\n out = controller.call(method, subpath).to_json\n success = true\n break\n end\n end\n end\n end\n\n return response_404 unless success\n\n [@status, @headers, [out]]\n end\n rescue => e\n raise e unless @options[:catch_exceptions]\n # log exceptions\n @stderr.puts(e.inspect)\n e.backtrace.each {|b| @stderr.puts \" #{b}\" }\n response_500(e)\n end",
"def invoke\n begin \n # RequestStore.available_services[@amfbody.service_class_name] ||=\n @service = @amfbody.service_class_name.constantize.new #handle on service\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise RUBYAMFException.new(RUBYAMFException.UNDEFINED_OBJECT_REFERENCE_ERROR, \"There was an error loading the service class #{@amfbody.service_class_name}\")\n end\n \n #call one or the other method depending in the ruby version we are using\n if RUBY_VERSION > RUBY_19\n caller = \"to_sym\"\n else\n caller = \"to_s\"\n end \n\n if @service.private_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_ACCESS_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is declared as private, it must be defined as public to access it.\")\n elsif [email protected]_methods.include?(@amfbody.service_method_name.send(caller))\n raise RUBYAMFException.new(RUBYAMFException.METHOD_UNDEFINED_METHOD_ERROR, \"The method {#{@amfbody.service_method_name}} in class {#{@amfbody.service_class_file_path}} is not declared.\")\n end\n \n #clone the request and response and alter it for the target controller/method\n req = RequestStore.rails_request.clone\n res = RequestStore.rails_response.clone\n \n #change the request controller/action targets and tell the service to process. THIS IS THE VOODOO. SWEET!\n controller = @amfbody.service_class_name.gsub(\"Controller\",\"\").underscore\n action = @amfbody.service_method_name\n req.parameters['controller'] = req.request_parameters['controller'] = req.path_parameters['controller'] = controller\n req.parameters['action'] = req.request_parameters['action'] = req.path_parameters['action'] = action\n req.env['PATH_INFO'] = req.env['REQUEST_PATH'] = req.env['REQUEST_URI'] = \"#{controller}/#{action}\"\n req.env['HTTP_ACCEPT'] = 'application/x-amf,' + req.env['HTTP_ACCEPT'].to_s\n \n #set conditional helper\n @service.is_amf = true\n @service.is_rubyamf = true\n \n #process the request\n rubyamf_params = @service.rubyamf_params = {}\n if @amfbody.value && [email protected]?\n @amfbody.value.each_with_index do |item,i|\n rubyamf_params[i] = item\n end\n end\n \n # put them by default into the parameter hash if they opt for it\n rubyamf_params.each{|k,v| req.parameters[k] = v} if ParameterMappings.always_add_to_params \n \n begin\n #One last update of the parameters hash, this will map custom mappings to the hash, and will override any conflicting from above\n ParameterMappings.update_request_parameters(@amfbody.service_class_name, @amfbody.service_method_name, req.parameters, rubyamf_params, @amfbody.value)\n rescue Exception => e\n raise RUBYAMFException.new(RUBYAMFException.PARAMETER_MAPPING_ERROR, \"There was an error with your parameter mappings: {#{e.message}}\")\n end\n\n #fosrias\n #@service.process(req, res)\n\n # call the controller action differently depending on Rails version\n if Rails::VERSION::MAJOR < 3\n @service.process(req, res)\n else\n @service.request = req\n @service.response = res\n @service.process(action.to_sym)\n end\n #fosrias\n \n #unset conditional helper\n @service.is_amf = false\n @service.is_rubyamf = false\n @service.rubyamf_params = rubyamf_params # add the rubyamf_args into the controller to be accessed\n \n result = RequestStore.render_amf_results\n \n #handle FaultObjects\n if result.class.to_s == 'FaultObject' #catch returned FaultObjects - use this check so we don't have to include the fault object module\n e = RUBYAMFException.new(result['code'], result['message'])\n e.payload = result['payload']\n raise e\n end\n \n #amf3\n @amfbody.results = result\n if @amfbody.special_handling == 'RemotingMessage'\n @wrapper = generate_acknowledge_object(@amfbody.get_meta('messageId'), @amfbody.get_meta('clientId'))\n @wrapper[\"body\"] = result\n @amfbody.results = @wrapper\n end\n @amfbody.success! #set the success response uri flag (/onResult)\n end",
"def call(env)\n @req = Rack::Request.new(env)\n @res = Rack::Response.new\n handle_request\n @res.finish\n end",
"def process(request_hash)\n request = Request.new(request_hash)\n case request.path\n when '/'\n index_route(request)\n when %r{^/sleep/\\d+$}\n sleep_route(request)\n else\n Response.new(\n \"No route found for #{request.path}. Try '/' or '/sleep/3'.\",\n status: 404\n )\n end\n end",
"def call(env)\n env[\"rack.errors\"] = StringIO.new # Send Rack errors nowhere fast!\n begin\n setup(env)\n begin\n route = Mack::Routes.retrieve(self.request)\n if route[:redirect_to]\n # because the route is specified to be a redirect, let's do that:\n redirect_to(route)\n else\n # set these in case we need them for handling errors:\n @original_controller = route[:controller]\n @original_action = route[:action]\n run_controller(route)\n end\n # return teardown\n rescue Exception => e\n # There was an exception, let's see if there's a handler for this error in routes:\n route = Mack::Routes.retrieve_from_error(e.class)\n unless route.nil?\n self.request.params[:original_controller] = @original_controller\n self.request.params[:original_action] = @original_action\n # There is a handler, let's try running that:\n run_controller(route, e)\n else\n # If we can't find the resource, or there's no route, let's check the public directory:\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n return try_to_find_resource(env, e)\n else\n # Re-raise the exception\n raise e\n end\n end\n # return teardown\n end\n # Capture all the Exceptions for this call:\n rescue Exception => e\n Mack.logger.error e\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n handle_error(404, 'Page Not Found!', e)\n # If it's any other type of exception render the 500.html page:\n else\n handle_error(500, 'Server Error!', e)\n end\n # return teardown\n ensure\n teardown\n end\n return self.response.finish\n end",
"def process(request, response)\n indirection, method, key, params = uri2indirection(http_method(request), path(request), params(request))\n\n check_authorization(indirection, method, key, params)\n\n send(\"do_#{method}\", indirection, key, params, request, response)\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => e\n return do_exception(response, e)\n end",
"def run(req, res)\n first_matched_route = match(req)\n\n if first_matched_route\n first_matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches for #{req.request_method} for #{req.path}\")\n end\n end",
"def dispatch_request(cli, request)\n # Is the client requesting keep-alive?\n if ((request['Connection']) and\n (request['Connection'].downcase == 'Keep-Alive'.downcase))\n cli.keepalive = true\n end\n\n # Search for the resource handler for the requested URL. This is pretty\n # inefficient right now, but we can spruce it up later.\n p = nil\n len = 0\n root = nil\n\n resources.each_pair { |k, val|\n if (request.resource =~ /^#{k}/ and k.length > len)\n p = val\n len = k.length\n root = k\n end\n }\n\n if (p)\n # Create an instance of the handler for this resource\n handler = p[0].new(self, *p[2])\n\n # If the handler class requires a relative resource...\n if (handler.relative_resource_required?)\n # Substituted the mount point root in the request to make things\n # relative to the mount point.\n request.relative_resource = request.resource.gsub(/^#{root}/, '')\n request.relative_resource = '/' + request.relative_resource if (request.relative_resource !~ /^\\//)\n end\n\n\n # If we found the resource handler for this resource, call its\n # procedure.\n if (p[1] == true)\n Rex::ThreadFactory.spawn(\"HTTPServerRequestHandler\", false) {\n handler.on_request(cli, request)\n }\n else\n handler.on_request(cli, request)\n end\n else\n elog(\"Failed to find handler for resource: #{request.resource}\", LogSource)\n\n send_e404(cli, request)\n end\n\n # If keep-alive isn't enabled for this client, close the connection\n if (cli.keepalive == false)\n close_client(cli)\n end\n end",
"def invoke_layered(service_name, method_name, *args)\r\n prepare_request('api', service_name, method_name, *args)\r\n @controller.process(@request, @response)\r\n decode_rpc_response\r\n end",
"def call(request)\n compile! unless compiled?\n pattern, verb, params = *parse_request(request)\n pattern = pattern.encode(Encoding.default_external)\n candidacies = match_with(pattern)\n raise_exception(404) if candidacies.empty?\n candidacies, allows = *candidacies.partition{ |route| route.verb == verb }\n raise_exception(405, :verbs => allows.map(&:verb)) if candidacies.empty?\n candidacies.map{ |route| [route, route.params_for(pattern, params)] }\n end",
"def request(*args); end",
"def dispatch_request(req)\n # /calculator/add\n #\n # gets split into nil, calculator as prefix and add as method name\n # that is called on actor instance\n #\n # TODO: how about /math/calculator/add and handling namespaced\n # actors or methods with / in them? It may be an issue for a larger\n # nanites cluster :/\n _, prefix, meth = req.type.split('/')\n begin\n actor = @actors[prefix]\n res = actor.send((meth.nil? ? \"index\" : meth), req.payload)\n rescue Exception => e\n res = \"#{e.class.name}: #{e.message}\\n #{e.backtrace.join(\"\\n \")}\"\n end\n Result.new(req.token, req.reply_to, res, agent.identity) if req.reply_to\n end",
"def call(env)\n resource, method, response = dispatch(env)\n resource.handle(method)\n\n rescue Object => ex\n ex = InternalServerError.new(ex) unless ex.respond_to?(:render)\n response = ex.render(env)\n ensure\n Session.save(resource.instance_variable_get(\"@session\"), response) if resource\n return response.finish\n end",
"def serve request, response, client, vhost\n @action.call(request, response, client, vhost) unless @action.nil?\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n end",
"def call(env)\n # Rack::Request provides convenient methods\n # for the incoming request\n request = Rack::Request.new(env)\n\n # return a 200 status for all matching routes\n @routes.each do |route|\n content = route.match(request)\n # [][-1] is an enumerable of stringable objects\n # => sometimes you want to return responses lazily (through an enumerable)\n # .to_s because you don't want this to blow up when\n # a route handler returns an array or other format\n return [200, { 'Content-Type' => 'text/plain' }, [content.to_s]] if content\n end\n\n # otherwise, return 404\n [404, {}, ['Not Found']]\n end",
"def execute(request)\n request.pretty_print\n element = @pt.extract(URI.parse(request.get_uri_path))\n if element.nil? then\n request.respond(CR[:not_found])\n else\n primary(request, element)\n end\n request.send_response\n ## XXX: do we need to be able to really handle\n ## this method in a custom fashion?\n end",
"def call(env)\n req = Rack::Request.new(env)\n\n [200, { 'Content-Type' => 'application/json' }, [dispatch_action(req)]]\n rescue Heartcheck::Errors::RoutingError\n [404, { 'Content-Type' => 'application/json' }, ['Not found']]\n end",
"def route(agi, params=nil)\n request = {\n :uri => @uri,\n :controller => @controller,\n :method => @method,\n :id => @id,\n :options => @options\n }\n\n return if !@controller\n\n controller_name = if !@controller[/controller/]\n \"#{@controller}_controller\"\n else\n \"#{@controller}\"\n end\n\n controller_name = controller_name.classify\n controller = get_controller(controller_name)\n\n @@logger.info \"Processing Route to #{controller_name}##{@method}\"\n @@logger.info \"#{@uri}\"\n\n unless controller\n @@logger.warn(\"Nonexistant controller\")\n return set_invalid_extension(agi)\n end\n\n unless check_controller(controller)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n unless check_route(controller, @method)\n @@logger.warn \"Unroutable method\"\n return set_invalid_extension(agi)\n end\n\n ctrl_instance = controller.new({\n :agi => agi,\n :params => params,\n :request => request\n })\n\n begin\n ctrl_instance.run_filter_chain :before\n ctrl_instance.method(@method).call()\n ctrl_instance.run_filter_chain :after\n rescue AGIFilterHalt => e\n LOGGER.warn e.message\n end\n end",
"def process(request); end",
"def run(req, res)\n matched_route = match(req)\n if matched_route\n matched_route.run(req, res)\n else\n res.status = 404\n res.write(\"No route matches #{req.fullpath}\")\n end\n end",
"def handle(request, env)\n params = @params.dup\n path_info, script_name = env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"]\n \n return unless request_conditions.all? do |method_name, condition|\n # TODO: Refactor this... it lacks awesome\n next true unless request.respond_to?(method_name)\n matched, captures = condition.match(request)\n if matched\n params.merge!(captures)\n if method_name == :path_info\n new_path_info = @path_info.dup if @path_info\n new_path_info ||= env[\"PATH_INFO\"].sub(/^#{Regexp.escape(matched)}/, '')\n new_path_info.gsub!(SEGMENT_REGEXP) { |s| params[$2.to_sym] }\n env[\"SCRIPT_NAME\"] = Utils.normalize(request.env[\"SCRIPT_NAME\"] + matched)\n env[\"PATH_INFO\"] = Utils.normalize(new_path_info)\n end\n true\n end\n end\n \n env[\"rack_router.route\"] = self\n env[\"rack_router.params\"].merge! params\n \n @app.call(env)\n ensure\n env[\"PATH_INFO\"], env[\"SCRIPT_NAME\"] = path_info, script_name\n end",
"def do_request(request, response)\n body = make_request(request)\n\n # Always 200. A simplification, but fine for user\n # error messages.\n response.status = 200\n response['Content-Type'] = 'text/html' \n response.body = body\n end",
"def invoke_method\n unless check_preconditions\n return send_response(status: :precondition_failed)\n end\n\n method = request.request_method.downcase\n status, body = make_request method\n\n send_response status: status, body: body\n end",
"def do_request(request, response)\n if request.request_method != 'GET'\n response.status = 405\n LOG.error \"Unsupported request method #{request.request_method}\"\n return\n end\n\n do_get(request, response)\n end",
"def requestAction(controller,action,params={})\n controller.class_eval{\n def params=(params); @params = params end\n def params; @params end\n }\n c = controller.new\n c.request = @_request\n c.response = @_response\n c.params = params\n c.send(action)\n c.response.body\n end",
"def route_request\n env.logger.debug \"#{self.class} ROUTING - #{env[Goliath::Request::PATH_INFO]}\"\n if has_path = ( env[Goliath::Request::PATH_INFO] =~ /^\\/(\\w+)(\\/\\w+)*/ )\n env.logger.debug \"#{self.class} route_request:\\t pathinfo = #{$1} extended = #{$2}\"\n path_info = $1\n extended_path_info = $2\n has_path = true #it will be a number or nil - let's just make it a bool\n elsif params[:id]\n has_path = true\n end\n \n method = env[Goliath::Request::REQUEST_METHOD]\n action = case method\n when 'GET'\n has_path ? 'show' : 'index'\n when 'POST'\n has_path ? ( raise BadRequestError, \"can't post to this resource\" ) : 'create'\n when 'PUT'\n !has_path ? ( raise BadRequestError, \"no resource to PUT to\" ) : 'update'\n when 'DELETE'\n !has_path ? ( raise BadRequestError, \"no resource to DELETE\" ) : 'delete'\n else\n raise MethodNotAllowedError, \"unknown request method\"\n end\n env.logger.info \"#{self.class} route_request:\\t attempting to call #{action} action\"\n if self.respond_to?(action, true) #second param includes private methods\n env['params']['id'] = params[:id] || (path_info if has_path)\n self.send(action)\n else\n error_on MethodNotAllowedError, \"#{action} not supported for this resource\"\n end\n end",
"def process\n klass.new(request).process\n end",
"def do_dispatch(env)\n path = env['PATH_INFO']\n\n # Try to serve a public file\n ret = dispatch_public(env, path)\n return ret if not ret.nil?\n\n log.debug \"Checking for routes that match: #{path}\"\n route = router.match(env)\n\n if route.has_key? :ok\n dispatch_controller(route, env)\n else\n [404, {\"Content-Type\" => \"text/plain\"}, [\"404 Not Found: #{path}\"]]\n end\n end",
"def call(env)\n # Create a NakedModel::Request from the environment\n request = Request.from_env(env,namespace)\n\n # Push pseuo-path arguments, turning http methods into special case methods to call on adapters\n # TODO wrap << in request\n# case request.request.request_method\n# when 'POST'\n# request.chain << 'create'\n# when 'PUT'\n# request.chain << 'update'\n# when 'DELETE'\n# # TODO traverse back up the chain....\n# end\n\n\n\n # Resolve the request to its end, catching errors thrown during the resolution\n begin\n resolved = request.chain.reduce(namespace) do |progress,fragment| \n request.decorate progress.rel(fragment)\n end\n\n rescue NakedModel::RecordNotFound\n return [404, {'Content-Type' => 'text/plain'}, [\"Not found: #{request.request.url}\"]]\n rescue NakedModel::CreateError => e\n return [409, {'Content-Type' => 'text/plain'}, [e.message]]\n rescue NakedModel::UpdateError => e\n return [406, {'Content-Type' => 'text/plain'}, [e.message]]\n end\n\n # Serialize the final object for returning to the client\n body = resolved.as_json request\n\n # The world's a beautiful place, acknowledge our success\n return [200, {'Content-Type' => 'application/json'}, [body.to_json]]\n end",
"def run(req, res)\n if req.body\n check_method_param(req)\n end\n route = match(req)\n if route.nil?\n res.status = 404\n res.body = \"Cannot find route for #{req.request_method} #{req.path}\"\n else\n route.run(req, res)\n end\n end",
"def perform(request, options); end",
"def request(req)\n req = Request.new(req) if req.kind_of?(Hash)\n action = if req.kind_of?(Request) then req.action else '(string)' end\n debug(\"#{action}: #{req.inspect}\")\n begin\n res = get_response(req)\n info(\"#{action}: #{res.inspect}\")\n rescue Error::Casual => ex\n info(\"#{action}: (ignored) #{ex.message}\")\n raise if verbose\n res = ex.response\n rescue Error::Fatal => ex\n error(\"#{action}: #{ex.message}\")\n raise\n rescue Errno::ECONNREFUSED => ex\n error(\"#{ex.message} / #{self['host'].inspect}:#{self['port'].inspect}\")\n raise\n end\n return res\n end",
"def process(context)\n request = context.request\n\n router = @processor_map[request.request_method.downcase.to_sym]\n return 404 unless router\n begin\n processor, params = router.routing(request.path)\n rescue FancyServer::PathRouter::NoRouteMatched\n return 404\n rescue FancyServer::PathRouter::DestinationDuplicated => ex\n return {:status => 503, :body => ex.message}\n end\n return 404 unless processor\n context.params.merge!(params)\n processor.respond_to?(:to_proc) ? context.instance_eval(&processor) : processor\n end",
"def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n req_options = req_options.merge(options)\n \n raise ConfigurationError.new \"No endpoint defined\" if !path || path.empty?\n raise ConfigurationError.new \"No hostname defined\" if !req_options[:base_uri] || req_options[:base_uri].empty?\n \n # prepare request\n req = HTTParty::Request.new http_method, path, req_options\n\n # Sanitized request for logs\n safe_req_options = strip_unsafe_params(http_method, req_options)\n req_to_output = HTTParty::Request.new http_method, path, safe_req_options\n req_for_airbrake = { :method => http_method, :path => path, :options => safe_req_options }\n\n begin\n response = req.perform\n rescue => ex\n raise CityGridExceptions::RequestError.new req_for_airbrake, ex\n ensure\n if CityGrid.print_curls? \n if defined?(Rails.logger)\n Rails.logger.info req_to_output.to_curl\n else\n puts req_to_output.to_curl\n end\n end\n end\n\n \n begin \n # catch unparsable responses (html etc)\n if !response.parsed_response.is_a?(Hash)\n #pp \"[gem] the response was unparsable (response was not a hash)\"\n raise CityGridExceptions::ResponseParseError.new req_for_airbrake, response\n # catch responses not in new response format\n elsif response[\"errors\"]\n #pp \"[gem] An error in the old response format was caught. Raising a general response error...\"\n raise CityGridExceptions::ResponseError.new req_for_airbrake, response[\"errors\"], response\n\n # Parse and handle new response codes \n elsif (response[\"response\"] && response[\"response\"][\"code\"] != \"SUCCESS\") && \n (response[\"response\"] && response[\"response\"][\"code\"] != 200) && \n (response[\"response\"] && response[\"response\"][\"code\"] != 400) \n error_code = response[\"response\"][\"code\"]\n #pp \"[gem] The response was contained in the first level of the response hash. Below:\"\n #pp response\n #pp \"found error code: #{error_code}\"\n #pp \"****************************************************************************\"\n raise CityGridExceptions.appropriate_error(error_code).new req_for_airbrake, response, response[\"response\"][\"message\"].to_s #+ \" \" + CityGridExceptions.print_superclasses(error_code)\n # if the response is a nested hash/nested hash containing arrays\n elsif response[\"totalNumEntries\"] && response[\"response\"].nil?\n #pp \"[gem] now parsing a response with multiple entries: #{response}\"\n error_code = parse_multiple_responses(response)\n #pp \"the error code that came back is #{error_code}\"\n if error_code.nil? || error_code == []\n #pp \"[gem] passing over this for now\"\n return CityGrid::API::Response.new response # pass over for now\n elsif error_code[0] == \"SUCCESS\" || error_code[0] == 200 || error_code[0] == 400\n return CityGrid::API::Response.new response\n else \n #pp \"[gem] we found an error and it was #{error_code[1]}\"\n raise CityGridExceptions.appropriate_error(error_code[0]).new req_for_airbrake, response, error_code[1].to_s + \" \"# + CityGridExceptions.print_superclasses(error_code[0])\n end\n else\n return CityGrid::API::Response.new response\n end\n rescue => ex\n pp \"The gem threw an error: #{ex}\"\n raise ex if CityGrid.raise_errors?\n end\n end",
"def request(verb, url, params={}, headers={})\n if (verb == :get) || (verb == :delete)\n resp = connection.run_request(verb, url, nil, headers) do |req|\n req.params.update(params)\n end\n else\n resp = connection.run_request(verb, url, params, headers)\n end\n\n case resp.status\n when 200...299\n Response.new(resp)\n when 302\n request(verb, resp.headers['location'], params, headers)\n when 400...599\n response = Response.new(resp)\n e = Error.new(response)\n raise e if options[:raise_errors]\n response.error = e\n response\n else\n raise Error.new(Response.new(resp)), \"Unhandled status code value of #{resp.status}\"\n end\n end",
"def call(request)\n result = invoke(decompose(request))\n if result.success?\n on_success(request, result)\n else\n on_failure(request, result)\n end\n end",
"def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend"
] | [
"0.7021056",
"0.6921165",
"0.6833926",
"0.6778968",
"0.6777807",
"0.670508",
"0.66774523",
"0.66507787",
"0.6649419",
"0.65485454",
"0.64955187",
"0.6422547",
"0.64106125",
"0.6249101",
"0.62411064",
"0.62276566",
"0.6211158",
"0.6192104",
"0.6154475",
"0.613387",
"0.6078911",
"0.60627395",
"0.59822565",
"0.5968794",
"0.5907737",
"0.5907266",
"0.5892539",
"0.58578837",
"0.5836731",
"0.58238876",
"0.57751375",
"0.5756449",
"0.5747282",
"0.57396525",
"0.5721754",
"0.5715122",
"0.57030153",
"0.5687974",
"0.56822544",
"0.5649174",
"0.5647171",
"0.56396395",
"0.5634347",
"0.56177074",
"0.5613139",
"0.559209",
"0.55889165",
"0.5578653",
"0.5572424",
"0.5570331",
"0.5564173",
"0.5544886",
"0.5543994",
"0.5542514",
"0.55390346",
"0.5529088",
"0.55274874",
"0.5520891",
"0.55119634",
"0.55084616",
"0.55082554",
"0.55026656",
"0.5481362",
"0.5478333",
"0.54729056",
"0.54682267",
"0.54630184",
"0.5462238",
"0.54516405",
"0.54501665",
"0.54488575",
"0.5446585",
"0.54435796",
"0.5438396",
"0.5433128",
"0.5430769",
"0.5421203",
"0.54165643",
"0.5416065",
"0.54125154",
"0.5396184",
"0.53872097",
"0.53775173",
"0.53772104",
"0.5376156",
"0.5372938",
"0.53621",
"0.53617483",
"0.53613627",
"0.5359579",
"0.53587496",
"0.5350728",
"0.53499633",
"0.533653",
"0.5325383",
"0.53162813",
"0.53133297",
"0.5312615",
"0.5311195",
"0.5308255"
] | 0.73800755 | 0 |
Opens container, if possible. Takes care of notifying the player of the result. | def open(event)
player = event[:player]
if @locked
player.output("The #{@generic} is locked.")
elsif @open
player.output("The #{@generic} is already open, silly.")
else
@open = true
room = $manager.find(player.room, nil)
if @name.empty?
player.output "You open #@article #@generic."
room.output "#{player.name} opens #@article #@generic.", player
else
player.output "You open #@name."
room.output "#{player.name} opens #@name.", player
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n Common.contain( self )\n self\n end",
"def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@generic} opens.\"\n end",
"def open\n @is_running = true\n run_interpreter\n end",
"def run_container\n # find devices to bind for Wayland\n devices = Dir[\"/dev/dri/*\"] + Dir[\"/dev/video*\"]\n devices_list = []\n devices.each do |dri|\n devices_list.push({'PathOnHost' => dri, 'PathInContainer' => dri, 'CgroupPermissions' => 'mrw'})\n end\n container.start('Binds' => ['/tmp/.X11-unix:/tmp/.X11-unix'],\n 'Devices' => devices_list,\n 'Privileged' => true)\n container.refresh! if container.respond_to? :refresh!\n status = container.info.has_key?('State')? container.info['State']['Status'] : container.json['State']['Status'] \n while status == 'running'\n sleep 1\n container.refresh! if container.respond_to? :refresh!\n status = container.info.has_key?('State')? container.info['State']['Status'] : container.json['State']['Status'] \n end\n if !@options[:keep_alive] || @options[:reattach]\n container.delete\n end\n end",
"def start\n @window = Window.new(slide_deck)\n @window.show\n end",
"def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end",
"def open_bag\n call_scene(Bag)\n Graphics.transition unless @running\n end",
"def open\n @item = Image.find(params[:id])\n @sslaunch = '<script>reslide();</script>';\n render :partial => 'layouts/om', :locals => {:@item => @item, :@sslaunch => @sslaunch}\n end",
"def open!(*args)\n @status = :opening\n self.buffer.open # @buffer.status to :opening\n\n self.set_timer\n self.set_alive_checker\n self.finish\n end",
"def execute_in container \n @lesson, @page = 0, 0\n @container.container = container\n container.extend HH::Tooltip\n\n @execution_thread = Thread.current\n @page_thread = Thread.new { execute_page }\n sleep # wait until the close button gets called\n end",
"def start\n # Start dependencies\n @dependencies.each do |dependency|\n dependency.start unless dependency.running?\n end\n\n # Create a container object\n if @container.nil?\n prepare_image\n prepare_container\n end\n\n @container.start unless @container.nil?\n end",
"def open\n\t \texec 'open '+@params[0]\n\t end",
"def container\n return @container if defined? @container\n if @options[:reattach]\n all_containers = Docker::Container.all(all: true)\n all_containers.each do |container|\n if container.info['Image'] == @tag\n @container = Docker::Container.get(container.info['id'])\n end\n end\n begin\n @container = Docker::Container.create('Image' => @tag)\n rescue Docker::Error::NotFoundError\n puts \"Could not find an image with @tag #{@tag}\"\n return nil\n end\n elsif !ARGV.empty?\n @container = Docker::Container.create('Image' => @tag,\n 'Cmd' => ARGV,\n 'Env' => ['DISPLAY=:0'])\n elsif @options[:wayland]\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => ['DISPLAY=:0'],\n 'Cmd' => ['startplasmacompositor'])\n else\n @container = Docker::Container.create('Image' => @tag,\n 'Env' => [\"DISPLAY=:#{xdisplay}\"])\n end\n @container\n end",
"def open\n ensure!\n open_in_editor\n end",
"def start\n if request.xhr? && current_user.owns_game?(current_game) && current_game.open?\n current_game.start!\n Juggernaut.send_to_channel('embedGame();', current_game.id);\n else\n raise \"Already started or not owner of game...\"\n end\n \n render :nothing => true\n end",
"def start\n display = ::Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n \n display.dispose\n end",
"def game_start\n game_setup\n @console_delegate.show\n end",
"def open\n require \"launchy\"\n\n Launchy.open(BASE_URL)\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n display.dispose\n end",
"def opening; end",
"def opening; end",
"def opening; end",
"def start_container(container)\n populate_chef_secure_path\n Chef::Log.info(\"Starting container #{container.id}...\")\n container.start\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def open\n raise NotImplementedError.new(\"Method 'open' not implemented by '#{self.class.name}'\")\n end",
"def open\n return self if @open\n\n @open = true\n write_bytes FrameBytes.channel_open(@id)\n expect(:channel_open_ok)\n self\n end",
"def start\n return if @closed\n error = check_result ::Libuv::Ext.idle_start(handle, callback(:on_idle))\n reject(error) if error\n end",
"def open\n init_screen\n init_colors\n init_keys\n\n curs_set 0 # hide the cursor\n cbreak # turn off line buffering\n\n yield\n\n close\n end",
"def start_pc\n pc = ::GamePlay::Storage.new\n pc.main\n end",
"def start\n setup_ui\n setup_mediator\n attach_to_mediator\n start_ui\n @result\n end",
"def opened\n end",
"def show\n @container = Container.get!(params[:id])\n @dropbox = Dropbox.new(@container)\n @upload_url = upload_container_url(@container.id)\n if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.public?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container }\n end\n else\n redirect_to container_url(Container.root.id)\n end\n end",
"def start\n display = Swt::Widgets::Display.get_current\n while [email protected]\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end",
"def start(container, attach:false, interactive:false)\n run!('start', {attach:attach,interactive:interactive}, container).strip\n end",
"def initialize\n open\n end",
"def ready_to_open_host_session\n @local_serial = false # default for host\n load_prompt_file # prompt regexp of device\n spawn_cmd = make_spawn_command\n if @prompt && spawn_cmd\n yield spawn_cmd\n else\n @logger.error 'Invalid parameter in param file(S)'\n end\n end",
"def open\n refresh\n super\n end",
"def open_session\n if @session == nil || @session.closed?\n @status = :normal\n @session = Showoff::Setup.prepare(@provided_key)\n @channel = @session.open_channel do |channel|\n channel.exec(\"api -v #{Showoff::VERSION}\") do |ch, success|\n unless success\n puts \"\\nShowoff is currently experiencing difficulties. If this persists, let us know at [email protected]\"\n Process.exit\n end\n @dormant = true\n ch.on_eof do |ch|\n if @status == :executing\n puts \"\\nShowoff was unable to process your request. If this persists, let us know at [email protected]\"\n Process.exit\n elsif @status != :normal && @status != :closing\n puts \"\\nShowoff has encountered an error and needs to close. If this persists, let us know at [email protected]\"\n Process.exit\n else\n print \"\\n\"\n Process.exit\n end\n end\n end\n\n channel.on_close do |channel|\n print \"\\n\"\n Process.exit\n end\n end\n end\n end",
"def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end",
"def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\") #note this should be from setting file\n event(\"Post\")\n end",
"def open(*args, &block)\n end",
"def open\n [head, open_stream] * \"\"\n end",
"def find_container\n if action_name.in? ['create', 'update']\n cid = params[:container_id]\n else\n cid = params[:id]\n params[:id] = params[:download_id]\n alid = params[:activity_log_id]\n altype = params[:activity_log_type]\n end\n @container = NfsStore::Browse.open_container id: cid, user: current_user\n @retrieval_type = params[:retrieval_type]\n\n @activity_log = ActivityLog.open_activity_log altype, alid, current_user if alid.present? && altype.present?\n\n case @retrieval_type\n when 'stored_file'\n @download = @container.stored_files.find_by(id: params[:download_id])\n when 'archived_file'\n @download = @container.archived_files.find_by(id: params[:download_id])\n else\n raise FphsException, 'Incorrect retrieval_type set'\n end\n\n @container.parent_item = @activity_log\n @master = @container.master\n @master.current_user ||= current_user\n # object_instance.container = @container\n @container\n end",
"def on_open\n\t\t\ttrue\n\t\tend",
"def open\n @peer.open\n end",
"def open\n close\n @shell = service.open_shell\n @command_count = 0\n determine_max_commands unless max_commands\n shell\n end",
"def connect!(&block)\n connect(&block)\n loop { opening? }\n self\n end",
"def create_container_call\n # When CPU is under load we cannot create a healthy container\n CpuLoadHandler.wait_cpu_to_idle\n\n additional_env = ''\n environment_variables.each do |variable|\n additional_env += \" -e #{variable}\"\n end\n emulator_args = is_running_on_emulator ? \"-p #{no_vnc_port}:6080 -e DEVICE='#{device_name}'\" : ''\n emulator_args = \"#{emulator_args}#{additional_env}\"\n @docker_commander.start_container(emulator_args: emulator_args, docker_image: docker_image,\n core_amount: core_amount)\n end",
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end",
"def initialize name = 'CamStudio - Custom Build'\n sleep 0.2 while (@h_cam = @@find_window.call nil, name ) <= 0\n set_window_pos\n\n # TODO: raise exception if can not find\n end",
"def start\n main_loop\n end",
"def on_container_start(container)\n # Connecting to broker and creating receiver\n @receiver = container.connect(\n # Set broker URI\n @broker,\n # Enabled SASL authentication\n sasl_enabled: true,\n # Enabled insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs\n ).open_receiver(@broker.amqp_address)\n # If browse messages instead of reading\n if browse\n # Set browsing mode\n @receiver.source.distribution_mode = \\\n Qpid::Proton::Terminus::DIST_MODE_COPY\n end\n end",
"def wait_and_open\n info \"Attempting to connect to the web site...\"\n Http.head \"http://127.0.0.1:3000/\"\n rescue Errno::ECONNREFUSED\n sleep(0.5)\n retry if (self.try += 1) < max\n info \"Server not found, sorry.\"\n raise\n else\n Launchy.open(\"http://127.0.0.1:3000/\")\n end",
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def launch\n # To be overriden in subclass,\n # not implemented here.\n raise NotImplementedError\n end",
"def show\n page = ShowBlock.new(self).run(&Proc.new)\n finish_show(page)\n end",
"def open\n raise NotImplementedError\n end",
"def setup_container\n assign_unique_vnc_port if port_factor && is_running_on_emulator\n\n if container_available?\n UI.important('Container was already started. Stopping and removing..')\n @docker_commander.delete_container\n end\n\n handle_ports_allocation if is_running_on_emulator && vnc_enabled\n\n pull_from_registry if @pull_latest_image\n\n # Make sure that network bridge for the current container is not already used\n @docker_commander.disconnect_network_bridge\n\n create_container\n\n if is_running_on_emulator && kvm_disabled?\n raise 'Linux requires GPU acceleration for running emulators, but KVM virtualization is not supported by your CPU. Exiting..'\n end\n\n container_state = wait_for_healthy_container\n\n if is_running_on_emulator && container_state\n connection_state = @emulator_commander.check_connection\n container_state = connection_state && connection_state\n end\n\n unless container_state\n UI.important(\"Will retry to create a healthy docker container after #{sleep_interval} seconds\")\n @docker_commander.delete_container\n sleep @sleep_interval\n create_container\n\n unless wait_for_healthy_container\n UI.important('Container is unhealthy. Exiting..')\n begin\n Actions.sh(\"docker logs #{container_name} --tail 200\")\n Actions.sh(\"docker exec -i #{container_name} cat /var/log/supervisor/docker-android.stderr.log\")\n Actions.sh(\"docker exec -i #{container_name} cat /var/log/supervisor/supervisord.log\")\n rescue StandardError\n # do nothing\n end\n # We use code \"2\" as we need something than just standard error code 1, so we can differentiate the next step in CI\n exit 2\n end\n\n if is_running_on_emulator && !@emulator_commander.check_connection\n UI.important('Cannot connect to emulator. Exiting..')\n exit 2\n end\n end\n\n if is_running_on_emulator\n @emulator_commander.disable_animations\n @emulator_commander.increase_logcat_storage\n end\n\n execute_pre_action if @pre_action\n end",
"def create_container\n UI.important(\"Creating container: #{container_name}\")\n CpuLoadHandler.print_cpu_load\n begin\n container = create_container_call\n set_container_name(container)\n rescue StandardError\n UI.important(\"Something went wrong while creating: #{container_name}, will retry in #{@sleep_interval} seconds\")\n CpuLoadHandler.print_cpu_load\n @docker_commander.delete_container\n sleep @sleep_interval\n container = create_container_call\n set_container_name(container)\n end\n @container = get_container_instance(container)\n\n if @container.nil?\n sleep 3\n @container = get_container_instance(container)\n end\n end",
"def start() @root.mainloop end",
"def open\n object.open\n end",
"def on_open( &block )\n @on_open = block\n end",
"def build(*args)\n # create the container they ask for with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end",
"def open\n raise NotImplementedError, \"You must implement #open in your driver.\"\n end",
"def start!\n Thread.new {\n Docker::Container.all.each do |container|\n stream_container_logs(container, 'start')\n end\n }\n end",
"def wait_while_present\n container.wait_while_present\n end",
"def launch!\n introduction\n # action loop\n result = nil\n until result == :quit do\n action, args = get_action\n result = do_action(action, args)\n end\n conclusion\n end",
"def start!\n start\n wait_until_terminated(nil)\n end",
"def create_and_run_container args\n \t# update the timeout for the Excon Http Client\n \t# set the chunk size to enable streaming of log files\n ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}\n container = ::Docker::Container.create(\n \t\t'Image' => args[:image],\n \t\t'Cmd' => args[:command],\n \t\t\"Binds\" => args[:volumes],\n \t\t\"Env\" => args[:environment],\n \t\t'WorkingDir' => args[:working_directory],\n 'NetworkMode' => @network,\n 'name' => args[:name],\n 'PublishAllPorts' => true\n )\n\n output = ''\n\n unless args[:deamon] == true\n thread = Thread.new do\n container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => false, :tty => false) do\n |stream, chunk|\n if chunk.index('[ERROR]') != nil # deal with hidden characters\n @logger.error chunk.gsub(/\\[.*\\]/,'')\n else\n output += chunk.gsub(/\\[.*\\]/,'') if output == ''\n output += chunk.gsub(/\\[.*\\]/,'').prepend(\" \") unless output == ''\n @logger.debug chunk.gsub(/\\[.*\\]/,'')\n end\n end\n end\n end\n\n \n\n container.start\n \n thread.join unless args[:deamon] == true\n\n success = (container.json['State']['ExitCode'] == 0) ? true: false \n \n @logger.error(output) unless success \n\n \treturn container, success\n end",
"def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend",
"def open\n system \"open #{@output}\"\n end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be\n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n @connected = true\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\n end",
"def call(env)\n if @params[:io].player?(env)\n io = @params[:io].new env\n open_game_inst io\n io.response\n else\n @params[:server].call env\n end\n end",
"def start\n self.connect\n self.login if @connected\n end",
"def open\n @output = DL::CPtr.new(0)\n C.snd_rawmidi_open(nil, @output.ref, \"virtual\", 0)\n end",
"def start_background_container(image, container_name, solve_conflicts=true)\n Cheetah.run(\n \"docker\", \"run\",\n \"-d\",\n \"--entrypoint\", \"env\",\n \"--name\", container_name,\n image,\n \"sh\", \"-c\", \"sleep 1h\")\n end",
"def start_background_container(image, container_name, solve_conflicts=true)\n Cheetah.run(\n \"docker\", \"run\",\n \"-d\",\n \"--entrypoint\", \"env\",\n \"--name\", container_name,\n image,\n \"sh\", \"-c\", \"sleep 1h\")\n end",
"def on_container_start(container)\n # Connecting to broker and creating sender\n container.connect(\n # Set broker URI\n @broker,\n # Enable SASL authentication\n sasl_enabled: @sasl_enabled,\n # Enable insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs,\n # Set idle timeout\n idle_timeout: @idle_timeout,\n # Set max frame size\n max_frame_size: @max_frame_size,\n ).open_sender({\n # Set target address\n :target => anonymous ? nil : @broker.amqp_address,\n # Set auto settle\n :auto_settle => @auto_settle_off ? false : true,\n })\n end",
"def on_open(&block)\n if @channel.status == :opening\n self.on_open_callbacks << block\n else\n block.call\n end\n end",
"def open_session; end",
"def on_open(&block)\n define_callback :connect, &block\n end",
"def open(handler)\n puts '! Connection established' if handler.bot.debug\n end",
"def open_scene?\n id = $game_temp.open_scene_event_id\n if id != nil\n interpreter = Game_Interpreter.new\n $game_temp.open_scene_event_id = nil\n event = $game_map.events[id]\n interpreter.setup(event.list, event.id)\n while interpreter.running?\n interpreter.update\n update_basic\n wait_for_message\n @message_window.update\n end\n end\n end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be \n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\t\n end",
"def _start_scene\n # Load YAML file\n build_scene(scene_file) if scene_file\n # Call hook method\n start_scene\n # Perform opening transition\n do_transition(transition_options[:start]) if transition_options.try(:[], :start)\n # Mark self as built\n @built = true\n end",
"def open(&block)\n repo.blob_pipe(sha, &block)\n end",
"def run\r\n @log.debug \"Run the tester...\"\r\n @dlg_box = CupSingleGameWin.new(@options)\r\n @dlg_box.create\r\n end",
"def onopen(&blk); super; end",
"def open\n @thread = Thread.new{ @wamp_client.open }\n end",
"def close\n\n # nothing to do here.\n end",
"def reopen\n end",
"def begin!\n start_server\n end",
"def open\n session = @@opentok.create_session({media_mode: :routed})\n @session = Session.create(session_id: session.session_id,\n active: true)\n render json: @session\n end",
"def open\n # Opening the simulator with a specific UDID will boot the device\n if booted\n shutdown\n end\n sim = %x[/usr/bin/xcode-select -p].gsub(\"\\n\", \"/Applications/iOS Simulator.app\")\n %x[open -g -a '#{sim}' --args -CurrentDeviceUDID #{self.id}]\n sleep 0.5\n end",
"def start\n raise \"NotImplemented\"\n end",
"def create_new_container\n puts 'Start creating a new container..'\n host = get_available_host\n if host.nil?\n puts 'Could not found a host with limit enough to create more containers'\n return\n end\n puts \"getting an available port to #{host}\"\n port = get_available_port(host)\n if port.nil?\n puts 'Could not found an available port'\n return\n end\n\n puts \"using port #{port} from #{host}\"\n\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n container = Docker::Container.create(\n 'Image' => \"#{@ws_image}\",\n 'ExposedPorts' => { \n '8070/tcp' => {}\n },\n 'HostConfig' => {\n 'CpuPeriod' => 25000,\n 'PortBindings' => {\n '8070/tcp' => [ { 'HostPort' => \"#{port}\" } ]\n }\n }\n )\n container.start\n register_container(host, port, container.id)\n end",
"def start\n log_debug \"[ #{@node}/#{@environment} ] - Start Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container start --cgroup-manager=cgroupfs #{@container}\"\n end",
"def close\n return true\n end",
"def frame(*args)\n return yield unless ui_enabled?\n CLI::UI::Frame.open(*args) { yield }\n end"
] | [
"0.6011619",
"0.5924011",
"0.5833936",
"0.57958317",
"0.564251",
"0.55786717",
"0.55647635",
"0.5563498",
"0.5541097",
"0.55401075",
"0.5494131",
"0.5468679",
"0.5403339",
"0.5397162",
"0.53943634",
"0.53896",
"0.5373252",
"0.536076",
"0.53584313",
"0.5353028",
"0.5353028",
"0.5353028",
"0.5346239",
"0.5343889",
"0.5343467",
"0.5334767",
"0.532806",
"0.5324532",
"0.52978635",
"0.52910495",
"0.5269714",
"0.5264248",
"0.5212563",
"0.5191467",
"0.5189942",
"0.51826656",
"0.5154737",
"0.5131796",
"0.5120755",
"0.5092727",
"0.50834304",
"0.506321",
"0.50619245",
"0.5060526",
"0.5054912",
"0.5054504",
"0.5045851",
"0.50409824",
"0.5037029",
"0.50188124",
"0.5014349",
"0.501013",
"0.50055075",
"0.50029397",
"0.4999709",
"0.49959165",
"0.49928483",
"0.49836594",
"0.4982297",
"0.4969993",
"0.49490887",
"0.49439248",
"0.494214",
"0.49312666",
"0.4928863",
"0.49232274",
"0.49207565",
"0.49084806",
"0.49065107",
"0.48974535",
"0.4886266",
"0.48613927",
"0.4859137",
"0.485857",
"0.48522472",
"0.48411402",
"0.48280355",
"0.48280355",
"0.48185334",
"0.48153037",
"0.48125786",
"0.48101032",
"0.48046634",
"0.48042816",
"0.4800365",
"0.4791086",
"0.47888964",
"0.4784182",
"0.47819668",
"0.47773907",
"0.4774297",
"0.4772106",
"0.47714657",
"0.47705916",
"0.47644392",
"0.47644028",
"0.47636402",
"0.47613883",
"0.47583222",
"0.47575074"
] | 0.48137245 | 80 |
Closes container, if possible. Takes care of notifying the player of the result. | def close(event)
player = event[:player]
if not @open
player.output("The #{@generic} is already closed, silly.")
else
@open = false
room = $manager.find(player.room, nil)
if @name.empty?
player.output "You close #@article #@generic."
room.output "#{player.name} closes #@article #@generic.", player
else
player.output "You close #@name."
room.output "#{player.name} closes #@name.", player
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n\n # nothing to do here.\n end",
"def close\n # no-op\n end",
"def close\n # ..\n end",
"def close\n # NOOP\n end",
"def close\n # NOOP\n end",
"def close\n\t\t\t\[email protected](&:close)\n\t\t\t\[email protected]\n\t\t\tend",
"def close\n tagged_response(\"CLOSE\")\n end",
"def close\n @closed = true\n @on_close and @on_close.call\n end",
"def close\n @closed = true\n end",
"def closing?; end",
"def close()\n @closed = true\n end",
"def close( &block )\n compile!( :close!, &block )\n end",
"def close\n @closed = true\n end",
"def game_close\n @console_delegate.close\n end",
"def close\n # don't need to close\n end",
"def close\n handle_action_exceptions(__method__) do\n priv_close\n logger('debug', 'close') { 'done!' }\n @closed = true\n @json ? { 'result' => 'Success' } : true\n end\n end",
"def close!\n close(true)\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def do_close; end",
"def other_side_closed\n room = $manager.find @container\n @open = false\n room.output \"The #{@generic} closes.\"\n end",
"def close!\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n Common.uncontain\n self\n end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def closed?; end",
"def close\n Processing::App.current = nil\n control_panel.remove if respond_to?(:control_panel) && !online?\n container = (@frame || JRUBY_APPLET)\n container.remove(self)\n self.destroy\n container.dispose\n end",
"def do_close\n @logger.debug(\"closing\", :plugin => self.class.name)\n close\n end",
"def close\n close!\n end",
"def closing; end",
"def closing; end",
"def close!\n # Not implemented\n end",
"def close\n # this method may be left unimplemented if that is applicable\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n return if closed?\n\n nocbreak\n close_screen\n end",
"def close; true; end",
"def close; true; end",
"def close() end",
"def close() end",
"def close() end",
"def close() end",
"def close\n render :text => \"\"\n end",
"def close() end",
"def close\n return true\n end",
"def close\n return if closed?\n _data[:closed] = true\n _data[:on_close].call unless _data[:on_close].nil?\n closing\n end",
"def close\n '</div>'\n end",
"def closed\n end",
"def close\n self\n end",
"def close\r\n command 'close'\r\n end",
"def close\r\n command 'close'\r\n end",
"def finalize\n close\n end",
"def close\n # Force full flush call to ensure that all accumulated messages are flushed.\n buffer_flush(:final => true)\n end",
"def close\n nil\n end",
"def close\n abort('Thanks for playing!')\n end",
"def close\n # Do nothing.\n end",
"def Close\n end",
"def close\n\t\t\tKernel.exit 0\n\t\tend",
"def on_close\n on :close\n close\n end",
"def close\n end",
"def close\n end",
"def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end",
"def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end",
"def close; end"
] | [
"0.6503784",
"0.6471342",
"0.6456059",
"0.644419",
"0.644419",
"0.6443244",
"0.643075",
"0.6373326",
"0.63388807",
"0.63354105",
"0.6258919",
"0.6245982",
"0.6232022",
"0.6229963",
"0.62106025",
"0.6206791",
"0.61939436",
"0.61889815",
"0.6179985",
"0.6160607",
"0.61581725",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.6155611",
"0.61329216",
"0.61329216",
"0.61329216",
"0.6131069",
"0.6123075",
"0.6123075",
"0.6123075",
"0.6123075",
"0.6111494",
"0.6108292",
"0.61080927",
"0.60943794",
"0.60943794",
"0.6093731",
"0.60591656",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6048984",
"0.6037395",
"0.6027483",
"0.6027483",
"0.6021747",
"0.6021747",
"0.6021747",
"0.6021747",
"0.6020242",
"0.6019931",
"0.60036045",
"0.5996779",
"0.5989337",
"0.59845424",
"0.5979281",
"0.59781605",
"0.59781605",
"0.59725434",
"0.5972143",
"0.595922",
"0.59590524",
"0.5938515",
"0.5923149",
"0.59225327",
"0.5913733",
"0.59009796",
"0.59009796",
"0.5898153",
"0.5898153",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976",
"0.58856976"
] | 0.0 | -1 |
Locks the object with the key. Returns true if successful, false otherwise. In this case the key is the GOID of a key. | def lock(key, admin = false)
if @lockable and not @locked and (@keys.include? key or admin)
@locked = true
if self.can? :connected_to
other = $manager.find self.connected_to
other.lock(key, admin) if other.can? :lock
end
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def lock(key)\n raise NotImplementedError\n end",
"def lock(group_id) \n synchronize do\n if @@lock_table[group_id].nil?\n @@lock_table[group_id] = group_id\n return true\n end\n false\n end\n end",
"def lock id\n begin\n @db[:locks].insert :id => id, :locked => 1\n return TRUE\n rescue\n return FALSE\n end\n end",
"def lock(key)\n returned_from_block = nil\n client.lock(key, @ttl) do |locked|\n raise UnableToAcquireLockError unless locked\n returned_from_block = yield\n end\n returned_from_block\n end",
"def locked?(key)\n raise NotImplementedError\n end",
"def locked?(*args)\n inspect_lock(:redis_lock_key, *args)\n end",
"def lock( actor, silent = false )\n\t\tif not @closed\n\t\t\tactor.output \"You can't lock it while it's open!\" unless silent\n\t\t\treturn false\n\t\telsif @locked\n\t\t\tactor.output \"It is already locked.\" unless silent\n\t\t\treturn false\n\t\telsif actor.items.map(&:id).include?(@key_id)\n @reset.activate if @reset\n\t\t\tunless silent\n\t\t\t\tactor.output \"Click.\"\n if @direction\n\t (actor.room.occupants - [actor]).each_output \"0<N> locks the #{self.name} to the #{@direction.name}.\", [actor]\n else\n (actor.room.occupants - [actor]).each_output \"0<N> locks #{self.name}.\", [actor]\n end\n\t\t\tend\n\n\t\t\t@locked = true\n\t\t\[email protected]( actor, silent: true ) if @pair\n\t\t\treturn true\n\t\telse\n\t\t\tactor.output \"You lack the key.\" unless silent\n\t\t\treturn false\n\t\tend\n\tend",
"def with_lock(key)\n raise NotImplementedError\n end",
"def try_lock\n @client.service.service.insert_object(\n @bucket.name,\n name: @object.name,\n if_generation_match: 0,\n upload_source: StringIO.new(@uuid),\n )\n\n true\n rescue Google::Apis::ClientError => e\n raise unless e.status_code == 412 && e.message.start_with?('conditionNotMet:')\n\n false\n end",
"def lock!(key, key2 = nil, timeout: nil)\n unless in_transaction?\n raise \"You cannot use lock! outside of a transaction\"\n end\n\n if key.is_a?(String)\n # calculate a 31 bit checksum < 0\n key = Digest::CRC32.hexdigest(key).to_i(16) # get a 32-bit stable checksum\n key &= ~0x80000000 # reset bit 31\n key = -key # make it negative\n end\n\n # shorten key, key2 to the allowed number of bits\n if key2\n key = apply_bitmask(key, MASK_31_BITS)\n key2 = apply_bitmask(key2, MASK_31_BITS)\n else\n key = apply_bitmask(key, MASK_63_BITS)\n end\n\n if timeout\n lock_w_timeout(key, key2, timeout)\n else\n lock_wo_timeout(key, key2)\n end\n end",
"def lock\n @privkey = nil\n @locked = true\n end",
"def lock\n # locking will automatically trigger reload\n # locker older than 1 hour is considered stale\n if !is_locked || (is_locked && locked_at < Time.now - 3600)\n self.is_locked = true\n self.locked_at = Time.now\n save!\n else\n false\n end\n end",
"def lock(obj, time = RedisMutexer.config.time)\n logger\n locked = RedisMutexer.config.redis.setnx(key(obj), self.id)\n if locked\n return RedisMutexer.config.redis.expire(key(obj), time)\n end\n locked\n end",
"def lock?\n return true if @_lock_type\n false\n end",
"def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def lock_key(*arguments)\n nil\n end",
"def locked?(obj)\n RedisMutexer.config.redis.exists(key(obj))\n end",
"def lock(keyspace, ttl, options={})\n # returns false if the key already exists\n @storage.add(keyspace.lock_key, LOCK_VALUE, ttl, options)\n end",
"def lock\n if unlocked_status == false\n raise ArgumentError.new(\"You cannot lock this door - it is already locked\")\n else\n door_hash[:unlocked_status] = false\n end\n end",
"def try_enter\n raise 'Already locked' if @locked\n enter_primitive ? @locked = true : false\n end",
"def lock\n if lockfile.lock\n begin\n yield\n ensure\n lockfile.unlock\n end\n return true\n else\n return false\n end\n end",
"def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end",
"def lock(key, &block)\n\n kl = \"#{key}-lock\"\n\n loop do\n\n break if @redis.setnx(kl, Time.now.to_f.to_s) != false\n # locking successful\n\n #\n # already locked\n\n t = @redis.get(kl)\n\n @redis.del(kl) if t && Time.now.to_f - t.to_f > 60.0\n # after 1 minute, locks time out\n\n sleep 0.007 # let's try to lock again after a while\n end\n\n #@redis.expire(kl, 2)\n # this doesn't work, it makes the next call to setnx succeed\n\n result = block.call\n\n @redis.del(kl)\n\n result\n end",
"def acquire_lock\n\t\t@@logger.info { \"Acquiring a lock in the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => false).update(:locked => true) != 0\n\tend",
"def lock!\n create_lock_file!\n if have_first_lock?(false)\n @locked = true\n else\n cleanup_lock_file!\n false\n end\n end",
"def lock(key, expiration)\n timeout = (expiration * 1000).to_i\n if @redis.set(\"SimpleRedisLock:#{key}\", Time.now.strftime('%Y-%m-%d %H:%M:%S.%L %z'), nx: true, px: timeout)\n if block_given?\n begin\n yield\n ensure\n release key\n end\n else\n true\n end\n end\n end",
"def lock!\n @locked = true\n end",
"def lock!\n @locked = true\n end",
"def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end",
"def with_lock(key)\n with_multilock(Array.wrap(key)) do |lock_objects|\n yield lock_objects[key]\n end\n end",
"def id_locked?(id_to_check)\n @con.hexists(\"#{@lock_map_key}_h\", id_to_check)\n end",
"def keep_alive_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:st] = Time.now.to_i\n puts \"Keep Alive called for Key: #{key}\"\n end\n true\n end",
"def lock\n if @mutex\n if @owner != Thread.current.object_id\n @mutex.lock\n @owner = Thread.current.object_id\n end\n @count += 1\n end\n true\n end",
"def lock(worker)\n return true if locked? && locked_by == worker.name\n #all this to make sure the check and the lock are simultanious:\n cnt = repository.update({properties[:lock_name]=>worker.name},self.class.all(:id=>self.id,:lock_name=>nil))\n if 0 != cnt\n @lock_name = worker.name\n true\n else\n worker.say( \"Worker #{worker.name} Failed to aquire lock on job #{id}\" )\n false\n end\n end",
"def work\n stat :attempting_lock_on, item_id: object_id\n if @mutex.try_lock\n stat :has_lock_on, item_id: object_id\n chore\n stat :releasing_lock_on, item_id: object_id\n @mutex.unlock\n else\n stat :bailed_on, item_id: object_id\n end\n end",
"def lockable?\n @lockable\n end",
"def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end",
"def locking?\n @locking\n end",
"def self_locked?\n results = mysql2.query(%Q[select is_used_lock('#{key}')], as: :array)\n lock_id = results.to_a.first.first\n return nil if lock_id.nil?\n results = mysql2.query(%Q[select connection_id()], as: :array)\n self_id = results.to_a.first.first\n self_id == lock_id\n end",
"def with_locked_key(key)\n raise %(deadlock detected: \"#{key}\") unless @locks.add?(key)\n\n yield(key)\n ensure\n @locks.delete(key)\n end",
"def locked?\n end",
"def lock\n self.is_locked = true\n self\n end",
"def can_lock?\n SpaceRequestPolicy.can_lock?(current_user, object)\n end",
"def lock!(certifier)\n return false if self.locked? # already locked?\n# NCID staff determined it was best to disable these checks to allow people to recertify things\n# return false if self.certifier.present? # already claimed?\n# return false unless self.certified_at.nil? # already certified?\n\n return self.update_attributes!(:certifier_id => certifier.id, :locked => true)\n end",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end",
"def lock(p_lock_file)\n lock_file = File.open(p_lock_file, \"w\")\n lock_file.write(Time.now.to_i.to_s)\n lock_file.close\n return true\n end",
"def lock\n if block_given?\n raise 'Race condition' if locking?\n\n @locking = true\n yield\n return @locking = false\n end\n @locking = true\n end",
"def lock_present?(keyspace)\n @storage.read(keyspace.lock_key) == LOCK_VALUE\n end",
"def try_lock\n\t\t\t@nested_locks += 1 and return true if @locked == Thread.current\n\t\t\tresult = false\n\t\t\tThread.critical = true\n\t\t\tunless @locked\n\t\t\t\t@locked = Thread.current\n\t\t\t\tresult = true\n\t\t\tend\n\t\t\tThread.critical = false\n\t\t\tresult\n\t\tend",
"def try_lock\n lock_expire = (Time.now + expire_timeout).to_f\n lock_full_ident = owner_ident\n !!if 1 == eval_safe(@eval_try_lock, @ns_names, [lock_full_ident, (lock_expire*1000.0).to_i])\n @lock_expire = lock_expire\n @locked_owner_id = lock_full_ident\n end\n end",
"def update\n return if params_missing([ :id, :lock_serial ], params, true)\n\n lock = Lock.get_active_else_not(params)\n return render_error_modelname(404, :MISSING_RECORD, Lock) if !lock\n\n # Only the owner can update the lock record\n return render_error(403, :NOT_BELONGING, Lock) if lock.user_id != @current_user_device.user_id\n return render_error(404, :LOCK_DECOMMISSIONED) if lock.decommissioned?\n\n lock.assign_attributes(params_app_allowed)\n\n new_lock = false\n if !lock.commissioned?\n # New lock, set it all up\n new_lock = true\n lock.commission_date = DateTime.now\n end\n\n return check_save_failure(lock) if !lock.save\n\n # Owner's key not created until commissioning is completed (saved) successfully.\n # TODO Transaction around this and the commissioning?\n if new_lock\n key = create_user_key(lock.id, lock.user, lock.user)\n # Validation errors may fail in interesting ways here.\n end\n\n render_lock_reply(lock)\n end",
"def lock _obj, _args\n \"_obj lock _args;\" \n end",
"def lock\n\n return true if locked?\n\n @lockfile = nil\n\n FileUtils.mkdir_p(::File.dirname(@path))\n\n file = File.new(@path, File::RDWR | File::CREAT)\n locked = file.flock(File::LOCK_NB | File::LOCK_EX)\n\n return false unless locked\n\n now = Time.now\n\n file.print(\"pid: #{$$}, \")\n file.print(\"scheduler.object_id: #{self.object_id}, \")\n file.print(\"time: #{now}, \")\n file.print(\"timestamp: #{now.to_f}\")\n file.flush\n\n @lockfile = file\n\n true\n end",
"def have_lock?\n !!@handle\n end",
"def locked?\n\t\t#puts \"Came to check locked.\"\n\t\tif $redis.get(get_race_condition_key_name).blank?\n\t\t\t#puts \"the key is blank\"\n\t\t\tfalse\n\t\telse\n\t\t #puts \"key is not blank\"\n\t\t #puts \"key is: #{$redis.get(get_race_condition_key_name)}\"\n\t\t $redis.get(get_race_condition_key_name) == LOCKED\n\t\tend\n\tend",
"def add? lock_number\n if @lock_number != lock_number\n # used to recognize different searchpasses of request_class_template\n @lock_number = lock_number\n @lock = -1\n true\n else\n false\n end\n end",
"def locked?\n @locked\n end",
"def __object_lock_key\n @key ||= \"this.#{object_id}\".to_sym\n end",
"def supports_locking?\n false #true\n end",
"def run_atomically(lock_key, tries=ConcurrentRestriction.lock_tries)\n acquired_lock = false\n exp_backoff = 1\n\n tries.times do\n lock_expiration = Time.now.to_i + ConcurrentRestriction.lock_timeout\n if acquire_lock(lock_key, lock_expiration)\n acquired_lock = true\n begin\n yield\n ensure\n release_lock(lock_key, lock_expiration)\n end\n break\n else\n sleep(rand(100) * 0.001 * exp_backoff)\n exp_backoff *= 2\n end\n end\n \n return acquired_lock\n end",
"def is_locked?\n locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n locksmith.locked?\n end",
"def return_lock\n\t\t@@logger.info { \"Returning the lock to the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => true).update(:locked => false) != 0\n\tend",
"def try_lock\n puts \"I couldn't get a lock.\" unless \n open_lock('contested', 'w', File::LOCK_EX | File::LOCK_NB) do\n puts \"I've got a lock!\" \n true\n end\nend",
"def lock!(wait = 0.1)\n until redis.call(\"SETNX\", key[:_lock], lock_timeout) == 1\n next unless lock = redis.call(\"GET\", key[:_lock])\n sleep(wait) and next unless lock_expired?(lock)\n\n break unless lock = redis.call(\"GETSET\", key[:_lock], lock_timeout)\n break if lock_expired?(lock)\n end\n end",
"def lock\n post :lock\n end",
"def locked?\n self.is_locked\n end",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def locked?\n @mutex.locked?\n end",
"def lock\n @unlocked = false\n \"Diary is now locked\"\n end",
"def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end",
"def set_lock\n if File.exists? lock_file_name\n false\n else\n FileUtils.touch lock_file_name\n true\n end\n end",
"def lock\n doc['lock']\n end",
"def locked?\n\t\t\t@locked\n\t\tend",
"def lock!\n freeze!\n @locked = true\n self\n end",
"def lock_status?\n return @unlocked == true\n end",
"def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end",
"def acquire_lock(lock_key, lock_expiration)\n # acquire the lock to work on the restriction queue\n expiration_time = lock_expiration + 1\n acquired_lock = Resque.redis.setnx(lock_key, expiration_time)\n\n # If we didn't acquire the lock, check the expiration as described\n # at http://redis.io/commands/setnx\n if ! acquired_lock\n # If expiration time is in the future, then someone else beat us to getting the lock\n old_expiration_time = Resque.redis.get(lock_key)\n return false if old_expiration_time.to_i > Time.now.to_i\n\n # if expiration time was in the future when we set it, then someone beat us to it\n old_expiration_time = Resque.redis.getset(lock_key, expiration_time)\n return false if old_expiration_time.to_i > Time.now.to_i\n end\n\n # expire the lock eventually so we clean up keys - not needed to timeout\n # lock, just to keep redis clean for locks that aren't being used'\n Resque.redis.expireat(lock_key, expiration_time + 300)\n\n return true\n end",
"def lock\n @locked = true\n self\n end",
"def locked?\n raise NotImplementedError\n end",
"def try_lock\n end",
"def enqueued?(*args)\n inspect_lock(:redis_loner_lock_key, *args)\n end",
"def our_lock?(current_lock)\n return nil unless current_lock\n return false unless current_lock[\"client_name\"] == client_name\n return false unless current_lock[\"process_id\"] == Process.pid\n true\n end",
"def lock\n @@locks.synchronize do\n @@locks[@path] ||= Monitor.new\n @@locks[@path]\n end\n end",
"def locked?\n !!@owner\n end",
"def lock!; end",
"def before_enqueue_lock(*args)\n key = lock(*args)\n now = Time.now.to_i\n timeout = now + lock_timeout + 1\n\n # return true if we successfully acquired the lock\n return true if Resque.redis.setnx(key, timeout)\n\n # see if the existing timeout is still valid and return false if it is\n # (we cannot acquire the lock during the timeout period)\n return false if now <= Resque.redis.get(key).to_i\n\n # otherwise set the timeout and ensure that no other worker has\n # acquired the lock\n now > Resque.redis.getset(key, timeout).to_i\n end",
"def locked?\n not @lock_name.nil?\n end",
"def lock\n shaz_nolock_lock if !@nolock\n end",
"def acquire_lock(lock_name)\n begin\n acquired = false\n sql = lock_query(lock_name)\n connection.query(sql) do |result|\n acquired = result.fetch_row.first == \"1\"\n end\n acquired\n rescue ::Exception\n false\n end\n end",
"def locked?\n return @locked\n end",
"def request_lock lock\n\n\tif @intent_locks[lock.baseset].empty?\n\t\t@intent_locks[lock.baseset] << lock.lock_type\n\t\tputs @intent_locks\n\telse\n\t\tcloned_locks = @intent_locks[lock.baseset].clone\n\t\tcloned_locks.each do |element|\n\t\t\tputs @lock_matrix[element][lock.lock_type]\n\t\t\tif @lock_matrix[element][lock.lock_type]\n\t\t\t\t@intent_locks[lock.baseset] << lock.lock_type\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn true\nend",
"def lock_interaction(job_id)\n operation_lock = nil\n\n # get the lock object\n @manager_lock.synchronize do\n @job_lock_table[job_id] ||= Mutex.new\n operation_lock = @job_lock_table[job_id]\n end\n\n return operation_lock.lock\n end"
] | [
"0.72280157",
"0.713438",
"0.68065655",
"0.67863727",
"0.67599803",
"0.6741938",
"0.6718068",
"0.6611296",
"0.6575373",
"0.6571031",
"0.6421851",
"0.63809466",
"0.63685924",
"0.6362767",
"0.6344252",
"0.63328576",
"0.6300605",
"0.62975717",
"0.62889814",
"0.62740326",
"0.6262838",
"0.6200671",
"0.6194616",
"0.61914253",
"0.6157429",
"0.61574244",
"0.6134786",
"0.6124354",
"0.6108717",
"0.61061215",
"0.60999334",
"0.6089539",
"0.6087175",
"0.608124",
"0.6075497",
"0.60687226",
"0.6055107",
"0.60455996",
"0.6002271",
"0.59928244",
"0.598186",
"0.59785414",
"0.59744287",
"0.5971483",
"0.59433454",
"0.5898669",
"0.58775896",
"0.5874068",
"0.58568126",
"0.5851268",
"0.5836621",
"0.58114046",
"0.58093584",
"0.58085436",
"0.5797447",
"0.5794958",
"0.5793654",
"0.57789695",
"0.5776819",
"0.57745177",
"0.57737356",
"0.57521355",
"0.5740174",
"0.57222646",
"0.57190174",
"0.57190174",
"0.57190174",
"0.57190174",
"0.57101476",
"0.56917715",
"0.56790125",
"0.56759024",
"0.56738603",
"0.56727034",
"0.56508905",
"0.56445324",
"0.56338096",
"0.56330496",
"0.5631416",
"0.5609805",
"0.56052977",
"0.5601419",
"0.55977273",
"0.55945283",
"0.55804646",
"0.5579951",
"0.55786145",
"0.557543",
"0.55631196",
"0.55628717",
"0.5557974",
"0.5543404",
"0.5539004",
"0.5534883",
"0.5532844",
"0.5526419",
"0.55227643",
"0.5515073",
"0.5513112",
"0.5512903"
] | 0.6914182 | 2 |
Unlocks the object with the key. Returns true if successful, false otherwise. In this case the key is the GOID of a key. | def unlock(key, admin = false)
if @lockable and @locked and (@keys.include? key or admin)
@locked = false
if self.can? :connected_to
other = $manager.find self.connected_to
other.unlock(key, admin) if other.can? :lock
end
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlock( actor, silent = false, override = false )\n\t\tif not @locked\n\t\t\tactor.output \"It isn't locked.\" unless silent\n\t\t\treturn false\n\t\telsif actor.items.map(&:id).include?(@key_id) || override\n @reset.activate if @reset\n\t\t\tunless silent\n\t\t\t\tactor.output \"Click.\"\n if @direction\n\t (actor.room.occupants - [actor]).each_output \"0<N> unlocks the #{self.name} to the #{@direction.name}.\", [actor]\n else\n (actor.room.occupants - [actor]).each_output \"0<N> unlocks #{self.name}.\", [actor]\n end\n\t\t\tend\n\n\t\t\t@locked = false\n\t\t\[email protected]( actor, true, override ) if @pair\n\t\t\treturn true\n\t\telse\n\t\t\tactor.output \"You lack the key.\" unless silent\n\t\t\treturn false\n\t\tend\n\tend",
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def unlock!(key)\n ::DatabaseEntryLock.destroy_by(lock_key: key)\n end",
"def unlock!\n if @locked\n cleanup_lock_file!\n @locked = false\n true\n end\n end",
"def unlock(_uri, lock_info)\n locks = data\n locks.each_with_index do |lock, k|\n next unless lock.token == lock_info.token\n locks.delete_at(k)\n put_data(locks)\n return true\n end\n\n false\n end",
"def unlock\n if unlocked_status == true\n raise ArgumentError.new(\"The door is already unlocked!\")\n else\n door_hash[:unlocked_status] = true\n end\n end",
"def unlock\n if @unlocked == true\n raise ExceptionError.new(\"An unlocked door needith not be unlocked\")\n else\n return @unlocked = true\n end\n end",
"def unblock_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:ct] = @keys[key][:st]\n @available_keys[key] = true\n end\n true\n end",
"def lock\n @privkey = nil\n @locked = true\n end",
"def unlock!(certifier)\n return false unless self.locked? # gotta be locked\n# return false unless self.certified_at.nil? # can't already be certified\n return false unless self.certifier_id == certifier.id # gotta be the currently active user\n\n return self.update_attributes!(:locked => false, :certifier_id => nil)\n end",
"def unlock\n @locking = false\n end",
"def unlock\n self.is_locked = false\n self\n end",
"def unlocked?\n @unlocked\n end",
"def unlock!\n self.locked_by = nil\n self.locked_at = nil\n save!\n end",
"def unlock\n self.is_locked = false\n self.locked_at = nil\n save!\n end",
"def locked?(key)\n raise NotImplementedError\n end",
"def release_lock\n if File.exists? lock_file_name\n FileUtils.rm lock_file_name\n true\n else\n false\n end\n end",
"def unlock!\n if (lock_expire = @lock_expire) && owner_ident == (lock_full_ident = @locked_owner_id)\n @locked_owner_id = @lock_expire = nil\n removed = eval_safe(@eval_unlock, @ns_names, [lock_full_ident, SIGNAL_QUEUE_CHANNEL, @marsh_names])\n end\n return removed == @ns_names.length && self\n end",
"def release_key(key_id)\r\n @transport.iso_apdu! :ins => 0x28, :p1 => key_id\r\n return true\r\n end",
"def release_lock( my_owner = oval )\n # Use my_owner = oval to make testing easier.\n with_watch( okey, xkey ) do\n owner = redis.get( okey )\n if owner == my_owner then\n redis.multi do |multi|\n multi.del( okey )\n multi.del( xkey )\n end\n end\n end\n end",
"def unlocked?\n !locked?\n end",
"def unlock(obj)\n logger\n if locked?(obj)\n RedisMutexer.config.redis.del(key(obj))\n end\n end",
"def can_unlock?\n SpaceRequestPolicy.can_unlock?(current_user, object)\n end",
"def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def unlocked?\n not locked?\n end",
"def locked?(obj)\n RedisMutexer.config.redis.exists(key(obj))\n end",
"def unlock_armoire\n if @house.find_room(:bedroom).inventory.include?(\"key\") && (@level == 1)\n @house.delete_item(\"armoire\")\n @house.create_item(\"armoire\", \"This armoire is unlocked. Hey, when you look inside it, you see a secret room extending to the west. Spooky.\", 30)\n @house.find_room(:bedroom).links[:west] = :secret_room\n @house.last_move_message = \"You took the key out of your pack and it fit the armoire!\"\n @level+=1\n end\n end",
"def locked?\n self.released?\n end",
"def unlock(keyspace)\n @storage.delete(keyspace.lock_key)\n end",
"def unlocked_release(id)\n lock_file = @machine_locks[id]\n if lock_file\n lock_file.close\n begin\n File.delete(lock_file.path)\n rescue Errno::EACCES\n # Another process is probably opened it, no problem.\n end\n\n @machine_locks.delete(id)\n end\n end",
"def delete\n return true unless locks\n\n result = locks.delete(data_bag_id)\n\n lock_manager.unregister(Actor.current)\n\n result\n rescue\n lock_manager.register(Actor.current)\n end",
"def release_lock(quorum_hosts, path, data)\n run_zk_block(quorum_hosts) do |zk|\n if lock_matches?(quorum_hosts, path, data)\n ret = zk.delete(path: path)\n else\n raise ::LockingResource::Helper::LockingResourceException,\n 'release_lock: node does not contain expected data ' \\\n 'not releasing the lock'\n end\n true if ret[:rc].zero?\n end ? true : false # ensure we catch returning nil and make it false\n end",
"def unlock\n if @locking\n @locking_file.close\n end\n end",
"def unlock\n if @locking\n @locking_file.close\n end\n end",
"def lock(group_id) \n synchronize do\n if @@lock_table[group_id].nil?\n @@lock_table[group_id] = group_id\n return true\n end\n false\n end\n end",
"def locked?(*args)\n inspect_lock(:redis_lock_key, *args)\n end",
"def lock\n if unlocked_status == false\n raise ArgumentError.new(\"You cannot lock this door - it is already locked\")\n else\n door_hash[:unlocked_status] = false\n end\n end",
"def unlocked?\n ! File.exist?(lock_file)\n end",
"def unlock\n locksmith.unlock # Only signal to release the lock\n end",
"def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end",
"def unlock\n if @locking\n @locking_file.close\n end\n end",
"def key?(key)\n @semaphore.synchronize do\n return @hashed_storage.key? key\n end\n end",
"def locked?\n !status_flag?(:kSecUnlockStateStatus)\n end",
"def lock_key(*arguments)\n nil\n end",
"def unlocked?\n unlocked, _, @active_worker_timestamp = Sidekiq.redis do |redis| \n redis.multi do\n redis.setnx(@locking_key, @current_worker_timestamp)\n redis.expire(@locking_key, 600)\n redis.get(@locking_key)\n end\n end\n unlocked\n end",
"def unlock\n self.locked_at = nil\n self.locked_by = nil\n end",
"def lock( actor, silent = false )\n\t\tif not @closed\n\t\t\tactor.output \"You can't lock it while it's open!\" unless silent\n\t\t\treturn false\n\t\telsif @locked\n\t\t\tactor.output \"It is already locked.\" unless silent\n\t\t\treturn false\n\t\telsif actor.items.map(&:id).include?(@key_id)\n @reset.activate if @reset\n\t\t\tunless silent\n\t\t\t\tactor.output \"Click.\"\n if @direction\n\t (actor.room.occupants - [actor]).each_output \"0<N> locks the #{self.name} to the #{@direction.name}.\", [actor]\n else\n (actor.room.occupants - [actor]).each_output \"0<N> locks #{self.name}.\", [actor]\n end\n\t\t\tend\n\n\t\t\t@locked = true\n\t\t\[email protected]( actor, silent: true ) if @pair\n\t\t\treturn true\n\t\telse\n\t\t\tactor.output \"You lack the key.\" unless silent\n\t\t\treturn false\n\t\tend\n\tend",
"def locked?\n !!@owner\n end",
"def unlock\n self.locked_at = nil\n self.locked_by = nil\n end",
"def release_lock\n return true unless @handle\n set_message ''\n @handle.flock(File::LOCK_UN)\n @handle.close\n @handle = nil\n true\n end",
"def unlock(secret)\n secret.locked = false\n secret.unlocked_value = YAML.load(security.decrypt(secret.value))\n secret\n end",
"def unlock\n self.locked_at = nil\n self.locked_by = nil\n end",
"def unlock\n return unless @locking\n\n @locking_file.close\n\n return unless File.exist?('/var/tmp/vcenter-importer-lock')\n\n File.delete('/var/tmp/vcenter-importer-lock')\n end",
"def do_decommission(lock, revoker = nil)\n if !lock.do_decommission(revoker, request.uuid)\n check_save_failure(lock)\n return false\n end\n return true\n end",
"def unlock\n if job\n job.report_running if report_job_status\n job.set_status(\"Unlocking #{to_s}\")\n end\n\n attempt_unlock\n\n report(true)\n end",
"def unlock\n end",
"def key_held?(key)\n @held_interval[key] == G.kb_held_interval\n end",
"def meterpreter_registry_unloadkey(key)\n begin\n client.sys.config.getprivs()\n root_key, base_key = session.sys.registry.splitkey(key)\n begin\n unloadres= session.sys.registry.unload_key(root_key,base_key)\n rescue Rex::Post::Meterpreter::RequestError => e\n case e.to_s\n when \"stdapi_registry_unload_key: Operation failed: The parameter is incorrect.\"\n #print_error(\"The KEY you provided does not appear to match a loaded Registry Hive: #{key}\")\n return false\n when /stdapi_registry_unload_key: Operation failed:/\n #print_error(\"An unknown error has occurred: #{unloadres.to_s}\")\n return false\n else\n return true\n end\n end\n rescue\n return false\n end\n end",
"def lock(key)\n raise NotImplementedError\n end",
"def release\n locked? && release!\n end",
"def unlock(job_id)\n locked.del(job_id)\n end",
"def lockout?\n @lockout\n end",
"def lock(key, admin = false)\n if @lockable and not @locked and (@keys.include? key or admin)\n @locked = true\n\n if self.can? :connected_to\n other = $manager.find self.connected_to\n other.lock(key, admin) if other.can? :lock\n end\n\n true\n else\n false\n end\n end",
"def key?(key)\n key = to_key key\n @group.key? key\n end",
"def id_locked?(id_to_check)\n @con.hexists(\"#{@lock_map_key}_h\", id_to_check)\n end",
"def return_lock\n\t\t@@logger.info { \"Returning the lock to the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => true).update(:locked => false) != 0\n\tend",
"def delete_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys.delete(key)\n @available_keys.delete(key)\n end\n @deleted_keys.add key\n puts \"Deleted Key: #{key}\"\n true\n end",
"def with_locked_key(key)\n raise %(deadlock detected: \"#{key}\") unless @locks.add?(key)\n\n yield(key)\n ensure\n @locks.delete(key)\n end",
"def unlock\n if ([email protected]?)\n if (@owner[:locks].last == self)\n @owner[:locks].pop\n else\n if @owner[:locks].delete(self)\n @out_of_order_locks += 1\n raise EMutexOrder.new(self, \"Expected #{@owner[:locks].last}\")\n end\n # if called again let it pass\n end\n @owner = nil\n end\n super\n end",
"def unlock(token)\n unless(@lock_class)\n NotImplemented\n else\n token = token.slice(1, token.length - 2)\n if(token.nil? || token.empty?)\n BadRequest\n else\n lock = @lock_class.find_by_token(token)\n if(lock.nil? || lock.user != @user)\n Forbidden\n elsif(lock.path !~ /^#{Regexp.escape(@path)}.*$/)\n Conflict\n else\n lock.destroy\n NoContent\n end\n end\n end\n end",
"def unlock\n if !self.open? && self.locked?\n @locked = false\n elsif self.open?\n raise TypeError.new(\"Door is open. Opne doors cannot be unlocked since they are already unlocked.\")\n elsif !self.locked?\n raise TypeError.new(\"Door is already unlocked. Unlocked doors cannot be unlocked again.\")\n end\n return self\n end",
"def lock!(key, key2 = nil, timeout: nil)\n unless in_transaction?\n raise \"You cannot use lock! outside of a transaction\"\n end\n\n if key.is_a?(String)\n # calculate a 31 bit checksum < 0\n key = Digest::CRC32.hexdigest(key).to_i(16) # get a 32-bit stable checksum\n key &= ~0x80000000 # reset bit 31\n key = -key # make it negative\n end\n\n # shorten key, key2 to the allowed number of bits\n if key2\n key = apply_bitmask(key, MASK_31_BITS)\n key2 = apply_bitmask(key2, MASK_31_BITS)\n else\n key = apply_bitmask(key, MASK_63_BITS)\n end\n\n if timeout\n lock_w_timeout(key, key2, timeout)\n else\n lock_wo_timeout(key, key2)\n end\n end",
"def release_loner_lock!(*args)\n lock_redis.del(redis_loner_lock_key(*args))\n end",
"def locked?\n end",
"def release_advisory_lock(lock_id) # :nodoc:\n end",
"def release_advisory_lock(lock_id) # :nodoc:\n end",
"def lock?\n return true if @_lock_type\n false\n end",
"def self_locked?\n results = mysql2.query(%Q[select is_used_lock('#{key}')], as: :array)\n lock_id = results.to_a.first.first\n return nil if lock_id.nil?\n results = mysql2.query(%Q[select connection_id()], as: :array)\n self_id = results.to_a.first.first\n self_id == lock_id\n end",
"def unlock_access_by_token(unlock_token); end",
"def unlock_access_by_token(unlock_token)\n original_token = unlock_token\n unlock_token = Devise.token_generator.digest(self, :unlock_token, unlock_token)\n\n lockable = find_or_initialize_with_error_by(:unlock_token, unlock_token)\n lockable.unlock_access! if lockable.persisted?\n lockable.unlock_token = original_token\n lockable\n end",
"def key_released?(key)\n @prev_down.index(key) and @down.index(key).nil?\n end",
"def unlock\n return unless locked?\n unlink_pid_file\n end",
"def test_locknull_on_unlock\n # ensure that locknull file doesn't exist\n response = @request.delete('locknull')\n\n # create a exclusive write locked null resource\n lock = lock 'locknull', :depth => 0\n\n response = @request.propfind '', 1, :\"current-user-privilege-set\"\n assert_not_nil response[\"#{@uri.path}locknull\"]\n\n unlock('locknull', lock.token)\n \n response = @request.propfind '', 1, :\"current-user-privilege-set\"\n assert_nil response[\"#{@uri.path}locknull\"]\n end",
"def unlock(token)\n return NotImplemented unless @lock_class\n\n token = token.slice(1, token.length - 2)\n if(token.nil? || token.empty?)\n BadRequest\n else\n lock = @lock_class.find_by_token(token)\n if(lock.nil? || lock.user != @user)\n Forbidden\n elsif(lock.path !~ /^#{Regexp.escape(@path)}.*$/)\n Conflict\n else\n lock.destroy\n NoContent\n end\n end\n end",
"def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end",
"def unlock(*args, &block)\n map_method(:unlock, args, &block)\n end",
"def lock\n @unlocked = false\n \"Diary is now locked\"\n end",
"def locked?\n @locked\n end",
"def run_action_unlock(item)\n item = validate_item(item)\n ui.print \" Unlocking #{ui.color(item, :bold)}... \"\n content = load_json(File.read(item)).to_smash\n if content[:sfn_parameters_lock]\n content = unlock_content(content)\n content.delete(:sfn_lock_enabled)\n File.write(item, format_json(content))\n ui.puts ui.color(\"unlocked\", :green)\n else\n ui.puts ui.color(\"no-op\", :yellow)\n ui.warn \"Item is already unlocked! (#{item})\"\n end\n end",
"def lock\n if lockfile.lock\n begin\n yield\n ensure\n lockfile.unlock\n end\n return true\n else\n return false\n end\n end",
"def key?(key)\n @mutex.synchronize do\n if @entries.key?(key) && (@entries[key].nil? || @entries[key].expired?)\n @entries.delete(key)\n end\n @entries.key?(key)\n end\n end",
"def release\n result = eval_script(\n RedisScripts::RELEASE_SCRIPT,\n RedisScripts::RELEASE_SCRIPT_HASH,\n keys: [redis_key],\n argv: [owner]\n )\n result != 0\n end",
"def unlock(value)\n value = value.to_smash\n [:content, :iv, :salt].each do |key|\n unless value[key]\n raise ArgumentError.new(\"Missing required information `#{key}`\")\n end\n end\n o_cipher = arguments[:cipher]\n arguments[:cipher] = value[:cipher] if value[:cipher]\n cipher = build(\n Base64.urlsafe_decode64(value[:salt]),\n Base64.urlsafe_decode64(value[:iv])\n )\n arguments[:cipher] = o_cipher\n string = Base64.urlsafe_decode64(value[:content])\n cipher.update(string) + cipher.final\n end",
"def key?(key)\n timeout_retry(3, 3){\n write \"EXISTS #{key}\\r\\n\"\n integer_reply == 1\n }\n end",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def unlock_database\n unlock_command = <<-EOS\n echo 'use admin\n db.$cmd.sys.unlock.findOne()' | #{mongo_shell}\n EOS\n\n run(unlock_command)\n end",
"def is_locked?\n locked\n end",
"def keep_alive_key(key)\n return false unless @keys.key? key\n @mutex.synchronize do\n @keys[key][:st] = Time.now.to_i\n puts \"Keep Alive called for Key: #{key}\"\n end\n true\n end",
"def unlock\n FileUtils.rm(lock_file) if File.exist?(lock_file)\n reset!\n end",
"def can_unlock?(user, space)\n user.review_space_admin? && space.shared? && space.locked?\n end"
] | [
"0.6448773",
"0.6419712",
"0.6261727",
"0.62215286",
"0.6189919",
"0.61527914",
"0.59902537",
"0.59011996",
"0.5878205",
"0.5818054",
"0.58128023",
"0.58097506",
"0.579645",
"0.57958484",
"0.5789584",
"0.576218",
"0.57618964",
"0.5724139",
"0.5675453",
"0.5636322",
"0.5599738",
"0.5587201",
"0.5556514",
"0.5505235",
"0.5498537",
"0.54797137",
"0.5468405",
"0.5451885",
"0.5428415",
"0.53743154",
"0.5373198",
"0.5369965",
"0.5357332",
"0.5357332",
"0.5334817",
"0.53249127",
"0.5318512",
"0.5317949",
"0.5312501",
"0.5288767",
"0.5262827",
"0.5251135",
"0.52472645",
"0.522607",
"0.5216785",
"0.5201391",
"0.51897",
"0.5180771",
"0.5155676",
"0.5148382",
"0.51229376",
"0.51192695",
"0.5114631",
"0.5113293",
"0.5113034",
"0.509575",
"0.50944436",
"0.5088528",
"0.5085556",
"0.5082552",
"0.50653946",
"0.5052109",
"0.50489575",
"0.50480956",
"0.5042367",
"0.5033567",
"0.5033043",
"0.50221986",
"0.50184566",
"0.50085175",
"0.5004468",
"0.49873847",
"0.4987192",
"0.4982949",
"0.49775675",
"0.49775675",
"0.49638936",
"0.49598503",
"0.49596098",
"0.49422392",
"0.49318773",
"0.49286163",
"0.49273",
"0.49248102",
"0.49079803",
"0.4904004",
"0.4900049",
"0.48994327",
"0.48974636",
"0.4896239",
"0.4890434",
"0.48899922",
"0.48880315",
"0.4882887",
"0.4881279",
"0.48810777",
"0.48808637",
"0.48770073",
"0.48636326",
"0.48595706"
] | 0.6755727 | 0 |
This is kind of a retarded method. Always returns true. | def openable?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semact?; false; end",
"def sharded?; false; end",
"def delicious?\n\t\treturn true\n\tend",
"def success?() end",
"def sharded?; true; end",
"def result?\n false\n end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def check ; true ; end",
"def fair?\n !crooked?\n end",
"def usable?; end",
"def erased?\n false\n end",
"def success?\n return true\n end",
"def despined?(*)\n end",
"def distracted?\n false\n end",
"def delicious?()\n\t\treturn TRUE\n\tend",
"def missed?; end",
"def missing?; false; end",
"def previously_existed?\n true\n end",
"def borked?; @borked; end",
"def run(_value)\n false\n end",
"def delicious?\n #its automattically true\n true\n end",
"def private_call?()\n #This is a stub, used for indexing\n end",
"def keep_retval?\n @keep_retval\n end",
"def complete?\n end",
"def pure?\n raise \"Not implemented yet\"\n end",
"def tainted?() end",
"def qwerty\n\t\tfalse\n\tend",
"def check!\n true\n end",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def success?(*) end",
"def dead?()\n #This is a stub, used for indexing\n end",
"def recommendable?() false end",
"def true(_argvs)\n return nil\n end",
"def consigned?\n false\n end",
"def frozen?() end",
"def frozen?() end",
"def dumb?\n false\n end",
"def sticky?() end",
"def stand\r\n return true\r\n end",
"def result?\n true\n end",
"def unfinished?\n !finished?\n end",
"def usable?\n false\n end",
"def finished?()\n #This is a stub, used for indexing\n end",
"def run\n false\n end",
"def recoverable?()\n return false\n end",
"def repealed?\n !!repealed_on\n end",
"def multi_arged?\n false\n end",
"def success?\n false\n end",
"def success?\n false\n end",
"def lost?\n # Fill this in\n end",
"def irregular?\n false\n end",
"def supports_returning?\n false\n end",
"def complete?\n false\n end",
"def appealed?\n appealed == 1\n end",
"def keep_going?\n !!@keep_going\n end",
"def working?\n false\n end",
"def improve\n return false unless valid?\n true\n end",
"def rest?\n false\n end",
"def test?\n false\n end",
"def method_missing(m, *args)\n return false\n end",
"def void_true(*args)\n return true\n end",
"def ran?\n @result != Result::NoResult\n end",
"def summon?\n return false\n end",
"def double?\n if self.id\n return true if self.torrent_url && Torrent.not_self(self.id).find_by_torrent_url(self.torrent_url)\n return true if self.transmission_hash_string && Torrent.not_self(self.id).find_by_transmission_hash_string(self.transmission_hash_string)\n return true if self.name && Torrent.not_self(self.id).find_by_name(self.name)\n else\n return true if self.torrent_url && Torrent.find_by_torrent_url(self.torrent_url)\n return true if self.transmission_hash_string && Torrent.find_by_transmission_hash_string(self.transmission_hash_string)\n return true if self.name && Torrent.find_by_name(self.name) \n end\n \n \n return false\n end",
"def aye?\n true\n end",
"def elide?\n false\n end",
"def fetch\n false\n end",
"def if_needs_rekey?; end",
"def complete?\n complete == true\n end",
"def non_blocking?()\n #This is a stub, used for indexing\n end",
"def settled?\n return !self.pending?\n end",
"def absorbent?\n @absorbent\n end",
"def expected?\n false\n end",
"def dirty?\n !!culprit\n end",
"def preserve?\n true\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def success?\n !error\n end",
"def bastard?\n end",
"def reminded?\n !!reminded_at\n end",
"def will_call?\n return true\n end",
"def complete?\n true\n end",
"def complete?\n true\n end",
"def kgio_autopush?()\n #This is a stub, used for indexing\n end",
"def assertive?\n true\n end",
"def refresh\n return false\n end",
"def update\n\t\treturn true\n\tend",
"def success?\n end",
"def fresh?\n not stale?\n end",
"def broken?\n ! not_broken?\n end",
"def success?\n finished? and !exception\n end",
"def internal?; end",
"def fresh?\n !stale?\n end",
"def finished?\n @finished == true\n end",
"def revealed? ; false ; end",
"def a\n return true\nend",
"def placebo?; false end",
"def method_missing(*_args)\n true\n end",
"def modifiable?\n !(self.complete? || self.ready_to_post?)\n end"
] | [
"0.72013676",
"0.7129007",
"0.7043102",
"0.70008",
"0.6931859",
"0.6853353",
"0.6819442",
"0.6819057",
"0.68055046",
"0.68021303",
"0.6704324",
"0.6692726",
"0.6678859",
"0.6655605",
"0.6653647",
"0.66482705",
"0.6647624",
"0.663442",
"0.6616701",
"0.6615145",
"0.659815",
"0.659439",
"0.6584377",
"0.65795535",
"0.6576459",
"0.65650666",
"0.6557281",
"0.65524626",
"0.65491617",
"0.65491617",
"0.6547645",
"0.65437734",
"0.6540161",
"0.6539413",
"0.6534367",
"0.65249825",
"0.65249825",
"0.6522271",
"0.65181166",
"0.65040404",
"0.6497093",
"0.64842314",
"0.64839846",
"0.6473477",
"0.64693946",
"0.6461389",
"0.64578974",
"0.6448886",
"0.6448517",
"0.6448517",
"0.643409",
"0.64206815",
"0.64001006",
"0.63973206",
"0.6393769",
"0.63877106",
"0.6385156",
"0.63829243",
"0.6380176",
"0.63774997",
"0.63709474",
"0.6367439",
"0.6363323",
"0.6356948",
"0.63498944",
"0.63483053",
"0.6344324",
"0.63410133",
"0.63403356",
"0.6340159",
"0.63393456",
"0.63380563",
"0.63347584",
"0.6334306",
"0.63335156",
"0.63308895",
"0.632916",
"0.632916",
"0.632916",
"0.6325751",
"0.6324837",
"0.6320715",
"0.63203126",
"0.6319401",
"0.6319401",
"0.63185537",
"0.631665",
"0.63143855",
"0.63112575",
"0.6308337",
"0.63083017",
"0.62982327",
"0.62969023",
"0.6296367",
"0.6273524",
"0.62688804",
"0.62661684",
"0.6265981",
"0.62651795",
"0.62625337",
"0.62582576"
] | 0.0 | -1 |
True if the object can be locked. | def lockable?
@lockable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_lock?\n SpaceRequestPolicy.can_lock?(current_user, object)\n end",
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def locked?\n end",
"def is_locked?\n locked\n end",
"def locked?\n self.is_locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @mutex.locked?\n end",
"def locked?\n return @locked\n end",
"def locked?\n raise NotImplementedError\n end",
"def locked?\n\t\t\t@locked\n\t\tend",
"def locked?(obj)\n RedisMutexer.config.redis.exists(key(obj))\n end",
"def locked?\n locksmith.locked?\n end",
"def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end",
"def locked?\n !!@owner\n end",
"def access_locked?\n !!locked_at && !lock_expired?\n end",
"def locked?\n self.released?\n end",
"def supports_locking?\n false #true\n end",
"def locked?\n if defined?(@locked)\n @locked\n else\n false\n end\n end",
"def lock?\n return true if @_lock_type\n false\n end",
"def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def locked?\n @bridge.device_locked?\n end",
"def is_locked\n return @is_locked\n end",
"def locking?\n @locking\n end",
"def locked?\n not @lock_name.nil?\n end",
"def locked?\n !!read\n end",
"def locked?\n !locked_at.nil?\n end",
"def have_lock?\n !!@handle\n end",
"def has_lock?\n @has_lock || false\n end",
"def locked_open?\n lock == :open\n end",
"def can_run?\n return false if locked_open?\n\n closed? || locked_closed? || half_open?\n end",
"def lock_status?\n return @unlocked == true\n end",
"def locked?\n (status & (1 << 0)).zero?\n end",
"def locked?\n !!locked_by && !!locked_at && (locked_at + Delayed::Worker.max_run_time) >= Delayed::Job.db_time_now\n end",
"def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end",
"def supports_advisory_locks?\n false\n end",
"def supports_advisory_locks?\n false\n end",
"def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end",
"def can_lock?(current_user)\n return false if current_user.anonymous?\n\n not is_locked?\n end",
"def queueing_locked?\n should_lock_on_queueing? && lock_present?\n end",
"def can_unlock?\n SpaceRequestPolicy.can_unlock?(current_user, object)\n end",
"def locked?\n File.exist?(lock_file)\n end",
"def locked?\n File.exist?(lock_file)\n end",
"def access_locked?; end",
"def unlocked?\n not locked?\n end",
"def locked?(key)\n raise NotImplementedError\n end",
"def locked?\n revision.locked == 1\n end",
"def available?\n return true unless coliding_locks.any?\n end",
"def device_locked?\n @bridge.device_locked?\n end",
"def if_access_locked; end",
"def unlocked?\n !locked?\n end",
"def access_locked?\n\n super && date_restricted?\n\n end",
"def unlocked?\n @unlocked\n end",
"def locked?\n\t\t\t!lockoutTime.nil? && lockoutTime.to_i != 0\n\t\tend",
"def locked_out?\n # don't need a mutex because we know #owned? can't change during the call \n locked? && !owned?\n end",
"def owned?\n locked? && @object.size == @uuid.size && @object.download.read == @uuid\n end",
"def locked?\n approved? or rejected?\n end",
"def locked_closed?\n lock == :closed\n end",
"def locked?\n finished? && Time.now.utc > finished_at + 30.minutes\n end",
"def locked?\n locked_by.present? && locked_at.present? && locked_at > 10.minutes.ago\n end",
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def locked?\n !status_flag?(:kSecUnlockStateStatus)\n end",
"def locked?\n submitted?\n end",
"def mon_locked?\n @mon_data.mon_locked?\n end",
"def locked_according_to_internal_state?\n @state_mutex.synchronize do\n unsynced_locked_according_to_internal_state?\n end\n end",
"def unlocked?\n ! File.exist?(lock_file)\n end",
"def can_lock?(user, space)\n user.review_space_admin? && space.shared? && space.active?\n end",
"def try_lock\n\t\t\t@nested_locks += 1 and return true if @locked == Thread.current\n\t\t\tresult = false\n\t\t\tThread.critical = true\n\t\t\tunless @locked\n\t\t\t\t@locked = Thread.current\n\t\t\t\tresult = true\n\t\t\tend\n\t\t\tThread.critical = false\n\t\t\tresult\n\t\tend",
"def can_be_replied_to?\n !locked?\n end",
"def secure?\n (frozen? || lock?) && self.class.closed? && strict?\n end",
"def requirements_unlocked_or_can_be?\n true\n end",
"def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end",
"def write_locked?\n @counter.value >= RUNNING_WRITER\n end",
"def already_locked?\n lock_stack.last == lock_stack_item\n end",
"def mon_locked?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).locked?\n end",
"def is_locked=(value)\n @is_locked = value\n end",
"def lock\n if @mutex\n if @owner != Thread.current.object_id\n @mutex.lock\n @owner = Thread.current.object_id\n end\n @count += 1\n end\n true\n end",
"def locked?\n if sha1 = @eval_is_locked\n 1 == eval_safe(sha1, @ns_names)\n else\n redis_pool.exists @ns_names.first\n end\n end",
"def running?\n # Avoid N+1 Query: `.includes_advisory_locks`\n if has_attribute?(:locktype)\n self['locktype'].present?\n else\n advisory_locked?\n end\n end",
"def lock_movements?\n true\n end",
"def loner_locked?(*args)\n locked?(*args) || (loner && enqueued?(*args))\n end",
"def locked?\n self.invoiced? && self.invoice.issued?\n end",
"def locking_enabled?\n lock_optimistically && columns_hash[locking_column]\n end",
"def read_only?\n mission.try(:locked?) # Mission may be nil if admin mode, in which case it's not read only.\n end",
"def multiple_lockable?\n return @multiple_lockable unless @multiple_lockable.nil?\n major, minor, patch = mysql_version\n @multiple_lockable = (major > 5) || (major == 5 && minor > 7) || (major == 5 && minor == 7 && patch >= 5)\n end",
"def can_lock_control\n if project_permissions != 'admin'\n errors.add(:base, 'Only an admin can lock')\n elsif !rule.review_requestor_id.nil?\n errors.add(:base, 'Cannot lock a control that is currently under review')\n elsif rule.locked\n errors.add(:base, 'Control is already locked')\n end\n end",
"def locked?(*args)\n inspect_lock(:redis_lock_key, *args)\n end",
"def able_to_save?\n unlocked? or state_was == 'pending'\n end",
"def lock_is_exclusive?\n lockscope == 'exclusive'\n end",
"def active_for_authentication?\n super and self.locked != 1\n end",
"def locked?\n persisted? && self.class.where(_id: id).locked.limit(1).count == 1\n end",
"def lock\n if lockfile.lock\n begin\n yield\n ensure\n lockfile.unlock\n end\n return true\n else\n return false\n end\n end",
"def validate_lock\n raise LockRequired.new(__method__, self.class) unless @mutex.owned?\n end",
"def locked?(certifier = nil)\n if certifier\n return self.certifier_id.present? && self.certifier_id != certifier.id\n end\n\n return self.locked.present?\n end",
"def protects?(thing)\n false\n end",
"def isLocked\n room = Room.find_by_id params[:id]\n\n if room.nil?\n respond_with locked: true\n else\n if room.lock_owner_user_id.nil? || room.room_lock_start.nil? || room.lock_owner_user_id == session[:uid]\n respond_with locked: false\n else\n respond_with locked: true\n end\n end\n end"
] | [
"0.8220008",
"0.80163366",
"0.7982346",
"0.7933893",
"0.7930157",
"0.79217315",
"0.79217315",
"0.79217315",
"0.79217315",
"0.7908445",
"0.78519136",
"0.78116924",
"0.7808527",
"0.7783475",
"0.77413106",
"0.7655804",
"0.7645491",
"0.763787",
"0.7633938",
"0.76041156",
"0.76025903",
"0.7557501",
"0.75206685",
"0.7435245",
"0.74062544",
"0.7401361",
"0.7385875",
"0.7373301",
"0.73178506",
"0.73076785",
"0.73065376",
"0.7289494",
"0.72625643",
"0.72618014",
"0.7255561",
"0.7228242",
"0.72259855",
"0.71929467",
"0.7185528",
"0.7165322",
"0.7165322",
"0.7161842",
"0.7148199",
"0.7134768",
"0.71005136",
"0.7076544",
"0.70741564",
"0.7065296",
"0.70264906",
"0.7014879",
"0.7005178",
"0.70028377",
"0.6946427",
"0.6944692",
"0.6939109",
"0.69233185",
"0.69177234",
"0.6874608",
"0.68130547",
"0.67609996",
"0.67565024",
"0.6728299",
"0.6706725",
"0.67017865",
"0.66927385",
"0.6692442",
"0.66905284",
"0.66494864",
"0.664871",
"0.66458124",
"0.6621143",
"0.6589989",
"0.6568656",
"0.65578145",
"0.65424275",
"0.653821",
"0.6515794",
"0.6514259",
"0.6512015",
"0.64975584",
"0.6476939",
"0.6475989",
"0.6457809",
"0.64457566",
"0.6436569",
"0.6414433",
"0.64097744",
"0.63872635",
"0.6386379",
"0.63606805",
"0.63585967",
"0.63521534",
"0.63267094",
"0.63145924",
"0.63107514",
"0.6298647",
"0.6296482",
"0.62953776",
"0.6278424",
"0.62699604"
] | 0.80853903 | 1 |
True if the object is locked. | def locked?
@locked
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def locked?\n @locked\n end",
"def is_locked?\n locked\n end",
"def locked?\n @mutex.locked?\n end",
"def locked?\n\t\t\t@locked\n\t\tend",
"def locked?\n self.is_locked\n end",
"def locked?\n end",
"def locked?\n return @locked\n end",
"def locked?\n not @lock_name.nil?\n end",
"def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end",
"def locked?\n locksmith.locked?\n end",
"def lock?\n return true if @_lock_type\n false\n end",
"def locked?\n !!@owner\n end",
"def locked?\n if defined?(@locked)\n @locked\n else\n false\n end\n end",
"def locking?\n @locking\n end",
"def lockable?\n @lockable\n end",
"def is_locked\n return @is_locked\n end",
"def has_lock?\n @has_lock || false\n end",
"def locked?(obj)\n RedisMutexer.config.redis.exists(key(obj))\n end",
"def have_lock?\n !!@handle\n end",
"def access_locked?\n !!locked_at && !lock_expired?\n end",
"def locked?\n !locked_at.nil?\n end",
"def locked?\n self.released?\n end",
"def lock_status?\n return @unlocked == true\n end",
"def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def locked_open?\n lock == :open\n end",
"def locked?\n raise NotImplementedError\n end",
"def locked?\n !!read\n end",
"def locked?\n File.exist?(lock_file)\n end",
"def locked?\n File.exist?(lock_file)\n end",
"def unlocked?\n not locked?\n end",
"def can_lock?\n SpaceRequestPolicy.can_lock?(current_user, object)\n end",
"def locked?\n !!locked_by && !!locked_at && (locked_at + Delayed::Worker.max_run_time) >= Delayed::Job.db_time_now\n end",
"def locked?\n\t\t\t!lockoutTime.nil? && lockoutTime.to_i != 0\n\t\tend",
"def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end",
"def supports_locking?\n false #true\n end",
"def queueing_locked?\n should_lock_on_queueing? && lock_present?\n end",
"def locked?\n @bridge.device_locked?\n end",
"def unlocked?\n !locked?\n end",
"def unlocked?\n ! File.exist?(lock_file)\n end",
"def locked?\n (status & (1 << 0)).zero?\n end",
"def locked_closed?\n lock == :closed\n end",
"def unlocked?\n @unlocked\n end",
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def locked_out?\n # don't need a mutex because we know #owned? can't change during the call \n locked? && !owned?\n end",
"def locked?\n revision.locked == 1\n end",
"def lock\n if @mutex\n if @owner != Thread.current.object_id\n @mutex.lock\n @owner = Thread.current.object_id\n end\n @count += 1\n end\n true\n end",
"def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end",
"def already_locked?\n lock_stack.last == lock_stack_item\n end",
"def locked?\n !status_flag?(:kSecUnlockStateStatus)\n end",
"def mon_locked?\n @mon_data.mon_locked?\n end",
"def lock\n if lockfile.lock\n begin\n yield\n ensure\n lockfile.unlock\n end\n return true\n else\n return false\n end\n end",
"def our_lock?(current_lock)\n return nil unless current_lock\n return false unless current_lock[\"client_name\"] == client_name\n return false unless current_lock[\"process_id\"] == Process.pid\n true\n end",
"def locked_according_to_internal_state?\n @state_mutex.synchronize do\n unsynced_locked_according_to_internal_state?\n end\n end",
"def can_lock?(current_user)\n return false if current_user.anonymous?\n\n not is_locked?\n end",
"def is_locked=(value)\n @is_locked = value\n end",
"def update_startlock?\r\n # When waiting for event execution or locked\r\n return (@starting or lock?)\r\n end",
"def locked?(key)\n raise NotImplementedError\n end",
"def locked?\n if sha1 = @eval_is_locked\n 1 == eval_safe(sha1, @ns_names)\n else\n redis_pool.exists @ns_names.first\n end\n end",
"def owned?\n locked? && @object.size == @uuid.size && @object.download.read == @uuid\n end",
"def locked?\n finished? && Time.now.utc > finished_at + 30.minutes\n end",
"def is_synchronized()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.AtomicDateTime_is_synchronized(@handle.ptr)\n result\n end",
"def locked?\n locked_by.present? && locked_at.present? && locked_at > 10.minutes.ago\n end",
"def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end",
"def running?\n # Avoid N+1 Query: `.includes_advisory_locks`\n if has_attribute?(:locktype)\n self['locktype'].present?\n else\n advisory_locked?\n end\n end",
"def mon_locked?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).locked?\n end",
"def access_locked?; end",
"def supports_advisory_locks?\n false\n end",
"def supports_advisory_locks?\n false\n end",
"def device_locked?\n @bridge.device_locked?\n end",
"def locked?(*args)\n inspect_lock(:redis_lock_key, *args)\n end",
"def locked?\n submitted?\n end",
"def lockout?\n @lockout\n end",
"def available?\n return true unless coliding_locks.any?\n end",
"def lock\n\n return true if locked?\n\n @lockfile = nil\n\n FileUtils.mkdir_p(::File.dirname(@path))\n\n file = File.new(@path, File::RDWR | File::CREAT)\n locked = file.flock(File::LOCK_NB | File::LOCK_EX)\n\n return false unless locked\n\n now = Time.now\n\n file.print(\"pid: #{$$}, \")\n file.print(\"scheduler.object_id: #{self.object_id}, \")\n file.print(\"time: #{now}, \")\n file.print(\"timestamp: #{now.to_f}\")\n file.flush\n\n @lockfile = file\n\n true\n end",
"def locked?\n\t\t#puts \"Came to check locked.\"\n\t\tif $redis.get(get_race_condition_key_name).blank?\n\t\t\t#puts \"the key is blank\"\n\t\t\tfalse\n\t\telse\n\t\t #puts \"key is not blank\"\n\t\t #puts \"key is: #{$redis.get(get_race_condition_key_name)}\"\n\t\t $redis.get(get_race_condition_key_name) == LOCKED\n\t\tend\n\tend",
"def locked?\n persisted? && self.class.where(_id: id).locked.limit(1).count == 1\n end",
"def if_access_locked; end",
"def locked?\n locked = false\n status_constant == OldOrder::UNPROCESSED ? locked = false : locked = true\n locked = true unless invoice.blank?\n return locked\n end",
"def locked?\n\t\t\t\t\treturn payment_in_progress? || paid?\n\t\t\t\tend",
"def lock_is_exclusive?\n lockscope == 'exclusive'\n end",
"def locked?\n self.invoiced? && self.invoice.issued?\n end",
"def try_lock\n\t\t\t@nested_locks += 1 and return true if @locked == Thread.current\n\t\t\tresult = false\n\t\t\tThread.critical = true\n\t\t\tunless @locked\n\t\t\t\t@locked = Thread.current\n\t\t\t\tresult = true\n\t\t\tend\n\t\t\tThread.critical = false\n\t\t\tresult\n\t\tend",
"def write_locked?\n @counter.value >= RUNNING_WRITER\n end",
"def lock\n # locking will automatically trigger reload\n # locker older than 1 hour is considered stale\n if !is_locked || (is_locked && locked_at < Time.now - 3600)\n self.is_locked = true\n self.locked_at = Time.now\n save!\n else\n false\n end\n end",
"def locking_enabled?\n lock_optimistically && columns_hash[locking_column]\n end",
"def loner_locked?(*args)\n locked?(*args) || (loner && enqueued?(*args))\n end",
"def locked\n end",
"def unlocked?\n unlocked, _, @active_worker_timestamp = Sidekiq.redis do |redis| \n redis.multi do\n redis.setnx(@locking_key, @current_worker_timestamp)\n redis.expire(@locking_key, 600)\n redis.get(@locking_key)\n end\n end\n unlocked\n end",
"def is_locked\n @attributes[:is_locked]\n end",
"def access_locked?\n\n super && date_restricted?\n\n end",
"def lock_movements?\n true\n end",
"def lock_present?(keyspace)\n @storage.read(keyspace.lock_key) == LOCK_VALUE\n end",
"def self_locked?\n results = mysql2.query(%Q[select is_used_lock('#{key}')], as: :array)\n lock_id = results.to_a.first.first\n return nil if lock_id.nil?\n results = mysql2.query(%Q[select connection_id()], as: :array)\n self_id = results.to_a.first.first\n self_id == lock_id\n end",
"def is_locked? file\n file_lock = file + \".lock\"\n FileTest::file? file_lock\n end",
"def running?\n File.exist?(@lock_file)\n end"
] | [
"0.8681678",
"0.8646511",
"0.8646511",
"0.8646511",
"0.8646511",
"0.8595943",
"0.85850555",
"0.8562264",
"0.85332197",
"0.8527973",
"0.85113525",
"0.84889686",
"0.8464462",
"0.84326",
"0.8425701",
"0.8419555",
"0.8385267",
"0.8319554",
"0.828247",
"0.82602847",
"0.82023853",
"0.81732994",
"0.8114537",
"0.8076673",
"0.8074406",
"0.80488664",
"0.80480075",
"0.79813856",
"0.79666805",
"0.79538065",
"0.7952332",
"0.7936694",
"0.78827125",
"0.7863883",
"0.7800387",
"0.77544135",
"0.77168196",
"0.7686386",
"0.767544",
"0.76568377",
"0.7634371",
"0.7633664",
"0.75534296",
"0.75420356",
"0.750376",
"0.7498118",
"0.748816",
"0.7427233",
"0.74144125",
"0.7405684",
"0.74026376",
"0.7370359",
"0.7340034",
"0.7317484",
"0.7252229",
"0.72264385",
"0.71943504",
"0.71487534",
"0.713542",
"0.71343786",
"0.71106327",
"0.7100727",
"0.70879287",
"0.7074219",
"0.7070552",
"0.7068751",
"0.70661825",
"0.7047354",
"0.7042828",
"0.70325357",
"0.7021487",
"0.69856644",
"0.69856644",
"0.697631",
"0.6974474",
"0.6970721",
"0.696152",
"0.69608665",
"0.69518995",
"0.6935725",
"0.69277954",
"0.69125336",
"0.690496",
"0.68989414",
"0.68966174",
"0.68878853",
"0.6869409",
"0.68557775",
"0.68483967",
"0.6843394",
"0.6837714",
"0.68046224",
"0.6796844",
"0.675086",
"0.67498636",
"0.6748524",
"0.6680209",
"0.6644907",
"0.66411847",
"0.66359794"
] | 0.85334843 | 8 |
True if the object is open. | def open?
@open
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open?\n @open\n end",
"def open?\n @open\n end",
"def open?\n @open\n end",
"def is_open?\n @open\n end",
"def open?\n @open || true\n end",
"def open?\n @opened\n end",
"def open?\n state == :open\n end",
"def is_open?\n\t\treturn !!@open\n\tend",
"def open?\n @state == :open\n end",
"def open?\n is_open\n end",
"def open?\n return @opened\n end",
"def open?\n !closed?\n end",
"def open?\n type == 'open'\n end",
"def is_open?()\n return !@closed\n end",
"def open?\n !(closed?)\n end",
"def opened?\n !closed?\n end",
"def opened?\n @opened\n end",
"def open?\n @connection.open?\n end",
"def is_open?\n return state == :open\n end",
"def opening?\n !(open? || closed?)\n end",
"def open?\n @session && @session.started?\n end",
"def open?\n !closed?\n end",
"def open?\n !closed?\n end",
"def open?\n state == \"open\"\n end",
"def open?(thing)\n false\n end",
"def open?\n end",
"def open?\n @connected\n end",
"def is_open?\n return self.status == \"open\"\n end",
"def open?\n status == \"open\"\n end",
"def opened?\n @session > -1 ? true : false\n end",
"def alive?\n state == :open\n end",
"def open?\n # typically, ruby devices are always open, subclasses might not be\n true\n end",
"def locked_open?\n lock == :open\n end",
"def open?\n @data_bytes[1] != 0\n end",
"def open?\n @handshake&.finished? && !@closed\n end",
"def isOpen\r\n\t\t\t\t\treturn @isOpen\r\n\t\t\t\tend",
"def openable?\n true\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def open?\n shell ? shell.open? : false\n end",
"def open?\n event_status_id == 1\n end",
"def closed?\n open ? false : true\n end",
"def open?\n return closetime && closetime > DateTime.now\n end",
"def open?\n @dialog ? true : false\n end",
"def open?\n return @header_data != nil\n end",
"def open?(_thing, _value, _options = {})\n false\n end",
"def active?\n @connection.state == System::Data::ConnectionState::open\n end",
"def closed?\n !open?\n end",
"def closed?\n\t\t\t@closed\n\t\tend",
"def closed?\n !!@closed\n end",
"def closed?\n @closed\n end",
"def can_open?\n\t\treturn true\n\tend",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n\t\t@closed\n\tend",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n closed\n end",
"def closed?\n defined?(@closed) && @closed\n end",
"def closed?\n @closed.true?\n end",
"def closed?\n false\n end",
"def open?\n showback_pool.state == \"OPEN\"\n end",
"def closed?\n not @open\n end",
"def closed?\n false\n end",
"def open_status?\n return @ajar == true\n end",
"def closed?\n @fd.closed?\n end",
"def closed?\n end",
"def closed?\n end",
"def closed?\n !!@closed\n end",
"def should_open?\n raise NotImplementedError\n end",
"def open?\n open = false\n\n # if any door is open, consider the entrance open\n self.doors.each do |door|\n if door.open?\n open = true\n end\n end\n\n open\n end",
"def open?\n (AVAILABLE == status) and in_redemption_period?\n end",
"def closed?\r\n _target_.closed?\r\n end",
"def closed?\n @closed || false\n end",
"def open\n return nil if @open.nil?\n @open ? '1' : '0'\n end",
"def openable?\n resp = connection.get do |req|\n req.url \"#{base_path}/openable\"\n end\n\n raise_exception_based_on_response!(resp) unless resp.success?\n\n case resp.body\n when 'true'\n true\n when 'false'\n false\n else\n raise MalformedResponse, \"Expected true or false, not #{resp.body}\"\n end\n end",
"def closed?\n self.status.is_closed?\n end",
"def closed?\n self.status.is_closed?\n end",
"def closing?\r\n @closing\r\n end",
"def closed?\n closed_on.present?\n end",
"def open?(thing)\n instrument(:open?, thing) { |payload|\n percentage = toggle.value.to_i\n\n if Types::Actor.wrappable?(thing)\n actor = Types::Actor.wrap(thing)\n key = \"#{@feature.name}#{actor.value}\"\n Zlib.crc32(key) % 100 < percentage\n else\n false\n end\n }\n end",
"def closed?\n return false\n end",
"def open?\n open_date < Time.now && !past_deadline? rescue nil\n end",
"def open?\n fail NotImplementedError\n end",
"def closed?\n state == :closed\n end",
"def is_closed\n if ((self.closed) && self.closed > 0 && self.closed < Time.now.to_i)\n return true\n else\n return false\n end\n end",
"def closed?\n @ptr.nil?\n end"
] | [
"0.8794455",
"0.8794455",
"0.8791962",
"0.87609553",
"0.8680179",
"0.86681664",
"0.865297",
"0.86026293",
"0.8579993",
"0.8566668",
"0.85399306",
"0.8437693",
"0.8436428",
"0.83275044",
"0.82854164",
"0.82777876",
"0.820139",
"0.816344",
"0.8130581",
"0.80510694",
"0.8028425",
"0.8023383",
"0.8023383",
"0.8015374",
"0.80132264",
"0.8011431",
"0.79057795",
"0.7869366",
"0.7869361",
"0.7866263",
"0.7836145",
"0.7800885",
"0.7712068",
"0.7655076",
"0.7617947",
"0.76034045",
"0.75954163",
"0.7576603",
"0.75752836",
"0.7574025",
"0.74742776",
"0.74604696",
"0.73834765",
"0.7381386",
"0.7329877",
"0.7329611",
"0.7301728",
"0.72934866",
"0.7293007",
"0.72762394",
"0.7260565",
"0.72490376",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.7244343",
"0.72013384",
"0.7184361",
"0.7184361",
"0.7184361",
"0.7184361",
"0.7178796",
"0.7172551",
"0.7165257",
"0.7156455",
"0.7150015",
"0.7148386",
"0.7137151",
"0.7132798",
"0.71176267",
"0.70938504",
"0.70938504",
"0.7068333",
"0.70607406",
"0.7056976",
"0.70546585",
"0.705095",
"0.70319474",
"0.7012729",
"0.69657356",
"0.69413376",
"0.69413376",
"0.6936325",
"0.6935384",
"0.6915381",
"0.68960285",
"0.68916076",
"0.6891039",
"0.6885017",
"0.68830305",
"0.68552977"
] | 0.8544327 | 10 |
True if the object is closed. | def closed?
not @open
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closed?\n closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n !!@closed\n end",
"def closing?\r\n @closing\r\n end",
"def closed?\n false\n end",
"def closed?\n @closed || false\n end",
"def closed?\n\t\t\t@closed\n\t\tend",
"def closed?\n false\n end",
"def closed?\n @closed.true?\n end",
"def closed?\n\t\t@closed\n\tend",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n @closed\n end",
"def closed?\n end",
"def closed?\n end",
"def closed?\n return false\n end",
"def closed?\n @fd.closed?\n end",
"def closed?\n !!@closed\n end",
"def closed?() @closed end",
"def closed?\n defined?(@closed) && @closed\n end",
"def closed?\n @ptr.nil?\n end",
"def closed?\n ptr.nil?\n end",
"def closed?\r\n _target_.closed?\r\n end",
"def closed?() end",
"def closed?() end",
"def closed?() end",
"def closed?()\n #This is a stub, used for indexing\n end",
"def closed?\n @io.closed?\n end",
"def closed?\n !open?\n end",
"def closed?\n @file.closed?\n end",
"def closed?\n open ? false : true\n end",
"def closed?\n raise NotImplementedError\n end",
"def open?\n !closed?\n end",
"def closed?\n state == :closed\n end",
"def closed?\n stream = @_st_stream\n if stream._equal?(nil)\n true\n else\n stream.closed?\n end\n end",
"def closed?\n @connection.closed?\n end",
"def closed?\n self.State == P2::DS_STATE_CLOSE\n end",
"def closed?\n io.closed?\n end",
"def closed?\n return @peer.closed?\n end",
"def closed?\n @connection.nil?\n end",
"def is_open?()\n return !@closed\n end",
"def closed?\n io.closed?\n end",
"def closed?\n super\n end",
"def closed?\n super\n end",
"def closed?\n @db.closed?\n end",
"def opened?\n !closed?\n end",
"def closed?\n self.status.is_closed?\n end",
"def closed?\n self.status.is_closed?\n end",
"def closed?\n @connection_state == :closed\n end",
"def open?\n !closed?\n end",
"def open?\n !closed?\n end",
"def closed?\n @subject.closed?\n end",
"def closed?\n @subject.closed?\n end",
"def open?\n !(closed?)\n end",
"def closing?\n if new_record?\n closed?\n else\n closed_on_changed? && closed?\n end\n end",
"def closed?\n\t\t\t\t@state == :closed || @framer.nil?\n\t\t\tend",
"def closed?\n @cursor.nil?\n end",
"def close\n return true\n end",
"def closed?\n\t\treturn @ssh_session.nil? || @ssh_session.closed?\n\tend",
"def is_closed\n if ((self.closed) && self.closed > 0 && self.closed < Time.now.to_i)\n return true\n else\n return false\n end\n end",
"def closed?\n @adapter.closed?\n end",
"def finished?\n self.closed?()\n end",
"def closed?\n @reader.closed? && @writer.closed?\n end",
"def closed?\n @secondary.closed?\n end",
"def closed?\n @native_manager.nil?\n end",
"def closed?\n self.state == 'CLOSED'\n end",
"def closed?\n closed_on.present?\n end",
"def can_close?; end",
"def closed?\n @state == :disconnected\n end",
"def closed?\n\t\t\[email protected]?\n\t\tend",
"def closed?\n @stmt.closed?\n end",
"def closed?\n @stmt.closed?\n end",
"def locked_closed?\n lock == :closed\n end",
"def closed?\n @socket.nil?\n end",
"def close_enabled?()\n #This is a stub, used for indexing\n end",
"def closed?\n @sock.closed?\n end",
"def closed?\n socket.closed?\n end",
"def closed?\n socket.closed?\n end",
"def closed?\n state == \"closed\"\n end",
"def is_open?\n\t\treturn !!@open\n\tend",
"def explicit_close?\n /close/i =~ @request['connection']\n end",
"def closed?\n @server.closed?\n end",
"def close\n if closed?\n true\n else\n ! @fiber.resume \"close\"\n end\n end",
"def closed?\n @socket.nil? or @socket.closed?\n end",
"def closed?\n with_timeout { !listening? }\n end",
"def close?\n fail NotImplementedError\n end"
] | [
"0.86673087",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.8617778",
"0.86170816",
"0.85870165",
"0.85775566",
"0.8576711",
"0.8567919",
"0.8562257",
"0.85545254",
"0.84994406",
"0.8468257",
"0.84642744",
"0.84642744",
"0.84642744",
"0.84642744",
"0.841784",
"0.841784",
"0.8402078",
"0.83524513",
"0.83440727",
"0.83412886",
"0.82906127",
"0.8272564",
"0.8168989",
"0.8154546",
"0.8134038",
"0.8134038",
"0.8134038",
"0.8082926",
"0.8063532",
"0.80328435",
"0.802176",
"0.7980631",
"0.7964852",
"0.7946199",
"0.7931312",
"0.7924609",
"0.79225606",
"0.7902645",
"0.78937376",
"0.78751343",
"0.7867531",
"0.78534365",
"0.784688",
"0.7831002",
"0.7831002",
"0.7788794",
"0.7746544",
"0.7745308",
"0.7745308",
"0.7718805",
"0.7707609",
"0.7707609",
"0.76828355",
"0.76828355",
"0.76623917",
"0.7646459",
"0.7643083",
"0.7640586",
"0.7640542",
"0.7638443",
"0.75971305",
"0.75749326",
"0.75459987",
"0.7542295",
"0.753522",
"0.7502751",
"0.7492038",
"0.74821526",
"0.74820304",
"0.7467695",
"0.74654317",
"0.74630463",
"0.7437794",
"0.73645186",
"0.7349371",
"0.7337101",
"0.73320484",
"0.73254657",
"0.7319528",
"0.7304091",
"0.7289348",
"0.7267618",
"0.7264784",
"0.72527635",
"0.72350675",
"0.7233648",
"0.7229341"
] | 0.7927463 | 48 |
TODO learn best practice with adding assocations | def subcategory_params
params.require(:subcategory).permit(:name, :category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associations; end",
"def assoc_options\n # Wait to implement this in Phase IVa. Modify `belongs_to`, too.\n @assoc_options ||= {}\n @assoc_options\n end",
"def setup_associations; end",
"def association(association_name); end",
"def assoc(name)\n associations[name].()\n end",
"def associated\n end",
"def associations; self.class.class_eval(\"@@associations\") end",
"def association(name, *options); end",
"def assoc_options\n @assoc_options ||= {}\n @assoc_options\n end",
"def add_relationship(rel_attr); end",
"def associate(type, assoc_name, opts=OPTS)\n if !opts[:is_used] && @unused_associations_data && (data = @unused_associations_data[name]) && data[assoc_name.to_s] == 'unused'\n return\n end\n \n super\n end",
"def get_associate\n\t\t@associates = Associate.all\n\tend",
"def eager_loading_use_associated_key?\n true\n end",
"def def_one_to_many(opts)\n one_to_one = opts[:type] == :one_to_one\n name = opts[:name]\n key = (opts[:key] ||= opts.default_key)\n km = opts[:key_method] ||= opts[:key]\n cks = opts[:keys] = Array(key)\n opts[:key_methods] = Array(opts[:key_method])\n primary_key = (opts[:primary_key] ||= self.primary_key)\n opts[:eager_loader_key] = primary_key unless opts.has_key?(:eager_loader_key)\n cpks = opts[:primary_keys] = Array(primary_key)\n pkc = opts[:primary_key_column] ||= primary_key\n pkcs = opts[:primary_key_columns] ||= Array(pkc)\n raise(Error, \"mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}\") unless cks.length == cpks.length\n uses_cks = opts[:uses_composite_keys] = cks.length > 1\n opts[:dataset] ||= opts.association_dataset_proc\n opts[:eager_loader] ||= proc do |eo|\n h = eo[:id_map]\n reciprocal = opts.reciprocal\n assign_singular = opts.assign_singular?\n delete_rn = opts.delete_row_number_column\n\n eager_load_results(opts, eo) do |assoc_record|\n assoc_record.values.delete(delete_rn) if delete_rn\n hash_key = uses_cks ? km.map{|k| assoc_record.get_column_value(k)} : assoc_record.get_column_value(km)\n next unless objects = h[hash_key]\n if assign_singular\n objects.each do |object| \n unless object.associations[name]\n object.associations[name] = assoc_record\n assoc_record.associations[reciprocal] = object if reciprocal\n end\n end\n else\n objects.each do |object| \n object.associations[name].push(assoc_record)\n assoc_record.associations[reciprocal] = object if reciprocal\n end\n end\n end\n end\n \n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n use_only_conditions = opts.include?(:graph_only_conditions)\n only_conditions = opts[:graph_only_conditions]\n conditions = opts[:graph_conditions]\n opts[:cartesian_product_number] ||= one_to_one ? 0 : 1\n graph_block = opts[:graph_block]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n ds = ds.graph(opts.apply_eager_graph_limit_strategy(eo[:limit_strategy], eager_graph_dataset(opts, eo)), use_only_conditions ? only_conditions : cks.zip(pkcs) + conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)\n # We only load reciprocals for one_to_many associations, as other reciprocals don't make sense\n ds.opts[:eager_graph][:reciprocals][eo[:table_alias]] = opts.reciprocal\n ds\n end\n \n return if opts[:read_only]\n\n save_opts = {:validate=>opts[:validate]}\n ck_nil_hash ={}\n cks.each{|k| ck_nil_hash[k] = nil}\n\n if one_to_one\n opts[:setter] ||= proc do |o|\n up_ds = _apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| get_column_value(k)})))\n if o\n up_ds = up_ds.exclude(o.pk_hash) unless o.new?\n cks.zip(cpks).each{|k, pk| o.set_column_value(:\"#{k}=\", get_column_value(pk))}\n end\n checked_transaction do\n up_ds.skip_limit_check.update(ck_nil_hash)\n o.save(save_opts) || raise(Sequel::Error, \"invalid associated object, cannot save\") if o\n end\n end\n opts[:_setter] = proc{|o| set_one_to_one_associated_object(opts, o)}\n else \n save_opts[:raise_on_failure] = opts[:raise_on_save_failure] != false\n\n opts[:adder] ||= proc do |o|\n cks.zip(cpks).each{|k, pk| o.set_column_value(:\"#{k}=\", get_column_value(pk))}\n o.save(save_opts)\n end\n \n opts[:remover] ||= proc do |o|\n cks.each{|k| o.set_column_value(:\"#{k}=\", nil)}\n o.save(save_opts)\n end\n\n opts[:clearer] ||= proc do\n _apply_association_options(opts, opts.associated_dataset.where(cks.zip(cpks.map{|k| get_column_value(k)}))).update(ck_nil_hash)\n end\n end\n end",
"def model_relationships; end",
"def setup_associates(klass, relation, _meta, parent_relation)\n assoc_name =\n if relation.associations.key?(parent_relation)\n parent_relation\n else\n singular_name = inflector.singularize(parent_relation).to_sym\n singular_name if relation.associations.key?(singular_name)\n end\n\n if assoc_name\n klass.associates(assoc_name)\n else\n klass.associates(parent_relation)\n end\n end",
"def stores_foreign_key?; true; end",
"def association_attributes\n {:person => Person.column_names}\n end",
"def eager_loading_use_associated_key?\n false\n end",
"def association_owner_key(assoc, key)\n k = 'activerecord.associations.models.'\n k << assoc.active_record.model_name.singular\n k << '.'\n k << assoc.name.to_s\n k << '.'\n k << key.to_s\n end",
"def create_associations\n self.associates.each do |associate|\n self.add_associated(associate)\n end\n end",
"def associated_record\n assoication.active_record\n end",
"def call_association(object, associations); end",
"def include_associations(hash, associations, assocs)\n associations.each do |name, attrs|\n instance = assocs[name.to_sym]\n\n foreign_key = attrs[:foreign_key]\n\n # for cases where instance is:\n # - association is empty (nil)\n # - association is present\n #\n # update hash with the foreign_key\n hash[foreign_key.to_sym] = (instance.id if instance.present?)\n end\n\n hash\n end",
"def associations\n @associations ||= {}\n end",
"def get_associated_data(object, key, opts = {})\n AssociationMap.get_associated_data(object, key, opts)\n end",
"def add_associate(hash)\n\n type = hash.delete(:type)\n\n doc = NSDocument.new(hash)\n doc.identifier = Noteshare::Identifier.new().string\n doc.root_ref = { 'id'=> 0, 'title' => ''}\n doc.author_id = self.author_id\n doc.author = self.author\n doc.author_credentials2 = self.author_credentials2\n\n doc2 = DocumentRepository.create doc\n\n doc2.associate_to(self, type)\n\n doc2\n\n end",
"def new_relations_data(personality)\n new_relations_data = {}\n new_relations_data[:personality_id] = personality.id\n new_relations_data[:related_content_data] = personality.content\n new_relations_data\n end",
"def alchemy\r\n end",
"def one_relationship(name)\n end",
"def finalize_associations!(relations:)\n super do\n associations.map do |definition|\n Memory::Associations.const_get(definition.type).new(definition, relations)\n end\n end\n end",
"def associations\n data[:associations]\n end",
"def create_associate_relationship\n if raw_material_category.has_any_model_relationship?\n model_relationship = eval(raw_material_category.model_relationship)\n model_relationship = model_relationship.new(:name => name,:full_name =>name ,:tag_name =>name.to_underscore.downcase,:raw_material_id => id)\n model_relationship.save\n end\n end",
"def meta_data(r)\n { :association_values => get_association_values(r).literalize_keys }\n end",
"def define_association(assoc, options = {:view => {}, :summary => {}})\n return {:summary => :none} if options[:summary] == :none\n case assoc.macro\n when :has_one, :belongs_to\n if assoc.options[:polymorphic]\n [:polymorphic_select, :name]\n else\n [:select, :name]\n end\n when :has_many, :has_and_belongs_to_many\n if assoc.options[:polymorphic]\n [:polymorphic_membership, :count]\n else\n [:membership, :count]\n end \n end\n end",
"def stores_foreign_key?; false; end",
"def stores_foreign_key?; false; end",
"def associates\n self.doc_refs\n end",
"def create_association(obj, type)\n @logger.info(\"Creating association for #{type} #{obj.name}\")\n case type\n when \"agent\"\n iso = find_sugarcrm_object('iso', 'sf_id', obj.sf_iso)\n obj.associate! iso if iso\n when \"merchant\"\n \n payment_method_id = find_payment_method_id(obj.sf_id)\n if payment_method_id\n payment_method = find_sugarcrm_object('payment_method', 'sf_id', payment_method_id)\n obj.associate! payment_method\n end\n \n email_id = find_email_id(obj.sf_id)\n if email_id\n email = find_sugarcrm_object('email', 'sf_id', email_id)\n obj.associate! email\n end\n \n agent = find_sugarcrm_object('agent', 'sf_id', obj.sf_agent)\n if agent\n obj.associate! agent\n obj.assigned_user_id = agent.assigned_user_id\n end\n \n when \"settlement_bank_account\"\n merchant = find_sugarcrm_object('merchant', 'sf_id', obj.sf_merchant)\n obj.associate! merchant if merchant\n end\n obj\n end",
"def assoc(p0) nil end",
"def belongs_to_extra_info(code)\n\t\t\t@belongs_to_extra_info = code\n\t\tend",
"def add_associations(association, records, opts); end",
"def single_object_db; end",
"def associated_new_column_values(obj, assoc)\n ref = model.association_reflection(assoc)\n ref[:keys].zip(ref[:primary_keys].map{|k| obj.send(k)})\n end",
"def orm; end",
"def entities; end",
"def initialize\n @columns = { }\n @primary_keys = []\n @to_avoid = []\n @default_values = { }\n @associations = \n {\n :belongs_to => { },\n :has_one => { },\n :has_n => { }\n }\n end",
"def eager_load(a, eager_assoc=@opts[:eager])\n return if a.empty?\n # Key is foreign/primary key name symbol\n # Value is hash with keys being foreign/primary key values (generally integers)\n # and values being an array of current model objects with that\n # specific foreign/primary key\n key_hash = {}\n # Reflections for all associations to eager load\n reflections = eager_assoc.keys.map{|assoc| model.association_reflection(assoc) || (raise Sequel::UndefinedAssociation, \"Model: #{self}, Association: #{assoc}\")}\n \n # Populate the key_hash entry for each association being eagerly loaded\n reflections.each do |r|\n if key = r.eager_loader_key\n # key_hash for this key has already been populated,\n # skip populating again so that duplicate values\n # aren't added.\n unless id_map = key_hash[key]\n id_map = key_hash[key] = Hash.new{|h,k| h[k] = []}\n\n # Supporting both single (Symbol) and composite (Array) keys.\n a.each do |rec|\n case key\n when Array\n if (k = key.map{|k2| rec.get_column_value(k2)}) && k.all?\n id_map[k] << rec\n end\n when Symbol\n if k = rec.get_column_value(key)\n id_map[k] << rec\n end\n else\n raise Error, \"unhandled eager_loader_key #{key.inspect} for association #{r[:name]}\"\n end\n end\n end\n else\n id_map = nil\n end\n \n loader = r[:eager_loader]\n associations = eager_assoc[r[:name]]\n if associations.respond_to?(:call)\n eager_block = associations\n associations = {}\n elsif associations.is_a?(Hash) && associations.length == 1 && (pr_assoc = associations.to_a.first) && pr_assoc.first.respond_to?(:call)\n eager_block, associations = pr_assoc\n end\n loader.call(:key_hash=>key_hash, :rows=>a, :associations=>associations, :self=>self, :eager_block=>eager_block, :id_map=>id_map)\n a.each{|object| object.send(:run_association_callbacks, r, :after_load, object.associations[r[:name]])} unless r[:after_load].empty?\n end \n end",
"def _load_associated_object_via_primary_key(opts)\n opts.associated_class.send(:primary_key_lookup, ((fk = opts[:key]).is_a?(Array) ? fk.map{|c| get_column_value(c)} : get_column_value(fk)))\n end",
"def attach; end",
"def macro\n :belongs_to_related\n end",
"def getAdvocacy\n\t\t\n\tend",
"def add_association(model_name, association_name, association_meta, association_class=nil)\n @associations[model_name] ||= {}\n @associations[model_name][association_name] = {\"meta\" => association_meta, \"class_name\" => association_class || association_name.classify}\n end",
"def configure_relation\n end",
"def child_relation; end",
"def related_attrs\n relationship = flex_options[:relationship_name]\n send relationship\n end",
"def process_association(class_name, assoc)\n\n STDERR.print \"\\t\\tProcessing model association #{assoc.name.to_s}\\n\" if @options.verbose\n\n # Skip \"belongs_to\" associations\n return if assoc.macro.to_s == 'belongs_to'\n\n # Only non standard association names needs a label\n \n # from patch #12384\n # if assoc.class_name == assoc.name.to_s.singularize.camelize\n \n assoc_class_name = (assoc.class_name.respond_to? 'underscore') ? assoc.class_name.pluralize.singularize.camelize : assoc.class_name \n if assoc_class_name == assoc.name.to_s.singularize.camelize\n assoc_name = ''\n else\n assoc_name = assoc.name.to_s\n end \n\n if assoc.macro.to_s == 'has_one' \n assoc_type = 'one-one'\n elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through])\n assoc_type = 'one-many'\n else # habtm or has_many, :through\n return if @habtm.include? [assoc.class_name, class_name, assoc_name]\n assoc_type = 'many-many'\n @habtm << [class_name, assoc.class_name, assoc_name]\n end \n # from patch #12384 \n # @graph.add_edge [assoc_type, class_name, assoc.class_name, assoc_name]\n @graph.add_edge [assoc_type, class_name, assoc_class_name, assoc_name] \n end",
"def associations\n @associations ||= {}.with_indifferent_access\n end",
"def associated_records\n raise NotImplementedError\n end",
"def add_association(gen_array, cha_array)\n \n if !gen_array.nil? \n gen_array.each do |gen|\n if Genre.exists?(id: gen)\n @genre = Genre.find(gen)\n @movie.genres << @genre\n end\n end\n end\n\n if !cha_array.nil? \n cha_array.each do |cha|\n if Character.exists?(id: cha)\n @character = Character.find(cha)\n @movie.characters << @character\n end\n end\n end\n\n end",
"def relationships\n @relationships ||= {}\n end",
"def associate_values\n\t\trequire 'yaml'\n\t\tcompany_values = YAML::load_file(\"#{RAILS_ROOT}/lib/company/company.yml\")\n\t\tcompany_values.each_pair do |key,val|\n\t\t\ttemp_arr = val.split(',')\n\t\t\ttemp_arr.each do |arr|\n\t\t\t\tunless Company.reflect_on_association(key.to_sym).macro == :has_one\n\t\t\t\t\t#Commented as on creation of a new company alvalues for only contact_stages was set and not for others. - Ketki\n\t\t\t\t\t# key == 'contact_stages' ? self.send(key).create(:lvalue=>arr.strip, :alvalue=>arr.strip) : self.send(key).create(:lvalue=>arr.strip)\n\t\t\t\t\tself.send(key).create(:lvalue=>arr.strip, :alvalue=>arr.strip)\n\t\t\t\telse\n\t\t\t\t\tkey == 'rating_type' ? eval(\"self.create_#{key}(:lvalue=>'#{arr.strip.to_s}', :alvalue => '#{arr.strip.to_s}')\") : eval(\"self.create_#{key}(:lvalue=>'#{arr.strip.to_s}')\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def has_one_through(name, assoc1, assoc2)\n define_method(name) do\n #grabbing the association we created in belongs_to\n params1 = self.class.assoc_params[assoc1] #Cat.assoc_params[:human]\n \n #house\n params2 = params1.other_class.assoc_params[assoc2] #Human.assoc_params[:house]\n\n primary_key1 = self.send(params1.foreign_key)\n results = DBConnection.execute(<<-SQL, primary_key1)\n SELECT \n #{params2.other_table}.*\n FROM \n #{params2.other_table}\n JOIN \n #{params1.other_table}\n ON \n #{params1.other_table}.#{params2.foreign_key}\n = #{params2.other_table}.#{params2.primary_key}\n WHERE \n #{params1.other_table}.#{params1.primary_key}\n = ?\n SQL\n\n params2.other_class.parse_all(results).first\n end\n end",
"def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend",
"def _many_to_many_hash\n @_many_to_many_hash ||= {}\n end",
"def associate_data(object, key, data, opts = {})\n AssociationMap.associate_data(object, key, data, opts)\n end",
"def associations_after_save\n # # WARNING: the associations here are not using active_record, so they are not auto saved with user intake\n # # we are saving the associations manually here\n # collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n # This is a 3 step process\n # \n # Thu Nov 11 00:14:24 IST 2010, ramonrails\n # Link per user, once only. compact.uniq ensures that\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # Sat Nov 20 02:03:52 IST 2010, ramonrails\n # * this logic is required when uset simply toggles the flag and saves\n _user = self.send( _what) # fetch the associated user\n unless _user.blank? || _user.nothing_assigned?\n # * default properties\n _user.autofill_login # create login and password if not already\n _user.lazy_associations[:user_intake] = self\n _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n\n case _what\n when 'senior'\n # _user.save\n # _user.is_halouser_of( group) unless _user.blank? || group.blank? # role\n _user.lazy_roles[:halouser] = group unless _user.blank? || group.blank? # role\n _user.save\n \n when 'subscriber'\n if subscribed_for_self? # senior is same as subscriber\n if was_subscribed_for_self?\n # * user and subscriber are same. not changed\n else\n # * subscriber was different. now same as senior\n self.subscriber_is_user = false # create old condition\n subscriber.is_not_subscriber_of( senior) unless subscriber.blank? || senior.blank? # remove old role first\n # subscriber.delete # remove this extra user\n self.subscriber_is_user = true # back to current situation\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n\n else # senior different from subscriber\n if was_subscribed_for_self?\n _user = senior.clone_with_profile if senior.equal?( subscriber) # same IDs, clone first\n senior.is_not_subscriber_of( senior) unless senior.blank? # senior was subscriber, not now\n else\n # all good. nothing changed\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n end\n \n when 'caregiver1'\n if caregiving_subscriber? # subscriber is caregiver\n if was_caregiving_subscriber?\n # all good. nothing changed\n else\n # was separate\n self.subscriber_is_caregiver = false # make old condition\n caregiver1.is_not_caregiver_of( senior) unless caregiver1.blank? || senior.blank?\n # caregiver1.delete # remove extra\n self.subscriber_is_caregiver = true # current condition again\n end\n \n else # subscriber different from caregiver1\n if was_caregiving_subscriber?\n _user = subscriber.clone_with_profile if subscriber.equal?( caregiver1) # same ID? clone first\n subscriber.is_not_caregiver_of( senior) unless subscriber.blank? || senior.blank? # remove caregiving role for subscriber\n else\n # all good. nothing changed\n end\n end\n if caregiving_subscriber? || (caregiver1_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior))\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver1_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver1_options\n _user.save\n # else\n # self.no_caregiver_1 = true\n # self.send(:update_without_callbacks)\n end\n \n when 'caregiver2'\n if caregiver2_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver2_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver2_options\n _user.save\n else\n self.no_caregiver_2 = true\n self.send(:update_without_callbacks)\n end\n\n when 'caregiver3'\n if caregiver3_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver3_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver3_options\n _user.save\n else\n self.no_caregiver_3 = true\n self.send(:update_without_callbacks)\n end\n end # case\n end # blank?\n end # _what\n \n # \n # Thu Jan 13 02:38:38 IST 2011, ramonrails\n # * Not required anymore\n # * lazy_associations attaches each user to this user intake\n # #\n # # * replace earlier associations. keep fresh ones\n # # * do not create duplicate associations\n # # QUESTION: what happens to orphaned users here?\n # # * reject new_record? anything not saved does not get assigned\n # # * only associate one copy of each\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].reject(&:new_record?).compact.uniq\n # # # \n # # # Thu Jan 13 02:34:27 IST 2011, ramonrails\n # # # * pre_quality.feature had error dispatching emails\n # # # * This might dispatch the email more than once\n # # self.users.each(&:dispatch_emails)\n\n\n # [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # # \n # # Fri Nov 19 03:17:32 IST 2010, ramonrails\n # # * skip saving the object if already saved\n # # * happens when object is shared. subscriber == user, or, subscriber == caregiver\n # # * saving also dispatches emails. A few more triggers/callbacks. Please check model code\n # _skip = ((_what == 'subscriber') && subscribed_for_self?)\n # _skip = (_skip || (_what == 'caregiver1' && caregiving_subscriber?))\n # # \n # # Thu Nov 11 00:32:18 IST 2010, ramonrails\n # # Do not save any non-assigned data, or blank ones\n # unless _user.blank? || _user.nothing_assigned? || _skip\n # _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n # \n # # _user.autofill_login # Step 1: make them valid\n # if _user.save # Step 2: save them to database\n # # \n # # Thu Nov 11 00:13:31 IST 2010, ramonrails\n # # https://redmine.corp.halomonitor.com/issues/3696\n # # caused a bug that created multiple links to the same user\n # self.users << _user unless users.include?( _user) # Step 3: link them to user intake\n # end\n # end\n # end\n # #\n # # * add roles and options\n # # * roles are already handled by user model\n # # * this will not double write the roles\n # # senior\n # senior.is_halouser_of( group) unless senior.blank?\n # # subscriber\n # unless senior.blank? || subscriber.blank?\n # subscriber.is_subscriber_of( senior)\n # subscriber.is_caregiver_of( senior) if caregiving_subscriber?\n # end\n # # Wed Oct 27 23:55:22 IST 2010\n # # * no need to check subscriber_is_caregiver here. that is done in caregiver1 method\n # # * just call for each caregiver and assign position and other options\n # (1..3).each do |index|\n # _caregiver = self.send(\"caregiver#{index}\".to_sym)\n # _required = self.send(\"caregiver#{index}_required?\")\n # unless (_caregiver.blank? || !_required || _caregiver.nothing_assigned?)\n # _caregiver.is_caregiver_of( senior) unless _caregiver.is_caregiver_of?( senior)\n # # \n # # Thu Nov 4 05:57:16 IST 2010, ramonrails\n # # user values were stored with apply_attributes_from_hash\n # # now we persist them into database\n # _options = self.send(\"mem_caregiver#{index}_options\")\n # # \n # # Thu Nov 18 20:58:29 IST 2010, ramonrails\n # # * Do not use any other method here, cyclic dependency can occur\n # _caregiver.options_for_senior( senior, _options)\n # end\n # end\n\n end",
"def test_course_associated_with_primary_instructor\n c = Course.create(course_code: \"tuv 789\", name: \"Getting Along\", term_id: 3)\n ci = CourseInstructor.create(primary: true)\n ci2 = CourseInstructor.create()\n c.course_instructors << ci\n c.course_instructors << ci2\n assert_equal ci, Course.find(c.id).primary_instructor\n\n\n end",
"def assoc(key)\n super(convert_key(key))\n end",
"def qualify_assoc(col)\n qualify(associated_class.table_name, col)\n end",
"def associations\n # is caching ok?\n unless @associations\n @associations = {}\n klass.relations.each{|name,association|\n @associations[name.to_s] = Association.new(association,self)\n }\n end\n @associations\n end",
"def save_associations\n self.class.associations.each do |association_data|\n association_name = association_data[:name]\n\n next unless send(\"#{association_name}_used?\") && association = send(association_name)\n\n inline_creation = association_data[:inline] == :create && new_record?\n changed = association.is_a?(Collection) || association.changed?\n\n if association.respond_to?(:save) && changed && !inline_creation && association.save\n send(\"#{association_name}=\", association) # set id/ids columns\n end\n\n if (association_data[:inline] == true || inline_creation) && changed\n attributes[association_name] = association.to_param\n end\n end\n end",
"def def_many_to_one(opts)\n name = opts[:name]\n opts[:key] = opts.default_key unless opts.has_key?(:key)\n key = opts[:key]\n opts[:eager_loader_key] = key unless opts.has_key?(:eager_loader_key)\n cks = opts[:graph_keys] = opts[:keys] = Array(key)\n opts[:key_column] ||= key\n opts[:graph_keys] = opts[:key_columns] = Array(opts[:key_column])\n opts[:qualified_key] = opts.qualify_cur(key)\n if opts[:primary_key]\n cpks = Array(opts[:primary_key])\n raise(Error, \"mismatched number of keys: #{cks.inspect} vs #{cpks.inspect}\") unless cks.length == cpks.length\n end\n uses_cks = opts[:uses_composite_keys] = cks.length > 1\n opts[:cartesian_product_number] ||= 0\n\n if !opts.has_key?(:many_to_one_pk_lookup) &&\n (opts[:dataset] || opts[:conditions] || opts[:block] || opts[:select] ||\n (opts.has_key?(:key) && opts[:key] == nil))\n opts[:many_to_one_pk_lookup] = false\n end\n auto_assocs = @autoreloading_associations\n cks.each do |k|\n (auto_assocs[k] ||= []) << name\n end\n\n opts[:dataset] ||= opts.association_dataset_proc\n opts[:eager_loader] ||= proc do |eo|\n h = eo[:id_map]\n pk_meths = opts.primary_key_methods\n\n eager_load_results(opts, eo) do |assoc_record|\n hash_key = uses_cks ? pk_meths.map{|k| assoc_record.get_column_value(k)} : assoc_record.get_column_value(opts.primary_key_method)\n if objects = h[hash_key]\n objects.each{|object| object.associations[name] = assoc_record}\n end\n end\n end\n \n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n use_only_conditions = opts.include?(:graph_only_conditions)\n only_conditions = opts[:graph_only_conditions]\n conditions = opts[:graph_conditions]\n graph_block = opts[:graph_block]\n graph_cks = opts[:graph_keys]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n ds.graph(eager_graph_dataset(opts, eo), use_only_conditions ? only_conditions : opts.primary_keys.zip(graph_cks) + conditions, Hash[eo].merge!(:select=>select, :join_type=>eo[:join_type]||join_type, :qualify=>:deep, :from_self_alias=>eo[:from_self_alias]), &graph_block)\n end\n \n return if opts[:read_only]\n \n opts[:setter] ||= proc{|o| cks.zip(opts.primary_key_methods).each{|k, pk| set_column_value(:\"#{k}=\", (o.get_column_value(pk) if o))}}\n opts[:_setter] = proc{|o| set_associated_object(opts, o)}\n end",
"def auto_assoc(opts = {})\n except = opts[:except] || []\n\n assocs = db.schema_parse_associations(table_name)\n relations = process_join_tables(assocs)\n\n relations.each do |row|\n src_tbl = row[:src_tbl]\n src_col = row[:src_col]\n if src_tbl == table_name && ! (src_col & except).empty?\n # TODO enable except for *_to_many\n next\n end\n src_uniq = row[:src_uniq]\n src_cardinality = cardinality(src_uniq)\n\n join_tbl = row[:join_tbl]\n\n dst_tbl = row[:dst_tbl]\n dst_col = row[:dst_col]\n dst_uniq = row[:dst_uniq]\n dst_cardinality = cardinality(dst_uniq)\n\n TABLE_MODELS.wait_all(src_tbl, dst_tbl) do |src_cls, dst_cls|\n self_ref = src_cls == dst_cls\n\n src = self_ref ? :child : underscore(src_cls.name).to_sym\n src = src_uniq ? singularize(src).to_sym : pluralize(src).to_sym\n\n dst = self_ref ? :parent : underscore(dst_cls.name).to_sym\n dst = dst_uniq ? singularize(dst).to_sym : pluralize(dst).to_sym\n\n if join_tbl\n left_col = row[:left_col]\n right_col = row[:right_col]\n send :many_to_many, src, :class => src_cls, :join_table => join_tbl,\n :left_key => left_col, :left_primary_key => dst_col,\n :right_key => right_col, :right_primary_key => src_col\n else\n # TODO name overrides\n\n if self == dst_cls\n # dst holds the foreign key -> one_to_*\n meth = dst_cardinality + '_to_' + src_cardinality\n send meth, src, :class => src_cls, :key => src_col, :primary_key => dst_col\n end\n\n if self == src_cls\n # src holds the foreign key -> *_to_one\n meth = src_cardinality + '_to_' + dst_cardinality\n\n # one_to_one requires to swap pk and fk\n src_col, dst_col = dst_col, src_col if src_uniq\n send meth, dst, :class => dst_cls, :key => src_col, :primary_key => dst_col\n end\n end\n\n end\n end\n end",
"def manual_relations(ar_instance)\n\t\t\tcase ar_instance.class.name\n\t\t\twhen 'Order'\n\t\t\t\t[:account_transactions, :billed_rates, :originator, {:customer => :rules},{:items => :originators}, {:order_status_transactions => :user}, {:order_items => :originator}]\n\t\t\twhen 'Shipnotice','ConsumerReturn'\n\t\t\t\t[{:shipnotice_items => :allocations}]\n\t\t\telse\n\t\t\t\t[]\n\t\t\tend\n\t\tend",
"def article_assocs(user = @current_user)\n @thread.associated_with \"Article\",\"[( >> :self) ([#{Basic_Destination}(~<- star_label_set:Star ->~)] receiver:UserInfo)]\",\n :assert_time => :show_time,\n :local_assert_time => local_assert_time_for_destination(\"articles.created_at\"),\n :distinct => select_items(Def_Article_Items, Def_Article_Items.keys),\n :conditions => merge_conditions(receive_restriction_cond(user), news_cond, answer_response_cond(@is_answer_response)),\n :group => \"articles.id\"\n end",
"def add_relationship ( user , country_list, rel_type )\n country_list.each do |country_node|\n rel_instance = get_rel_instance rel_type\n rel_instance.from_node = user\n rel_instance.to_node = country_node\n rel_instance.save\n end\n end",
"def related_information\n attributes.fetch(:relatedInformation)\n end",
"def other_claim_related_id\n end",
"def get_surrogate_association\n \n \t\n \t#first, lets see if I can get the expression ID from the manifestation table\n \tintAssociatedPageID = params[:transcription][:page_id]\n \t@page = Page.find(intAssociatedPageID)\n \tintAssociatedSurrogateID = @page.surrogate_id\n \tparams[:transcription][:surrogate_id] = intAssociatedSurrogateID\n \t\n \n end",
"def association?(object, associations); end",
"def associated_object_keys\n self[:keys]\n end",
"def load_with_associations\n @response = Response.with_basic_assoc.friendly.find(params[:id])\n end",
"def reciprocal_association?(assoc_reflect)\n super && self[:keys] == assoc_reflect[:keys] && primary_key == assoc_reflect.primary_key\n end",
"def association_matcher; end",
"def build_lookup_belongs(blank = nil)\n # TODO: Remove rescue statement\n @departments = Department.find_all_for_select_option(blank) rescue [['ERROR','']]\n @users = User.find_all_for_select_option(blank) rescue [['ERROR','']]\n @privacies = [[print_words('private').capitalize_words,false],[print_words('public').capitalize_words,true]]\n \n @addressbook_groups = AddressbookGroup.find_all_for_select_option(blank) rescue [['ERROR','']]\n \n end",
"def association_method\n self[:name]\n end",
"def get_association_items(ar, opts)\n s = {}\n if(opts[:include] != nil) \n opts[:include].each do |j|\n if ar.send(j).kind_of? Array\n m_a = []\n ar.send(j).each do |m|\n m_a.push m.attributes \n end\n s[j.to_s] = m_a\n else\n s[j.to_s] = ar.send(j).attributes\n end\n end\n end\n s\n end",
"def related_items\n related_items = { :coffee_pods => related_coffee_pods }\n related_items\n end",
"def _load_associated_object_via_primary_key(opts)\n if !opts.associated_class.respond_to?(:cache_get_pk) && (bv = association_bound_variables(opts)) && (ps = association_prepared_statement(opts, bv))\n ps.call(bv)\n else\n super\n end\n end",
"def many_to_many_associated_tables\n @many_to_many_associated_tables\n end",
"def attributes_with_association_names\n attributes = super\n add_attachments_to_attributes(attributes)\n Ticket::Article.insert_urls(attributes)\n end",
"def associated_primary_key\n self[:associated_primary_key] ||= associated_class.primary_key\n end",
"def save_primary_key_grip; end",
"def build_associations\n #\n # assumption: the associations will build in the order of appearance, subject to ruby behavior\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each { |type| build_user_type(type) }\n end",
"def association_bound_variables(opts)\n return if opts[:instance_specific]\n\n case opts[:type]\n when :many_to_one\n association_bound_variable_hash(opts.associated_class.table_name, opts.primary_keys, opts[:keys])\n when :one_to_many, :one_to_one\n association_bound_variable_hash(opts.associated_class.table_name, opts[:keys], opts[:primary_keys])\n when :many_to_many, :one_through_one\n association_bound_variable_hash(opts.join_table_alias, opts[:left_keys], opts[:left_primary_keys])\n when :many_through_many, :one_through_many\n association_bound_variable_hash(opts.final_reverse_edge[:alias], Array(opts[:left_key]), opts[:left_primary_keys])\n end\n end",
"def find_relationship_by(attribute, value); end",
"def relation_by_sql_form\n # Nothing to do here\n end",
"def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n load_associated_objects(opts, dynamic_opts.length == 0 ? OPTS : dynamic_opts[0], &block)\n end\n end",
"def associated_records\n []\n end",
"def def_association(opts)\n if !opts[:is_used] && @unused_associations_data && (data = @unused_associations_data[name]) && (unused = data[opts[:name].to_s])\n set_unused_options_for_association(opts, unused)\n end\n \n super\n end"
] | [
"0.6769806",
"0.65899664",
"0.6431001",
"0.6397871",
"0.62700313",
"0.6152481",
"0.6142582",
"0.606077",
"0.60355943",
"0.59915054",
"0.596306",
"0.58740455",
"0.58586794",
"0.58487254",
"0.58365333",
"0.58115447",
"0.5730784",
"0.5706652",
"0.5671419",
"0.56619495",
"0.56568646",
"0.5602497",
"0.559939",
"0.55968386",
"0.5592561",
"0.55634665",
"0.55367064",
"0.5529865",
"0.552828",
"0.55157745",
"0.5510561",
"0.5501246",
"0.54967374",
"0.5488051",
"0.54741466",
"0.54731894",
"0.54731894",
"0.54600555",
"0.5455616",
"0.54447925",
"0.5442331",
"0.54291594",
"0.5429076",
"0.5415512",
"0.541533",
"0.5411464",
"0.5411394",
"0.5403257",
"0.5401337",
"0.5385977",
"0.53840697",
"0.53818446",
"0.5371899",
"0.5365339",
"0.5363065",
"0.5357447",
"0.535291",
"0.5352236",
"0.5351561",
"0.5346947",
"0.5345522",
"0.53447074",
"0.53372633",
"0.53346515",
"0.53331816",
"0.53193593",
"0.5318294",
"0.53170407",
"0.53004736",
"0.5295955",
"0.5285652",
"0.52777624",
"0.5267914",
"0.5265901",
"0.52648133",
"0.5249046",
"0.52490044",
"0.52419406",
"0.5239698",
"0.52394897",
"0.52382255",
"0.52344996",
"0.5233849",
"0.52314323",
"0.52261937",
"0.5225011",
"0.52244645",
"0.52226627",
"0.5221068",
"0.5220188",
"0.5219241",
"0.52190226",
"0.5216692",
"0.5216038",
"0.52107406",
"0.5207539",
"0.5207151",
"0.52053213",
"0.518707",
"0.5184128",
"0.5172999"
] | 0.0 | -1 |
Compares two objects by key. | def <=>(object)
return @key <=> object.key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n key == other.key\n end",
"def ==(other)\n key == other.key\n end",
"def eql?(other)\n key == other.key\n end",
"def eql_when_keys_compared? other\n return true if self.object_id == other.object_id\n return false unless self.class == other.class\n keys1 = sort_keys(self.keys)\n keys2 = sort_keys(other.keys)\n return false unless keys1.eql?(keys2)\n (0...keys1.size).each do |index|\n # Handle odd cases where eql? and == behavior differently\n return false unless self[keys1[index]].eql?(other[keys2[index]]) || self[keys1[index]] == other[keys2[index]]\n end\n true\n end",
"def ==(other)\n self.key == other.key and self.bucket == other.bucket\n end",
"def eql?(other)\n self.class == other.class && key == other.key\n end",
"def compare_by_identity\n if @hash.respond_to?(:compare_by_identity)\n @hash.compare_by_identity\n self\n else\n raise NotImplementedError, \"#{self.class.name}\\##{__method__} is not implemented\"\n end\n end",
"def <=>(other)\n @Key <=> other.hash\n end",
"def ==(other)\n return false unless other.is_a?(Key)\n name == other.name && operator == other.operator && expanded == other.expanded\n end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def <=>(other)\n if self.etcd_key != other.etcd_key\n return self.etcd_key <=> other.etcd_key\n else\n return self.cmp_json(other)\n end\n end",
"def test_Hash_InstanceMethods_compare_by_identity\n\t\tkey = \"key\"\n\t\th = { key=>100, 99=>\"ninety nine\" }\n\t\tassert_equal(100, h[key])\n\t\tassert_equal(100, h[\"key\"])\n\t\tassert_equal(\"ninety nine\", h[99])\n\n\t\th.compare_by_identity\n\t\tassert_equal(nil, h[key])\n\t\tassert_equal(nil, h[\"key\"])\n\t\tassert_equal(\"ninety nine\", h[99])\n\tend",
"def compare(other)\n differences = Array.new\n self.keys.each do |key|\n oval,oid = other.get_value_and_owner(key)\n if @capabilityhash[key].to_s != oval.to_s\n differences<< [key,oval,oid]\n end\n end\n return differences\n end",
"def ==(other)\n @key == other.key && @target == other.target\n end",
"def compare_key(other_key)\n Innodb::Stats.increment :compare_key\n\n return 0 if other_key.nil? && key.nil?\n return -1 if other_key.nil? || (!key.nil? && other_key.size < key.size)\n return +1 if key.nil? || (!other_key.nil? && other_key.size > key.size)\n\n key.each_index do |i|\n Innodb::Stats.increment :compare_key_field_comparison\n return -1 if other_key[i] < key[i].value\n return +1 if other_key[i] > key[i].value\n end\n\n 0\n end",
"def ==(other)\n @key == other.key && @text == other.text\n end",
"def ==(comparison_object)\n comparison_object.equal?(self) ||\n (comparison_object.instance_of?(self.class) &&\n comparison_object.key == key &&\n !comparison_object.new_record?)\n end",
"def compare(key, value)\n namespace.compare(dn, key, value)\n end",
"def compare(dn, key, value)\n log_dispatch(:compare, dn, key, value)\n adapter.compare(dn, Ldaptic.encode(key), Ldaptic.encode(value))\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def eql?(other)\n return true if equal?(other)\n\n # two instances for different models cannot be equivalent\n return false unless other.kind_of?(model)\n\n # two instances with different keys cannot be equivalent\n return false if key != other.key\n\n # neither object has changed since loaded, so they are equivalent\n return true if repository == other.repository && !dirty? && !other.dirty?\n\n # get all the loaded and non-loaded properties that are not keys,\n # since the key comparison was performed earlier\n loaded, not_loaded = properties.select { |p| !p.key? }.partition do |property|\n attribute_loaded?(property.name) && other.attribute_loaded?(property.name)\n end\n\n # check all loaded properties, and then all unloaded properties\n (loaded + not_loaded).all? { |p| p.get(self) == p.get(other) }\n end",
"def ==(other)\n return false if self.class.to_s != other.class.to_s\n return pkeys() == other.pkeys()\n end",
"def intersect!(other)\n redis.sinterstore key, key, other.key\n ensure\n notify_changed\n end",
"def ==(value)\n key == value\n end",
"def ==(other)\n self.public_key == other.public_key &&\n self.private_key == other.private_key\n end",
"def ==(other)\n self.to_hash == other.to_hash\n end",
"def compare(x, y); end",
"def ==(other)\n other.kind_of?(Orchestrate::KeyValue) && \\\n other.collection == collection && \\\n other.key == key\n end",
"def ==(other)\n other.kind_of?(Orchestrate::KeyValue) && \\\n other.collection == collection && \\\n other.key == key\n end",
"def eql?(another_key)\n @window_count == another_key.window_count && @consec_count == another_key.consec_count \\\n && @waiting_tasks == another_key.waiting_tasks\n end",
"def secure_compare(a, b); end",
"def secure_compare(a, b); end",
"def secure_compare(a, b); end",
"def compare_with_nils(key1, key2)\n result = nil\n key1.zip(key2) do |k1, k2|\n if k1.is_a?(String) && !k2.is_a?(String)\n k1 = nil\n elsif !k1.is_a?(String) && k2.is_a?(String)\n k2 = nil\n end\n if k1.nil? && k2.nil?\n result = 0\n next\n elsif k1.nil?\n result = -1\n break\n elsif k2.nil?\n result = 1\n break\n elsif (k1 <=> k2) == 0\n next\n else\n result = (k1 <=> k2)\n break\n end\n end\n result\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def <=>(other)\n return nil unless other.kind_of?(Orchestrate::KeyValue)\n return nil unless other.collection == collection\n other.key <=> key\n end",
"def <=>(other)\n return nil unless other.kind_of?(Orchestrate::KeyValue)\n return nil unless other.collection == collection\n other.key <=> key\n end",
"def ==(other)\n self.hash == other.hash\n end",
"def eql #it cheks the value corresponding to their keys \n \t @a=Hash[\"1\"=>\"2016\",\"3\"=>\"2014\",\"2\"=>\"2013\"]\n @b=Hash[\"1\"=>\"2016\",\"2\"=>\"2013\",\"3\"=>\"2014\"]\n print @a == @b\n \n end",
"def compare(x,y)\n a = CachedProduct.find_by_product_id(x['product_id'].to_s)\n b = CachedProduct.find_by_product_id(y['product_id'].to_s)\n return a.max_small <=> b.max_small\n end",
"def objects_equal?(x, y)\n if x.nil?\n y.nil?\n elsif y.nil?\n nil\n elsif x.is_a?(Hash)\n return nil unless y.is_a?(Hash)\n return nil unless x.size == y.size\n x.each do|k, v|\n return nil unless objects_equal?(v, y[k])\n end\n true\n elsif x.is_a?(Array)\n return nil unless y.is_a?(Array)\n return nil unless x.size == y.size\n for i in 0..x.size\n return nil unless objects_equal?(x[i], y[i])\n end\n true\n else\n return nil if y.is_a?(Hash) || y.is_a?(Array)\n x == y\n end\n end",
"def ==(other)\n self.class==other.class && self.hash==other.hash\n end",
"def ==(other)\n return false unless other.respond_to? :size and\n size == other.size and\n other.respond_to? :[]\n each { |key, value| return false unless self[key] == other[key] }\n return true\n end",
"def ==(other)\n @hashed == other.hash && @downcase_key == other.downcase_key\n end",
"def sort_by_key(key = :name)\n sort do |x, y|\n x_value = x[key]\n y_value = y[key]\n x_value <=> y_value\n end\n end",
"def eql?(other)\n @hash.hash == other.hash\n end",
"def compare(a, b)\n comparator.call a, b\n end",
"def ==(other)\n has_key?(other.key) && @value == other.value\n rescue\n false\n end",
"def compare_by_identity\n raise NotImplementedError\n end",
"def compare(a, b) # rubocop:disable Naming/MethodParameterName\n return false if a.nil? || b.nil?\n\n # assume the arguments is String\n raise TypeError unless a.is_a?(String) || b.is_a?(String)\n return false unless a.size == b.size\n\n key = SecureRandom.random_bytes(32)\n ah = OpenSSL::HMAC.hexdigest('sha256', key, a)\n bh = OpenSSL::HMAC.hexdigest('sha256', key, b)\n\n # Implementation Note:\n # `&& a == b` is a very very conservative comparison.\n # In my opnion, `ah == bh` is enough to compare securely although several other implementations use\n # the strictly method such as:\n # - https://github.com/rails/rails/blob/v5.2.3/activesupport/lib/active_support/security_utils.rb#L27\n # - https://github.com/suryagh/tsscmp/blob/v1.0.6/lib/index.js#L35\n # So, as of the present time, I add `&& a == b`.\n ah == bh && a == b\n end",
"def <=>(other)\n (attributes.keys - [:id]).map(&:to_s).sort.map(&:to_sym).inject(attributes[:id] <=> other.attributes[:id]) do |rc, key|\n if rc == 0\n attributes[key] <=> other.attributes[key] rescue 0\n else\n rc\n end\n end\n end",
"def compare(object, options)\n options.keys.each do |key|\n return false unless object[key] == options[key]\n end\n\n true\n end",
"def b(memo, other)\n other.keys.each do |sort|\n if keys.include?(sort) && !memo.keys.include?(sort)\n memo << other.assoc(sort)\n end\n end\n end",
"def hash() source.hash ^ target.hash; end",
"def test_Hash_InstanceMethods_Equality\n\t\th1 = { 'a'=>1, 'c'=>2 }\n\t\th2 = { 7=>35, 'c'=>2, 'a'=>1 }\n\t\th3 = { 'a'=>1, 'c'=>2, 7=>35 }\n\t\th4 = { 'a'=>1, 'd'=>2, 'f'=>35 }\n\t\tassert_equal(false, h1 == h2)\n\t\tassert_equal(true, h2 == h3)\n\t\tassert_equal(false, h3 == h4)\n\tend",
"def ==(other)\n @hash == other.to_h\n end",
"def ==(other)\n hash == other.hash\n end",
"def ==(other)\n hash == other.hash\n end",
"def ==(other)\n return false unless other.respond_to? :size and\n size == other.size and\n other.respond_to? :[]\n each { |key, value| return false unless self[key] == other[key] }\n return true\n end",
"def ==(other)\n @hash == other.hash\n end",
"def ===(other)\n required = self.class.required_attributes\n\n other.respond_to?(:keys) && (common = other.keys & required) &&\n common.size == other.keys.size && common.size == required.size\n end",
"def <=> other\n (@comparator ||=\n KeyValue.const_defined?(:COMPARATOR) ?\n KeyValue::COMPARATOR : KeyValue.COMPARATOR).compare(@java, other.java)\n end",
"def ==(other)\n super || @hash == other.hash\n end",
"def ==(other)\n to_hash == other.to_hash\n end",
"def cmp(reference, checked)\n reference.each do |k,v|\n return false if checked[k] != v\n end\n \n return true\n end",
"def compare_by_identity?\n @hash.respond_to?(:compare_by_identity?) && @hash.compare_by_identity?\n end",
"def equivalent_hash?(a, b)\n lower_a = Hash[a.map { |k, v| [k.downcase, v] }]\n lower_b = Hash[b.map { |k, v| [k.downcase, v] }]\n return lower_a == lower_b\nend",
"def <=>(other)\n (@sort_key <=> other.sort_key) * @reversed\n end",
"def version_compare(a, b)\n make_comparable(a) <=> make_comparable(b)\n end",
"def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end",
"def deepCompare(name, hash1, hash2, failFast, errors=0)\n\t\t\tif hash1.is_a?(Hash)\n\t\t\t\tif hash2.nil?\n\t\t\t\t\tlogger(1,\"DeepCompare: #{name}, No Match '#{hash1}' vs 'nil'\")\n\t\t\t\t\[email protected](\"DeepCompare: #{name}, No Match '#{hash1}' vs 'nil'\")\n\t\t\t\t\tfailFast ? (return false) : (return errors+1)\n\t\t\t\tend\n\t\t\t\thash1.each do |key,value|\n\t\t\t\t\tif ( hash2.include?(key) )\n\t\t\t\t\t\tresult = deepCompare(\"#{name}:#{key}\", value, hash2[key], failFast, errors)\n\t\t\t\t\t\t( failFast and (!result) ) ? (return false) : errors = result\n\t\t\t\t\telse\n\t\t\t\t\t\tlogger(1,\"DeepCompare: #{name}, Missing Key '#{key}'\")\n\t\t\t\t\t\[email protected](\"DeepCompare: #{name}, Missing Key '#{key}'\")\n\t\t\t\t\t\tfailFast ? (return false) : (return errors+1)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tfailFast ? (return true) : (return errors)\n\t\t\telsif hash1.is_a?(Array)\n\t\t\t\t# Check array lengths match\n\t\t\t\tif hash1.length != hash2.length\n\t\t\t\t\tlogger(1, \"DeepCompare: #{name}, Size differs: #{hash1.length} vs #{hash2.length}\")\n\t\t\t\t\[email protected](\"DeepCompare: #{name}, Size differs: #{hash1.length} vs #{hash2.length}\")\n\t\t\t\t\tfailFast ? (return false) : (return errors+1)\n\t\t\t\tend\n\t\t\t\t# sort arrays before comparing\n\t\t\t\tsort1 = hash1.sort_by { |h| h.to_s }\n\t\t\t\tsort2 = hash2.sort_by { |h| h.to_s }\n\t\t\t\tsort1.each do |item1|\n\t\t\t\t\titem2 = sort2.shift\n\t\t\t\t\tresult = deepCompare(\"#{name}:#{item1}\", item1, item2, failFast, errors)\n\t\t\t\t\t( failFast and (!result) ) ? ( return false ) : errors = result\n\t\t\t\tend\t\n\t\t\t\tfailFast ? ( return true ) : ( return errors )\n\t\t\telse\n\t\t\t\tif ( hash1 != hash2 )\n\t\t\t\t\tlogger(1,\"DeepCompare: #{name}, No Match '#{hash1}' vs '#{hash2}'\")\n\t\t\t\t\[email protected](\"DeepCompare: #{name}, No Match: #{hash1} vs #{hash2}\")\n\t\t\t\t\tfailFast ? (return false) : (return errors+1)\n\t\t\t\tend\n\t\t\tend\n\t\t\tfailFast ? (return true) : (return errors)\n\t\tend",
"def cmp_json(other)\n self.class.json_attrs.each do |sym, json_attr|\n self_value = self.instance_variable_get(\"@#{sym}\")\n other_value = other.instance_variable_get(\"@#{sym}\")\n\n if self_value.nil? && other_value.nil?\n next\n elsif self_value.nil?\n return -1\n elsif other_value.nil?\n return +1\n elsif self_value != other_value\n return self_value <=> other_value\n end\n end\n return 0\n end",
"def ==(another)\n self.to_hash == another.to_hash\n end",
"def key_for(player1, player2)\n if player1.id < player2.id\n \"#{player1.id}/#{player2.id}\"\n else\n \"#{player2.id}/#{player1.id}\"\n end\n end",
"def assert_hash_equals(map1, map2)\r\n if (map1.size != map2.size)\r\n diff = map1.keys - map2.keys\r\n p \">>> Diff #{diff.join(',')}\"\r\n p \">>> #{map1.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n p \">>> #{map2.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n assert_equal map1.size, map2.size, \"Maps are not the same size.\"\r\n end\r\n\r\n map1.each_pair do |k,v|\r\n assert_not_nil map2[k], \"Unable to find key '#{k}'\"\r\n v1 = map2[k]\r\n assert_not_nil v1, \"Unable to find value for key '#{k}'\"\r\n if ( v.size != v1.size )\r\n diff = v.keys - v1.keys\r\n p \">>> Diff #{diff.join(',')}\"\r\n p \">>> #{v.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\"\r\n p \">>> #{v1.keys.sort { |a,b| a.to_s <=> b.to_s }.join(',')}\" \r\n assert_equal v.size, v1.size, \"Attribute for #{k} maps are not the same size\"\r\n end\r\n v.each do |k,v|\r\n assert_not_nil v1[k], \"Unable to find attribute for key '#{k}'\"\r\n assert_equal v, v1[k], \"Attribute mismatch for key '#{k}'\"\r\n end \r\n end\r\n end",
"def ==(other)\n other.kind_of?(OpenSSL::PKey::PKey) &&\n self.hash == other.hash\n end",
"def merge(other)\n # By default just take the other change if applicable\n other.instance_of?(self.class) && other.key == key ? other : self\n end",
"def eql?(other)\n @hash == other.hash\n end",
"def direction_intersect(other)\n self.class.new.tap do |memo|\n unless other.keys.empty?\n a(memo, other)\n b(memo, other)\n end\n c(memo)\n d(memo, other)\n end\n end",
"def fuzzy_hash_eql?(left, right)\n return true if (left == right)\n\n (left.count == right.count) && left.inject(true) do |res, kvp|\n res && (kvp[1] == right[kvp[0]])\n end\n end",
"def fuzzy_hash_eql?(left, right)\n return true if (left == right)\n\n (left.count == right.count) && left.inject(true) do |res, kvp|\n res && (kvp[1] == right[kvp[0]])\n end\n end",
"def test_Hash_InstanceMethods_key?\n\t\ta = {'Father'=>'Jedi', 'Mother'=>'Becky'}\n\t\tassert_equal(true, a.key?('Father'))\n\t\tassert_equal(true, a.key?('Mother'))\n\tend",
"def deepDiff(other)\n (keys + other.keys).uniq.each_with_object({}) do |key, diff|\n selfKey = self[key]\n otherKey = other[key]\n next if selfKey == otherKey\n if selfKey.respond_to?(:deepDiff) && otherKey.respond_to?(:deepDiff)\n diff[key] = selfKey.deepDiff(otherKey)\n else\n diff[key] = [selfKey, otherKey]\n end\n diff\n end\n end",
"def equals( t2 )\n t1 = self.clone\n t1.toK\n t2.toK\n if t1.value == t2.value then return true\n else return false\n end\n end",
"def sync_duplicate_obj_attributes(obj1, obj2)\n duplicate_keys.each do |key|\n unless obj1[key].blank? && obj2[key].blank?\n if obj1[key].blank?\n obj1.send(\"#{key}=\", obj2[key])\n elsif obj2[key].blank?\n obj2.send(\"#{key}=\", obj1[key])\n else # Each obj has a value\n if obj1[key] != obj2[key]\n raise ArgumentError, \"#{key} attribute values on the two objects don't match: #{obj1[key]} vs #{obj2[key]}\"\n end\n end\n end\n end\n end",
"def ==(other)\n a = to_h\n b = other.to_h\n a.delete(:_id)\n b.delete(:_id)\n a == b\n end",
"def package_updates(a, b)\n common_keys = a.keys & b.keys\n common_keys = a.keys & b.keys\n common_keys.inject({}) { |result, p| result.merge({p => a[p]}) }\n end",
"def ==(comp)\n comp.is_a?(RedisArray) ? @key == comp.key : to_a == comp\n end",
"def or other_hash\n return self if other_hash.nil?\n result = {}\n new_keys = self.keys | other_hash.keys\n new_keys.each do |key|\n value1 = self[key]\n value2 = other_hash[key]\n if block_given?\n result[key] = yield value1, value2\n elsif value1.nil? and not value2.nil?\n result[key] = value2\n elsif (not value1.nil?) and value2.nil?\n result[key] = value1\n elsif value1 == value2 or value1.eql?(value2)\n result[key] = value1 \n elsif value1.class == value2.class && value1.respond_to?(:|)\n result[key] = (value1 | value2)\n else # Hash#merge behavior\n result[key] = value2\n end\n end\n result\n end",
"def eql?(other)\n hash == other.hash\n end",
"def time_safe_equals(a, b)\n a.hash == b.hash && a == b\n end",
"def test_Hash_InstanceMethods_key\n\t\th = {a: 100, b: 200, c: 100}\n\t\tassert_equal('a', h.key(100).to_s)\n\t\tassert_equal('b', h.key(200).to_s)\n\t\tassert_equal(nil, h.key(300))\n\tend",
"def secure_compare(other)\n return false unless self.bytesize == other.bytesize\n\n l = self.unpack \"C#{self.bytesize}\"\n\n res = 0\n other.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end",
"def matches?(other)\n self.exists? && other.exists? && self.hash == other.hash\n end",
"def update(other)\n other.each do |k, v|\n if has_key?(k)\n unless self[k].equal?(v)\n raise ArgumentError,\n \"Cannot update self with other because they have different \" +\n \"Parameters with the same name #{k}\"\n end\n end\n end\n super(other)\n end",
"def same_hash\n book_info = { :first_name => 'Russ', :last_name => 'Olsen' }\n another_book_info = { first_name: 'Russ', last_name: 'Olsen' }\n book_info == another_book_info\nend",
"def same(x, y)\n find(x) == find(y)\n end",
"def eql?(another)\n self.to_hash == another.to_hash\n end",
"def ==(comparison_object)\n comparison_object.equal?(self) ||\n (comparison_object.instance_of?(self.class) &&\n comparison_object.data == data &&\n comparison_object.key == key &&\n !comparison_object.new_record?)\n end"
] | [
"0.70024794",
"0.70024794",
"0.67879623",
"0.6643736",
"0.6495879",
"0.6418652",
"0.6255551",
"0.62264323",
"0.6196548",
"0.6191487",
"0.6180526",
"0.60967046",
"0.6050241",
"0.60467124",
"0.6034101",
"0.60284454",
"0.60017973",
"0.5981955",
"0.59668577",
"0.59129316",
"0.59046876",
"0.58879834",
"0.58302957",
"0.5822973",
"0.58161396",
"0.5782194",
"0.57798624",
"0.577256",
"0.577256",
"0.5765618",
"0.5736034",
"0.5736034",
"0.5736034",
"0.57247686",
"0.570974",
"0.570974",
"0.5689719",
"0.5689719",
"0.568697",
"0.5669827",
"0.5665782",
"0.5641409",
"0.56248784",
"0.56230086",
"0.5617459",
"0.55723906",
"0.5569614",
"0.5566431",
"0.55570316",
"0.5553826",
"0.5548696",
"0.5543906",
"0.5529181",
"0.55278873",
"0.5525069",
"0.5503181",
"0.5502937",
"0.54944104",
"0.54944104",
"0.5494029",
"0.5481476",
"0.54810727",
"0.54553217",
"0.5454333",
"0.5449584",
"0.5430619",
"0.5421218",
"0.54205364",
"0.54145616",
"0.54062074",
"0.54057336",
"0.53968877",
"0.53907615",
"0.5381952",
"0.5371911",
"0.5369934",
"0.5345254",
"0.5341021",
"0.5340787",
"0.5327794",
"0.532634",
"0.532634",
"0.5313393",
"0.5312353",
"0.5290849",
"0.528185",
"0.52729857",
"0.526661",
"0.52657425",
"0.52602047",
"0.5239178",
"0.52334243",
"0.52278423",
"0.5224593",
"0.5224154",
"0.52012116",
"0.51896363",
"0.517135",
"0.51599777",
"0.51577526"
] | 0.5848417 | 22 |
Gets this object's value. When called with a block, yields the value in chunks as it is read in from the socket. | def value
key_escaped = Object.escape_key(@key)
if block_given?
@s3.request_get("/#{@bucket.name}/#{key_escaped}") do |response|
@s3.error?(response)
response.read_body {|chunk| yield chunk }
end
else
response = @s3.request_get("/#{@bucket.name}/#{key_escaped}")
@s3.error?(response)
return response.body
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def value\n @value ||= @block.call\n end",
"def get\n @mutex.synchronize { @value }\n end",
"def value\n return @value if done?\n raise LightIO::Error, 'already used' if @light_fiber\n @light_fiber = LightFiber.current\n @ioloop.transfer\n @value\n end",
"def get(&block)\n @mutex.synchronize {\n if @ready\n @value\n else\n @initializer = block if block\n @value = @initializer.call\n @ready = true\n @value\n end\n }\n end",
"def read()\r\n return @socket.read(1)\r\n end",
"def recv\n @send_mutex.synchronize { @send_cv.wait(@send_mutex) until @send } unless @send\n\n msg = @stream.recv_msg(blocking: true)\n return msg if msg\n raise StopIteration\n rescue GrpcKit::Errors::BadStatus => e\n @reason = e\n raise e\n end",
"def read\n data = @handle.availableData\n return data\n end",
"def value\n return @value if defined? @value\n\n result = @future_result.result\n @value = if @block\n @block.call(result)\n else\n result\n end\n end",
"def value\n v = connection.get(key)\n rescue Memcached::NotFound\n if block\n value = block.call\n value\n end\n end",
"def get\n socket.readline\n end",
"def gets\n\t\t\t\tif @buffer.nil?\n\t\t\t\t\treturn read_next\n\t\t\t\telse\n\t\t\t\t\tbuffer = @buffer\n\t\t\t\t\t@buffer = nil\n\t\t\t\t\treturn buffer\n\t\t\t\tend\n\t\t\tend",
"def data(&block)\n if not @data.nil?\n return @data\n end\n \n self.prepare! # seeks to block position\n \n if not block.nil?\n loop do\n size = @io.getbyte\n break if size <= 0\n block.call(@io.read(size))\n end\n else\n data = \"\"\n self.data do |chunk|\n data << chunk\n end\n @data = data\n \n return @data\n end\n end",
"def read\n\t\t\t\t\[email protected](BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def read\n @socket.read(1)\n end",
"def value\n if alive?\n self.parent = Beam.current\n ioloop.transfer\n end\n check_and_raise_error\n @value\n end",
"def value(block_num = nil)\n \tv, _ = value_with_addr(block_num)\n \tv\n end",
"def value\n\t\traise @exception if exception?\n\n\t\treturn @value if delivered?\n\n\t\tmutex.synchronize {\n\t\t\tcond.wait(mutex)\n\t\t}\n\n\t\tif exception?\n\t\t\traise @exception\n\t\telse\n\t\t\t@value\n\t\tend\n\tend",
"def get\n @mutex.synchronize do\n # get the first block of data\n if @log.debug?\n @log.debug \"reading #{@cipher.block_size} bytes from socket...\"\n end\n\n data = read( @cipher.block_size )\n\n # decipher it\n reader = @buffers.reader( @cipher.update( data ) )\n\n # determine the packet length and how many bytes remain to be read\n packet_length = reader.read_long\n remaining_to_read = packet_length + 4 - @cipher.block_size\n if @log.debug?\n @log.debug \"packet length(#{packet_length}) \" +\n \"remaining(#{remaining_to_read})\"\n end\n\n # read the remainder of the packet and decrypt it.\n data = read( remaining_to_read )\n\n # get the hmac from the tail of the packet (if one exists), and\n # then validate it.\n hmac = @hmac.mac_length > 0 ? read( @hmac.mac_length ) : \"\"\n\n reader.append @cipher.update( data ) unless data.empty?\n reader.append @cipher.final\n\n padding_length = reader.read_byte\n\n payload = reader.read( packet_length - padding_length - 1 )\n padding = reader.read( padding_length ) if padding_length > 0\n\n my_computed_hmac = compute_hmac( reader.content )\n raise Net::SSH::Exception, \"corrupted mac detected\" if hmac != my_computed_hmac\n\n # decompress the payload\n payload = @decompressor.decompress( payload )\n\n increment_sequence_number\n\n buffer = @buffers.reader( payload )\n @log.debug \"received: #{buffer.content.inspect}\" if @log.debug?\n\n return buffer\n end\n end",
"def value\n @lock.synchronize do\n\n while ! @ready do\n @cond.wait @lock\n end\n\n raise @exception if @exception\n\n @value\n end\n end",
"def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end",
"def read\n ensure_connected do |socket|\n Protocol::Reply.deserialize(socket)\n end\n end",
"def read()\n return @reader.call(@address)\n end",
"def fetch(length)\n # This callback should be set just once, yielding with the parsed message\n @driver.on(:message) { |msg| yield(msg.data.pack('C*')) } if @driver.listeners(:message).length.zero?\n\n data = @sock.read_nonblock(length) # Read from the socket\n @driver.parse(data) # Parse the incoming data, run the callback from above\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end",
"def read\n @buffer\n end",
"def value(options = {}, &block)\n if options.is_a?(Hash)\n reload = !options.empty?\n else\n reload = options\n options = {}\n end\n expirable_memoize(reload) do\n self.class.stream(key, bucket.name, options, &block)\n end\n end",
"def get(&block)\n @get = block\n end",
"def get(&block)\n @get = block\n end",
"def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end",
"def blocking_read\n raise RuntimeError, \"RAWIP: blocking_read: Not connected!\" unless connected?\n begin\n loop do\n data, sender = @rsock.recvfrom(8192)\n port, host = Socket.unpack_sockaddr_in(sender)\n #Assume a 20 byte IP header (yuck!)\n return data[20..-1] if host == @dest # only queue packets from our peer\n end\n rescue\n destroy_connection\n raise RuntimeError, \"RAWIP: blocking_read: Couldn't read from socket! (#{$!})\"\n end\n end",
"def read(&block)\n @read_block = block\n end",
"def read\n @socket.gets\n end",
"def get\n simulation.socket.readline\n end",
"def recv\n if open?\n @writer.close\n obj = Marshal.load(@reader.read)\n @reader.close\n obj\n end\n end",
"def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end",
"def block_on_value\n f = Fiber.current\n\n @deferrable.callback { |result| f.resume(result) }\n @deferrable.errback { |error| p \"Received error: #{error}!\"; f.resume }\n Fiber.yield\n end",
"def fetch\n @value\n end",
"def recv_msg(&block)\n return unless readable?\n\n # In order to get EM::XS::Connection#notify_readable called again by EM,\n # we need to receive strings until #recv_strings fails.\n loop do\n rc = @sock.recv_strings(strings = [], ::XS::NonBlocking)\n break unless ::XS::Util.resultcode_ok? rc\n\n if block_given?\n yield strings\n elsif @handler\n @handler.on_recv strings\n end\n end\n end",
"def get(key, &block)\n do_with_logging(:get, key) do\n retryable do\n val = self.adapter.get(key)\n handle_store_object(key, adapter.unmarshal(val), &block)\n end\n end\n end",
"def read_content\n # read content if content is being sent\n if @content_length && @content_length > 0\n @content = @socket.read(@content_length)\n end\n end",
"def get(*args, &block)\n connection.get(*args, &block)\n end",
"def each\n while (s = read_bytes(4096, \"\"))\n yield s\n end\n end",
"def read\n chunk = @client.get(@next_chunk)\n if chunk.headers[:location].nil? && chunk.code != 204\n # no more chunks\n @next_chunk = nil\n chunk.to_s\n elsif chunk.to_s == ''\n # assume no content and back off\n @interval = 2\n ''\n elsif location = chunk.headers[:location]\n # some data read and next chunk available\n @next_chunk = location\n @interval = 0\n chunk.to_s\n end\n end",
"def read_stream_block\n StreamBlock.parse(read_payload)\n end",
"def read\n @handle.read\n end",
"def each_remote_read\n return enum_for(:each_remote_read) unless block_given?\n begin\n loop do\n resp = remote_read\n break if resp.nil? # the last response was received\n yield resp\n end\n ensure\n set_input_stream_done\n end\n end",
"def read\n read_object(read_byte)\n end",
"def read_chunk\n # the first line contains the length of the next chunk\n length = @socket.gets\n chunk = @socket.read(length.to_i(16))\n # append to the local copy of the content\n @content += chunk\n # all content is followed by a newline\n @socket.gets\n # the length (as received, in hex) and the content chunk\n [length, chunk]\n end",
"def each_value\n return enum_for(__method__) unless block_given?\n @raw.each_value do |value|\n yield value\n end\n self\n end",
"def get_block_value\r\n if block_given?\r\n value = yield\r\n pp \"The block returned #{value}\"\r\n end\r\nend",
"def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n [email protected](8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end",
"def value\n return @updater.call(*@sources.map { |var| var.value }) if @updater\n return @value if @value\n raise \"No value or updating block set\"\n end",
"def readbyte\n map_exceptions do\n @socket.readbyte\n end\n end",
"def read\n connection.open(full_remote_path).read\n end",
"def connect(&block) \n EM.run do\n http = connection.get\n buffer = \"\"\n http.stream do |chunk|\n buffer << chunk\n while line = buffer.slice!(/.+\\r\\n/)\n hash= MultiJson.decode(line, :symbolize_keys => true)\n block.call(hash)\n end\n end\n http.errback do\n EM.stop\n end\n end\n end",
"def get(receiver)\n receiver.send(reader)\n end",
"def read(maxbytes=1024)\n \"\"\"Buffered read from node, non-blocking.\n maxbytes: maximum number of bytes to return\"\"\"\n count = @readbuf.length\n if count < maxbytes\n data = File.new(@stdout.fileno(), \"r\").sysread(maxbytes - count)\n puts data\n @readbuf += data\n end \n\n if maxbytes >= @readbuf.length\n result = @readbuf\n @readbuf = ''\n else\n puts 'entered'\n result = @readbuf[0..maxbytes]\n @readbuf = @readbuf[[email protected]]\n end\n\n return result\n end",
"def each\n return enum_for unless block_given?\n\n while (chunk = read)\n yield chunk\n end\n end",
"def perform(&block)\n response = perform!(&block)\n response.value\n end",
"def call\n 2.times do\n message = try_blocking_receive\n return message unless message.equal?(Undefined)\n end\n fail ProtocolError\n end",
"def read\n if active?\n res = nil\n\n while res.nil?\n @queue_lock.synchronize {\n @queue.each { |item|\n # Find next data\n if item.type == :data and item.seq == @seq_recv.to_s\n res = item\n break\n # No data? Find close\n elsif item.type == :close and res.nil?\n res = item\n end\n }\n\n @queue.delete_if { |item| item == res }\n }\n\n # No data? Wait for next to arrive...\n @pending.wait unless res\n end\n\n if res.type == :data\n @seq_recv += 1\n @seq_recv = 0 if @seq_recv > 65535\n res.data\n elsif res.type == :close\n deactivate\n nil # Closed\n end\n else\n nil\n end\n end",
"def read_object\n # Incrementally parse next object.\n begin\n while not @object\n @sock.readpartial(MAX_READ_CHUNK, @inbuf)\n @parser << @inbuf\n PennJSON_Conversation.do_clear(@inbuf)\n end\n rescue Yajl::ParseError\n PennJSON.panic 'Malformed protocol message.'\n rescue EOFError\n raise SystemExit, 'Remote closed connection.'\n end\n\n # Fetch parsed object. Could make this a queue, I suppose.\n result = @object\n @object = nil\n return result\n end",
"def next(stop_result = Stop.singleton)\n if read_fd.closed?\n stop_result\n else\n Marshal.load(read_fd)\n end\n end",
"def get_copy_data(async=false, decoder=nil)\n\t\tif async\n\t\t\treturn sync_get_copy_data(async, decoder)\n\t\telse\n\t\t\twhile (res=sync_get_copy_data(true, decoder)) == false\n\t\t\t\tsocket_io.wait_readable\n\t\t\t\tconsume_input\n\t\t\tend\n\t\t\treturn res\n\t\tend\n\tend",
"def sysread( length )\n\t\tresult = self.recvfrom( length )\n\t\treturn result[0]\n\tend",
"def get_value\n send_request(FUNCTION_GET_VALUE, [], '', 2, 'S')\n end",
"def get\n val = @source.get\n return nil if val.nil?\n processed_val = process(val)\n if processed_val.nil?\n get\n else\n return processed_val\n end\n\n end",
"def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end",
"def getline\n return @socket.gets\n end",
"def get_bytes()\n @value\n end",
"def read\n tmp = nil\n mutex.synchronize do\n tmp = @buffer.dup\n @buffer.clear\n end\n return tmp unless tmp.empty?\n end",
"def fetch(key, options = {})\n options ||= {}\n value = read(key, options) unless options[:force]\n\n if value.nil? && block_given?\n value = yield(key)\n write(key, value, options)\n end\n\n value\n end",
"def value (timeout = nil)\n\t\treturn @value if delivered?\n\n\t\[email protected] {\n\t\t\tcond.wait(@mutex, *timeout)\n\t\t}\n\n\t\treturn @value if delivered?\n\tend",
"def get\n @value\n end",
"def get *args, &block\n handle @conn.get *args, &block\n end",
"def getResponse(soc, &block)\n data = []\n while line = soc.gets\n #puts line\n r = line.chop.split ','\n if r[0] == R_ERR\n puts \"Error detected: %s\" % line\n raise IQFeedException.new(r[1]) \n end\n if r[0] == ENDMSG\n block.(data) unless block.nil?\n puts \"End of Data Detected: %s\" % r\n break\n end\n data << r\n unless block.nil? or data.size < CHUNK\n block.(data)\n data = []\n end\n end\n if block.nil?\n data\n else\n nil\n end\n end",
"def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end",
"def value_with_addr(block_num = nil)\n\t\t\t\tblock_num ||= @auth_block\n \traise Mifare::Error, \"Not authenticated\" unless block_num\n\n\t\t\t\tvalue_ptr = FFI::MemoryPointer.new(:int32, 1)\n\t\t\t\taddr_ptr = FFI::MemoryPointer.new(:uchar, 1)\n\t\t\t\tres = Mifare.mifare_classic_read_value(@pointer, block_num, value_ptr, addr_ptr)\n raise Mifare::Error, \"Can't read value block 0x%02x\" % block_num if 0 != res\n\n\t\t\t\t[value_ptr.get_int32(0), addr_ptr.get_uchar(0)]\n end",
"def body(&block)\n call_once\n @body ||= begin\n if entity = @response.get_entity\n EntityConverter.new.read_entity(entity, &block)\n end\n rescue Java::JavaIo::IOException, Java::JavaNet::SocketException, IOError => e\n raise StreamClosedException.new(\"Could not read from stream: #{e.message}\")\n # ensure\n # @request.release_connection\n end\n end",
"def gets\n\t\[email protected]\n\tend",
"def read_until([email protected])\n start = Time.now\n loop do\n if block_given?\n result = yield and\n return result\n end\n\n return if @eof_found\n\n # select treats 0 as infinity, so clamp it just above 0\n timeout_remaining = [timeout - (Time.now - start), 0.00001].max\n IO.select([@stream], [], [], timeout_remaining) or\n raise Timeout, \"timeout exceeded\"\n\n read_chunk\n end\n end",
"def get(length=nil)\n length = @need if length.nil?\n data = @buffer[0 ... length]\n @buffer = @buffer[length .. -1]\n return data\n end",
"def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end",
"def with_block(&block)\n yield self if block_given? && @value\n end",
"def socket_get\n\t\t\t\tline = @socket.gets.chomp\n\t\t\t\tdebug(\"<<< \" + line)\n\t\t\t\treturn line\n\t\t\tend",
"def read\n # Buffer for holding the received data. With sockets there is no\n # guarantee that you will receive the full message in a single\n # call to recv(). Accordingly, you have to have a buffer that\n # holds the partial data which is appended to on every recv\n # until you have a full message.\n buffer = ''\n #reader = BufferedReader.new(InputStreamReader.new(socket.get_input_stream))\n loop do\n # receive at most 8192 bytes, which is a mostly arbitrary\n # value that should work well\n chunk = socket.get_chunk\n # a zero-length chunk means the connection was closed\n if chunk == nil || chunk == '' || chunk == -1\n puts \"Lost connection\"\n @socket.close\n close\n break\n end\n\n # we use a single \\x000 (i.e., null) as a messag eterminator,\n # so we look for one in the chunk. If there is one, then that\n # gives us a complete message and we can process it. If not,\n # we wait for more data on the socket.\n if chunk == 0\n begin\n msg = YAML.load(buffer)\n rescue ArgumentError\n msg = nil\n puts \"Bad YAML recieved by #{self.class}\"\n end\n handle_msg(msg) if msg\n buffer = ''\n else\n begin\n buffer << chunk\n rescue\n puts $!\n end\n end\n end\n\n # Called when the socket connection is lost.\n def close\n end\n\n # Returns the socket object to be used in other operations. Must\n # be implemented by modules that include Communicator.\n def socket\n throw Exception(\"socket must be implemented\")\n end\n\n # Handles a message that's been received. Must be implemented by\n # moduels that include Communicator.\n def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end\n end",
"def getc\n return @read_buffer.slice!(0) if @read_buffer && !@read_buffer.empty?\n\n @read_buffer ||= +''\n Polyphony.backend_read(self, @read_buffer, 8192, false, -1)\n return @read_buffer.slice!(0) if !@read_buffer.empty?\n\n nil\n end",
"def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end",
"def get_byte(close_after_single_read=false)\n end",
"def read\n _read\n end",
"def fetch(key, value = nil)\n if read = self[key]\n return read\n end\n block_given? ? yield(key) : value\n end",
"def chunked\r\n @chunked = true\r\n @chunked_started = false\r\n while true\r\n # If the block returns nil, then this is the last part.\r\n @data = yield\r\n break if @data.nil? or data==false or data==''\r\n \r\n done = callcc do |continuation|\r\n @continuation = continuation\r\n return self\r\n end\r\n raise Errno::EPIPE if done\r\n end\r\n \r\n # Return self one last time to terminate the chunking\r\n @done = true\r\n self\r\n end",
"def result\n @buffer\n end",
"def remote_each\n if(@store)\n yield @store\n else\n @con.request_get(@call_path) do |res|\n res.read_body(@store) do |part|\n @cf.write part if @cf\n yield part\n end\n end\n end\n end",
"def read_bytes_full\n @_io.read\n end",
"def value(serializer)\n if block\n serializer.instance_eval(&block)\n else\n serializer.read_attribute_for_serialization(name)\n end\n end",
"def retrieve_data\r\n response = ''\r\n while next_line_readable?\r\n response = @socket.gets.chop\r\n puts response\r\n end\r\n response #returns last valid line\r\n end",
"def get(timeout = nil, ltimeout = def_read_loop_timeout, opts = {})\n # For those people who are used to being able to use a negative timeout!\n if (timeout and timeout.to_i < 0)\n timeout = nil\n end\n\n # No data in the first place? bust.\n if (has_read_data?(timeout) == false)\n return nil\n end\n\n buf = \"\"\n lps = 0\n eof = false\n\n # Keep looping until there is no more data to be gotten..\n while (has_read_data?(ltimeout) == true)\n # Catch EOF errors so that we can handle them properly.\n begin\n temp = read(def_block_size)\n rescue EOFError\n eof = true\n end\n\n # If we read zero bytes and we had data, then we've hit EOF\n if (temp and temp.length == 0)\n eof = true\n end\n\n # If we reached EOF and there are no bytes in the buffer we've been\n # reading into, then throw an EOF error.\n if (eof)\n # If we've already read at least some data, then it's time to\n # break out and let it be processed before throwing an EOFError.\n if (buf.length > 0)\n break\n else\n raise EOFError\n end\n end\n\n break if (temp == nil or temp.empty? == true)\n\n buf += temp\n lps += 1\n\n break if (lps >= def_max_loops)\n end\n\n # Return the entire buffer we read in\n return buf\n end",
"def get_value\n @get_value_handler.call\n end"
] | [
"0.6449273",
"0.633103",
"0.62878954",
"0.626846",
"0.61927986",
"0.61580235",
"0.6120366",
"0.6109555",
"0.60485584",
"0.60113615",
"0.5997681",
"0.59940094",
"0.59673584",
"0.5937367",
"0.5932679",
"0.5902808",
"0.5899798",
"0.58922327",
"0.585376",
"0.5828703",
"0.57225746",
"0.56938654",
"0.56843936",
"0.56631154",
"0.5658656",
"0.5623969",
"0.5619961",
"0.5617475",
"0.5617475",
"0.5605245",
"0.5596415",
"0.55930465",
"0.5580998",
"0.55800045",
"0.5579425",
"0.5546644",
"0.55338037",
"0.55260324",
"0.55250055",
"0.55235696",
"0.548061",
"0.5480501",
"0.5478917",
"0.5476944",
"0.5473307",
"0.5439249",
"0.5426238",
"0.54124653",
"0.54103494",
"0.54098934",
"0.53904545",
"0.5389399",
"0.53863263",
"0.5384598",
"0.53841525",
"0.5357173",
"0.5357159",
"0.5351658",
"0.53515613",
"0.53356606",
"0.5332132",
"0.5328491",
"0.5320478",
"0.53075755",
"0.5300908",
"0.529503",
"0.5294663",
"0.52940756",
"0.52865076",
"0.52822214",
"0.5277172",
"0.5263922",
"0.5263206",
"0.5252902",
"0.5241832",
"0.5233819",
"0.5227741",
"0.5221926",
"0.52126205",
"0.5211815",
"0.5210512",
"0.5207946",
"0.5202828",
"0.5202808",
"0.51979864",
"0.51942843",
"0.5191211",
"0.51853555",
"0.5163723",
"0.5158692",
"0.5158321",
"0.5157787",
"0.5155282",
"0.515394",
"0.5151862",
"0.5151231",
"0.5145251",
"0.51451313",
"0.51337296",
"0.5132977"
] | 0.5741931 | 20 |
Sets this object's value. If +new_value+ is an open IO stream, the value will be read from the stream. | def value=(new_value)
key_escaped = Object.escape_key(@key)
response = @s3.request_put("/#{@bucket.name}/" +
"#{key_escaped}", new_value)
@s3.error?(response)
return new_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value=(new_value)\n validate(new_value)\n @value = parse_value(new_value)\n end",
"def value=(new_value)\n @value = self.lazy_proc?(new_value) ? new_value : self.coerce(new_value)\n end",
"def value=(new_value)\n new_value = value_from_string(new_value) if new_value.is_a?(String)\n validate!(new_value)\n @is_explicit = true\n @value = new_value\n end",
"def value=(new_value)\n\t\t@value = new_value\n\t\tinform_obeservers\n\tend",
"def set(value)\n @read.close\n @write.write value\n end",
"def value=(new_value)\n ffi_delegate.set_value('%s', :string, new_value.to_s)\n end",
"def set_value new_value\n if validate_value new_value\n @value = new_value\n end\n end",
"def value=(new_value)\r\n raise WAZ::Blobs::InvalidOperation if self.snapshot_date\r\n self.class.service_instance.put_blob(path, new_value, content_type, metadata)\r\n @value = new_value\r\n end",
"def with(new_value)\r\n @new_value = new_value\r\n self\r\n end",
"def value=(new_value)\n validate(BigDecimal(new_value.to_s))\n @value = new_value.to_s\n end",
"def update(new_value)\n self.value = new_value\n end",
"def value=(new_value)\n validate(new_value)\n if new_value.nil?\n property_names.each { |name| self[name] = nil }\n else\n property_names.each { |name| self[name] = new_value[name] }\n end\n end",
"def value=(new_value)\n self[:value] = new_value.to_yaml\n end",
"def value=(new_value)\n self[:value] = new_value.to_yaml\n end",
"def get_and_set(new_value)\n @mutex.synchronize do\n old_value = @value\n @value = new_value\n old_value\n end\n end",
"def set(new_value = nil)\n @mutex.synchronize do\n Kernel.raise(Complete) if @complete\n @complete = true\n @value = new_value\n @waiter.resume_all_indefinitely\n end\n nil\n end",
"def value=(value)\n @object.instance_variable_set(:\"@#{@name}\",coerce(value))\n end",
"def write(new_value)\n raise \"#{to_s} cannot be used through Firmata\" if mode == Rufirmata::UNAVAILABLE\n raise \"#{to_s} is set up as an INPUT and therefore cannot be written to\" if mode == Rufirmata::INPUT\n if (new_value != value)\n self.value = new_value\n if mode == Rufirmata::OUTPUT\n port ? port.write() :\n board.write_command(Rufirmata::DIGITAL_MESSAGE, pin_number, value)\n elsif mode == Rufirmata::PWM\n val = (@value * 255).to_i\n board.write_command(Rufirmata::ANALOG_MESSAGE + pin_number, val % 128, val >> 7)\n end\n end\n end",
"def set_value(value)\n @value = value\n end",
"def write(new_value)\n return false if new_value == @value\n @value = new_value\n taint!\n end",
"def value=(value)\n if @value.class == value.class\n @value = value\n @updater = nil\n else\n raise \"Class of new value (#{value.class}) does not match class of current value (#{@value.class})\"\n end\n end",
"def value=(new_value)\n method(@method).call(new_value) if @method\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n end",
"def value=(value)\n @value = value\n @value_set = true\n end",
"def setValue(value)\n @value = value\n end",
"def set(value)\n value\n end",
"def set_value_for(value_provider, base = nil, new_value = nil, **options)\n value_provider.set_value(base, new_value, **options)\n end",
"def set_to(value)\n @native.set_current_value(value)\n end",
"def value=(value)\n @changed = true if value != @value\n @value = value\n end",
"def value=(v)\n @value = from_type(v)\n end",
"def value=(new_value)\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n method(@method).call(new_value) if @method\n end",
"def set_value(new_val)\r\n @bitstring=self.input_to_bitstring(new_val)\r\n end",
"def value=(v)\n @value = v\n @value_set = true\n @value\n end",
"def value=(new_value)\n self[:value] = new_value.to_yaml\n end",
"def value=(new_value)\n self[:value] = new_value.to_yaml\n end",
"def value=(value)\n @value = value\n end",
"def new_value(value)\n AwesomeObject.new(self, value)\n end",
"def value=(value); self.data.value = value; end",
"def value=(value)\n @value = value\n end",
"def value=(value)\n @value = value\n end",
"def value=(value)\n @value = value\n end",
"def value=(new_value)\n new_value = new_value[0...(self.strings.size)] + 0.chr #limit the size, add 0-byte\n new_value.bytes.each_with_index do |byte,index|\n self.strings[index].value = byte.chr\n end\n end",
"def value=(value)\n @value = Data.coerce_value(value, String, :to_s)\n end",
"def raw_value=(v)\n @value = v\n end",
"def set_value( value )\n @value = value \n end",
"def value=(value)\n return unless @run.initialized?\n @file = nil\n @remote_file = false\n @value = value\n end",
"def value=(obj)\n @value = to_value(obj)\n end",
"def set(value)\n @mutex.synchronize { @value = value }\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def value=(new_value)\n return nil if readonly?\n @value = send(\"sanitize_#{options[:type]}\", new_value)\n end",
"def value=(value)\n @value = value.nil? ? nil : _set_value(value)\n end",
"def value=(value)\n @value = value\n end",
"def set(value)\n old_value = refresh(value)\n handle_event :type => :change, :old_value => old_value, :value => @value if old_value != @value\n old_value\n end",
"def set(value)\n raise NotImplementedError\n end",
"def load(value)\n @value = value\n end",
"def value=(val)\n self[:value] = serialize_value(val)\n end",
"def set_value(new_value, index)\n update_tag(index, new_value)\n end",
"def new_value(old_value)\n raise 'to be implemented in subclass'\n end",
"def value(value)\n\t\t@value=value\n\tend",
"def set_value(value)\n send(\"set_#{value[:type]}_value\", value)\n end",
"def value=(new_value, unbind = true)\n self.unbind if unbind\n unless value == new_value\n super(new_value)\n changed.emit(new_value)\n end\n new_value\n end",
"def value=(value)\n self['value'] = value\n end",
"def value=(v)\n set(v)\n end",
"def __overwrite_value(val)\n @__node.content = __export_to_xml(val)\n self.__value = val\n end",
"def value=(v)\n self.explicitly_set_value = true\n @casted_value = nil\n @value = v\n end",
"def value=(newval)\n raise\n end",
"def add_value(string_value)\n current.value = string_value\n end",
"def set(object, value); end",
"def set_value(object, value)\n value = cast_value(value)\n\n case value_type\n when 'integer' then object.value_integer = value\n when 'float' then object.value_float = value\n when 'string' then object.value_string = value\n else raise_invalid_type\n end\n end",
"def update_value(new_value)\n if @type != :slider\n value_index = @values.index(new_value)\n new_value = @values[value_index || 0]\n end\n $options.send(setter, new_value)\n end",
"def set(value)\n @value = value\n info \"#{name} = #{value.inspect} (#{value.class})\"\n @change_observers.each { |proc| proc.call(value) }\n OmfEc.experiment.log_metadata(name, value, :prop)\n end",
"def value= value\n\t\t@value = value\n\t\trefresh\n\tend",
"def as(value)\n @value = value\n end",
"def value=(new_value)\n if @value.nil?\n @value = new_value\n else\n api.put_config_vars app.name, key => new_value\n @value = new_value\n end\n end",
"def put(new_value)\n raise Ractor::RetryTransaction if @tvar.value != EMPTY\n\n @tvar.value = new_value\n end",
"def set(value)\n execute_only(:set, value)\n end",
"def set(value)\n @value = value\n #info(@name, ' = ', value.inspect, '(type:', value.class,')')\n info('value = ', value.inspect, ' (',value.class,')')\n @changeListeners.each { |l|\n l.call(value)\n }\n TraceState.property(@name, :set, {'value' => value.inspect})\n end",
"def set(value)\n @value = value\n #info(@name, ' = ', value.inspect, '(type:', value.class,')')\n info(\"#{@name} = #{value.inspect} (#{value.class})\")\n @changeListeners.each { |l|\n l.call(value)\n }\n TraceState.property(@name, :set, {'value' => value.inspect})\n end",
"def setValue(value)\n @current = value\n self.limitCurrentValue\n end",
"def set(instance, value)\n set!(instance, coerce(value))\n end",
"def set_value(*args)\n raise ReadOnlyRecord if readonly?\n resource.set_value(*args)\n end",
"def set(value)\n execute(:set, value)\n end",
"def set_raw!(value)\n value = value.to_s\n\n @objects = nil\n @memory = FFI::MemoryPointer.new(:uchar, value.length) \n @memory.write_bytes(value)\n\n self[:type] = :raw\n\n raw = self[:values][:raw]\n raw[:size] = value.length\n raw[:ptr] = @memory\n end",
"def value=(val); end",
"def value=(value)\n `#{@element}.value = #{value}`\n end",
"def value=(value)\n @value = Data.coerce_value(value, Fixnum, :to_i)\n end",
"def value=(value)\n debug \"set value\"\n file = Tempfile.new('openldap_confgi', '/tmp')\n begin\n file << \"dn: cn=config\\n\"\n file << \"changetype: modify\\n\"\n file << \"replace: #{name}\\n\"\n file << \"#{name}: #{value}\\n\"\n file.close\n # file.path\n Puppet.debug(IO.read file.path)\n\n begin\n ldapmodify(['-Y','EXTERNAL','-H','ldapi:///','-f',file.path])\n rescue Exception => e\n raise Puppet::Error, \"LDIF content:\\n#{IO.read file.path}\\nError message: #{e.message}\"\n end\n ensure\n file.unlink\n end\n @property_hash[:value] = value\n end",
"def set!(value)\n @mutex.synchronize do\n old_value = @value\n @value = value\n @full_condition.signal\n apply_deref_options(old_value)\n end\n end",
"def []=(key, value)\n object = @bucket.get_or_new sanitize_key(key)\n object.raw_data = Marshal.dump(value)\n object.content_type = \"application/x-ruby-marshal\"\n object.store\n value\n end",
"def []=(key, value)\n if @_new_props\n @_new_props[key] = value\n else\n super\n end\n end",
"def value=(val)\n mutex.lock\n @value = val\n ensure\n mutex.unlock\n end",
"def value=(value)\n @block = nil\n @value = value\n end",
"def set(path, value, source)\n my_path = path.clone\n return source.send(my_path[0].to_s + \"=\",value) if my_path.length == 1\n target = my_path.shift\n set(my_path, value, source.send(target))\n end",
"def new_with_value(value)\n RObject.new self, value\n end",
"def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n set(value.to_i)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n val\n end",
"def proxy=(new_value); end",
"def assign(obj)\n @value = obj\n end",
"def set_value(value)\n unless value.kind_of?(String) or value == nil\n raise \"Illegal value passed to set_value!\"\n end\n\n @value = nil\n @value_string = value\n if value and value != \"\"\n @value = SimpleExpression.new(value)\n end\n\n @vartype = nil\n @depends_on = nil\n @diffeq_deps = nil\n end",
"def value=(new_value)\n new_value = new_value.to_s\n return if new_value.blank?\n new_value = '-' + new_value unless new_value =~ /^(\\+|-)/\n write_attribute :value, new_value.to_f.round\n end",
"def set_value(owner, value)\n if value.nil?\n raw_value = nil\n else\n raw_value = case type\n when 'string' then value.to_s\n when 'integer' then value.to_i\n when 'decimal' then value.to_f\n when 'length' then value.to_i\n when 'color' then value[1..-1].to_i(16)\n when 'percent' then value.to_f/100\n end\n end\n\n owner.set_raw_property_value(name, raw_value)\n end"
] | [
"0.73805296",
"0.73805296",
"0.7058884",
"0.69475746",
"0.6752625",
"0.6737067",
"0.6736774",
"0.6735831",
"0.6639714",
"0.64914864",
"0.64288485",
"0.6365661",
"0.6263758",
"0.623329",
"0.623329",
"0.622448",
"0.6152938",
"0.61500716",
"0.61470246",
"0.6119601",
"0.61061615",
"0.60983574",
"0.60970396",
"0.6051018",
"0.6022653",
"0.60101455",
"0.6007127",
"0.5995425",
"0.59847975",
"0.59305423",
"0.59103864",
"0.5908495",
"0.5898587",
"0.5888924",
"0.5888924",
"0.5886906",
"0.5875618",
"0.58497894",
"0.58479303",
"0.58479303",
"0.58479303",
"0.58378774",
"0.5833151",
"0.5826409",
"0.5809228",
"0.5781228",
"0.57778054",
"0.57321686",
"0.5728885",
"0.57231134",
"0.5712977",
"0.5709598",
"0.57061183",
"0.5693429",
"0.5651303",
"0.56375766",
"0.5621175",
"0.56151927",
"0.56147665",
"0.55807626",
"0.557495",
"0.5561416",
"0.5560692",
"0.55598235",
"0.55441785",
"0.55381656",
"0.5509979",
"0.5502222",
"0.5497679",
"0.5481386",
"0.5462332",
"0.54595375",
"0.54466325",
"0.5441196",
"0.53870547",
"0.5381614",
"0.53752303",
"0.537487",
"0.5364877",
"0.5362614",
"0.53208154",
"0.53201926",
"0.52954066",
"0.5291434",
"0.5285294",
"0.5282775",
"0.5277729",
"0.52556634",
"0.5255233",
"0.52384627",
"0.52241224",
"0.5222937",
"0.52026254",
"0.51737785",
"0.51736695",
"0.5157399",
"0.5156244",
"0.51510966",
"0.5150772",
"0.51496637"
] | 0.60299474 | 24 |
Returns custom DOM ID | def dom_id
['article', id].join('-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dom_id\n \"_#{self.object_id}\"\n end",
"def dom_id\n \"#{self.class.name.gsub(/:+/,\"_\")}_#{self.object_id}\"\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n node['id']\n end",
"def dom_id\n\t\tnode['id']\n\tend",
"def dom_id; end",
"def dom_id; end",
"def dom_id; end",
"def dom_id; end",
"def dom_id\n display_id = new_record? ? \"new\" : id\n prefix = prefix.nil? ? self.class.name.underscore : \"#{prefix}_#{self.class.name.underscore}\"\n prefix.gsub!('/', '_')\n \"#{prefix}_#{display_id}\"\n end",
"def element_dom_id(element)\n return \"\" if element.nil?\n \"#{element.name}_#{element.id}\"\n end",
"def dom_id(object)\n object.class.to_s.tableize + '_' + object.id.to_s\n end",
"def element_dom_id(element)\n return \"\" if element.nil?\n \"#{element.name}_#{element.id}\".html_safe\n end",
"def dom_id\n form_node['id']\n end",
"def dom_id\n self.class.dom_id_class.new(self).call\n end",
"def id\n id = attr('id')\n return id unless id == \"\"\n \n @@element_id_count += 1\n id = \"red_query_elem_#{@@element_id_count}\"\n attr('id', id)\n return id\n end",
"def dom_id(record, prefix = T.unsafe(nil)); end",
"def dom_id(object, prefix=nil)\n \"#{prefix ? prefix.to_s + '_' : nil}#{object.class.name}_#{object.id}\"\n end",
"def dom_id\n ActionController::RecordIdentifier.dom_id model\n end",
"def dom_identifier\n self.identifier.gsub(/\\//, '-')\n end",
"def unique_id\n id || @generated_dom_id || (@generated_dom_id = Time.now.to_f.to_s.gsub('.', '_'))\n end",
"def target_id\n attr_val('./*/cda:id/@root')\n end",
"def id\n attr_val('cda:act/cda:id/@root')\n end",
"def dom_id(suffix = nil)\n [@html_options[:dom_prefix], suffix].reject(&:blank?).join(\"_\")\n end",
"def element_id what\n \"#{object_type}_#{what}\"\n end",
"def input_dom_id(key)\n \"#{object_name}_#{key.to_s}\"\n end",
"def dom_id(suffix = nil)\n [@dom_prefix, name, suffix].reject(&:blank?).join(\"_\")\n end",
"def html_id_for obj\n return '' if obj.nil?\n \"#{obj.model_name.element.dasherize}-#{obj.id}\"\n end",
"def content_dom_id(content)\n return \"\" if content.nil?\n if content.class == String\n a = Content.find_by_name(content)\n return \"\" if a.nil?\n else\n a = content\n end\n \"#{a.essence_type.underscore}_#{a.id}\"\n end",
"def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end",
"def id\n `return #{@element}.id ? #{self}.Y(#{@element}.id) : #{nil};`\n end",
"def create_html_id\n self.html_id = title.blank? ? \"element-unnamed\" : title.downcase.gsub!(/[^a-zA-Z0-9\\-_]+/, '-')\n end",
"def id\n return @doc.xpath('//mets:metsHdr/@ID').to_s\n end",
"def id() end",
"def get_id(node)\n node.parent.parent.attributes[\"id\"].value\n end",
"def model_html_id(base)\n name = base.to_s.strip\n unless name.end_with?(*RESERVED_SUFFIX)\n FIELD_PREFIX.find { |prefix| name.delete_prefix!(prefix) }\n end\n name = 'None' if name.blank?\n html_id(name, camelize: true)\n end",
"def get_id()\n return @doc_name\n end",
"def html_id(record)\n \"#{record.class.name.underscore}_#{record[:id].to_i}\"\n end",
"def id\n attribute('id', 'id')\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def get_unique_dom_id( prefix, target_datetime )\n \"#{prefix}_#{target_datetime}\".gsub(/[òàèùçé^!\"'£$%&?.,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-')\n end",
"def content_dom_id(content)\n\t\t\t\treturn \"\" if content.nil?\n\t\t\t\tif content.class == String\n\t\t\t\t\tc = Content.find_by_name(content)\n\t\t\t\t\treturn \"\" if c.nil?\n\t\t\t\telse\n\t\t\t\t\tc = content\n\t\t\t\tend\n\t\t\t\t\"#{c.essence_type.demodulize.underscore}_#{c.id}\"\n\t\t\tend",
"def id\n @id ||= node.attr :tid\n end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def set_node_id(document, namespace, node, position)\n node_id = \"#{node.downcase}-#{SecureRandom.uuid}\"\n document.at(\"xmlns|#{node}\", xmlns: namespace)['wsu:Id'] = node_id\n @header_template.css('dsig|Reference')[position]['URI'] = \"##{node_id}\"\n\n node_id\n end",
"def ext_id id\n \"#{@master_node}|#{id}\"\n end",
"def css_id name\n attr \"##{name}\"\n end",
"def tracking_number\n @root.attribute(\"ID\").to_s\n end",
"def tracking_number\n @root.attribute(\"ID\").to_s\n end",
"def id\n\t\t@id ||= \"#{page_id.nil? ? 0 : page_id}_#{part}_#{position}\"\n\tend",
"def generate_id\n if @document.attributes.has_key? 'sectids'\n sep = @document.attributes['idseparator'] || '_'\n pre = @document.attributes['idprefix'] || '_'\n base_id = %(#{pre}#{title.downcase.gsub(REGEXP[:illegal_sectid_chars], sep).tr_s(sep, sep).chomp(sep)})\n # ensure id doesn't begin with idprefix if requested it doesn't\n if pre.empty? && base_id.start_with?(sep)\n base_id = base_id[1..-1]\n base_id = base_id[1..-1] while base_id.start_with?(sep)\n end\n gen_id = base_id\n cnt = 2\n while @document.references[:ids].has_key? gen_id\n gen_id = \"#{base_id}#{sep}#{cnt}\"\n cnt += 1\n end \n gen_id\n else\n nil\n end\n end",
"def _id\n @id\n end",
"def id\n return @poco_data[:id] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:id'))\n end",
"def element_id(str)\n find_element(:id, str)\n end",
"def object_id() end",
"def id\n __id\n end",
"def it_doc_id\n type_name + ' ' + self.id.to_s\n end",
"def id\n name.gsub /-/, '_'\n end",
"def auto_id\n fauto_id = @form.auto_id\n fauto_id ? fauto_id % @html_name : ''\n end",
"def oid\n id(get_oid())\n end",
"def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end",
"def get_node_id(node)\n node[\"self\"].split('/').last\nend",
"def urn_id; :id end",
"def urn_id; :id end",
"def id_number; end",
"def header_id(n)\n \"#{n.dom_id}_header\"\n end",
"def __id__() end",
"def generate_doc_id\n self.class.generate_doc_id\n end",
"def id(path)\n if @root\n fs_id = @root.node_id(path)\n \" <#{fs_id.unparse}>\"\n else\n \"\"\n end\n end",
"def id\n @document.fetch('id')\n end",
"def to_identifier\n \"#{self.document_template.identifier}::#{self.identifier}\"\n end",
"def id_base\n \"#{@page_config.name}_#{parent_field_id}#{@field_name}\"\n end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def id\n @node.id\n end",
"def form_element_id\n \"#{self.model_name}_#{self.column_name}\"\n end",
"def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end",
"def label_id\n input_dom_id\n end",
"def dom_id(record_or_class, prefix = nil)\n raise ArgumentError, \"dom_id must be passed a record_or_class as the first argument, you passed #{record_or_class.inspect}\" unless record_or_class\n\n record_id = record_key_for_dom_id(record_or_class) unless record_or_class.is_a?(Class)\n if record_id\n \"#{dom_class(record_or_class, prefix)}#{JOIN}#{record_id}\"\n else\n dom_class(record_or_class, prefix || NEW)\n end\n end",
"def identifier\n @document.xpath('/xmlns:mediapackage/@id', {'xmlns' => XML_NS_MEDIAPACKAGE}).first.value\n end",
"def relationship_div_id(relationship, item, in_window = false)\n \"#{@model_ui.relationships[relationship.name].view_def.id_fragment}::#{relationship.name}::#{item.id}::#{relationship.class_name}#{'::win' if in_window}\"\n end",
"def id\n solr_document.fetch('id').sub(/^id-/, '')\n end",
"def identifier\n id_value || super\n end",
"def id; 1; end",
"def id\n @customFieldId\n end",
"def convert_dom_id(id)\n RawJS.new(\"#{format_type_to_js(id)}.replace(/^#*/, '#')\")\n end",
"def field_id(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n\n %(id=\"#{id_base}#{extra}\")\n end",
"def select_cdm_identifier(record, _context)\n uri = record.xpath(ID_XPATH, NS).map(&:text).reject(&:blank?)\n uri.first if uri.any?\n end",
"def id\n `$q(this.__native__.id||nil)`\n end",
"def get_id()\n return @id\n end",
"def node_id(r)\n r.send(data_class.primary_key)\n end",
"def id\n special_attribute('@rid'.freeze)\n end",
"def wrapper_id\n %(id=\"#{id_base}_field_wrapper\")\n end",
"def get_id()\n @id\n end",
"def get_id()\n @id\n end",
"def js_id\n @js_id ||= parent.nil? ? @item_id : [parent.js_id, @item_id].join('__')\n end",
"def id\n code\n end"
] | [
"0.80329716",
"0.796256",
"0.7962211",
"0.7962211",
"0.7850982",
"0.78440744",
"0.7729735",
"0.7729735",
"0.7729735",
"0.7729735",
"0.7686059",
"0.759315",
"0.7581771",
"0.74917203",
"0.7451999",
"0.73669267",
"0.7260476",
"0.72356546",
"0.7172572",
"0.7124794",
"0.71100366",
"0.6996973",
"0.6981816",
"0.6976337",
"0.6949573",
"0.6915418",
"0.6903853",
"0.6851358",
"0.68023974",
"0.67578435",
"0.6746467",
"0.67439324",
"0.67399347",
"0.6682927",
"0.6682897",
"0.66508895",
"0.66467106",
"0.66451406",
"0.6644697",
"0.6633029",
"0.66300213",
"0.65484005",
"0.65484005",
"0.654006",
"0.65340805",
"0.6502748",
"0.64919776",
"0.64884454",
"0.64840084",
"0.64631706",
"0.6429868",
"0.6429868",
"0.6410261",
"0.6409814",
"0.64078444",
"0.6353936",
"0.6340544",
"0.633858",
"0.6330175",
"0.6301962",
"0.6290434",
"0.62866503",
"0.62817806",
"0.62768567",
"0.6266794",
"0.6252176",
"0.6252176",
"0.62520254",
"0.6237403",
"0.62318236",
"0.622822",
"0.6226813",
"0.6222278",
"0.6221559",
"0.62120664",
"0.62111765",
"0.62111765",
"0.62078434",
"0.6207319",
"0.6200845",
"0.6197639",
"0.61967754",
"0.6193188",
"0.6187997",
"0.61843574",
"0.61835796",
"0.61609966",
"0.61548126",
"0.61528534",
"0.61493117",
"0.61386985",
"0.61364955",
"0.6133864",
"0.61334753",
"0.613013",
"0.6122355",
"0.6116395",
"0.6116395",
"0.61132455",
"0.61132324"
] | 0.69046843 | 26 |
strip to include white space | def cold_shoulder? remark
'' == remark.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end",
"def strip() end",
"def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end",
"def rstrip() end",
"def trim_whitespace; end",
"def rstrip!() end",
"def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end",
"def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end",
"def dewhitespace\n gsub(/\\s+/,' ').strip\n end",
"def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end",
"def strip_whitespace!\n replace(self.strip_whitespace)\n end",
"def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end",
"def strip_squeeze\n strip.squeeze(\" \")\n end",
"def trim_whitespace\n @expression.strip!\n end",
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def lstrip\n `return self.replace(/^\\s*/, '');`\n end",
"def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end",
"def lstrip() end",
"def strip!() end",
"def strip_leading_whitespace(text)\n return text if text.empty?\n leading_spaces = text.lines.first[/^(\\s+)/, 1]\n text.gsub(/^#{leading_spaces}/, '')\n end",
"def compact_whitespace s\n s.gsub(/\\s+/, ' ').gsub(/>\\s</, '><').strip\n end",
"def evaporate\n self.gsub(/\\s/, '')\n end",
"def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end",
"def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end",
"def strip(s)\n Sanitize.clean(s)\n end",
"def trim_all_whitespace(text)\n text.to_a.map do |line|\n left_spacing(line) + line.squeeze(\" \").squeeze(\" \").lstrip #the 2. is a tab\n end.join\n end",
"def tighten\n gsub(/[\\t ]+/,' ').strip\n end",
"def scrub\n self.gsub(/[^a-zA-Z\\s0-9\\.]/, '').gsub(/\\t/, ' ').gsub(/\\r/, ' ').gsub(/\\s\\s/, '').lstrip.rstrip\n end",
"def strip_whitespace\n code.gsub!(WHITESPACE_REGEX, ' ')\n\n code\n end",
"def strip_leading_whitespace(str)\n str.gsub(/^(\\s+)/, '').gsub(/^->/, '')\n end",
"def strip(str); end",
"def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend",
"def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend",
"def sstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/^(#{str})+|(#{str})+$/, '')\n end",
"def lstrip!() end",
"def strong_strip\n reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '').reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '')\n end",
"def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend",
"def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend",
"def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.gsub(/^\\s*$/, '')\n end",
"def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end",
"def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end",
"def strip_all_spaces(text)\n text&&text.gsub(/ |\\xC2\\xA0|\\xA0/, ' ').strip\n end",
"def remove_whitespace\n # NOTE: According to the docs, \\s only matches [ \\t\\r\\n\\f], i.e. it does not\n # match e.g. non-breaking space ( ). The POSIX character class\n # [[:space:]] does match non-breaking space. This is relevant because\n # in Heroku, space in ENV variables might be translated as  .\n # DOC: http://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Character+Classes\n # SOURCE: http://stackoverflow.com/a/13288542\n gsub(/[[:space:]]/, '')\n end",
"def force_strip(str)\n str[0] = \"\"\n end",
"def removeWhitespace(a)\n\toutString = \"\"\n\ta.split(\"\").each do |i|\n\t\toutString += i unless i == \" \"\n\tend\n\treturn outString\nend",
"def stripped\n @stripped ||= strip @text\n end",
"def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end",
"def strip\n with_command \"-strip\"\n end",
"def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end",
"def white_out(str)\n str.delete(\" \\n\\t\")\nend",
"def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n end",
"def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n self.complement_title = self.complement_title.strip\n end",
"def strip(*fields)\n sanitize(*fields) { |value| value.strip }\n end",
"def strip_whitespace\n self.tags = tags.gsub(/\\s+/, '')\n # self.tags = tags.strip\n self.title = title.strip\n self.description = description.strip\n # self.keywords = keywords.strip\n self.body = body.strip\n end",
"def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end",
"def remove_whitespace\n self.name = self.name.strip\n self.phone = self.phone.strip\n end",
"def sans_whitespace_and_commas\n @str.gsub(' ', '').gsub(',', '')\n end",
"def sstrip(str)\n self.dup.tap { |duped|\n duped.sstrip!(str)\n }\n end",
"def strip!\n \"\"\n end",
"def trim(**props)\n transform(type: :trim, **props) do |value|\n if value\n value = value.strip\n value = nil if value.empty?\n end\n value\n end\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend",
"def clean( input )\n input.gsub( %r/\\s+/, '' )\n end",
"def remove_whitespace\n self.first_name = self.first_name.strip\n self.last_name = self.last_name.strip\n self.biography = self.biography.strip\n end",
"def admin_strip_text(str)\n\t\tstr.gsub(/\\t|\\n/,'')\n\t\tstr.strip\n\tend",
"def strip_trailing_whitespace(text)\n text.split(\"\\n\").collect(&:strip).join(\"\\n\")\n end",
"def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end",
"def strip_trailing_whitespace\n %w( title abstract year ).each {|attribute|\n self.send(attribute).to_s.strip!\n }\n end",
"def strip_surrounding_empty_lines(str)\n str.sub(/\\A[[:space:]]*^/, \"\")\n .sub(/$[[:space:]]*\\z/, \"\")\n end",
"def lsstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/^(#{str})+/, '')\n end",
"def unprocessed(value)\n return value.strip if value.respond_to? :strip\n value\n end",
"def remove_whitespace\n self.time = self.time.strip\n self.description = self.description.strip\n self.venue = self.venue.strip.downcase\n self.location = self.location.strip.downcase\n end",
"def rsstrip!(str)\n str = Regexp.quote(str)\n self.gsub!(/(#{str})+$/, '')\n end",
"def strip_unwanted!(filter)\n substitute!(filter, '')\n end",
"def left_strip(str)\n output = \"\"\n whitespace = \"\\n\\t \"\n i = 0\n left = true\n while i < str.length\n if !left\n output << str[i]\n elsif !whitespace.include? str[i]\n left = false\n output << str[i]\n end\n i+=1\n end\n return output\nend",
"def strip_selector_space!\n replace self.gsub(/\\n/, \"\").gsub(\",\", \", \").gsub(\", \", \", \")\n end",
"def trim_whitespace=(_arg0); end",
"def no_space(x)\n x.gsub(\" \", \"\")\nend",
"def cleanup(txt)\n txt.gsub(/[^a-z]/i, ' ').squeeze(' ')\nend",
"def strip_blanks\n self.title = self.title.strip\n self.unit = self.unit.strip\n end",
"def cleanup(input)\n input.gsub(/[^a-zA-Z]/, ' ').squeeze(' ')\nend",
"def remove_whitespaces(myString)\n\treturn myString.gsub(/\\s+/, \"\")\nend",
"def remove_whitespace\n self.title = self.title.strip\n self.description = self.description.strip\n end",
"def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end",
"def whitespace\n @input = @input.gsub(/\\ +/, ' ').strip\n end",
"def cleanup(string)\n string.gsub(/[^a-z0-9]/, \" \").gsub(/\\s+/, \" \")\n # string.gsub(/[^a-z]/, ' ').squeeze(' ')\nend",
"def space_out\n gsub(/(.)/, ' \\1')\n end",
"def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend",
"def normalize_whitespace!\n @raw.gsub!(/\\s+/, ' ')\n end",
"def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end",
"def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end",
"def remove_whitespace\n self.attributes.each { |key, value| self[key] = value.strip if value.respond_to?(:strip) }\n end",
"def strip_string string\n string.strip\n end",
"def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end",
"def cleanup(str)\n str.gsub(/([^a-z])/, ' ').squeeze(' ')\nend",
"def clean(line)\n line.chomp.strip\n end",
"def stripped_content\n\t\treturn self.content.gsub( /<.*?>/, '' ).tr( \"\\n\\t \", ' ' ).strip\n\tend",
"def strip_lines(value)\n value.to_s.gsub(/\\n\\s*/, ' ')\n end",
"def rstrip_except_escapes(string)\n string.sub(/(?<!\\\\)\\s+$/, '')\n end",
"def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end",
"def clean!\r\n reject!(&:blank?)\r\n map!(&:strip)\r\n uniq!\r\n end"
] | [
"0.8197625",
"0.8144433",
"0.8090801",
"0.800083",
"0.7794926",
"0.77044857",
"0.77021885",
"0.76656526",
"0.76491493",
"0.7618722",
"0.7596349",
"0.75830305",
"0.7576805",
"0.7576669",
"0.75612",
"0.75612",
"0.7557862",
"0.746632",
"0.74662894",
"0.7427292",
"0.73818725",
"0.7376549",
"0.73449963",
"0.73402435",
"0.7247402",
"0.724154",
"0.72222465",
"0.7200265",
"0.71830815",
"0.71787983",
"0.7155116",
"0.7153407",
"0.7153407",
"0.71418464",
"0.71378624",
"0.7132509",
"0.71078557",
"0.71078557",
"0.710073",
"0.70918375",
"0.7087658",
"0.70768833",
"0.7049278",
"0.7043358",
"0.70329016",
"0.70010304",
"0.69839746",
"0.698358",
"0.6977225",
"0.6973696",
"0.6972834",
"0.69713473",
"0.69524086",
"0.6943123",
"0.6937702",
"0.69367504",
"0.69290084",
"0.6912582",
"0.6905457",
"0.69016945",
"0.68985474",
"0.6888392",
"0.68881243",
"0.6883881",
"0.68836385",
"0.6869645",
"0.68494976",
"0.6847922",
"0.6847667",
"0.6829384",
"0.6821054",
"0.67955947",
"0.67916816",
"0.67902887",
"0.6782333",
"0.6777847",
"0.6774313",
"0.675564",
"0.6738244",
"0.67283636",
"0.6723138",
"0.6719746",
"0.67188364",
"0.67148286",
"0.6710963",
"0.67033756",
"0.6698328",
"0.6690762",
"0.66818726",
"0.66704196",
"0.66704196",
"0.6658332",
"0.6640566",
"0.66391575",
"0.66262174",
"0.66224444",
"0.66199625",
"0.6616144",
"0.66158813",
"0.66100323",
"0.6609473"
] | 0.0 | -1 |
def user_is_admin? return false if current_user.nil? return true if current_user.has_role?('admin') end | def user_is_track_owner?(track)
return false if current_user.nil?
return true if current_user.has_role?('admin')
current_user.is_track_owner?(track)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?\n current_user.role.eql?(\"admin\")\n end",
"def admin?\n current_user && current_user.role?(\"admin\")\n end",
"def is_admin\n return current_user.role == User::ADMIN\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def is_admin?\n current_user && current_user.admin?\n end",
"def admin?\n @current_user && @current_user.has_role?(:admin)\n end",
"def current_user_is_admin?\n current_user && current_user.is_admin\n end",
"def is_admin?\n current_user && current_user.admin\n end",
"def is_admin?\n current_user ? current_user.login == 'admin' : false\n end",
"def is_admin?\n !!current_user.admin if !!current_user\n end",
"def is_admin?\n current_user && current_user.try(:admin?)\n end",
"def is_admin?\n return false if !current_user\n current_user.admin?\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def is_admin?\n if logged_in?\n current_user.role == \"Admin\"\n end\n end",
"def current_user_admin?\n current_user && current_user.admin?\n end",
"def is_admin?\n current_user and current_user.is_admin?\n end",
"def is_admin?\n\t\trole == 'admin'\n\tend",
"def is_admin?\n\t\trole == 'admin'\n\tend",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def admin?\n logged_in? && current_user.has_role?(:admin)\n end",
"def is_admin? \n return (user_signed_in? and current_user.role == 1)\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def is_admin?\n role = self.role\n\n if(role == 'admin')\n return true\n else\n return false\n end\n end",
"def admin?\r\n\tif !current_user.administrator\r\n\t\treturn false;\r\n\telse\r\n\t\treturn true;\r\n\tend\r\nend",
"def admin_user?\n current_user.admin\n end",
"def current_admin?(user)\n current_user.admin?\n end",
"def admin?\n current_user.admin?\n end",
"def admin?\r\n has_role?(\"admin\")\r\n end",
"def admin?\n\t\thas_role?(:admin)\n\tend",
"def admin?\n if self.role == 'admin'\n true\n else\n false\n end\n end",
"def is_admin?\n self.role && self.role_name == \"Admin\"\n end",
"def admin?\n user_role_id == UserRole::ADMIN\n end",
"def is_admin?\n logged_in? && current_user && current_user.admin\n end",
"def admin?\n @current_user.admin?\n end",
"def is_admin?\n if @is_admin.nil?\n @is_admin = (current_user.has_role?('admin') == true)\n end\n \n @is_admin\n end",
"def is_admin?\n self.role == ROLES[:admin]\n end",
"def is_admin?(user)\n user.admin > 0\n end",
"def is_admin?\n role == :admin\n end",
"def is_admin?\n determine_user_role\n if @admin_user || @superadmin_user\n return true\n else\n return false\n end\n end",
"def current_user_is_admin?\n roles.include?(ADMIN_ROLE)\n end",
"def is_admin\n current_user.admin?\n end",
"def admin?\n\t\tcurrent_user.try(:admin)\n\tend",
"def is_admin?\n role == 'admin'\n end",
"def is_admin?\n role == 'admin'\n end",
"def is_admin?\n role == 'admin'\n end",
"def admin?\n current_user.admin?\n end",
"def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend",
"def admin?\n return self.role == \"admin\"\n end",
"def admin?\n return self.role == \"admin\"\n end",
"def admin?\n has_role?(:admin)\n end",
"def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end",
"def admin?\n role?('admin')\n end",
"def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def checkAdmin\n current_user.present? && current_user.isAdmin\n end",
"def is_admin?\n is_admin == 1\n end",
"def admin?\n if(@current_user)\n @current_user.admin?\n end\n end",
"def admin?\n logged_in? && current_user.admin?\n end",
"def admin_user\n (current_user.present? && current_user.admin?)\n end",
"def admin?\n role == :admin\n end",
"def admin?\n role?(UserRoles::ADMIN)\n end",
"def is_admin?\n (self.role =~ /admin/) == 0 ? true : false\n end",
"def admin?\n user.admin?\n end",
"def admin?\n role == 'admin'\n end",
"def admin?\n role == 'admin'\n end",
"def admin? \n role == 'admin'\n end",
"def admin?\n logged_in? and current_user.admin?\n end",
"def admin?\n has_role? :admin\n end",
"def admin?\n role == 1\n end",
"def admin?\n self.role == 'admin'\n end",
"def admin?\n self.role == 'admin'\n end",
"def admin?\n self.role == 'admin'\n end",
"def logged_in_as_admin?\n !current_admin.nil?\n end",
"def admin?\n role == \"admin\"\n end",
"def is_admin?\n self.role_id.present? && ADMIN_ROLE_ID == self.role_id\n end",
"def is_admin\n if self.role_as_admin.size > 0\n return true\n else\n return false\n end\n end",
"def is_admin?\n return false unless logged_in?\n user = User.find_by_id(current_user)\n user.userstatus.status == \"admin\" ? true : false\n end",
"def current_admin\n \tcurrent_user && current_user.has_role?(:admin)\n\tend",
"def current_user_is_admin?\n signed_in? && current_user.admin?\n end",
"def is_admin?\n self.role.role_name == \"Admin\"\n end",
"def is_admin?\n \trole.name == 'Administrator'\n end",
"def admin?\n @user = current_user.is_admin?\n end",
"def admin_user?\n self.admin ==true\n end",
"def admin?\n if role == \"admin\"\n return true\n end\nend",
"def logged_in_as_admin?\n current_admin != :false\n end",
"def is_admin?\n if valid_session?\n current_user.admin == true\n end\n end",
"def admin?\n self.role == 'Admin'\n end",
"def admin_logged_in?\n current_user && current_user.admin?\n end",
"def is_admin?\n current_user && current_user.site=='admin'\n end",
"def is_admin?\n admin?\n end",
"def me_admin?\n signed_in? && current_user.role == \"admin\"\n end",
"def admin?\n self.role == Role.admin\n end",
"def admin?\n @user.admin?\n end",
"def is_admin?\n\t current_account.user.is_a?(Administrator)\n\tend",
"def admin?\n has_role?(:admin) || has_role?(:admin, :any)\n end",
"def current_user_is_admin?(node)\n current_user_has_role?('admin', node)\n end",
"def admin?\n User.admin_logged_in?\n end",
"def current_user_admin?\n current_user&.admin?\n end"
] | [
"0.9451987",
"0.9422624",
"0.9343366",
"0.934293",
"0.93067676",
"0.9298518",
"0.9260927",
"0.9259483",
"0.9259443",
"0.9252591",
"0.9252501",
"0.92288095",
"0.9227162",
"0.92150295",
"0.9199699",
"0.91962487",
"0.91683704",
"0.91683704",
"0.9167297",
"0.9167297",
"0.9167297",
"0.9167297",
"0.9167297",
"0.91352767",
"0.91260815",
"0.9119839",
"0.9113168",
"0.9112733",
"0.9111969",
"0.9098989",
"0.9097538",
"0.9096772",
"0.9095566",
"0.9093044",
"0.90869564",
"0.90840626",
"0.9083466",
"0.90824836",
"0.90821254",
"0.9079455",
"0.9078356",
"0.90779155",
"0.9074833",
"0.90735745",
"0.90727407",
"0.9062448",
"0.9062448",
"0.9062448",
"0.9054672",
"0.90543413",
"0.9049904",
"0.9049904",
"0.9046245",
"0.9045791",
"0.9044401",
"0.9042984",
"0.9035112",
"0.9012294",
"0.90094304",
"0.9003962",
"0.9003204",
"0.89922583",
"0.898689",
"0.8986244",
"0.8982614",
"0.89825743",
"0.89804494",
"0.89804494",
"0.8974771",
"0.8972777",
"0.89716357",
"0.89686745",
"0.8965945",
"0.8965945",
"0.8965945",
"0.89643174",
"0.89619356",
"0.8959844",
"0.89533925",
"0.8948801",
"0.89478153",
"0.89467806",
"0.8933928",
"0.8933721",
"0.89316046",
"0.8927925",
"0.8926269",
"0.89208466",
"0.8920606",
"0.8920535",
"0.8919848",
"0.89193743",
"0.89180785",
"0.8911185",
"0.890841",
"0.8897345",
"0.8896469",
"0.88959575",
"0.8889255",
"0.8879307",
"0.8877351"
] | 0.0 | -1 |
functions defined after this section are direct ================ Direct Functions START ================ | def index
self.merchants_index_preliminary_actions
self.set_vendor_products
self.set_flash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal; end",
"def private; end",
"def probers; end",
"def isolated; end",
"def isolated; end",
"def custom; end",
"def custom; end",
"def functions\n\n end",
"def operations; end",
"def operations; end",
"def who_we_are\r\n end",
"def wrapper; end",
"def external; end",
"def weber; end",
"def schubert; end",
"def trd; end",
"def stderrs; end",
"def dh; end",
"def implementation; end",
"def implementation; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def invention; end",
"def anchored; end",
"def extended(*) end",
"def refutal()\n end",
"def silly_adjective; end",
"def normal\n end",
"def normal\n end",
"def standard\n end",
"def how_it_works\r\n end",
"def in_law; end",
"def sld; end",
"def processor; end",
"def spouse; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods() end",
"def berlioz; end",
"def gounod; end",
"def terpene; end",
"def suivre; end",
"def villian; end",
"def extra; end",
"def accessibility; end",
"def herald; end",
"def hd\n \n end",
"def specialty; end",
"def operation; end",
"def formation; end",
"def common\n \n end",
"def scientist; end",
"def original; end",
"def pass; end",
"def pass; end",
"def directives; end",
"def directives; end",
"def private_method\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def plain; end",
"def jack_handey; end",
"def under; end",
"def usage; end",
"def usage; end",
"def ibu; end",
"def r; end",
"def r; end",
"def transact; end",
"def p15\n\t\nend",
"def calls; end",
"def calls; end",
"def public; end",
"def public; end",
"def internal_methods; end",
"def rest_positionals; end",
"def diagnostic; end",
"def intensifier; end",
"def strain; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def rossini; end",
"def internal?; end",
"def expanded; end",
"def handle; end",
"def lsi; end",
"def explicit; end",
"def guct\n end",
"def alt; end",
"def ignores; end"
] | [
"0.6908098",
"0.6833622",
"0.6710157",
"0.65541476",
"0.65541476",
"0.6428371",
"0.6428371",
"0.639278",
"0.63871497",
"0.63871497",
"0.63785154",
"0.62970275",
"0.6290221",
"0.6262175",
"0.6236859",
"0.62321687",
"0.62071174",
"0.62058884",
"0.6180638",
"0.6180638",
"0.61546975",
"0.61546975",
"0.61546975",
"0.61546975",
"0.61511713",
"0.6143503",
"0.6117647",
"0.6087413",
"0.60772306",
"0.60723823",
"0.60723823",
"0.6034983",
"0.60180223",
"0.60069656",
"0.60012406",
"0.59878284",
"0.5983835",
"0.59838307",
"0.59838307",
"0.59838307",
"0.59838307",
"0.59826183",
"0.5977031",
"0.5971821",
"0.5971566",
"0.59380233",
"0.5928201",
"0.5924284",
"0.58687",
"0.5850319",
"0.5846802",
"0.5840034",
"0.58388495",
"0.58250034",
"0.5823578",
"0.57989746",
"0.5788825",
"0.5784233",
"0.5784233",
"0.577395",
"0.577395",
"0.576214",
"0.57592016",
"0.57592016",
"0.57592016",
"0.5758388",
"0.5750224",
"0.574161",
"0.5740026",
"0.5740026",
"0.5737669",
"0.572474",
"0.572474",
"0.5724092",
"0.571527",
"0.5701228",
"0.5701228",
"0.5696615",
"0.5696615",
"0.5689153",
"0.5670747",
"0.56701595",
"0.56697714",
"0.5667421",
"0.56651914",
"0.56651914",
"0.56651914",
"0.56651914",
"0.56651914",
"0.56651914",
"0.56651914",
"0.56651914",
"0.5657434",
"0.5648932",
"0.5635232",
"0.5619772",
"0.56150097",
"0.5609985",
"0.5609128",
"0.56061256",
"0.55939597"
] | 0.0 | -1 |
================ Direct Functions END ================ functions defined after this section are auxillary ================ Auxillary Functions START ================ | def merchants_index_preliminary_actions
# This variable is set to make the tab highlighted when its clicked.
@from = "pricelist"
# This method is called from application_controller, this will set the logged_in_login_name instance variable which will always hold the login_name using which the merchant authenticated.
set_logged_in_merchant
if (params[:vendor_id].nil?)
#This method is called from the same file to set the type, vendor and vendor_id instance variables from the current_merchant method called from application_controller which creates a current_merchant instance variable based on the vendor_id mapped to the current login_name and password.
set_type_vendor_vendor_id
else
#This method is called from the same file to set the type, vendor and vendor_id instance variables from the vendor_id chosen by a default vendor from the select drop down menu.
set_type_vendor_vendor_id(params[:vendor_id].to_i)
end
# This method is called from the same file to set the branches select drop down which will display the list of branches for the current vendor.
set_branches(@vendor.first.vendor_name)
# The model_name instance variable will be set by this method from the current_merchant instance variable
self.set_model_name
if(!session[:notifications_count].nil?)
title = "CrawlFish - Merchant Login - Price List"
get_vendor_coupons_count(@vendor_id.to_i,title)
else
@meta_merchant_login_title = 'CrawlFish - Merchant Login - Price List'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal; end",
"def custom; end",
"def custom; end",
"def private; end",
"def extra; end",
"def probers; end",
"def external; end",
"def extended(*) end",
"def isolated; end",
"def isolated; end",
"def trd; end",
"def operations; end",
"def operations; end",
"def berlioz; end",
"def extra_state; end",
"def specialty; end",
"def functions\n\n end",
"def upc_e; end",
"def suivre; end",
"def stderrs; end",
"def ibu; end",
"def refutal()\n end",
"def extra=(_arg0); end",
"def diagnostic; end",
"def silly_adjective; end",
"def upc_a; end",
"def terpene; end",
"def dh; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def villian; end",
"def alt; end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def malts; end",
"def in_law; end",
"def wrapper; end",
"def invention; end",
"def lsi; end",
"def final; end",
"def implementation; end",
"def implementation; end",
"def transformations; end",
"def recup_handle\n\t\t\n\tend",
"def anchored; end",
"def weber; end",
"def intensifier; end",
"def schubert; end",
"def jack_handey; end",
"def incomplete\r\n\r\n end",
"def rest_positionals; end",
"def who_we_are\r\n end",
"def appraisals; end",
"def appraisals; end",
"def aux\n 'aux'\n end",
"def processor; end",
"def probers=(_arg0); end",
"def x______________STRUCTURE\r\nend",
"def x______________STRUCTURE\r\nend",
"def original; end",
"def Com6 # Recuperation Info\n \n end",
"def post_process; end",
"def code_of_conduct; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def postproc; end",
"def identify; end",
"def medical_use; end",
"def sld; end",
"def ca; end",
"def formation; end",
"def common\n \n end",
"def user_os_complex\r\n end",
"def init_ext()\n \n end",
"def under_construction\n end",
"def ext; end",
"def ext; end",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def standard\n end",
"def sub_c\n end",
"def production_curtailment; end",
"def hd\n \n end",
"def tld; end",
"def tld; end",
"def extension=(_arg0); end",
"def extension=(_arg0); end",
"def extra; @extra; end",
"def internal_methods; end",
"def herald; end",
"def operation; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def callbacks; end",
"def callbacks; end"
] | [
"0.6465548",
"0.6427167",
"0.6427167",
"0.6295827",
"0.6267347",
"0.625292",
"0.62055826",
"0.613279",
"0.6004328",
"0.6004328",
"0.59019345",
"0.5856988",
"0.5856988",
"0.58116364",
"0.578667",
"0.57703054",
"0.5767531",
"0.5765681",
"0.5701749",
"0.5687361",
"0.56785667",
"0.5656421",
"0.5628303",
"0.5621849",
"0.5611563",
"0.5610661",
"0.5607881",
"0.55966836",
"0.5592551",
"0.5592551",
"0.5592551",
"0.5592551",
"0.5587838",
"0.5585669",
"0.55687416",
"0.55687416",
"0.55687416",
"0.5560962",
"0.5542897",
"0.55425537",
"0.55402666",
"0.55380213",
"0.5535253",
"0.5524898",
"0.5524898",
"0.5523835",
"0.5522598",
"0.5509546",
"0.5506889",
"0.5499478",
"0.5498544",
"0.5497316",
"0.5484933",
"0.54621696",
"0.54549307",
"0.5435977",
"0.5435977",
"0.54302675",
"0.5429808",
"0.5419956",
"0.5414352",
"0.5414352",
"0.5413427",
"0.5402874",
"0.53927",
"0.5388754",
"0.5384343",
"0.5384343",
"0.5384343",
"0.5370727",
"0.53589416",
"0.5352056",
"0.5348429",
"0.53470695",
"0.5342035",
"0.5336402",
"0.53317493",
"0.5321607",
"0.5318931",
"0.53131276",
"0.53131276",
"0.5312937",
"0.5312937",
"0.531267",
"0.53089184",
"0.5304415",
"0.52907807",
"0.5288769",
"0.5288769",
"0.5283227",
"0.5283227",
"0.5282221",
"0.52816635",
"0.5280384",
"0.5276195",
"0.52598125",
"0.52598125",
"0.52598125",
"0.52598125",
"0.52562106",
"0.52562106"
] | 0.0 | -1 |
Updates the updated_at column on all the variants associated with this option value. | def touch_all_variants
variants.find_each(&:touch)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_updated_at\n if able_to_set_updated_at?\n self.updated_at = Time.configured.now unless updated_at_changed?\n end\n\n clear_timeless_option\n end",
"def set_updated!\n @updated_at = Time.now\n end",
"def _update_timestamps\n if self.respond_to?('updated_at')\n self.updated_at = Time.now\n end\n end",
"def updated=(val)\n parsed = parse_datetime(val)\n @updated = parsed if parsed && (!@updated || parsed > @updated)\n end",
"def set_target_updated_on_save\n self.target_updated_at = target.updated_at\n end",
"def updated=(val)\n parsed = parse_datetime(val)\n @updated = parsed if !@updated || parsed > @updated\n end",
"def updated=(val)\n parsed = parse_datetime(val)\n @updated = parsed if !@updated || parsed > @updated\n end",
"def update\n set_deltatime\n set_last_update_at\n end",
"def updated=(new_updated)\n @updated = new_updated\n end",
"def updated(opts={})\n ordered(:updated_at)\n date_time_filter(:updated_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end",
"def updated_at=(value)\n @updated_at = DateTime.parse(value)\n end",
"def update_timestamp(value)\n self.class.update_all ['updated_at = ?', value], ['id = ?', id]\n reload\n end",
"def update \n update = object.updated_at\n end",
"def update_active_for_variants\n if self.variants.present? and self.active_changed?\n self.variants.each do |variant|\n variant.update_column(:active, self.active)\n end\n end\n end",
"def updated_at\n @updated_at ||= parse_or_at(@attrs[:updated_at]) if @attrs[:updated_at]\n end",
"def mark_as_updated\n update_column( :updated_at, Time.now )\n Observation.delay(\n run_at: 10.minutes.from_now,\n priority: INTEGRITY_PRIORITY,\n unique_hash: { \"Observation::elastic_index\": id }\n ).elastic_index!( ids: [id] )\n end",
"def bump_timestamps\n self.updated_at = Time.now.utc\n end",
"def updated_at\n I18n.l(self.__source.updated_at, format: :short)\n end",
"def update!(**args)\n @virtual_time = args[:virtual_time] if args.key?(:virtual_time)\n end",
"def updated_at\n @updated_at ||= Time.parse(@attributes['updated_at'])\n end",
"def salesforce_updated_at=(updated_at)\n updated_at = Time.parse(updated_at) if updated_at.present? && updated_at.kind_of?(String)\n write_attribute(:salesforce_updated_at, updated_at)\n end",
"def updated_at\n Time.at @updated rescue nil\n end",
"def update_good_variants_with_default_value\n associated_variants.update_all [ \"#{ variant_column } = ?\", default_value ]\n end",
"def updated=(v)\n case v\n when Time, nil\n @updated = v\n when String\n @updated = Time.parse(v)\n else\n raise \"Not a Time\"\n end\n @updated \n end",
"def update_timestamp(*_args)\n current_time = current_time_from_proper_timezone\n\n write_attribute('updated_at', current_time) if respond_to?(:updated_at)\n write_attribute('updated_on', current_time) if respond_to?(:updated_on)\n end",
"def updated_at=(time)\n unless time.is_a?(Time)\n raise TypeError.new('updated_at must be a Time object')\n end\n @updated_at = time\n end",
"def updated(item)\n end",
"def updated_at\n @updated_at ||= begin\n updated_dates = [self[:updated_at] || self[:created_at] || Date.null_date.to_time]\n updated_dates += self.captions.collect{|c| c.updated_at }\n \n updated_dates.compact.max\n end\n end",
"def _updated_at(target)\n result = rate(@original, target)\n \n result[:updated_at]\n end",
"def updated_at\n formatted_time(object.updated_at)\n end",
"def after_update(updated)\n # not required\n end",
"def update(options)\n @values.merge!(options)\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def last_updated_date_time=(value)\n @last_updated_date_time = value\n end",
"def updated\n watchers.find_all(&:updated?)\n end",
"def do_update\n @logger.operation(:update) do\n run_svn(\"update\", get_tag_argument)\n end\n do_update_tag\n end",
"def on_update\n options[:on_update]\n end",
"def updated_at\n @gapi[\"updated\"]\n end",
"def updated_at\n DateTime.parse((solr_document[\"updated_at_dtsi\"] || solr_document[\"timestamp\"] || solr_document[\"created_at_dtsi\"]).to_s).utc\n end",
"def update_timestamps(columns_to_update)\n if model_class.columns.include?(:updated_at)\n columns_comparison = columns_to_update.map { |key|\n [\"#{model_class.table_name}__#{key}\".to_sym, \"excluded__#{key}\".to_sym]\n }.to_h\n update_condition = Sequel.~(columns_comparison) # only perform the update if at least one column differs\n updated_at_case = Sequel.case(\n [[update_condition, Sequel.function(:NOW)]],\n \"#{model_class.table_name}__updated_at\".to_sym # default value\n )\n { updated_at: updated_at_case }\n else\n { }\n end\n end",
"def update_variant_values\n higher_positioned_options.any? ? shift_variant_values : nullify_variant_values\n end",
"def updated_at\n @updated_at ||= Time.parse @updated_string if @updated_string\n end",
"def updated_at\n @updated_at ||= Time.parse @updated_string if @updated_string\n end",
"def set_timestamps\n return if skip_edited\n self.edited_at = self.updated_at\n return if skip_tagged\n return if replies.exists? && !status_changed?\n self.tagged_at = self.updated_at\n end",
"def updated_by_last_action(arg) # rubocop:disable TrivialAccessors\n @updated = arg\n end",
"def update_values\n end",
"def update_values\n end",
"def update!(**args)\n @dated_values = args[:dated_values] if args.key?(:dated_values)\n end",
"def set_update_time(time = last_modified_date)\n self.last_updated__c = ((last_updated__c and time < last_updated__c) ? last_updated__c : time) # fails migration ?\n# self.last_updated__c = self.last_modified_date # for migration\n end",
"def remote_update(*)\n super(changed)\n end",
"def updated_at_datetime\n @updated_at_datetime ||= DateTime.parse(@updated_at)\n end",
"def option_values(variant_id:)\n version_ids = option_values_version_ids(variant_id: variant_id)\n\n versions = PaperTrail::Version.where(id: version_ids)\n versions.map(&:reify)\n end",
"def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end",
"def updated_at_string\n @updated_string\n end",
"def updated_at_string\n @updated_string\n end",
"def updated_at\n dateChanged\n end",
"def updated_at(field = :updated_at)\n max = max_by{|o| o.send(field)}\n if max\n max.send(field)\n else\n Time.now\n end\n end",
"def after_save\n for a in changes.keys\n next if [\"updated_at\"].include? a\n oldv, newv = changes[a]\n e = Edit.new\n e.item_id = self.id\n e.attribute = a\n e.old_value = oldv\n e.new_value = newv\n e.save! # raises on failure\n end\n end",
"def updates_versions_of(*args, &block)\n # TODO\n end",
"def update(*args)\n each{|r| r.update(*args)}\n end",
"def updated\n ## todo/fix: use a new name - do NOT squeeze convenience lookup into existing\n # db backed attribute\n read_attribute_w_fallbacks( :updated, :published )\n end",
"def update\n update_all\n end",
"def updated\n DateTime.parse(@json['project']['meta']['updated'])\n end",
"def autolog_updated\n autolog_event(:updated)\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def refresh\n update_attributes({:updated_at => DateTime.parse(Time.now.to_s)})\n end",
"def update(updates = {})\n tap do |conf|\n updates.each_pair { |k, v| conf.send(:\"#{k}=\", v) }\n end\n end",
"def after_update_hook\n execute_hooks_for(:after, :update)\n end",
"def set_update_time!(time = last_modified_date)\n set_update_time(time)\n # disable_ferret\n save\n return last_updated__c\n end",
"def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end",
"def update\n @mtime = File.mtime(path)\n end",
"def update(options = {})\n run_hooks(:before, :update)\n options.each do |key, value|\n send(\"#{key}=\", value)\n end\n run_hooks(:after, :update)\n @persisted = false\n save\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: self.columns_changeable,\n columns_visible: self.columns_visible,\n filters: self.filters}.hash.to_s(36)[1..5]\n end",
"def update_all(updates)\n raise ArgumentError, \"Empty list of attributes to change\" if updates.blank?\n raise ArgumentError, \"updates must be a Hash\" unless updates.is_a? Hash\n run_update(updates)\n end",
"def updated_at(format = nil)\n if new?\n format ? Time.now.strftime(format) : Time.now\n else\n format ? self[:updated_at].strftime(format) : self[:updated_at]\n end\n end",
"def updating_all_timestamp_sql\n update_col = timestamp_attributes_for_update_in_model.first\n\n \", #{update_col} = ?\" if update_col\n end",
"def update(entry_id, start_date, end_date, options = {})\n end",
"def update_value_in_index(index, value)\n if value.respond_to? :update_index\n value.update_index(index, self)\n elsif value.is_a?(Hash) && value['version']\n update_value_in_index(index, value['value'])\n else\n index\n end\n end",
"def updated_at\n @udpated_at ||=\n Utilities.utc_to_localtime(@ldap_entry[:whenchanged].first)\n end",
"def reset_timestamp_attrs_for_update_if_needed\n return if live?\n @record.send(:timestamp_attributes_for_update_in_model).each do |column|\n @record.send(\"restore_#{column}!\")\n end\n end",
"def reset_timestamp_attrs_for_update_if_needed\n return if live?\n @record.send(:timestamp_attributes_for_update_in_model).each do |column|\n @record.send(\"restore_#{column}!\")\n end\n end",
"def update!(**args)\n @version_aliases = args[:version_aliases] if args.key?(:version_aliases)\n end",
"def update_timestamp\n self.fields_last_modified = {\n columns_changeable: columns_changeable,\n columns_visible: columns_visible,\n filters: filters\n }.hash.to_s(36)[1..5]\n end",
"def configure update\n return if update.nil?\n options.merge! update\n end",
"def update(opts); end",
"def updatedb\n @updatedb\n end",
"def update_variants\n # new_variants = []\n # variant_keys.each do |key|\n # new_variants += Move.where([\"name LIKE ?\", \"%#{key}%\"]).all\n # end\n\n # Yeah, this is not so pretty.\n regex = /#{variant_keys.join('|')}/i\n puts regex.inspect\n new_variants = Move.all.to_a.find_all { |m| m.name =~ regex }\n\n # This stuff doesn't change though\n new_variants.uniq!\n new_variants -= [self]\n self.variants.replace new_variants\n end",
"def set_completed_at_time\n self.update_attributes completed_at: Time.now\n end",
"def onUpdated(item)\n @object.updated(import(item))\n end",
"def updated_on\n updated_at\n end",
"def the_updated_at(format = :long)\n h.l(object.updated_at, format: format.to_sym)\n end",
"def update(values, opts = nil)\n raise NotImplementedError, NOTIMPL_MSG\n end",
"def force_updated_on_change\n if @current_journal || changed?\n self.updated_on = current_time_from_proper_timezone\n if new_record?\n self.created_on = updated_on\n end\n end\n end",
"def update\n run_callbacks :update do\n true\n end\n end",
"def update\n # TODO: implement update\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end",
"def last_update_date_time=(value)\n @last_update_date_time = value\n end"
] | [
"0.65122306",
"0.63043356",
"0.6237301",
"0.6066347",
"0.6012204",
"0.6001508",
"0.6001508",
"0.5990792",
"0.5951579",
"0.59422266",
"0.58961415",
"0.5848873",
"0.56863946",
"0.5604782",
"0.56018734",
"0.5587947",
"0.55159944",
"0.5379126",
"0.5367201",
"0.5360474",
"0.5348845",
"0.52995527",
"0.5262315",
"0.5228945",
"0.5181692",
"0.518168",
"0.51680857",
"0.5153168",
"0.5134749",
"0.5133319",
"0.5086145",
"0.5085201",
"0.50822955",
"0.50822955",
"0.50822955",
"0.50822955",
"0.5074753",
"0.5057785",
"0.50570416",
"0.5045304",
"0.5041835",
"0.5018203",
"0.4982406",
"0.4977283",
"0.4977283",
"0.4964326",
"0.49609533",
"0.49605054",
"0.49605054",
"0.4956428",
"0.49474338",
"0.49332485",
"0.49319804",
"0.4931528",
"0.49282137",
"0.49211866",
"0.49211866",
"0.49152917",
"0.49049574",
"0.49026904",
"0.4889008",
"0.48690838",
"0.48661166",
"0.48615113",
"0.485698",
"0.48556626",
"0.48481143",
"0.4843153",
"0.48233604",
"0.48229334",
"0.4816263",
"0.48124817",
"0.4810569",
"0.4798648",
"0.47861412",
"0.4766991",
"0.4764854",
"0.4761754",
"0.47590795",
"0.4748205",
"0.4745405",
"0.474476",
"0.474476",
"0.47365934",
"0.47272038",
"0.4720652",
"0.4719988",
"0.4713324",
"0.47070396",
"0.47045526",
"0.46979097",
"0.46975595",
"0.4692633",
"0.4680855",
"0.4672746",
"0.46715358",
"0.46669143",
"0.4665798",
"0.4665798"
] | 0.5068947 | 38 |
defines methods x, y, x=, y= | def initialize(x,y)
@x = x
@y = y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize x, y\n\t\t@x = x\n\t\t@y = y\n\tend",
"def initialize(x,y) # defines an instance method for the class\n @x, @y = x, y # Take the two parameters passed, => assign them to instance variables @x @y\n end",
"def set_x_y(x,y)\r\n @x=x\r\n @y=y\r\n self\r\n end",
"def initialize(x,y) # Initialize method \n @x,@y = x, y # Sets initial values for instance variables\n end",
"def initialize(x,y) # Initialize method\n @x,@y = x,y # Sets initial values for instance variables\n end",
"def set(x, y)\n @x, @y = x, y\n end",
"def initialize(x,y)\n @x, @y = x,y\n end",
"def initialize(x,y)\n @x, @y = x, y\n end",
"def initialize\n self.x, self.y = 0, 0\n end",
"def initialize(x, y)\n @x, @y = x, y\n end",
"def initialize(x, y)\n @x, @y = x, y\n end",
"def initialize(x,y)\n @x, @y = x,y\n end",
"def initialize(x,y) # Initialize method\n@x,@y = x, y\n# Sets initial values for instance variables\nend",
"def initialize(x,y)\n @x,@y = x, y\n end",
"def initialize(x,y)\n @x,@y = x,y\n end",
"def initialize(x,y)\r\n @x = x\r\n @y = y \r\n end",
"def initialize(x, y)\n @x, @y = x, y\n end",
"def x(y)\n raise NotImplementedError, \"Define #{__method__}() in the inherited class.\"\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def set(x, y)\n @x = x\n @y = y\n self\n end",
"def initialize(x, y) #Code Type M\n @x = x #Code Type M\n @y = y #Code Type A\n end",
"def initialize(x, y)\n @x = x\n @y = y\n end",
"def x\n end",
"def initialize( x = nil, y = nil )\n @x = x\n @y = y\n end",
"def x\n end",
"def x\n end",
"def setxy(x, y)\n setpos y, x\n end",
"def initialize(x = nil, y = nil)\n set(x,y) ;\n end",
"def moveTo x, y\n\n\tend",
"def initialize(x = 0, y = 0)\n @x = x\n @y = y\n end",
"def initialize(x = 0, y = 0)\n @x = x\n @y = y\n end",
"def initialize(x=0,y=0)\n super()\n @x = x\n @y = y\n end",
"def x; end",
"def x; end",
"def x; end",
"def x; end",
"def x; end",
"def set_x_y(x, y)\n @x = x && !x.is_a?(Numeric) ? x.to_f : x\n @y = y && !y.is_a?(Numeric) ? y.to_f : y\n self\n end",
"def initialize (x, y, w, h)\n @x1 = x\n @y1 = y\n @x2 = x + w\n @y2 = y + h\n end",
"def y; end",
"def y; end",
"def y; end",
"def initialize(x,y)\n @x = x\n @y = y\n @prev = nil\n end",
"def methods=(_arg0); end",
"def update!(**args)\n @x1 = args[:x1] if args.key?(:x1)\n @x2 = args[:x2] if args.key?(:x2)\n @y1 = args[:y1] if args.key?(:y1)\n @y2 = args[:y2] if args.key?(:y2)\n end",
"def foo(x,y)\nend",
"def foo(x,y)\nend",
"def method(x, y)\n x * y\nend",
"def initialize(x=3,y=3)\n @x=x\n @y=y \n\tdraw_new\n end",
"def update\n get_x\n get_y\n end",
"def ini( x, y )\n @x = Coord.set( x )\n @y = Coord.set( y )\n self\n end",
"def two_method(x,y,z)\n\t\tx + y + z\nend",
"def initialize( x, y )\n @x, @y = x.to_f, y.to_f\n end",
"def initialize(x, y) # x and y are arrays\n\t\tself.x = self.xArrayToMatrix(x)\n\t\tself.y = Matrix.column_vector(y)\n\tend",
"def setposition(x,y)\n\t\t@x = x\n\t\t@y = y\n\tend",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n end",
"def set!(x, y=self.x, z=self.y)\n end",
"def y\n end",
"def call(x, y)\n @position_x += x\n @position_y += y\n end",
"def y=(_arg0); end",
"def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end",
"def to(x,y)\n\t\t\tdx = x - @attributes[:cx]\n\t\t\tdy = y - @attributes[:cy]\n\t\t\tr = (dx**2 + dy**2)**(0.5)\n\t\t\t@attributes[:r] = r\n\t\t\t\n\t\t\tyield self if block_given?\n\t\t\treturn self\n\t\tend",
"def update!(**args)\n @x0 = args[:x0] if args.key?(:x0)\n @x1 = args[:x1] if args.key?(:x1)\n @y0 = args[:y0] if args.key?(:y0)\n @y1 = args[:y1] if args.key?(:y1)\n end",
"def add_2(x, y)\nend",
"def y=(_); end",
"def y=(_); end",
"def initialize(x,y) # Initialize method\n @x,@y = x,y # Sets initial values for instance variables\n \n # Use the class variables in this instance method to collect data\n @@n += 1 # Keep track of how many Points have been created\n @@totalX += @x # Add these coordinates to the totals \n end",
"def set_loc(x, y)\n @curr_x = x\n @curr_y = y\n end",
"def initialize options\r\n super\r\n @x = options[:x]\r\n @y = options[:y]\r\n end",
"def evitar(x, y)\r\n @evitarx = x\r\n @evitary = y\r\n end",
"def method=(_); end",
"def initialize(params)\n @x = params[:x]\n @y = params[:y]\n end",
"def y\n end",
"def y\n end",
"def initialize( position_x, position_y )\n @x = position_x\n @y = position_y\n end",
"def methods() end",
"def initialize(a,x,y)\n @a = Float(a)\n @x1 = Float(x)-(@a/2)\n @y1 = Float(y)-(@a/2)\n @x2 = x1+@a\n @y2 = y1+@a\n end",
"def set_mouse_position(x, y); end",
"def init(x, y, direction)\n @x = x\n @y = y\n @direction = direction\n end",
"def move_to (x, y)\n @x, @y = x, y\n end",
"def initialize(x, y, location)\n\t\t@x = x\n\t\t@y = y\n\t\t@location = location\n\tend",
"def x=(x)\n end"
] | [
"0.6847129",
"0.6746982",
"0.67251253",
"0.6682827",
"0.6637733",
"0.66010237",
"0.65911776",
"0.6588873",
"0.6579011",
"0.6572358",
"0.6572358",
"0.6553997",
"0.6515704",
"0.65123075",
"0.6511823",
"0.6495369",
"0.6493831",
"0.644357",
"0.6440991",
"0.6440991",
"0.6440991",
"0.6440991",
"0.6440991",
"0.6440991",
"0.6440991",
"0.6440991",
"0.640012",
"0.640012",
"0.640012",
"0.640012",
"0.63774866",
"0.6358406",
"0.63582957",
"0.63226885",
"0.6322348",
"0.62518865",
"0.62518865",
"0.62246716",
"0.6214326",
"0.61971885",
"0.6132143",
"0.6132143",
"0.6102829",
"0.6093578",
"0.6093578",
"0.6093578",
"0.6093578",
"0.6093578",
"0.6042949",
"0.60208535",
"0.6012584",
"0.6012584",
"0.6012584",
"0.5992336",
"0.59883094",
"0.5967863",
"0.59545237",
"0.59545237",
"0.5940273",
"0.59367615",
"0.59331095",
"0.59132916",
"0.5905758",
"0.5901863",
"0.5885486",
"0.58774006",
"0.5866634",
"0.5866634",
"0.5866634",
"0.5866634",
"0.5866634",
"0.5866634",
"0.5866634",
"0.5866634",
"0.58661413",
"0.586157",
"0.5849236",
"0.5838068",
"0.5837827",
"0.58311343",
"0.5823153",
"0.5803422",
"0.5790763",
"0.5790763",
"0.57874924",
"0.57819813",
"0.5780633",
"0.5778898",
"0.57545656",
"0.57384485",
"0.5730659",
"0.5730659",
"0.5730139",
"0.5699575",
"0.56939435",
"0.56928897",
"0.56849843",
"0.5679167",
"0.5675171",
"0.5673088"
] | 0.63205796 | 35 |
defines methods color, color= | def initialize(x,y,c="clear")
super(x,y) # keyword super calls same method in superclass
@color = c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_methods; end",
"def color; end",
"def color; end",
"def color; end",
"def colors; end",
"def color(color); end",
"def color_methods\n colors.each do |key|\n next if key == :default\n\n define_method key do\n colorize(:color => key)\n end\n\n define_method \"on_#{key}\" do\n colorize(:background => key)\n end\n end\n end",
"def setcolorrep(*)\n super\n end",
"def red; end",
"def red; end",
"def red\n end",
"def blue=(_); end",
"def blue; end",
"def blue; end",
"def method_missing(method, *args, &block)\n super unless term_colorizer_methods.include? method\n self.class.send(:define_method, method) do\n str = self\n str = add_normal_color(str, method) if color_methods.include? method\n str = add_bright_color(str, method) if bright_color_methods.include? method\n str = add_bg_color(str, method) if bg_color_methods.include? method\n str = add_underline(str) if \"underline\".eql? method.to_s\n str = add_strikethrough_effect(str) if \"strikethrough\".eql? method.to_s\n str = str + \"\\e[0m\" unless str.end_with? \"\\e[0m\"\n str\n end and self.send(method, *args)\n end",
"def color(*values); end",
"def color(*values); end",
"def colors\n return\n end",
"def blue\n end",
"def red=(_); end",
"def green=(_); end",
"def color(*args)\n @instructions << Instruction.new(:color, args)\n self\n end",
"def color\n @color\n end",
"def color\n @color\n end",
"def color\n @color;\n end",
"def rgb_color; end",
"def green; end",
"def green; end",
"def color\n Color.new\n end",
"def color\n @color\nend",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def method_missing(method_name, *arguments, &block)\n if @@color_codes.keys.include? method_name.to_sym\n self.class.create_colors\n self.send(method_name.to_s)\n else\n super\n end\n end",
"def initialize\r\n\t\t@color =\"platinum\"\r\n\tend",
"def setColor(color)\n\t\t@color = color\n\n\tend",
"def hsla_color; end",
"def colorized?; end",
"def color=(new_color) #<---- = sign means same as variable. means assignment.\n # writer method - assigns new value to that @instance variable\n @color = new_color\n end",
"def colorize!; @colors = true; end",
"def color\n return @color\n end",
"def color\n @color || $def_fg_color\n end",
"def initialize(color) \n @color = color #instance variable\n end",
"def fancy_color_methods\n self.term_colorizer_methods\n end",
"def color_field(object_name, method, options = T.unsafe(nil)); end",
"def path!\n @color = @@colors[:yellow]\n end",
"def color\n\t\treturn @color\n\t\t\n\tend",
"def color_method(method)\n case method\n when /delete/i then RED\n when /get|search|reload|find/i then BLUE\n when /post|create/i then GREEN\n when /put|patch|update/i then YELLOW\n when /login|logout|download|query/i then CYAN\n else MAGENTA\n end\n end",
"def color=(new_color)\n @color = new_color\nend",
"def calculate_color\n\n self.color || color_by_title\n end",
"def red=(value)\n end",
"def green\n end",
"def color=(new_color)\n\t\t@color = new_color\n\tend",
"def r; self.color.r end",
"def set_color(color)\n @color = color\n end",
"def initialize(color)#recibe el color de brown\n p super# trae el comportamiento de la superclase con los valores de name\n p @color = color #el valor de colo lo declaramos como variable de instancia\n end",
"def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end",
"def fill_color(color)\n end",
"def initialize(color={:cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0})\n @color=color\n end",
"def recolor(color)\n @color = color\n self\n end",
"def colors() = @colors ||= %i[blue green purple magenta cyan yellow red]",
"def rgb\n raise NotImplementedError, 'Overwrite the method in a subclass'\n end",
"def color=(color) #SETTER\n @color = \"##{color.downcase}\"\n end",
"def color=(value)\n @color = value\n end",
"def color=(value)\n @color = value\n end",
"def red\n colorize(:red)\nend",
"def set_colors\n if @color_output \n @c_app_info = @color_app_info\n @c_app_exe = @color_app_exe\n @c_command = @color_command\n @c_description = @color_description\n @c_parameter = @color_parameter\n @c_usage = @color_usage\n \n @c_error_word = @color_error_word\n @c_error_name = @color_error_name\n @c_error_description = @color_error_description\n \n @c_bold = @color_bold\n @c_reset = @color_reset\n else\n @c_app_info, @c_app_exe, @c_command, \n @c_description, @c_parameter, @c_usage, \n @c_bold, @c_reset, @c_error_word, \n @c_error_name, @c_error_description = [\"\"]*11\n end\n end",
"def open!\n @color = @@colors[:cyan]\n end",
"def set_color=(new_color)\n @@color = new_color\n end",
"def setfillcolorind(*)\n super\n end",
"def initialize(color)\n @color = color\n end",
"def paint( color )\n self.update(color: color)\n end",
"def color(x, y, method)\n Kernel.raise ArgumentError, \"Unknown PaintMethod: #{method}\" unless PAINT_METHOD_NAMES.key?(method.to_i)\n primitive 'color ' + sprintf('%g,%g,%s', x, y, PAINT_METHOD_NAMES[method.to_i])\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def rgb(*args); end",
"def rgb(*args); end",
"def spray_paint(new_color)\n self.color = new_color\n end",
"def lbSetColor _obj, _args\n \"_obj lbSetColor _args;\" \n end",
"def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end",
"def lbColor _obj, _args\n \"_obj lbColor _args;\" \n end",
"def blue=(value)\n end",
"def color\n\t\t \t\t\t\"El color de tu vaca es #{@color}\"\n\t\t \t\tend",
"def background_color(color); end",
"def initialize(red, green, blue, alpha = 1.0); end",
"def colorChange(couleur)\n @color=couleur\n apply\n end",
"def term_colorizer_methods\n methods = []\n methods += color_methods\n methods += bright_color_methods\n methods += bg_color_methods\n methods += [\n :underline, :strikethrough, :term_colorizer_methods,\n :fancy_color_methods, :no_underline, :no_strikethrough,\n :no_color, :no_bg_color, :plain_text, :reset_fancyness\n ]\n end",
"def color\n @red ? \"R\" : \"B\"\n end",
"def set(red, green, blue, alpha=255)\n self.red = red\n self.green = green\n self.blue = blue\n self.alpha = alpha\n end",
"def set_colors\n if color_output\n @c_app_info = @color_app_info\n @c_app_exe = @color_app_exe\n @c_command = @color_command\n @c_description = @color_description\n @c_parameter = @color_parameter\n @c_usage = @color_usage\n \n @c_error_word = @color_error_word\n @c_error_name = @color_error_name\n @c_error_description = @color_error_description\n \n @c_bold = @color_bold\n @c_reset = @color_reset\n else\n @c_app_info, @c_app_exe, @c_command, @c_description,\n @c_parameter, @c_usage, @c_bold, @c_reset, @c_error_word,\n @c_error_name, @c_error_description = [\"\"]*12\n end\n end",
"def get_color\n @color\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def set(red, green, blue, alpha = nil); end",
"def start!\n @color = @@colors[:green]\n end",
"def color=(c)\n @color = Color.new(c)\n end",
"def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #008B8B #006400\n ).sample\n end\n end",
"def red\n\t\tlight COLOR_KEY_RED\n\tend",
"def initialize(red, green, blue, alpha=255)\n set red, green, blue, alpha\n end",
"def initialize(color, display)\n @color = color\n @display = display\n end",
"def yellow \n\t\tlight COLOR_KEY_YELLOW\n\tend",
"def <<(color)\n r = [1.0, color.red * color.alpha + self.red].min\n g = [1.0, color.green * color.alpha + self.green].min\n b = [1.0, color.blue * color.alpha + self.blue].min\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end",
"def setlinecolorind(*)\n super\n end",
"def text_color(param)\n begin \n colour = case param\n when Integer then super(param) rescue normal_color\n when Symbol then send(param) rescue normal_color\n when Array then Color.new(*param) rescue normal_color\n else\n normal_color\n end\n end\n colour.is_a?(Color) ? colour : normal_color\n end",
"def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend"
] | [
"0.8357488",
"0.83423615",
"0.83423615",
"0.83423615",
"0.81691134",
"0.80981016",
"0.77449095",
"0.7569002",
"0.7503601",
"0.7503601",
"0.74650836",
"0.74402696",
"0.74153674",
"0.74153674",
"0.7304448",
"0.72640103",
"0.72640103",
"0.72636724",
"0.7251018",
"0.72441584",
"0.71344084",
"0.71229714",
"0.70812696",
"0.70812696",
"0.70697826",
"0.706137",
"0.70121634",
"0.70121634",
"0.69919825",
"0.6984945",
"0.694094",
"0.6927783",
"0.6923728",
"0.69183373",
"0.6913711",
"0.69107395",
"0.69003344",
"0.6888578",
"0.6857031",
"0.68538886",
"0.68316466",
"0.68187237",
"0.6811503",
"0.6810353",
"0.67829895",
"0.6777737",
"0.67644554",
"0.67622095",
"0.67538047",
"0.674945",
"0.67330164",
"0.67273915",
"0.67081326",
"0.670679",
"0.6703141",
"0.6692427",
"0.66747576",
"0.6672489",
"0.6658317",
"0.66480225",
"0.664198",
"0.66283035",
"0.6625358",
"0.66248906",
"0.6616972",
"0.6609126",
"0.66066045",
"0.6603742",
"0.6599736",
"0.6591187",
"0.6582188",
"0.6575747",
"0.65752995",
"0.65752995",
"0.6552068",
"0.65387213",
"0.6534225",
"0.65295327",
"0.6528436",
"0.65263844",
"0.6525688",
"0.65251917",
"0.65220565",
"0.651626",
"0.65118474",
"0.64986134",
"0.64983344",
"0.649494",
"0.6487017",
"0.6484705",
"0.6484158",
"0.64669734",
"0.6458238",
"0.64432263",
"0.64392644",
"0.64346457",
"0.64299434",
"0.64294475",
"0.64265966",
"0.64214426",
"0.6417738"
] | 0.0 | -1 |
Creates a new task with name +name+. | def initialize(name)
@name = name
@options = {}
yield self if block_given?
define
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end",
"def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end",
"def create_task name, url, cron, enabled = nil, timeout = nil, mail_when_success = false, mail_when_failure = false, timezone = nil\n connection.create_task(id, name, url, cron, enabled, timeout, mail_when_success, mail_when_failure, timezone)\n end",
"def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def create(task)\n validate_type!(task)\n\n attributes = sanitize(task)\n _, _, root = @client.post(\"/tasks\", attributes)\n\n Task.new(root[:data])\n end",
"def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end",
"def task(name, options = {}, &block)\n name = name.to_s.downcase.to_sym\n task_re = /\\A[a-z0-9.:-_]+\\z/\n raise \"Task already exists: #{name}\" if $bot[:tasks].include?(name)\n raise \"Task name does not match regexp #{task_re.to_s}\" unless name.to_s.match(task_re)\n\n opts = {\n desc: ''\n }.merge(options)\n\n $bot[:tasks][name] ||= {\n block: block,\n desc: opts[:desc]\n }\n end",
"def _create_task_by_name(task_name)\n @tasks.each do |t|\n return t.clone if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end",
"def createTask(description) \n task = Task.new\n task.Description = description\n @Tasks.push task\n end",
"def create\n task = current_user.tasks.create(name: \"Neue Aufgabe\")\n render text: task.name\n end",
"def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end",
"def create_task(task, tasklist_id = '@default')\n post gtasks_tasks_url(tasklist_id), strip(:task, :create, task)\n end",
"def create\n @task = Task.create!(task_params)\n end",
"def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend",
"def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end",
"def save_as_task!(task_name, options = {})\n default_action = new_record? ? \"create\" : \"update\"\n action_type = options.delete(:action_type) || default_action\n\n record_action(action_type, task_name:)\n save!(options)\n end",
"def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end",
"def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end",
"def create_task_hash name\n { name: name,\n schedule: \"To-Do\",\n priority: \"Normal\",\n due_days: 2,\n due_hours: \"0\",\n due_minutes: \"00\",\n followup: \"\",\n assigned_to: \"Negotiator\",\n fees_assigned: \"0.00\",\n task_description: \"#{name} task description\",\n letter_agreement: \"\",\n }\nend",
"def create\n # We'll see that in a moment.\n @task = task.new\n #@task = Task.create\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n end",
"def add_project(name)\n @tasks[name] = []\n end",
"def create_instance(name, tasks, priority = 1, comment = nil)\n instance = Instance.new\n instance.name = name\n instance.priority = priority\n instance.comment = comment if comment\n if tasks.instance_of? Array\n instance.tasks = tasks\n else\n instance.tasks = [tasks]\n end\n\n res = ODPS.conn.post do |req|\n req.url \"projects/#{ODPS.current_project}/instances\"\n req.headers['Content-Type'] = 'application/xml'\n req.body = instance.serialize [String, ['Job'], 'Name', name],\n [String, ['Job'], 'Comment', comment],\n [String, ['Job'], 'Priority', priority],\n [Array, ['Job'], 'Tasks', instance.tasks.map { |t| REXML::Document.new t.to_xml }]\n end\n\n if res.status == 201\n instance.location = res['Location']\n instance\n end\n end",
"def task(task_name, opts = EMPTY_HASH)\n conf = OpenStruct.new # rubocop:disable Style/OpenStructUse\n yield conf\n tasks << ({ name: task_name, **opts, **conf.to_h })\n self\n end",
"def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end",
"def create\n @task = Task.new(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n if @task.save\n redirect_to task_path(@task.id)\n else\n render :new\n end\n end",
"def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end",
"def new_task(task_name)\n click_link 'New task'\n find(:xpath, \"(//input[@type='text'])[last()]\").set(task_name)\n end",
"def new_task(params = {})\n raise ArgumentError if not params[:title] or params[\"title\"]\n\n params.keys.each do |key|\n raise ArgumentError if not Babar::Taskfields.include? key.to_sym\n end\n\n #Create a new Task object and push it onto the array of tasks to be added upon the next sync\n task = Babar::Task.new(@authenticator, params) \n @new_tasks.push(task)\n @tasks[task.id] = task\n end",
"def set_task(name,task=nil) # Add a Task and its name\n @defaults['taskname']=name.to_s # taskname = task name\n if ! task.nil?\n @defaults['taskobj']=task # taskobj = the Task\n @defaults['env']=task.envars # env = the Task's env vars\n @defaults['seq']=task.seq # seq = Task's index location\n end\n return self\n end",
"def create\n\t\tformat_task_attributes(task_params)\n\t\t@task =Task.new(@updated_params)\n\t\tlogger.debug \"Created Task #{@task}\"\n\t\[email protected] = current_user\n\t\tauthorize! :create, @task\n\t\[email protected]_completed=false\n\t\tsave_task\n\tend",
"def create(name)\n url = prefix + \"create\" + \"&name=#{name}\"\n return response(url)\n end",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def create(name)\n url = prefix + \"create\" + \"&name=#{name}\"\n return response(url)\n end",
"def create(name=nil, options={})\n deprecate # 07/26/2012\n name = create_request(name, options)\n loop do\n break if create_complete?(name)\n sleep 1\n end\n name\n end",
"def create(name)\n self.new(name)\n end",
"def create_task(task_body, opts = {})\n data, _status_code, _headers = create_task_with_http_info(task_body, opts)\n data\n end",
"def create_task(options = {})\n task = Task.create({\n title: \"a\"*(Task::TITLE_MIN_LENGTH),\n difficult: Task::PERMITTED_FIBONACCI_VALUES.first,\n description: \"a\"*(Task::DESCRIPTION_MIN_LENGTH)\n }.merge(options))\n\n return task\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def add_task(task_name)\n unless File.exist? \"app/scheduled_jobs/#{task_name}.rb\"\n raise \"Task #{task_name} does not exist!\"\n end\n url = \"http://localhost:#{server_port}/tasks/#{task_name}\"\n command \"/usr/bin/curl #{url} -X POST\"\nend",
"def duplicate_task(name: required(\"name\"), include: nil, options: {}, **data)\n with_params = data.merge(name: name, include: include).reject { |_,v| v.nil? || Array(v).empty? }\n Resource.new(parse(client.post(\"/tasks/#{gid}/duplicate\", body: with_params, options: options)).first, client: client)\n end",
"def create_task(data)\n pid = data[\"project_id\"]\n priority = data[\"priority\"]\n description = data[\"description\"]\n status = false\n\n response = @db.exec_params(%Q[\n INSERT INTO tasks(project_id, priority, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id;\n ], [pid, priority, description, status])\n\n response.first[\"id\"]\n end",
"def to_task(name, priority = 1)\r\n {\"name\" => name, \"priority\" => priority}\r\nend",
"def add_eval_task_named(task_name)\n new_ev_task = EvaluatedRakeTask.new(task_name, self.filename)\n add_eval_task(new_ev_task)\n\n new_ev_task\n end",
"def create name='', config={}, project=nil\n @@step_map[name.to_sym].new(name, config, project) || Step.new(name, config, project)\n end",
"def task_creation(task)\n @task = task\n @project = @task.project\n mail to: task.user.email, subject: \"New task created: #{task.name}\"\n end",
"def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end",
"def create_by_name(name)\n self.new.tap do |o|\n o.name = name # ambos sirven\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.save\n redirect_to task_path(@task)\n end",
"def test_create_a_new_task\n results = Task.createNewTask(\"#{MyApp.settings.root}/tests/unit/tasks_test_add_new.txt\", \"Bob\", \"Sweep up Grandpa's ashes\", \"12373514\")\n assert_equal(nil, results)\n end",
"def create_task\n\t@task = Task.create(:quest_id => params[:id], :user_id => @current_user.id, :title => params[:task][:title])\n\tredirect_to quest_path(params[:id])\n\tend",
"def create name\n response = client.create_topic(:name => name)\n Topic.new(response.topic_arn, :config => config)\n end",
"def add(task_name, group, date)\n group = @default_group unless @default_group.nil? || group != ''\n date = @default_date unless @default_date.nil? || date != ''\n add_group_array(group)\n task = Task.new(next_id, task_name, group, date)\n @to_dos.add(task)\n end",
"def task(name, &block)\r\n if name.kind_of?(Hash)\r\n name.each do |alias_name, task_name|\r\n raise(\"Undefined task `#{task_name}'\") unless @@tasks[task_name.to_s]\r\n @@tasks[alias_name.to_s] = @@tasks[task_name.to_s]\r\n @@descriptions[alias_name.to_s] = @@last_description\r\n end\r\n else\r\n raise(\"Task `#{name}' is defined more than once\") if @@tasks[name.to_s]\r\n @@tasks[name.to_s] = block\r\n @@descriptions[name.to_s] = @@last_description\r\n end\r\n\r\n @@last_description = nil\r\n end",
"def create\n @taks = Task.new()\n @task.save\n redirect_to task_path(@task)\n end",
"def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end",
"def setTaskName(taskName)\r\n\t\t\t\t\t@taskName = taskName\r\n\t\t\t\tend",
"def create_task(list_id, text)\n path = \"lists/#{list_id}/tasks\"\n params = {task: {text: text}}\n request(path, params, :post)\n\n # output full list again\n show_list(list_id)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, serializer: TaskSerializer\n else\n render json: { error: t('task_create_error') }, status: :unprocessable_entity\n end\n end",
"def new\n\t\t@task= Task.new\n\tend",
"def create\n @task = Task.new(task_params)\n @task[:authorization_id] = Authorization.current_id\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.create(task_params)\n redirect_to tasks_path\n end",
"def add_task\n\n new_description_prompt_print\n\n increment_task_id_counter\n\n new_text = gets.chomp\n\n @tasks[@id_counter] = create_task(new_text)\n\n end",
"def create\n # raise params.inspect\n @task = Task.new(task_params)\n if @task.save\n redirect_to tasks_url\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n\n end\n end",
"def add(id, *args)\n @tasks[id] = @task_factory.new(*args)\n end",
"def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def new_plan(name, puppet: false)\n Bolt::PlanCreator.validate_input(config.project, name)\n Bolt::PlanCreator.create_plan(config.project.plans_path, name, puppet)\n end",
"def add_task(*args)\n task = Util::get_task_from_args(*args)\n add_task_internal(task, true)\n end",
"def create\n \n @user= User.find_by_id(session[:user_id])\n @task = @user.tasks.create(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.new(task_params)\n @task.start\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def step(task_name, opts = EMPTY_HASH)\n task(task_name, opts)\n end",
"def add_remote_task(task_name)\n heroku.run_task(task_name)\n end",
"def enq name, schedule, options = {}, &block\n raise ArgumentError.new(\"Block not given\") unless block_given?\n\n new_task = nil\n @mutex.synchronize do\n @tasks << new_task = Task.send(:new,\n self, name, schedule,\n options[:exclusive], options[:timeout],\n &block)\n end\n return new_task\n end",
"def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end",
"def new\n\t@task = Task.new\nend",
"def create\n \n @task = @project.tasks.new(params[:task])\n\n if @task.save\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully created.' \n else\n \t\n render('new')\n end\n end",
"def create\n @task = Task.new(params[:task])\n\n if @task.save\n redirect_to(project_task_path(@task.project.id, @task.id))\n end\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend",
"def create_task step, steps\n task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments |\n tags = build_tags step, steps\n\n if cloud.exists? tags\n puts \"image \\'#{step[ :name ]}\\' already up to date and exists:\"\n tags.each{ | key, value | puts \"\\'#{key}\\' => \\'#{value}\\'\" } \n else\n puts \"starting instance for: \\'#{step[ :name ]}\\'\"\n instance = cloud.start_instance initial_image_id( step, steps )\n puts \"instance for: \\'#{step[ :name ]}\\' started.\"\n\n begin\n dns_name = cloud.dns_name instance\n expand_step = step.dup.merge( setup_name: expand_path( step[ :setup_name ] ) )\n expand_step[ :tags ] = tags \n \n puts \"excuting installation for: \\'#{step[ :name ]}\\'\"\n setup.execute expand_step, dns_name \n puts \"installation for: \\'#{step[ :name ]}\\' done.\"\n\n puts \"storing image for: \\'#{step[ :name ]}\\'\"\n cloud.store_image instance, tags\n puts \"image for: \\'#{step[ :name ]}\\' stored\"\n rescue\n cloud.stop_instance instance\n raise\n end \n end \n end\n\n task.add_description( step[ :description ] ) if step.key? :description\n task\n end",
"def name\n\t\t\t@task\n end",
"def create\n # 'params_task' returns the value that is authorized by this function\n # rails in default blocks any modifications so we have to give this access\n @task = Task.new(task_params)\n @task.save\n # we don't want to go to a kind of 'create's page' so we are redirecting to\n # out root page\n redirect_to tasks_path(@task)\n end",
"def new\n @task = Task.new(position: current_position)\n end",
"def create\n\n # binding.pry\n\n unless params[:name].nil?\n\n if Task.where(name: params[:name]).exists?\n\n task = Task.find_by_name(params[:name])\n else\n task = Task.create(name: params[\"name\"])\n end\n @time_record = TimeRecord.new(state: \"open\", task_id: task.id)\n\n else\n @time_record = TimeRecord.new(state: \"open\")\n\n end\n\n\n\n respond_to do |format|\n if @time_record.save\n if task\n task.time_records << @time_record\n end\n format.html { redirect_to edit_time_record_path(@time_record), notice: 'Time record was successfully created.' }\n format.json { render json: @time_record, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def task(name, actor_class, options={}, &block)\n has_state = options.has_key?(:state)\n unless has_state\n options = options.clone\n options[:state] = Task::STOPPED\n end\n t = Task.new(self, name, actor_class, options)\n @tasks[t.name] = t\n yield(t) if block_given?\n t\n end",
"def rake_task task_name\n @rake.invoke_task task_name\n end",
"def new_task(task)\n @task = task\n\n mail to: task.assigned_user.email, subject: \"Vypro prj.: #{task.project.name}, úkol: #{task.name}\"\n end"
] | [
"0.7285603",
"0.7219194",
"0.7155665",
"0.70825505",
"0.69806194",
"0.6889819",
"0.68816435",
"0.68630683",
"0.6848598",
"0.67115927",
"0.6694039",
"0.66352665",
"0.66230094",
"0.6620601",
"0.6573416",
"0.65412354",
"0.653079",
"0.65093917",
"0.65093917",
"0.6495483",
"0.6484786",
"0.6428735",
"0.64168155",
"0.64073706",
"0.6393792",
"0.63618743",
"0.63425857",
"0.63285863",
"0.6306764",
"0.630508",
"0.6275978",
"0.6250593",
"0.6234069",
"0.6233635",
"0.62256587",
"0.62256587",
"0.6223727",
"0.6216175",
"0.62077713",
"0.6206918",
"0.6190144",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.61892",
"0.6182774",
"0.6181892",
"0.61807567",
"0.61487645",
"0.61455506",
"0.6141421",
"0.6109712",
"0.6094473",
"0.60903156",
"0.60714436",
"0.60557306",
"0.6041289",
"0.60405254",
"0.60351944",
"0.6032003",
"0.6027924",
"0.6016691",
"0.6008823",
"0.60051423",
"0.5990426",
"0.5963883",
"0.59623337",
"0.59543455",
"0.5946103",
"0.5944346",
"0.59275097",
"0.58849764",
"0.58792037",
"0.5860894",
"0.5859712",
"0.5857286",
"0.5856973",
"0.58484405",
"0.58478063",
"0.5844721",
"0.58423054",
"0.58399147",
"0.5830562",
"0.5819612",
"0.58148545",
"0.5804017",
"0.5795841",
"0.57825667",
"0.5779743",
"0.5770376",
"0.57634664",
"0.57606214"
] | 0.0 | -1 |
fibonacci series: 0 1 1 2 3 5 8 13 21 ... e.g. 0th fibonacci number is 0 e.g. 1st fibonacci number is 1 .... e.g. 6th fibonacci number is 8 | def fibonacci(n)
return 0 if n == 0
if n == nil
raise ArgumentError.new("Nil object is not an integer")
end
if n < 0
raise ArgumentError.new("Negative input")
end
return 1 if n == 1
k = 0
j = 1
i = 2
result = 0
while i <= n
result = k + j
k = j
j = result
i += 1
end
return j
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibinacci(number)\n fibinacci_series = [1,1]\n index = 2\n while index <= (number-1)\n fibinacci_series[index] = fibinacci_series[index - 1] + fibinacci_series[index - 2]\n index = index + 1\n end\n return fibinacci_series\nend",
"def fibonacci(how_many_numbers)\n fibonacci_sequence = []\n count = 0\n while count < how_many_numbers\n if count == 0\n fibonacci_sequence << 0\n count += 1\n elsif count == 1\n fibonacci_sequence << 1\n count += 1\n else\n fibonacci_sequence << fibonacci_sequence[-1] + fibonacci_sequence[-2]\n count += 1\n end\n end\n fibonacci_sequence\nend",
"def fib(n)\n # edge cases:\n if n < 0\n raise Exception, 'Index was negative. No such thing as a negative index in a series.'\n elsif n == 0 || n == 1\n return n\n end\n\n # we'll be building the fibonacci series from the bottom up\n # so we'll need to track the previous 2 numbers at each step\n prev_prev = 0\n prev = 1\n current = prev + prev_prev\n\n # since we already initialized up to the 2nd number in the series\n # we take n - 2 steps ahead to reach n (.times is exclusive)\n (n - 1).times do\n current = prev + prev_prev\n prev_prev = prev\n prev = current\n end\n\n current\nend",
"def fibonacci(n)\n if n == 0\n 0\n elsif n == 1\n 1\n else\n before_previous = 0\n previous = 1\n actual = nil\n (2..n).each do\n actual = previous + before_previous\n before_previous = previous\n previous = actual\n end\n actual\n end\nend",
"def nth_fib(x)\n arr = [0,1]\n count = 1\n while count < x\n next_val = arr[-1] + arr[-2]\n arr = [arr[-1], next_val]\n count += 1\n end\n puts next_val\n # puts \"The weird algorithm from Hackerank comes to: #{next_val % (10**8 + 7)}\"\n end",
"def nthFibonacci (n)\n \n if n == 0\n return 0\n end\n\n i = 0\n\n sequence = Array.new\n\n sequence.push(i)\n\n i += 1\n\n sequence.push(i)\n\n while i < n do\n sequence[i+1] = (sequence[-1]) + (sequence[-2])\n\n i += 1\n end\n\n sequence[-1]\nend",
"def fibonacci(num)\n fib_nums = []\n (0...num).each do |i|\n if i == 0 || i == 1\n fib_nums << 1\n next\n end\n fib_nums << fib_nums[i-2] + fib_nums[i-1]\n end\n return fib_nums\nend",
"def cool_fib(number)\n (0..number).inject([1,0]) {|i_arr| [i_arr.last, i_arr.first + i_arr.last]}.first\nend",
"def fib (x)\n y = x-2\nfib_sequence = y.times.inject(%5B0,1%5D) do |a, idx|\n a << a[-2] + a[-1]\nend",
"def fibonaci(n)\n\tfi= [1, 1]\n\t(n-1).times do\n\t\tfi << fi[1]+fi.shift\n\tend\n\treturn fi[0]\nend",
"def nth_fibonacci(n)\n return 0 if n == 1\n sequence = [1]\n (n - 2).times do\n current_number, last_number = sequence.last(2)\n sequence << current_number + (last_number || 0)\n end\n\n sequence.last\nend",
"def fibs (n) #Non-recursive\n\n\t# n = number of Fibonacci sequence members.\n\t# 0, 1, 1, 2, 3, 5, 8, 13, ..\t\n\tfib_seq = []\n\t(0..n).each do |i|\n\t\tif i == 0\n\t\t\tfib_seq << 0\n\t\telsif i == 1\n\t\t\tfib_seq << 1\n\t\telse\n\t\t\tfib_seq << fib_seq[i-2] + fib_seq[i-1]\n\t\tend\n\tend\n\tfib_seq\nend",
"def get_fibonacci(num)\n f = [0,1]\n for i in (2..num)\n f << (f[-1] + f[-2])\n end\n if num == 0\n f = 0\n end\n f[-1]\nend",
"def fibonacci_sequence index\n if index == 0 || index == 1\n return index\n else\n return fibonacci_sequence(index - 2) + fibonacci_sequence(index - 1)\n end\nend",
"def nthFibonacci (n)\r\n num = n.to_i\r\n fibonacci_sequence = Array.new\r\n case num\r\n when 0 \r\n fibonacci_sequence << 0\r\n when 1\r\n fibonacci_sequence << [0,1]\r\n else\r\n fibonacci_sequence[0] = 0\r\n fibonacci_sequence[1] = 1\r\n i = 1\r\n while i < num\r\n i+= 1\r\n fibonacci_sequence[i] = fibonacci_sequence[i-1] + fibonacci_sequence[i-2] \r\n end\r\n end\r\n return fibonacci_sequence\r\nend",
"def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend",
"def fibonacci_sequence(n)\n counter = 1\n fib_sum = 1\n previous = [1]\n if n == 1 || n == 2\n return 1\n else \n until counter == n - 1\n previous << fib_sum\n fib_sum += previous[counter - 1] \n counter += 1\n end\n return fib_sum\n end\nend",
"def nth_fibonacci(n)\n result = [0,1]\n\n for i in 1..n-1\n result[i+1] = result[i] + result[i-1]\n end\n\n return result[n]\nend",
"def fibonacci\n\tresults, first, second, current = 0, 1, 2, 2\n\twhile current <= 4000000\n\t\tif current % 2 == 0\n\t\t\tresults += current\n\t\tend\n\t\tcurrent = first + second\n\t\tfirst, second = second, current\n\tend\n\treturn results\nend",
"def fibonacci_number(n)\n #define nth Fibonacci term\n fibonacci_lst=[0,1] #F1=1,F2=1\n for i in 2..n\n fibonacci_lst[i]=fibonacci_lst[i-1]+fibonacci_lst[i-2]\n end\n return fibonacci_lst[n]\nend",
"def fib(n) \n if n == 0\n return 0\n else\n\tfib_0 = 0\n\tfib_1 = 1\n\t(1..(n-1)).each do \n\t\ttemp = fib_0\n\t\tfib_0 = fib_1\n\t\tfib_1 = temp + fib_1\n\t\t\n\tend\n\treturn fib_1\n end\nend",
"def fibonacci\n @sequence = [1,1]\n x = 0\n while (@sequence[x+1] < 4e+6)\n @sequence << @sequence[x] + @sequence[x+1]\n x += 1\n end\n even? x\nend",
"def iterative_fib(num)\r\n a = 0\r\n b = 1\r\n\r\n num.to_i.times do\r\n temp = a\r\n a = b\r\n # Add up previous two numbers in sequence\r\n b = temp + b\r\n end\r\n\r\n return b\r\nend",
"def fibonacci(n)\n raise ArgumentError, \"n must be an integer greater than 0\" unless n && n >= 0\n current = 0\n one_before = 0\n two_before = 0\n i = 0\n while i <= n\n if i == 1\n current = 1\n else\n two_before = one_before\n one_before = current\n current = one_before + two_before\n end\n i += 1\n end\n return current\nend",
"def fib(number)\n sequence = [0,1]\n number.times {sequence << sequence[-1] + sequence[-2]}\n sequence[-1]\n return sequence\nend",
"def fib (n)\n # return appropriate starter values if n is 0 or 1\n if n == 0 \n return 0\n elsif n == 1\n return 1\n end\n # set up initial constants\n prevNum = 0\n currNum = 1\n # Loop through fibonacci numbers, starting at index 2.\n 2.upto(n) do\n nextNum = prevNum + currNum\n prevNum = currNum\n currNum = nextNum\n end\n return currNum\nend",
"def fibs(num)\n array = []\n 0.upto(num) do |i|\n array << i if i.zero? || i == 1\n array << array[i - 1] + array[i - 2] if i > 1\n end\n array\nend",
"def nth_fibonacci(n) \n if n == 1\n return 0\n elsif n == 2\n return 1\n end\n return nth_fibonacci(n-1) + nth_fibonacci(n-2)\nend",
"def fibonacci(num)\n (1..num).inject( [0,1] ) { |fib| fib << fib.last(2).inject(:+) }\n\nend",
"def fibonacci(fib)\r\n \t#Set a variable to 0\r\n\tvalue1 = 0 \r\n\t#Set a variable to 1 (array must start with 0, 1...)\r\n\tvalue2 = 1\r\n\t\t#For the number of digits it will be, loop do this many times\r\n\t\tfib.times do \r\n\t\t\t#Create a temp to store value1\r\n \t\t\ttemp = value1\r\n \t\t\t#Make value1 equal value2\r\n \t\t\t#This will help when printing out 0,1,1.. in the beginning\r\n \t\t\tvalue1 = value2\r\n \t\t\t#Make value2 equal the sum of temp and value2\r\n \t\t\t#This will add the last numbers to get the next number\r\n \t\t\tvalue2 = temp + value2\r\n \t\t#End do loop\r\n\t\tend\r\n\t#Return the first value\r\n \tvalue1\r\n#End of method\r\nend",
"def fibonacci(integer)\n fibs = [1, 1]\n (integer - 2).times do |num|\n fibs << fibs[num] + fibs[num + 1]\n end\n fibs.last\nend",
"def fib(n)\n if n == 0\n return 0\n elsif n == 1\n return 1\n end\n\n last = 1\n next_to_last = 0\n i = 2\n\n while i <=n\n cur_fib = last + next_to_last\n next_to_last = last\n last = cur_fib\n i +=1\n end\n return cur_fib\nend",
"def fibonacci(term1, term2, num_terms)\n series = [term1, term2]\n series << series[-2] + series[-1] until series.length == num_terms\n series\nend",
"def fibonacci(num)\n arr = []\n (1..num).each do |number|\n number == 1 || number == 2 ? arr << 1 : arr << arr[-1] + arr[-2]\n end\n arr.last\nend",
"def fibonacci_iterative(n)\n return 0 if n == 0\n fib_sequence = [0,1]\n index = 1\n until n == index\n fib_sequence << fib_sequence[index] + fib_sequence[index-1]\n index += 1\n end\n fib_sequence.last\nend",
"def fib(n)\n\n fib_array = []\n first = 0\n second = 1\n\n if n == 0\n fib_array << nil\n elsif n == 1\n fib_array << 0\n else\n fib_array << 0\n fib_array << 1\n if n >= 3\n (3..n).each do # Due to the zero index of\n # Ruby, we use 3 here to represent the\n # numbers after 0, 1, 1\n\n next_number = (first + second)\n first = second\n fib_array << second = next_number\n\n end\n end\n end\n return fib_array\n\nend",
"def fibonacci (integer)\n\tfib_arr = [0, 1]\n\t(integer-2).times do |index|\n\t\tresult = fib_arr[index+1] + fib_arr[index]\n\t\tfib_arr << result\n\tend\n\t\np fib_arr\nend",
"def fibonacci_series(input)\n fib = 2\n while(fib < input) do\n if(fib == 2)\n previous = fib\n fib += 1\n ap(1)\n ap(1)\n ap(previous)\n else\n tmp_previous = fib # number we got from current iteration will be previous value to next value\n fib = fib + previous \n previous = tmp_previous # setting the previous value\n end\n ap(fib)\n end\nend",
"def fibonacci_last(n)\n return 1 if n <= 2\n n1, n2 = [1, 1]\n 3.upto(n) { n1, n2 = [n2, n1 + n2] }\n n2.to_s.chars[-1].to_i\nend",
"def fibonacci(n)\n raise ArgumentError if n == nil || n < 0 || n.class != Integer\n return n if n < 2\n\n if n >= 2\n current_value= 0\n previous_value = 1\n next_value = 0\n number = n - 1\n\n number.times do \n next_value = current_value + previous_value \n current_value = previous_value \n previous_value = next_value\n end\n end\n \n return next_value\nend",
"def fibonacci(n)\n if n == 0 || n == 1\n return n\n end\n\n first = 0\n second = 1\n current = 1\n\n while n > 2\n first = second\n second = current\n current = first + second\n n -= 1\n end\n\n return current\nend",
"def iter_fib(n)\n return n if n == 0 || n == 1\n\n two_before = 0\n one_before = 1\n\n for i in 2..n\n current = two_before + one_before\n two_before = one_before\n one_before = current\n end\n one_before\nend",
"def fibs(number)\n\n\tfibonacci=[1]\n\tcount=0\n\tnum1=1\n\tnum2=0\n\twhile fibonacci.size<number\n\t\tsum=num1+num2\n\t\tfibonacci.push(sum)\n\t\tnum2=num1\n\t\tnum1=sum\n\tend\n\n\treturn fibonacci\nend",
"def fibonacci(num) \n\tfib = [0,1]\n (num - 2).times do \n \tfib << fib[-2] + fib[-1]\n end\n fib[-1]\nend",
"def fibonacci(n)\n # raise NotImplementedError\n raise ArgumentError if n < 0 || n == nil #error if negative\n\n i = 0\n fib_array = [0, 1] #all fibonacci sequences begin with 0 and 1\n until fib_array.length == n+1 #until the correct index is reached\n fib_array.push fib_array[i] + fib_array[i+1]\n i += 1\n end\n return fib_array[n] #return number at requested index\nend",
"def iterative_nth_fib(n)\n return 1 if n <= 2\n a = 1\n b = 1\n i = 3\n while i <= n\n new_a = b\n b = a + b\n a = new_a\n i += 1\n end\n b\nend",
"def fibonacci(limit)\n sequence = [0]\n if limit == 0\n puts \"Please enter a number above 0\"\n else\n pattern = 1\n (limit - 1).times do |index|\n sequence << pattern\n pattern = pattern + sequence[index]\n end\n puts \"The first #{limit.to_s} numbers in the Fibonacci Sequence are #{sequence}\"\n end\nend",
"def fibonacci(n)\n ary = [0, 1]\n (n - 1).times { |_| ary << ary[-2] + ary[-1] }\n ary.pop\nend",
"def regular_fib(sequence)\n first = 0\n second = 1\n if sequence == 0\n puts \"total = 0\"\n end\n sequence.times do \n total = first + second\n puts \"total(#{total}) = #{first} + #{second}\"\n first = second\n second = total\n end \nend",
"def fib(n)\n n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2]+obj[-1]}\nend",
"def iterative_fib (num)\n fib_arr = []\n (1..num).each do |i|\n if i == 1 || i == 2\n fib_arr << 1\n else\n fib_arr << fib_arr[-1] + fib_arr[-2]\n end\n end\n fib_arr\nend",
"def fibonacci(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n fibonacci(n-2) + fibonacci(n-1)\n end\nend",
"def fibonacci(n)\n raise ArgumentError, \"Not an integer larger than 0\" if !n || n < 0\n\n fib_array = [0, 1]\n i = 0\n\n if n == 0\n return 0\n elsif n == 1\n return 1\n else\n until i == (n - 1)\n fib_array << fib_array[i] + fib_array[i + 1]\n i += 1\n end\n end\n return fib_array[n]\nend",
"def fib(n) #n indicates # of elements we want in array\r\n a = 0\r\n b = 1\r\n fib_arr = []\r\n #loop starts iff n >= 1, but x starts from 0 (when n=1, x=0; n=2, x=0,1)\r\n n.times do |x| \r\n if x == 0\r\n fib_arr << a\r\n elsif x == 1\r\n fib_arr << b\r\n else\r\n c = a+b #c is the new fib # we are generating\r\n fib_arr << c\r\n a = b\r\n b = c\r\n end\r\n end\r\n return fib_arr\r\nend",
"def fib(x)\n fibo_number = [0, 1]\n (x - 2).times do\n n = fibo_number[-1] + fibo_number[-2]\n fibo_number << n\n end\n puts fibo_number\nend",
"def fibonacci(n)\n n = fibonacci( n - 1 ) + fibonacci( n - 2 ) if n > 1\n n\nend",
"def fib(x)\n fib_nums = [0,1]\n number = x - 2\n number.times do\n fib_nums << fib_nums[-2] + fib_nums[-1]\n end\n p fib_nums\nend",
"def fibs(n)\r\n\r\n fibs = [0, 1]\r\n until n == fibs.length\r\n fibs << fibs[-1] + fibs[-2]\r\n end\r\n fibs\r\n\r\nend",
"def fibs(n)\r\n\r\n fibs = [0, 1]\r\n until n == fibs.length\r\n fibs << fibs[-1] + fibs[-2]\r\n end\r\n fibs\r\n\r\nend",
"def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n else\r\n return fibonacci(n-1) + fibonacci(n-2)\r\n end\r\nend",
"def fibonacci(int)\n range_array = (1..int).to_a\n final_array = [1,1]\n range_array.each do |num|\n p num > 2 ? final_array << final_array[num-3] + final_array[num-2] : nil\n end\n final_array[-1]\nend",
"def fibonacci(int)\n range_array = (1..int).to_a\n final_array = [1,1]\n range_array.each do |num|\n num > 2 ? final_array << final_array[num-3] + final_array[num-2] : nil\n end\n final_array[-1]\nend",
"def fibonacci(n)\n fib = [1, 1]\n #count from 3rd term but\n #i = 2 because of array 0 indexing\n i = 2\n\n while i < n\n fib.push(fib[i-1] + fib[i-2])\n i += 1\n end\n\n #print result\n puts fib.inspect\nend",
"def fibonacci_number(i)\n if i == 1 || i == 2\n 1\n else\n fibonacci_number(i - 1) + fibonacci_number(i - 2)\n end\nend",
"def fib1(n)\n fibs = [0, 1]\n ( 0..(n-1) ).each { |idx|\n next if fibs[idx] < 1\n fibs << fibs[idx] + fibs[idx - 1]\n }\n fibs.last\nend",
"def iter_fib(number)\n v1 = 0\n v2 = 1\n (number-1).times.each do\n temp = v2\n v2 = v2 + v1\n v1 = temp\n end\n v2\nend",
"def fibonacci(amount)\r\n fib_array = [0, 1]\r\n current_value = 0\r\n if (amount == 0) ; return 0; end # Edge case...\r\n if (amount == 1) ; return 1; end # Edge case...\r\n\r\n index = 2 # Start indexing after the edge cases.\r\n until index == amount\r\n current_value = fib_array[-1] + fib_array[-2] # Equation for Fib-sequence. push it onto array afterwards.\r\n fib_array.push(current_value)\r\n index += 1 # counter approaching amount\r\n end \r\n return fib_array[-1] # return the last value we did!\r\nend",
"def calc_fib(n)\n # initialize list with first two numbers\n fib_list = [0, 1]\n # then iteratively add new members of the series, up but not including n\n i = 2\n while i <= n\n fib_list.push(fib_list[i-1] + fib_list[i-2])\n i += 1\n end\n return fib_list[n]\nend",
"def fibonacci(integer)\n x = 2\n sequence = [1, 1]\n until x == integer\n last = sequence[0] + sequence[1]\n first = sequence[1]\n sequence[1] = last\n sequence[0] = first\n x += 1\n end\n\n sequence.last\nend",
"def fib_iterative(n)\n\tnum = 0\n\tnext_num = 1\n\tpositions = 1..n\n\tpositions.each do |position|\n\t\tnum = next_num\n\t\tnext_num = next_num + num\n\tend\n\tretun num\nend",
"def fibonacci(n)\n return [0,1].take(n) if n <= 2\n fib_seq = fibonacci(n-1)\n last_ele = fib_seq[-1] + fib_seq[-2]\n fib_seq << last_ele\nend",
"def fibonacci n\n first = 0\n second = 1\n n.times do\n third = first + second\n first = second\n second = third\n end\n first\nend",
"def fibonacci_number(num)\n # make sure fibonacci_number(0) and fibonacci_number(1)\n # start the sequence by returning 1 and 1. \n # This is an edge case\n\n if num <= 2\n return 1\n end\n # start the sequence with the first two numbers\n fibs_ar = [1, 1]\n # for educational purposes\n counter = 1\n\n # calculate the next number until the array has the one we want\n while fibs_ar.length < num\n second_to_last = fibs_ar[fibs_ar.length - 2]\n last = fibs_ar.last\n next_fib = second_to_last + last\n fibs_ar << next_fib\n counter +=1\n puts \"second_to_last = #{second_to_last}\"\n puts \"last = #{last}\"\n puts \"next_fib = #{next_fib}\"\n puts \"counter = #{counter}\"\n puts \"The Fibonacci Series is = #{fibs_ar}\"\n puts \"After #{counter} iterations, the last number is #{last}\"\n puts \"===========================================\"\n end\n print \"The final Fibonacci series is: #{fibs_ar}\"\n print \"\\n\"\n print \"The number in the Fibonacci series at position #{num} is: #{fibs_ar.last}\"\n print \"\\n\"\n fibs_ar.last\nend",
"def fib(n)\n current_value = 0\n next_value = 1\n\n n.times do |i|\n current_value, next_value = next_value, current_value + next_value\n end\n\n return current_value\nend",
"def fibonacci2(n)\n return 0 if n == 0\n return 1 if n == 1 || n == 2\n last = 0\n lastlast = 1\n current = 0\n n.times do\n current = last + lastlast\n lastlast = last\n last = current\n end\n current\nend",
"def fibonacci(n)\n fibonacci_num = 0\n prior_num = 0\n current_num = 1\n\n if !n || n < 0\n raise ArgumentError\n elsif n == 0 || n == 1\n return n\n else \n (n-1).times do\n fibonacci_num = prior_num + current_num\n prior_num = current_num\n current_num = fibonacci_num\n end\n return current_num\n end\nend",
"def fibonacci(n)\n fibb = []\n fibb[0], fibb[1], fibb[2] = 0, 1, 1\n (3).upto(n) do |i|\n fibb[i] = fibb[i - 2] + fibb[i - 1]\n end\n fibb[n]\n end",
"def fib(n)\n n.times.each_with_object([0,1]) { |_, results| results << results[-2] + results[-1] }\nend",
"def fibonacci(n)\n if n<=2\n [0,1].take(n)\n else\n arr = fibonacci(n-1)\n arr << arr[-2]+arr[-1]\n end\nend",
"def iterative_fib_sequence(n)\n\tfib = [0]\n\tn.times do\n\t\tif fib.length > 2\n\t\t\tfib << fib[-1] + fib[-2]\n\t\telse\n\t\t\tfib << 1\n\t\tend\n\tend\n\tfib\nend",
"def fibonacci (n)\r\n seq = [0, 1]\r\n \r\n (2..n).each do |i|\r\n seq.push seq[i-1] + seq[i-2]\r\n end\r\n \r\n return seq\r\nend",
"def fib(n)\n n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] }\nend",
"def fib_i(n)\n fin_fib = [0,1]\n until n == fin_fib.length\n fin_fib.push(fin_fib[-2] + fin_fib[-1])\n end\n fin_fib\nend",
"def fib(num)\n fib_seq_arr = []\n\n (0..num).each do |number|\n fib_seq_arr << number if number <= 1\n fib_seq_arr << fib_seq_arr[-1] + fib_seq_arr[-2] if fib_seq_arr.length > 1\n end\n return fib_seq_arr\nend",
"def fib(n)\n fib_0 = 0\n fib_1 = 1\n (0...n).each do \n temp = fib_0\n fib_0 = fib_1\n fib_1 = temp + fib_1\n end\n return fib_1\nend",
"def fibs(n)\n result = []\n penultimate = 0\n last = 1\n ## skips iteration if n = 0\n 1.upto(n) do |num|\n if num == 1\n result << penultimate\n elsif num == 2\n result << last\n else\n next_num = penultimate + last\n penultimate = last\n last = next_num\n result << next_num\n end\n end\n return result\nend",
"def fib_seq(n)\n return \"#{n} isn't a positive integer number\" if n < 1\n\n fib_array = []\n\n n.times do |number|\n number > 1 ? fib_array.push(fib_array[number - 1] + fib_array[number - 2]) : fib_array.push(number)\n end\n\n fib_array\nend",
"def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend",
"def fibonacci(n)\n result = []\n i = 1\n while i <= n\n if i == 1 || i == 2\n result << 1\n else\n result << result[i - 3] + result[i - 2]\n end\n i += 1\n end\n result.last\nend",
"def get_fibonacci_sequence(count)\n $i = 0\n # make sure we were passed in a number by converting it to an integer and then comparing the string value of the resulting\n # object to the original as to_i will output 0 if it can't convert to an integer\n # if it's not a number we'll raise an ArgumentError\n i_count = count.to_i\n if i_count.to_s != count || i_count < 0\n raise(ArgumentError, 'The requested number of items from the sequence must be a positive number.')\n end\n\n # create a new array to hold the calculated values and seed it with the first 2 numbers of the sequence to use in the calculations\n fib_sequence = Array.new\n fib_sequence.push 0\n fib_sequence.push 1\n $i+=2\n\n while $i <= i_count\n fib_sequence.push fib_sequence[-2] + fib_sequence[-1]\n $i+=1\n end\n # because we seed the array with the first 2 values of the sequence, we use slice to make sure we don't return too many items\n # in the case where they request 0 or 1 items\n fib_sequence.slice(0, i_count)\n end",
"def fibonacci number\n sequence = []\n a = 1\n b = 1\n while true\n sequence << b\n newa = b\n b = a+b\n a = newa\n break if b > number\n end\n sequence\nend",
"def fibonacci(n)\n fib_array = [0,1]\n\tfib = n - 2\n fib.times do |fib|\n fib_array << fib_array[-1] + fib_array[-2]\n end\n\n\tif fib_array.count < 20\n \tp fib_array\n else\n \tp fib_array.last \n end\t\nend",
"def fibonacci_numbers(num) #method takes one argument. The amount of fibonacci numbers you wish to generate.\r\n\tfib_arr = [0,1] #the fibonacci sequence begins with integers 0 and 1\r\n\t(num-2).times {fib_arr << fib_arr[-1] + fib_arr[-2]} #because the first two numbers are given we subtract 2 from the number of times we want to push numbers into our fib_arr.\r\n#we add the last two numbers in the sequence togther and push that to the fib_arr\r\n\treturn fib_arr #return array with new numbers\r\nend",
"def fibo(n)\n\n first = 0\n second = 1\n total = 0\n\n (1...n).each do\n total = first + second\n first = second\n second = total\n end\n return total\nend",
"def fibonacci(num)\n\tresult = [1]\n\tcurrent = 1\n\tuntil num == 1\n\t\tresult.push(current)\n\t\tcurrent += result[result.length-2]\n\t\tnum -= 1\n\tend\n\treturn result\nend",
"def iterative_fibinacci(num)\n\tfib_container = [1,1]\n\t(num-2).times { fib_container << fib_container[-2] + fib_container.last }\n\tfib_container\nend",
"def sim_fib(n)\n return '0' if n == 0\n return '01' if n == 1\n\n sim_fib(n - 1) + sim_fib(n - 2)\nend",
"def get_nth_fib(n)\n if n == 0 || n == 1\n return 0\n elsif n == 2\n return 1\n else\n return get_nth_fib(n-1) + get_nth_fib(n-2)\n end\n\nend",
"def find_fib_nth(n)\n if n == 0\n 1\n elsif n == 1\n 1\n else\n return (find_fib_nth(n - 2) + find_fib_nth(n - 1))\n end\nend",
"def fib(x)\n fib = [0,1]\n index_count = 0\n until index_count == x - 2\n fib << (fib[index_count] + fib[index_count + 1])\n index_count += 1\n end\n p fib\nend",
"def fibonacci(n)\n return 1 if n <= 2\n num1, num2 = [1, 1]\n index = 2\n while n > index\n running_total = num1 + num2\n num1, num2 = num2, running_total\n n -= 1\n end\n running_total\nend"
] | [
"0.82578814",
"0.817861",
"0.8171225",
"0.81679255",
"0.8152787",
"0.8117557",
"0.8115754",
"0.8089277",
"0.80868137",
"0.806834",
"0.8060022",
"0.8044851",
"0.80428267",
"0.80332655",
"0.8028445",
"0.7977023",
"0.795287",
"0.793297",
"0.79304934",
"0.79237646",
"0.79113305",
"0.7894359",
"0.7894108",
"0.7880599",
"0.78696007",
"0.7863249",
"0.78553385",
"0.78531206",
"0.7852721",
"0.78480715",
"0.7837109",
"0.7836805",
"0.7828573",
"0.7826223",
"0.7825993",
"0.78165305",
"0.7813186",
"0.7808788",
"0.7807332",
"0.7796267",
"0.7791192",
"0.7783813",
"0.7777004",
"0.7776938",
"0.7772991",
"0.777239",
"0.77699333",
"0.7768147",
"0.77504635",
"0.77492213",
"0.7747749",
"0.77444476",
"0.773881",
"0.7738087",
"0.77361333",
"0.77348775",
"0.7732954",
"0.77327603",
"0.77327603",
"0.77275777",
"0.77225596",
"0.7721097",
"0.77208805",
"0.7716442",
"0.77159244",
"0.77146006",
"0.7713741",
"0.77131087",
"0.77122515",
"0.7711545",
"0.77110416",
"0.77100617",
"0.7709614",
"0.7708288",
"0.7707477",
"0.7702049",
"0.77015215",
"0.7701511",
"0.76983607",
"0.7697901",
"0.7696019",
"0.7695526",
"0.76954824",
"0.7693781",
"0.7688831",
"0.76871735",
"0.7685433",
"0.76844573",
"0.76838875",
"0.768133",
"0.76783746",
"0.7677065",
"0.7673077",
"0.767141",
"0.7668354",
"0.7665815",
"0.76619124",
"0.76608765",
"0.7657855",
"0.7657721",
"0.765738"
] | 0.0 | -1 |
identify if document is flagged to be encrypted | def mustBeEncrypted?
return false if @conf["gpg::encrypt"].nil? or @conf["gpg::encrypt"] != TRUE
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def signed_or_encrypted; end",
"def xml_authorized?\n self.documento.digital == true\n end",
"def authorized?(encrypted_string)\n\n \tend",
"def is_encrypted\n return @is_encrypted\n end",
"def encrypted?\n @encrypted ||= false\n end",
"def flag_unencrypted?()\n return(true) if(@flags & TAC_PLUS_UNENCRYPTED_FLAG == TAC_PLUS_UNENCRYPTED_FLAG)\n return(false)\n end",
"def is_signer\n if current_user == @doc.signer\n true\n else\n false\n redirect_to root_path, notice: \"Вы не имеете прав подписывать или отказывать в подписи этого документа\"\n end\n end",
"def encrypted?\n\t\tFile.exists?(File.join(self.location, \"encrypted\"))\n\tend",
"def can_decrypt?\n false\n end",
"def classic?\n !! @signer\n end",
"def should_encrypt_password\n @encrypt_password_flag || false\n end",
"def verified?\n key == '1'\n end",
"def isDecrypted( artifact )\n ## There are several fields that a decrypted artifact\n ## will have; this is only one of them.\n if artifact.has_key?( \"secondary_private_fields\" )\n return true\n end\n return false\nend",
"def encryption_required?\n super\n end",
"def signed_icla?\n !icla_signatures.empty?\n end",
"def secure?\n self.generated_signature == self.signature\n end",
"def encrypted_attribute?(attribute)\n encrypted_keys.include?(attribute)\n end",
"def contains_document?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_document?}\n result\n end",
"def suppresses_encryption?\n value =~ /^_/\n end",
"def author_worthy?\n notes?\n end",
"def FT_IS_CID_KEYED(face)\n face.face_flags & FaceFlag[:CID_KEYED]\n end",
"def is_citable document\n if document.respond_to?(:export_as_mla_citation_txt) || document.respond_to?(:export_as_apa_citation_txt)\n return true\n end\n end",
"def is_encrypted=(value)\n @is_encrypted = value\n end",
"def document?\n self.type == \"Document\"\n end",
"def is_certificate_entry(aliaz)\n\n end",
"def encrypted?(value)\n value.is_a?(String) && value.start_with?(ENCRYPTED_PREFIX)\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def encrypt?\n !@options[:bypass_auto_encryption]\n end",
"def attr_encrypted?(attribute)\n encrypted_attributes.has_key?(attribute.to_sym)\n end",
"def cms_voucher_request?\n false\n end",
"def ecb_encrypted?(cipher)\n line_parts = cipher.scan(/.{16}/)\n line_parts.detect { |e| line_parts.count(e) > 1 } ? true : false\nend",
"def xml_authorized?\n self.firma == true \n end",
"def restricted_should_authenticate\n authenticate_user! unless @document.public?\n end",
"def encrypted?(ctx)\n ctx[:server][:encrypted] && !ctx[:server][:encrypted].to_s.empty?\n end",
"def attr_encrypted?(attribute)\n encrypted_attributes.keys.include?(attribute.to_s)\n end",
"def license_allows_download?(document)\n document[:license_ss] =~ /(Creative Commons|No known restrictions)/\n end",
"def document?\n self.type == \"Assetabler::Document\"\n end",
"def in_a_document?\n state = false\n state = true if document_lines.count > 0\n return state\n end",
"def attr_encrypted?(attribute)\n attr_encrypted_encrypted_attributes.has_key?(attribute.to_sym)\n end",
"def certified?\n @data['certifiedBot']\n end",
"def encryption_control_information\n \"Version: 1\"\n end",
"def encryption_info\n @ms_off_crypto.encryption_info\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def scram_sha_256_enabled?\n $scram_sha_256_enabled ||= scanned_client_server!.features.scram_sha_256_enabled?\nend",
"def scram_sha_256_enabled?\n $scram_sha_256_enabled ||= scanned_client_server!.features.scram_sha_256_enabled?\nend",
"def is_natural?\n identification_document_type.is_natural\n end",
"def with_encrypted_storage?\n @dbi.storage_encrypted\n end",
"def with_encrypted_storage?\n @dbi.storage_encrypted\n end",
"def letsencrypt_verify\n render body: 'ZfWSZ-8jDoGc8OenfP8JC79QPITHFU6BH9YPvVabGd8.f7vLMOThcyEXB9qAI5BSN_yaTVOEKeyNNW23TFYNCRA'\n end",
"def postConditionalGLSConnection\n# 4A107\n dataProtection = DataProtection.new\n result = (dataProtection.checkDataEncrypted('cougaar') >= 100)\n saveResult(result, \"4a107\", \"no persisted data encrypted if dataprotection is not turned on\")\n#exit 0\n\n end",
"def opendocument?\n false\n end",
"def opendocument?\n false\n end",
"def authorisation?\n event_code == AUTHORISATION\n end",
"def signature?\n SIGNATURES.include?(@simplified.downcase)\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def verified?\n true\n end",
"def regenerate?(document); end",
"def should_encrypt_password=(flag)\n @encrypt_password_flag = flag\n end",
"def supporting_document_other?\n supporting_document_list.include?('OTHER')\n end",
"def flag_unencrypted!\n if (!flag_unencrypted?)\n @flags = @flags | TAC_PLUS_UNENCRYPTED_FLAG\n else\n @flags = @flags & (~TAC_PLUS_UNENCRYPTED_FLAG)\n end\n return(nil)\n end",
"def secret?\r\n own? or invited? or admin?\r\n end",
"def demotable?\n @demotable\n end",
"def i_cloud_require_encrypted_backup\n return @i_cloud_require_encrypted_backup\n end",
"def file_download_access?\n if license_delivery_contact == 'Yes'\n true\n end\n end",
"def certified?\n @data['certifiedDev']\n end",
"def validate\n encrypt\n end",
"def verify_mode; end",
"def verify_mode; end",
"def verify_mode; end",
"def has_verified_akismet_key?()\n return @verifiedKey\n end",
"def votable?\n # NOTE: it was requested by NCID staff to make all registrations automatically votable\n # regardless of certification status\n return true\n# return self.certification.present?\n end",
"def challenge_readable?\n cryptography_provider.respond_to? :decrypt\n end",
"def signed?\n @signed\n end",
"def challenge_password?\n !read_attributes_by_oid('challengePassword').nil?\n end",
"def isEmailVerified?()\n flags & 16 != 0\n end",
"def encrypted_column?(attribute)\n encrypted_columns.include?(attribute)\n end",
"def plain?\n mechanism == :plain\n end",
"def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end",
"def consigned?\n false\n end",
"def encrypt?\n @path.end_with? '.gpg'\n end",
"def plain?\n mechanism == :plain\n end",
"def true_is_ingested_in_trustee\n 'true'\n end",
"def has_correct_license_key?\n has_license_key? && correct_license_length\n end",
"def can_read_document?(doc = nil)\r\n true\r\n end",
"def data_bag_encrypted?\n if(node[node_key][:config_bag].respond_to?(:has_key?))\n !!node[node_key][:config_bag][:encrypted]\n else\n false\n end\n end",
"def verify_key; end",
"def verify_key; end",
"def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end",
"def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end",
"def encryptable?(file = nil)\n bool = false\n flags_ptr = FFI::MemoryPointer.new(:ulong)\n\n if file\n file = File.expand_path(string_check(file))\n wide_file = file.wincode\n\n if !PathIsRootW(wide_file)\n unless PathStripToRootW(wide_file)\n raise SystemCallError.new(\"PathStripToRoot\", FFI.errno)\n end\n end\n else\n wide_file = nil\n end\n\n unless GetVolumeInformationW(wide_file, nil, 0, nil, nil, flags_ptr, nil, 0)\n raise SystemCallError.new(\"GetVolumeInformation\", FFI.errno)\n end\n\n flags = flags_ptr.read_ulong\n\n if flags & FILE_SUPPORTS_ENCRYPTION > 0\n bool = true\n end\n\n bool\n end",
"def request_encrypt_content\nRails.logger.debug \"request_content=#{request_content.inspect}, request.raw_post=#{request.raw_post.inspect}\"\n request_content['xml']['Encrypt']\n end",
"def audience_restricted?\n xml.attribute('audience_restricted') == 'true'\n end",
"def allows_document?\n self.allows_title? && ![TITLE, COVER].include?(self.kind)\n end",
"def should_encrypt?(path)\n options.exts.include?(path.extname) && options.ignore.none? { |ignore| Middleman::Util.path_match(ignore, path.to_s) }\n end",
"def licensed?\n end",
"def verification_flags; end",
"def mongoize\n encrypted\n end",
"def is_encarcelado\n return @encarcelado\n end"
] | [
"0.63967687",
"0.63851815",
"0.63544494",
"0.6336276",
"0.6270608",
"0.6244641",
"0.602539",
"0.59576845",
"0.5910024",
"0.590356",
"0.5861356",
"0.5803271",
"0.5757316",
"0.57561487",
"0.57331526",
"0.5727445",
"0.57183105",
"0.57073677",
"0.56989354",
"0.5691105",
"0.5608582",
"0.55889666",
"0.55622387",
"0.5556536",
"0.55540955",
"0.5542803",
"0.554232",
"0.55069804",
"0.55069804",
"0.5504085",
"0.5503254",
"0.5494667",
"0.5493117",
"0.5490282",
"0.54850626",
"0.5481732",
"0.54751086",
"0.5452699",
"0.54487205",
"0.5448167",
"0.5445244",
"0.5443689",
"0.5433565",
"0.5424255",
"0.5351265",
"0.5351265",
"0.5322245",
"0.5322245",
"0.53198504",
"0.5311345",
"0.5311345",
"0.52988094",
"0.5298126",
"0.52887183",
"0.52887183",
"0.5285062",
"0.5283552",
"0.5283538",
"0.5273959",
"0.5271319",
"0.5271286",
"0.52623725",
"0.5255523",
"0.52536404",
"0.5252079",
"0.52440804",
"0.52345884",
"0.5233582",
"0.5227778",
"0.52114516",
"0.52114516",
"0.52114516",
"0.52057153",
"0.520417",
"0.51999557",
"0.5196485",
"0.5196373",
"0.5196018",
"0.5192775",
"0.51888645",
"0.51881146",
"0.5181736",
"0.5181613",
"0.515953",
"0.5156731",
"0.5153963",
"0.5151567",
"0.51423126",
"0.514133",
"0.514133",
"0.5133368",
"0.5133368",
"0.51306874",
"0.5126954",
"0.5125294",
"0.5122895",
"0.5119804",
"0.51179564",
"0.5116376",
"0.5114276",
"0.5113472"
] | 0.0 | -1 |
Read optional file parameters | def ReadConfig()
# Deep copy
puts "Reading global config file #{$conf[:globalConfFile]}" if $verbose
conf = Marshal.load( Marshal.dump($conf) )
optfile = @ConfFile
conf["conffile"] = optfile
conf["filename"] = @filename
conf["dir"] = @dir
if File.exists?(optfile)
begin
puts "Reading specific config file #{optfile}" if $verbose
c = YAML.load_file(optfile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if c[s].class == Array
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
else
conf[s] = c[s]
end
}
rescue
puts "Error loading #{optfile}"
end
else
puts "Skip loading unknown specific config file #{optfile}" if $verbose
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
conf[k][i].gsub!(/%D/, @dir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
conf[k].gsub!(/%D/, @dir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def merged_file_read_opts(site, opts); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:name].nil? ||\n config[:vios].nil? ||\n config[:virtual_server].nil? ||\n config[:disk_name].nil?\n show_usage\n exit 1\n end\n\n if config[:profile].nil?\n config[:profile] = config[:name]\n end\n end",
"def readParams(fname)\n begin\n f = File.open(fname)\n rescue Exception => e\n puts e\n $stdout.flush\n exit(1)\n end\n\n section = nil\n f.each_line{|line|\n\n line.chomp!\n line.strip!\n if line == \"\" || line =~ /^%/\n # skip blank lines & lines beginning with %\n\n elsif line == $headerPorts || line == $headerShips ||\n line == $headerTraveler || line == $headerOutput\n section = line\n\n elsif section == $headerPorts\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starport.push(Starport.new(name,size))\n \n elsif section == $headerShips\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starship.push(Starship.new(name,size))\n\n elsif section == $headerTraveler\n parts = line.split(' ')\n name = parts.shift\n itinerary = []\n parts.each { |p| itinerary.push(find_name($starport,p)) }\n person = Traveler.new(name,itinerary)\n $traveler.push(person)\n find_name($starport,parts.first).arrive(person)\n\n elsif section == $headerOutput\n $simOut.push(line)\n\n else\n puts \"ERROR: simFile format error at #{line}\"\n $stdout.flush\n exit(1)\n end\n }\nend",
"def read_parameter\n @parameters = []\n ARGV.each { |option| parameters.push(option) }\n raise Exceptions::InvalidParameters if parameters.length > 1\n raise Exceptions::EmptyParameters if parameters.length.zero?\n end",
"def parse_file_argument(key)\n if @opts[key].nil? and [email protected]\n @opts[key] = do_file_read(f)\n end\n end",
"def read_options_from_file\n Shellwords.shellwords File.read(\".rspec_n\").to_s.gsub(/\\n|\\r\\n/, \" \")\n end",
"def read_defaults(fname, o)\n if File.exist?(fname)\n IO.foreach(fname) do |line|\n next if line.match(/^\\s*#/) || line.match(/^\\s*$/)\n if /(?<key>\\S+)\\s*=\\s*(?<val>\\S+)/ =~ line\n o[key.to_sym] = val\n end\n end\n else\n STDERR.puts \"Warning: System defaults file '#{fname}' does not exist\"\n end\nend",
"def read_params(params)\n cg_reader.read_params(params)\n end",
"def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"def file_options; end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def readConfigFile(filename)\n f = File.open(filename, \"r\")\n f.each_line do |line|\n line = line.strip().split(\"=\")\n option = line[0].upcase\n value = Integer(line[1])\n if option == \"UPDATEINTERVAL\"\n $update_interval = value\n elsif option == \"MAXPAYLOAD\"\n $mtu = value\n elsif option == \"PINGTIMEOUT\"\n $ping_timeout = value\n end\n end\n f.close()\nend",
"def readFlags\n @opt_parser.parse!\n\n Aerospike.logger.level = Logger::ERROR\n if @options[:debug_mode]\n Aerospike.logger.level = Logger::INFO\n end\n\n @binDataType, binDataSz = parseValuedParam(@options[:bin_def])\n if binDataSz\n @binDataSize = @options[:binDataSz]\n else\n case @binDataType\n when 'B'\n @binDataSize = 200\n when 'S'\n @binDataSize = 50\n end\n end\n\n @workloadType, workloadPct = parseValuedParam(@options[:workload_def])\n if workloadPct\n @workloadPercent = workloadPct.to_i\n else\n case @workloadType\n when 'I'\n @workloadPercent = 100\n when 'RU'\n @workloadPercent = 50\n end\n end\nend",
"def file_params\n [:path, :tag_list, :attachment, :downloadable].inject({}) do |hash, key|\n hash[key] = params[key] unless params[key].nil?\n hash\n end\n end",
"def read_config_file(file); end",
"def load_file_params\n @filename, @params = URIUtils.parse_asset_uri(uri)\n end",
"def read_config_file; end",
"def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend",
"def add_std_file_opt(inkey)\n @oparse.on(\"-f\", \"--file FILENAME\", \"Input from FILENAME\") do |f|\n @opts[inkey] = do_file_read(f)\n end\n return @oparse\n end",
"def read_configurations(file_name = T.unsafe(nil)); end",
"def import_params\n params.require(:file)\n end",
"def parameters_source\n @parameters_source ||= @options[:parameters_content] || read_file(parameter_file)\n end",
"def read_input_params options_cli={}\n #utility sub\n def find_first_yaml_file(dir_to_process)\n Dir.chdir(dir_to_process)\n yaml_file = nil\n Dir.glob(\"*.{yaml,yml}\") do |file|\n yaml_file = file\n break\n end \n return yaml_file\n end\n\n # read input args\n dir_to_process = Dir.pwd\n fail(\"#{dir_to_process} does not exist\") unless File.exist?(dir_to_process) \n fail(\"#{dir_to_process} is not a Directory\") unless File.directory?(dir_to_process)\n $log.info \"Dir to be processed: #{dir_to_process}\"\n \n yaml_name = options_cli['--event']||find_first_yaml_file(dir_to_process)\n fail(\"- no YAML File found;\") if yaml_name.nil? \n fail(\"- no YAML File found;\") unless File.file?(yaml_name)\n $log.info \"YAML Profile to be processed: #{yaml_name}\"\n return [dir_to_process, yaml_name]\nend",
"def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend",
"def read_options\n if ( request.format.csv? )\n @is_task_type = params[ :user_report ].nil?\n type = @is_task_type ? 'task' : 'user'\n @exclude_title = ! ( params[ \"include_title_#{ type }\" ] == '1' )\n end\n end",
"def read_parameters\n params = read_stdin\n return_error(\"Parameter 'target' contains illegal characters\") unless safe_string?(params['target'])\n params\nend",
"def read(*args, **kwd); end",
"def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend",
"def yardopts(file = T.unsafe(nil)); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end",
"def read_as_params\n reader ? {full_name => read} : {}\n end",
"def read_file_params\n params.require(:read_file).permit(:fecha, :referencia, :descripcion, :monto, :saldo)\n end",
"def read_options(files)\n ret = {}\n files.each do |file|\n data = read_file(file)\n next if data.nil? || data.empty?\n ret = merge_hashes(ret, data)\n end\n ret\n end",
"def load_params(args)\n return args['playbook_name'],\n args['role_name'],\n args['vars'] || {},\n args['tags'],\n args['user_id']\n end",
"def optional_file(val)\n path = val\n io = val if String === val\n if Hash === val\n raise 'argument to optional_file should be length 1' if val.size != 1\n path = val.first[0]\n io = val.first[1]\n end\n @book.add_optional_file(path, io)\n end",
"def initialize file\n @file = file\n @properties = {}\n# IO.foreach(file) do |line|\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# end\nFile.open(file, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n @properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n @properties[line] = ''\n end\n end\n end\n end\nend",
"def optional_config_file\n if ::File.exists?(@options.to_s)\n @options = @global.load_ruby_config(::File.expand_path(@options))\n end\n end",
"def github_params\n if File.exist?(GITHUB_INFO_PATH)\n read_github_info\n else\n retrieve_options_from_user\n end\n end",
"def read_opts(file_path=nil)\n begin\n default_opts.merge!(\n deep_symbolize(YAML.load_file(file_path || config_file_path))[environment.to_sym])\n rescue Errno::ENOENT => e\n p \"[warning] config file not read, using default options\"\n default_opts\n end\n end",
"def read(*args)\n file.try(:read, *args)\n end",
"def read(opts = T.unsafe(nil)); end",
"def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end",
"def load_input_params(in_file)\n params = YAML::load(File.open(in_file))\n load_helper(params[\"SS_script_support_path\"])\n @params = strip_private_flag(params)\n #BJB 11-10-14 Intercept to load framework\n initialize_framework\n @params\n end",
"def get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend",
"def read_config_files(files); end",
"def parameter_file\n filename_path(:parameter_dir, filename)\n end",
"def loadKnownParams(filename)\n\t\t\t@knownParams = {}\n\t\t\tif (!File.exist? filename )\n\t\t\t\tlogger(-1, \"Error, Known Params File does not exist: #{filename}\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlogger(1, \"Parsing Known Params File: #{filename}\")\n\t\t\tkpf = File.open( filename )\n\t\t\tkpf.each_line do |line|\n\t\t\t\tentry = line.chomp.split(',')\n\t\t\t\tobject = entry.shift\n\t\t\t\tif @knownParams.has_key?(object)\n\t\t\t\t\t@knownParams[object][entry.shift] = entry\n\t\t\t\telse\n\t\t\t\t\t@knownParams[object] = { entry.shift => entry } \n\t\t\t\tend\n\t\t\tend\t\t\n\t\t\tkpf.close\n\t\tend",
"def dir_get_args(dir)\n get_args(dir) { |filename| read_nil(filename) }\nend",
"def read_settings\n if test( ?s, RC_FILE )\n lines = File.read( RC_FILE ).split( /\\r\\n?|\\n/ )\n lines.each do |l|\n l = l.sub( /#.*$/, '' ) # remove trailing comments\n if l =~ /^\\s*(\\S+)\\s*=\\s*(\\S(.*\\S)?)\\s*$/\n key, val = $1, $2\n $rc_settings[ key ] = val \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n elsif l =~ /^\\s*(\\S+)\\s*=\\s*$/\n key, val = $1, ''\n $rc_settings[ key ] = '' \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n end # if l =~\n end # do |l|\n end # if ?s\n end",
"def read_prop_file(prop_file)\n props = {}\n File.open(prop_file, 'r') do |f|\n f.each_line do |line|\n props[$1] = $2 if line =~ /^export (.*)=(.*)$/\n end\n end if File.exists?(prop_file)\n props\nend",
"def load_ini\n last_file = nil\n last_speed = nil\n last_position = nil\n last_speeds = nil\n if File.exists? @ini_file\n File.open(@ini_file, \"r\") do |f|\n f.each do |line|\n last_file = line.sub(\"last_file=\", \"\").strip if line =~ /^last_file=/\n last_speed = line.sub(\"last_speed=\", \"\").strip.to_f if line =~ /^last_speed=/\n last_position = line.sub(\"last_position=\", \"\").strip.to_i if line =~ /^last_position=/\n if line =~ /^speeds=/\n last_speeds = line.sub(\"speeds=\", \"\").strip.split(\",\")\n last_speeds.map!{|s| s.to_f}\n end\n if line =~ /^partial_repeat=/\n @partial_repeat = line.sub(\"partial_repeat=\", \"\").strip\n if @partial_repeat == 'true'\n @partial_repeat = true\n else\n @partial_repeat = false\n end\n end\n @partial_duration = line.sub(\"partial_duration=\", \"\").strip.to_i if line =~ /^partial_duration=/\n end\n end\n end\n return last_file, last_speed, last_position, last_speeds\nend",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_quantity = info[0].chop\n @last_category = info[1].chop.to_i\n @exercises = info[2].chop.split(\",\")\n @last_repq = info[3].chop\n @rep_ex = info[4].chop\n end",
"def read(*rest) end",
"def read(*rest) end",
"def yardopts(file = options_file)\n return [] unless use_yardopts_file\n File.read_binary(file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def try_file(opt=\"\")\n File.read(File.expand_path(opt)) rescue opt\n end",
"def initialize(filename, read_properties=true)\n end",
"def initialize(filename, read_properties=true)\n end",
"def get_required_params(key)\n get_option(key, :required_params)\n end",
"def parse(filenames)\r\n properties = {}\r\n filenames.each do |filename|\r\n if (File.exists?(filename))\r\n file = File.open(filename, \"r\")\r\n file.read.each_line do |line|\r\n line.strip!\r\n if (line[0] != ?# and line[0] != ?=)\r\n i = line.index(\"=\")\r\n if (i)\r\n key = line[0..i - 1].strip\r\n value = line[i + 1..-1].strip\r\n properties[key] = value.strip\r\n else\r\n key = line\r\n value = \"\"\r\n properties[key] = value\r\n end\r\n end\r\n end\r\n file.close\r\n file = nil\r\n end\r\n end\r\n properties\r\nend",
"def base_validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n validate_parameters\n nil\n end",
"def read_config(config_path = T.unsafe(nil)); end",
"def PARAMETER_LIST()\r\n\"\r\n_VT01.txt:5du-4du+-3du+,1p,2m 8 6 12 0 64 2 24\r\n_VT02.txt:5m-2p,4d-3me,1p\r\n_VT03.txt:2me,3m,4m 8 6 12 0 64 2 24\r\n_VT04.txt:2m,7d-2me,3pw 8 6 12 0 64 2 24\r\n_VT05.txt:2me,3m-7m-6p+,4m-5m+ 8 6 12 0 64 2 24\r\n_VT06.txt:2me[2f]-6p[3]+,3m[1e]-7m[6d]-6p[3]+-2mew+,4m[3c]-5m[2b]+-2me+ 8 6 12 0 64 2 24\r\n_VT07.txt:1d-2me-3p,4m[uf]-5m[2]+,5m[6]-6me[2]+-3p[3]+-2mew+ 8 6 12 0 64 2 6\r\n_VT08.txt:9d-10d-11d-12d, 4p-5m-7m, 6m-8m | 1me, 2me, 3p\r\n\"\r\nend",
"def read_file(filename); end",
"def sysread(*rest) end",
"def sysread(*rest) end",
"def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end",
"def opts\n load_defaults unless @opts\n @opts\n end",
"def file_format_params\n params.require(:file_format).permit(:title, :notes)\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def load_params args\n\tparams = {}\n\targs.each_slice(2) do | key_value |\n\t\t# puts \"o #{key_value}\"\n\t\tparams[key_value[0][1..-1]] = key_value[1]\n\tend\n\tparams\nend",
"def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end",
"def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end",
"def read(*args)\n IO.read(@path, *args)\n end",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_learnq = info[0].to_i\n @last_repq = info[1].to_i\n @last_exerq = info[2].to_i\n @last_category = info[3].to_i\n @exercises = info[4].split(\",\").collect! {|v| v.to_i}\n @rep_ex = info[4].to_i\n end",
"def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end",
"def process_stack_parameters_file(filename)\n content = File.read(filename)\n return CloudFormation.parse_json_params(JSON.parse(content))\n end",
"def read_param(key)\n return nil unless value = params[key] || params[SHORT_NAMES[key]]\n value.strip!\n\n value.empty? ? nil : value\n end",
"def require_data(*file); end",
"def require_data(*file); end",
"def read_file(subpath = nil)\n result = {}\n path = full_path(@file_name_prefix, subpath)\n contents = File.file?(path) ? File.read(path) : ''\n contents.each_line do |line|\n match = line.chomp.match(/^(.+)=(.*)$/)\n result[match[1]] = match[2]\n end\n result\n end",
"def file_record_params\n params.fetch(:file_record, {})\n end",
"def get_flags(*files)\n matches = []\n begin\n files.each do |f|\n file = File.new(f, 'r')\n while (line = file.gets)\n m = line.match(/(^.*=)?/)\n matches << m[0] if m\n end\n file.close\n end\n rescue => err\n puts 'Exception: #{err}'\n err\n end\n matches.uniq.sort!\nend",
"def method_missing(m, *a, &b)\n read_settings(m.to_s)\n end",
"def read_file(file, context); end",
"def initialize(defaults,cmd_opts)\n @fields = defaults\n if !cmd_opts[:config_file].nil?\n path = cmd_opts[:config_file]\n else\n path = defaults[:config_file]\n end\n data = YAML.load_file(path)\n # Now combine data:\n # defaults, config file, command line (low->high priority)\n data.each do |k,v|\n if EXPECTED.include? k.to_sym\n @fields[k.to_sym] = v\n else\n STDERR.puts \"Warning: unknown section '#{k}' in config file\"\n end\n end\n cmd_opts.each do |k,v|\n @fields[k] = v\n end\n end",
"def parse_init_file(path)\n return [] unless ::File.exist?(path)\n\n in_info = false\n ::File.readlines(path).each_with_object([]) do |line, acc|\n if /^### BEGIN INIT INFO/.match?(line)\n in_info = true\n elsif /^### END INIT INFO/.match?(line)\n break acc\n elsif in_info\n if line =~ /Default-(Start|Stop):\\s+(\\d.*)/\n acc << $2.split(\" \")\n end\n end\n end.flatten\n end",
"def load_specification(file_name); end",
"def validate_opts\n validate_opts_file if options[:file]\n end",
"def build_args\n if File.exist? build_info_file\n build_info = File.readlines build_info_file\n build_info = build_info.map {|x| x.strip }\n build_info.delete \"\"\n build_info\n else\n []\n end\n end",
"def getParameters\n params = Hash.new\n\n # Define the supported options\n opts = GetoptLong.new(\n [ '-?', GetoptLong::NO_ARGUMENT ],\n [ '-d', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-h', GetoptLong::NO_ARGUMENT ],\n [ '-m', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-s', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-w', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-p', GetoptLong::REQUIRED_ARGUMENT ]\n )\n \n opts.each do |opt, arg|\n case opt\n when '-?'\n when '-h'\n raise\n when '-d'\n params['imageDirectory'] = arg\n when '-m'\n params['mapID'] = arg\n when '-s'\n params['metadataServerURL'] = arg\n when '-w'\n params['sleepDelay'] = arg\n when '-p'\n params['publishServerURL'] = arg\n end\n end\n \n params\n end",
"def read_file_level_settings\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_settings\n end"
] | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.5897326",
"0.58809644",
"0.58373344",
"0.58351016",
"0.5823861",
"0.57497233",
"0.57461405",
"0.5732525",
"0.57317245",
"0.57132757",
"0.5711",
"0.57086474",
"0.56513244",
"0.56203175",
"0.5594072",
"0.5592697",
"0.55752224",
"0.5517684",
"0.55149746",
"0.5496722",
"0.5495175",
"0.5486224",
"0.545998",
"0.54579645",
"0.5452573",
"0.54284143",
"0.5420056",
"0.5407102",
"0.5398042",
"0.5393706",
"0.5389009",
"0.5348413",
"0.53469765",
"0.5344859",
"0.5308994",
"0.53008205",
"0.52814114",
"0.5275601",
"0.5264888",
"0.52572304",
"0.5239648",
"0.5239648",
"0.5239558",
"0.52368546",
"0.5235852",
"0.52244216",
"0.52244216",
"0.5215373",
"0.5214081",
"0.5204531",
"0.52014554",
"0.51995486",
"0.5191211",
"0.51858777",
"0.51858777",
"0.51738644",
"0.5171061",
"0.5148052",
"0.5142491",
"0.5131674",
"0.5131047",
"0.513013",
"0.5128088",
"0.51253176",
"0.5125058",
"0.5122155",
"0.511778",
"0.5117451",
"0.5117451",
"0.5107368",
"0.5104604",
"0.5104577",
"0.50999326",
"0.5098876",
"0.50908405",
"0.50881994",
"0.50791806",
"0.50775564",
"0.50739384",
"0.5063782",
"0.5058908"
] | 0.0 | -1 |
Need to regenerate output file ? | def convertNeed?
# List of dependences
srcfiles = [ "-revhistory.xml" ]
return true if not File.exists?(@outfile)
if @doc.encrypted?
filename = @doc.filename_ori
else
filename = @doc.filename
end
return true if File.mtime(filename) > File.mtime(@outfile)
return true if File.exists?($conf[:globalConfFile]) and File.mtime($conf[:globalConfFile]) > File.mtime(@outfile)
return true if File.exists?(@ConfFile) and File.mtime(@ConfFile) > File.mtime(@outfile)
srcfiles.each {|s|
f = @doc.filename.gsub(@doc.extname, s)
return true if File.exists?(f) and File.mtime(f) > File.mtime(@outfile)
}
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_path; end",
"def regenerate\n generate\n end",
"def generate; end",
"def generate; end",
"def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end",
"def generate (path)\n File.open(path, \"w\") do |f|\n @output.each do |line|\n f.puts line\n end\n end \n end",
"def generate\n if @options.dry_run then\n # do nothing\n @generator.generate\n else\n Dir.chdir @options.op_dir do\n unless @options.quiet then\n $stderr.puts \"\\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}...\"\n end\n\n @generator.generate\n update_output_dir '.', @start_time, @last_modified\n end\n end\n end",
"def generate_output\n write_average_fitness('output/average.txt')\n write_best_fitness('output/best.txt')\n write_survivors('output/survivors.txt')\n write_traits('output/traits.txt')\n end",
"def run(inname, outname)\n\tgenerated = gen inname\n\n\tcopy_dependencies inname, outname, generated\n\n\tFile.write outname, generated\nend",
"def generate\n end",
"def write\n make_parent_directory\n generate_file\n end",
"def write\n\t\t#clear the directory before doing anything else\n\t\tclear @path\n\n\t\t#write out source code files\n\t\[email protected] do |mold|\n\t\t\twrite_object(mold.name + \".h\", header(mold))\n\t\t\twrite_object(mold.name + \".m\", source(mold))\n\t\tend\n\tend",
"def setup_output\r\n\t\t@output = File.open(File.join(\"log\", \"#{@server}_#{@db}_#{snow}.output\"), \"w\")\t\tif @run_cmds\r\n\t\t@output_cmds = File.open(File.join(\"log\", \"#{@server}_#{@db}_#{snow}.cmd\"), \"w\")\t\tif @log_cmds\t\r\n\tend",
"def generate\n setup\n\n write_style_sheet\n generate_index\n generate_class_files\n generate_file_files\n generate_table_of_contents\n @json_index.generate\n @json_index.generate_gzipped\n\n copy_static\n\n rescue => e\n debug_msg \"%s: %s\\n %s\" % [\n e.class.name, e.message, e.backtrace.join(\"\\n \")\n ]\n\n raise\n end",
"def generate_input_file\n @run_name += \"_t\"\n if @restart_id\n @runner.run_list[@restart_id].restart(self)\n else\n make_initial_profiles if self.respond_to?(:make_initial_profiles) \n end\n if uses_ecom?\n setup_ecom\n elsif uses_chease?\n setup_chease\n end\n #eputs \"nwrite 6 is \", new_run.flux_runs[0].nwrite\n @avail_cpu_time = (@wall_mins-1.0) * 60 if @wall_mins\n if flux_gs2? or flux_gryfx?\n @avail_cpu_time = (@wall_mins-6.0) * 60 if @wall_mins\n end\n check_parameters\n write_input_file\n #eputs \"nwrite 7 is \", new_run.flux_runs[0].nwrite\n generate_flux_input_files if flux_gs2? or flux_gryfx?\n #eputs \"nwrite 8 is \", new_run.flux_runs[0].nwrite\n end",
"def generate\n end",
"def gen_sub_directories\n\t\[email protected]\n\tend",
"def gen_sub_directories\n\t\[email protected]\n\tend",
"def generate\n generate_header\n generate_content\n #not_dirty\n end",
"def generate_input_file\n\t\t\t#FileUtils.touch(\"#@run_name.mat\")\n\t\t\t#cronos.new_file\n\t\t\t#eputs \"Make sure you save the file as #@run_name.mat... overwrite the existing empty place holder. When you have saved the file press enter.\"\n\t\t\tif @duplicate_id\n\t\t\t\told = @runner.run_list[@duplicate_id]\n\t\t\t\tsystem \"cp #{old.directory}/#{old.run_name}.mat #@directory/#@run_name.mat\"\n\t\t\t\tload\n\t\t\telsif @restart_id\n\t\t\t\told = @runner.run_list[@restart_id]\n\t\t\t\tsystem \"cp #{old.directory}/#{old.run_name}_resultat.mat #@directory/#@run_name.mat\"\n\t\t\t\tload\n\t\t\telse\n\t\t\t\tsz = Terminal.terminal_size[1]\n\t\t\t\teputs((str = \"When you have created the file press enter. Don't save it (CodeRunner will automatically save it in the right place. You can edit parameters later as well. CodeRunner will not submit the file... submit it manually using a batch or interactive run.\"; [\"-\"*sz, str, \"-\"*sz]))\n\t\t\t\tcronos.puts(\"zuicreate\")\n\t\t\t\tSTDIN.gets\n\t\t\tend\n\t\t\tcronos.puts(\"param.gene.origine = '#@directory/#@run_name.mat'\")\n\t\t\tcronos.puts(\"param.gene.file = '#@directory/#{@run_name}_resultat.mat'\")\n\t\t\tcronos.puts(\"param.gene.rapsauve = '#@directory/#{@run_name}_resultat'\")\n\t\t\tcronos.puts(\"param.edit.currentfile= '#@directory/#@run_name.mat'\")\n\t\t\tcronos.puts(\"param.from.creation.com = '#@comment'\")\n\t\t\tcronos.puts(\"zuisavedata('force')\")\n\t\t\t#cronos.eval(\"zuicreate\")\n\t\t\trefresh_gui\n\t\t\t\n\t\tend",
"def output_to_file\n @output=:file\n end",
"def generate_data!\n start_dir = Dir.pwd\n \n Dir.chdir tool_path\n system \"./generate -pc #{product_factor} -fn #{filename} -fc\"\n ensure\n Dir.chdir start_dir\n end",
"def save_output\n\n end",
"def generate\n save\n end",
"def create_output\n test_case = TestCase.find(params[:id])\n tempDirectory = Rails.configuration.compile_directory + current_user.name.tr(\" \", \"_\") + '_' + test_case.id.to_s + '/'\n if not Dir.exists?(tempDirectory) \n Dir.mkdir(tempDirectory)\n end\n\n # Adds in the test case files\n test_case.create_directory(tempDirectory)\n\n # Compiles and runs the program\n comp_status = test_case.compile_code(tempDirectory)\n\n if comp_status.nil?\n flash[:notice] = \"Outputs Made\"\n else\n flash[:notice] = \"No Outputs Made\"\n flash[:comperr] = comp_status\n end\n\n FileUtils.rm_rf(tempDirectory)\n\n respond_to do |format|\n format.js { render :action => \"refresh_output\" }\n end\n end",
"def generate_input_file\n check_parameters\n if @restart_id\n @runner.run_list[@restart_id].restart(self)\n end\n @diagdir = \".\"\n @n_procs_sim = actual_number_of_processors\n # Simulation time limit is set to ~ 90% of wall mins to allow GENE to \n # exit gracefully\n @timelim = @wall_mins * 55 if @wall_mins\n write_input_file\n end",
"def updated_source_file; end",
"def create_output_files\n return unless @option_output_path\n return if @collected_nodes.empty?\n @collected_nodes.each do |certname, properties|\n next if properties['settings'].empty?\n output_file = \"#{@option_output_path}/nodes/#{certname}.yaml\"\n File.write(output_file, properties['settings'].to_yaml)\n output(\"## Wrote Hiera YAML file: #{output_file}\\n\\n\")\n end\n return if @common_settings.empty?\n output_file = \"#{@option_output_path}/common.yaml\"\n File.write(output_file, @common_settings.to_yaml)\n end",
"def generate(file_name,template,map, overwrite = true)\r\n # make sure the package folder exists\r\n pkg_path = (map['package'] || '').gsub('.','/') \r\n FileUtils.makedirs \"#{target}/#{pkg_path}\"\r\n File.open(\"#{target}/#{pkg_path}/#{file_name}\",'w') do |f|\r\n f << self.process_template(template,map)\r\n log \">> writing #{f.path}\"\r\n end #file\r\n end",
"def gen_sub_directories\n @outputdir.mkpath\n end",
"def rebuild(options)\n puts \"rebuilding to #{options[:out]}\"\n puts options[:files].inspect\n File.open(options[:out], 'w') do |out|\n # out.write @pre if @pre\n\n options[:files].each do |file|\n out.write wrap_source file\n end\n\n if options[:main]\n main = options[:main].sub(/\\.rb$/, '')\n out.write \"opal.require('#{main}');\\n\"\n end\n\n # out.write @post if @post\n end\n end",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def generate(output_folder, types, version_name)\n generate_objects(output_folder, types, version_name)\n copy_files(output_folder) \\\n unless @config.files.nil? || @config.files.copy.nil?\n compile_examples(output_folder) unless @config.examples.nil?\n compile_changelog(output_folder) unless @config.changelog.nil?\n # Compilation has to be the last step, as some files (e.g.\n # CONTRIBUTING.md) may depend on the list of all files previously copied\n # or compiled.\n compile_files(output_folder, version_name) \\\n unless @config.files.nil? || @config.files.compile.nil?\n\n generate_datasources(output_folder, types, version_name) \\\n unless @config.datasources.nil?\n apply_file_acls(output_folder) \\\n unless @config.files.nil? || @config.files.permissions.nil?\n end",
"def output_file\n @output\n end",
"def setup_output_dir(op_dir)\n flag_file = File.join(op_dir, \"created.rid\")\n if File.exist?(op_dir)\n unless File.directory?(op_dir)\n error \"'#{op_dir}' exists, and is not a directory\" \n end\n unless File.file?(flag_file)\n error \"\\nDirectory #{op_dir} already exists, but it looks like it\\n\" +\n \"isn't an RDoc directory. Because RDoc doesn't want to risk\\n\" +\n \"destroying any of your existing files, you'll need to\\n\" +\n \"specify a different output directory name (using the\\n\" +\n \"--op <dir> option).\\n\\n\"\n end\n else\n File.makedirs(op_dir)\n end\n File.open(flag_file, \"w\") {|f| f.puts Time.now }\n end",
"def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end",
"def output\n super(@file_format => @file_path)\n end",
"def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://github.com/kryszan/cloudy]cloudy[/url]\\\\m/ [/sup][/align]\"\n\t\tend\n\tend",
"def regenerator; end",
"def render\n File.open(@file.output_path, \"w\") { |file| file.write(super) }\n end",
"def generate\n super\n end",
"def generate_sdf3(graph,graphProperties)\n#change directory\nDir.chdir(\"/home/blue/sdf3/build/release/Linux/bin\")#Note:Please change this path accroding to your own file location.Respectively,the path 'sdf3/build/release/Linux/bin' is the default path which holds the executed commands and the output files.\n\n\npath = '/home/blue/sdf3/sdf/testbench/option.opt'#path is the original option file location,used to cover the temp.opt\ndst = '/home/blue/sdf3/sdf/testbench/temp.opt'#dst is the path of option file which used to rewrite by user.Note:change these two paths accroding to your own file location. \n\nFileUtils.cp path,dst#initialize temp file,making its every attribute to unknown as 'X'\n\nfile = File.open(dst,\"r\")\n content = file.read\n file.close\n\n #replace the 'X' with the data previously set in graph and graphProperties\n content.gsub!(/actors nr=\"X\"/,'actors nr=\"'+graph.actors.nr+'\"')\n content.gsub!(/degree avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'degree avg=\"'+graph.degree.avg+'\" var=\"'+graph.degree.var+'\" min=\"'+graph.degree.min+'\" max=\"'+graph.degree.max+'\"')\n content.gsub!(/rate avg=\"X\" var=\"X\" min=\"X\" max=\"X\" repetitionVectorSum=\"X\"/,'rate avg=\"'+graph.rate.avg+'\" var=\"'+graph.rate.var+'\" min=\"'+graph.rate.min+'\" max=\"'+graph.rate.max+'\" repetitionVectorSum=\"'+graph.rate.repetitionVectorSum+'\"')\n content.gsub!(/initialTokens prop=\"X\"/,'initialTokens prop=\"'+graph.initial.tokens+'\"')\n content.gsub!(/structure stronglyConnected=\"X\" acyclic=\"X\"/,'structure stronglyConnected=\"'+graph.structure.stronglyConnected+'\" acyclic=\"'+graph.structure.acyclic+'\"')\n\n content.gsub!(/procs nrTypes=\"X\" mapChance=\"X\"/,'procs nrTypes=\"'+graphProperties.proc.nrTypes+'\" mapChance=\"'+graphProperties.proc.mapChance+'\"')\n content.gsub!(/execTime avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'execTime avg=\"'+graphProperties.execTime.avg+'\" var=\"'+graphProperties.execTime.var+'\" min=\"'+graphProperties.execTime.min+'\" max=\"'+graphProperties.execTime.max+'\"')\n content.gsub!(/stateSize avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'stateSize avg=\"'+graphProperties.stateSize.avg+'\" var=\"'+graphProperties.stateSize.var+'\" min=\"'+graphProperties.stateSize.min+'\" max=\"'+graphProperties.stateSize.max+'\"')\n content.gsub!(/tokenSize avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'tokenSize avg=\"'+graphProperties.tokenSize.avg+'\" var=\"'+graphProperties.tokenSize.var+'\" min=\"'+graphProperties.tokenSize.min+'\" max=\"'+graphProperties.tokenSize.max+'\"')\n content.gsub!(/bandwidthRequirement avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'bandwidthRequirement avg=\"'+graphProperties.bandwidthRequirement.avg+'\" var=\"'+graphProperties.bandwidthRequirement.var+'\" min=\"'+graphProperties.bandwidthRequirement.min+'\" max=\"'+graphProperties.bandwidthRequirement.max+'\"')\n content.gsub!(/latencyRequirement avg=\"X\" var=\"X\" min=\"X\" max=\"X\"/,'latencyRequirement avg=\"'+graphProperties.latencyRequirement.avg+'\" var=\"'+graphProperties.latencyRequirement.var+'\" min=\"'+graphProperties.latencyRequirement.min+'\" max=\"'+graphProperties.latencyRequirement.max+'\"')\n content.gsub!(/autoConcurrencyDegree=\"X\" scaleFactor=\"X\"/,'autoConcurrencyDegree=\"'+graphProperties.throughputConstraint.autoConcurrencyDegree+'\" scaleFactor=\"'+graphProperties.throughputConstraint.scaleFactor+'\"')\n\nFile.open(dst,\"w\"){|f| f << content}#write the replacement to temp file\n\n\n`./sdf3generate-sdf --settings /home/blue/sdf3/sdf/testbench/temp.opt --output -temp`#command line to generate XML file\n`./sdf3print-sdf --graph /home/blue/sdf3/build/release/Linux/bin/-temp --format dot --output -tempfile`#command line to generate graph.Note:Please change these two paths accroding to your own file location. \nend",
"def gen_router\n filename = 'config/router.rb'\n bakname = 'config/router.rb~'\n File.delete(bakname) if File.exist?(bakname)\n File.rename(filename, bakname) if File.exist?(filename)\n File.open(filename, \"w\") do |file|\n file.puts(router_content)\n end\n end",
"def generated_files() = @generated_files ||= []",
"def freeze_file\n generated_file(@component.basename + \".frz\")\n end",
"def output_ext; end",
"def output_ext; end",
"def output_ext; end",
"def generate\n\t\t dir = \"./experiments/\" + @arguments.first\n\t\t\tDir.mkdir(dir)\n\t\t\tFile.open(dir + \"/\" + @arguments.first + \".rb\", \"w\") do |req_file|\n\t\t\t req_file.puts \"# ## #{as_human_name @arguments.first} ##\"\n\t\t\t req_file.puts \"# \"[email protected](\"\\n\").join(\"\\n# \")\n\t\t\t req_file.puts\n\t\t\t req_file.puts\n\t\t\t req_file.puts \"# The first contious block of comment will be included in your report.\"\n\t\t\t req_file.puts \"# This includes the reference implementation.\"\n\t\t\t req_file.puts \"# Override any desired files in this directory.\"\n\t\t\t Dir[\"./app/**/*.{rb,o,dll,so,bundle}\"].each do |f|\n\t\t\t next if File.basename(f) == 'extconfig.rb'\n\t\t\t p = File.expand_path(f).split(\"/\") - File.expand_path(\".\").split(\"/\")\n\t\t\t req_file.puts \"require \\\"#{p.join(\"/\").gsub(/\\.(rb|o|dll|so|bundle)$/, \"\")}\\\"\"\n\t\t\t end\n\t\t\t req_file.puts \"\\nclass #{as_class_name @arguments.first} < MyExperiment\\n\\t\\nend\"\n\t\t\tend\n\t\t\tFile.open(dir + \"/config.yaml\", \"w\") do |f|\n\t\t\t f << \"---\\nexperiment:\\n development:\\n compute:\\n\"\n end\n end",
"def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end",
"def genWritables(model, outRoot)\n firstRecord = model.records.values.first\n pyPackage, base, packagePath = DataMetaDom::PojoLexer::assertNamespace(firstRecord.name)\n # Next: replace dots with underscores.The path also adjusted accordingly.\n #\n # Rationale for this, quoting PEP 8:\n #\n # Package and Module Names\n #\n # Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves\n # readability. Python packages should also have short, all-lowercase names, although the use of underscores\n # is discouraged.\n #\n # Short and all-lowercase names, and improving readability if you have complex system and need long package names,\n # is \"discouraged\". Can't do this here, our system is more complicated for strictly religous, \"pythonic\" Python.\n # A tool must be enabling, and in this case, this irrational ruling gets in the way.\n # And dots are a no-no, Python can't find packages with complicated package structures and imports.\n #\n # Hence, we opt for long package names with underscores for distinctiveness and readability:\n pyPackage = pyPackage.gsub('.', '_')\n packagePath = packagePath.gsub('/', '_')\n destDir = File.join(outRoot, packagePath)\n FileUtils.mkdir_p destDir\n wriOut = nil # File.open(File.join(destDir, \"#{writableClassName(base)}.py\"), 'wb')\n serFile = File.join(destDir, 'serial.py')\n FileUtils.rm serFile if File.file?(serFile)\n ioOut = File.open(serFile, 'wb') # one huge serialization file\n ioOut.puts %|# This file is generated by DataMeta DOM. Do not edit manually!\n#package #{pyPackage}\n\nfrom hadoop.io import WritableUtils, InputStream, OutputStream, Text\nfrom ebay_datameta_core.base import DateTime\nfrom decimal import *\nfrom collections import *\nfrom bitarray import bitarray\nfrom ebay_datameta_hadoop.base import *\nfrom model import *\n\n|\n begin\n model.records.values.each { |e|\n _, base, _ = DataMetaDom::PojoLexer::assertNamespace(e.name)\n case\n when e.kind_of?(DataMetaDom::Record)\n genWritable model, wriOut, ioOut, e, pyPackage, base\n else\n raise \"Unsupported Entity: #{e.inspect}\"\n end\n }\n ensure\n begin\n ioOut.close\n ensure\n #wriOut.close\n end\n end\n end",
"def compile_output(out)\r\n head.each { |ln| out.puts ln }\r\n\r\n # Add new line between import statements and output\r\n out.puts ln_ending\r\n\r\n tmp_files.each do |tmp|\r\n last = copy_lines(tmp, out)\r\n\r\n out.puts ln_ending unless last.chomp.empty?\r\n File.delete(tmp)\r\n end\r\n end",
"def save\n require 'yaml'\n File.open(output_file, 'w') { |f| f.puts(generate.to_yaml) }\n end",
"def regenerate( how = nil )\n retouch nil, how\n end",
"def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n page.generate(@output_path, @version, @preserve_tree)\n SiteLog.debug(\"Finished page generation - #{name}\")\n end\n\n @files.each do |path, data|\n path = ::File.join(@output_path, path)\n ::FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, \"w\") do |f|\n f.write(data)\n end\n end\n end",
"def generate()\n traverse(@root)\n @un_arr.traverseUnions if @@union_flag\n @un_arr.traverseArrays if @@dyn_array_flag\n write_to_file\n end",
"def gen_prj\n filename = \"#{@work_dir}/#{@module_name}.prj\"\n printf(\"@I:Generate Prj File(%s)\\n\",filename)\n f = File.open(\"#{filename}\",\"w\")\n tmp = Array.new\n tmp << @file_name\n tmp.uniq!\n tmp.each{|file|\n f.printf(\"verilog work \\\"%s\\\"\\n\",file)\n }\n f.close\n end",
"def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend",
"def output\n @output ||= File.open(File.join(output_final_directory_path, Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME), 'w')\n end",
"def write_transform_file\n render_template(resource_path(\"doc-transform.erb\"),\n destination: transform_file,\n variables: {\n pathdir: project.install_dir.split(\"/\")[1],\n })\n end",
"def generate_all(template_file, output_dir, override=false)\n parse_messages(template_file).each do |message|\n target_file = File.join(output_dir, \"#{message.name}.xml\")\n if !File.exist?(target_file) or override\n File.open(target_file, \"w\") do |file|\n file.write(generate_message_xml(message))\n end\n end\n end\nend",
"def build\n sync\n output_dir.mkpath\n outputs.each(&:build)\n output_dir.touch\n end",
"def update_output_dir(op_dir, time)\n File.open(output_flag_file(op_dir), \"w\") {|f| f.puts time.rfc2822 }\n end",
"def update_output_dir(op_dir, time)\n File.open(output_flag_file(op_dir), \"w\") {|f| f.puts time.rfc2822 }\n end",
"def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end",
"def generate_output_file(zip_out, contents); end",
"def out\n return @out if @out\n FileUtils.mkdir_p out_base unless File.exist? out_base\n @out = File.open( \"#{out_path}\", 'w' )\n end",
"def generate #(args, opts)\n actionlist = actionlist(copylist)\n\n if actionlist.empty?\n logger.report_nothing_to_generate\n return\n end\n\n source = '' # FIXME\n logger.report_startup(source, output)\n mkdir_p(output) #unless File.directory?(output)\n Dir.chdir(output) do\n actionlist.each do |action, loc, src, dest, opts|\n atime = Time.now\n result, fulldest = *__send__(action, loc, src, dest, opts)\n logger.report_create(relative_to_output(dest), result, atime)\n #logger.report_create(dest, result, atime)\n end\n end\n logger.report_complete\n logger.report_fixes #if session.newproject?\n end",
"def write_out\n @all_content.each do |venue_id, venue_content|\n manifest_dir = \"#{@base.deploy_path}\" / \"#{venue_content.sha1_digest}\"\n venue_dir = \"#{@base.deploy_path}\" / \"#{Venue.get!(venue_id).router.identifier}\"\n manifest_file = manifest_dir / \"manifest.json\"\n files_dir = manifest_dir / \"files\"\n venue_content_ln = \"#{venue_dir}\" / \"content\"\n sha1_file = manifest_dir / \"#{venue_content.sha1_digest}.sha1\"\n \n FileUtils.rm(venue_content_ln) if File.exists?(venue_content_ln)\n FileUtils.mkdir_p(venue_dir)\n if File.exists?(sha1_file)\n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n next\n end\n\n FileUtils.mkdir_p(manifest_dir)\n\n open(manifest_file, \"w+\") do |f|\n f << venue_content.manifest.to_json\n end\n\n #FileUtils.mkdir_p(files_dir)\n source_files = venue_content.filelist\n venue_content.filelist.each do |f|\n #UploadManager is using the first 2 bytes of the file digest as directory names.\n #The split('/'[-3..-1].join('') restores the filename to the full digest when it is copied\n #from the upload dir to the deployment dir\n dest = \"#{manifest_dir}\" / \"#{f.split('/')[-3..-1].join('')}\"\n FileUtils.cp(f, dest)\n end\n \n open(sha1_file, \"w+\") do |f|\n f << venue_content.sha1_digest\n end\n \n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n end\n end",
"def clobber\n Yui.clobber(outpath,@options[:suffix],@options[:type])\n end",
"def write_traits(output_file)\n open(output_file, 'a') { |f|\n f.puts \"=========#{@generation}========\"\n @all_persons.each do |person|\n f.puts \"#{person.get_chromosome.get_sequence}\"\n end\n }\n end",
"def saveOutput\r\n tmpFile = \"#{@responseDir}/#{@fileName}.response\"\r\n if File.exists?(tmpFile)\r\n File.delete(tmpFile)\r\n end\r\n \r\n file = File.open(tmpFile, \"w\")\r\n file.write printXml\r\n file.close\r\n \r\n lstFile = \"listfile.txt\"\r\n if File.exists? lstFile\r\n File.delete(lstFile)\r\n end\r\n \r\n file = File.open(lstFile, \"w\")\r\n file.write tmpFile\r\n file.close\r\n end",
"def purge_output\n Dir.glob dir(\"output/**/*\") do |item|\n next if File.directory? item\n File.delete item unless @touchedfiles.include? undir(item)\n end\n end",
"def write(options=nil)\n temp_options(options) if options\n\n @fingerprint = file_fingerprint\n @file = output_file\n\n js = \"/* Build fingerprint: #{@fingerprint} */\\n\" + compile\n\n if has_fingerprint(@file, @fingerprint)\n info \"Stitch \" + \"identical \".green + @file.sub(\"#{Dir.pwd}/\", '')\n reset_options if options\n true\n else\n begin\n write_msg = (File.exists?(@file) ? \"overwrite \" : \"created \").yellow + @file.sub(\"#{Dir.pwd}/\", '')\n cleanup(@file) if @options[:cleanup]\n\n FileUtils.mkdir_p(File.dirname(@file))\n File.open(@file, 'w') { |f| f.write js }\n\n info \"Stitch \" + write_msg\n true\n rescue StandardError => e\n error \"Stitch failed to write #{@file.sub(\"#{Dir.pwd}/\", '')}\".red\n error e\n reset_options if options\n false\n end\n end\n\n end",
"def generate\n Dixi.logger.info \"Generating index for #{@project}\"\n\n @entries = {}\n\n require 'find'\n Find.find( @project.version_dir.to_s ) do |path|\n if path =~ /index\\.yaml/\n Find.prune\n elsif path =~ /\\.yaml/\n res = Dixi::Resource.from_filepath(@project, Pathname.new(path))\n self.add( res )\n end\n end\n\n save!\n @loaded = true\n\n @entries\n end",
"def generate_in(directory)\n migration_path = File.expand_path(\"#{directory}/#{@filename}\")\n File.open(migration_path, 'w') { |f| f.write(render 'geode/templates/model_rename_migration_template.erb') }\n relative_migration_path = Pathname.new(migration_path).relative_path_from(Pathname.pwd).to_s\n puts \"+ Generated migration #{@migration_name} at #{relative_migration_path}\"\n end",
"def generate\n proxy_hpp = Generation.render_template \"proxies\", \"Task.hpp\", binding\n proxy_cpp = Generation.render_template \"proxies\", \"Task.cpp\", binding\n file_proxy_hpp = Generation.save_automatic \"proxies\", \"#{task.basename}.hpp\", proxy_hpp\n file_proxy_cpp = Generation.save_automatic \"proxies\", \"#{task.basename}.cpp\", proxy_cpp\n\n cmake = Generation.render_template 'proxies', 'CMakeLists.txt', binding\n Generation.save_automatic('proxies', \"CMakeLists.txt\", cmake)\n \n pc = Generation.render_template \"proxies\", \"proxies.pc\", binding\n Generation.save_automatic \"proxies\", \"#{project.name}-proxies.pc.in\", pc\n end",
"def updated_source_file?; 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 writeConfigFile(templateFileName, previousLogFileName, numRunSteps)\n # template file name - specific for the given system\n month = Hash[0 => \"January\",\n\t 1 => \"February\",\n\t 2 => \"March\",\n\t 3 => \"April\",\n\t 4 => \"May\",\n\t 5 => \"June\",\n\t 6 => \"July\",\n\t 7 => \"August\",\n\t 8 => \"September\",\n\t 9 => \"October\",\n\t 10 => \"November\",\n\t 11 => \"December\"]\n\n day = Time.now.day\n monthNum = Time.now.month\n year = Time.now.year\n date = \"#{month[monthNum]} #{day}, #{year}\"\n\n previousRunNum = 0\n if previousLogFileName =~ /eq(\\d+)/ then\n previousRunNum = $1.to_i\n end\n currentRunNum = previousRunNum + 1\n\n lastTimestep = digestPrevLogFile(previousLogFileName).to_i\n nextTimestep = lastTimestep + numRunSteps\n \n outFileName = previousLogFileName\n outFileName = outFileName.gsub(/\\.log/,\".namd\")\n outFileName = outFileName.gsub(/eq#{previousRunNum}/,\"eq#{currentRunNum}\")\n \n if !File.readable?(templateFileName) then\n print \"Error: writeConfigFile - no \\n\"\n return\n end\n template = File.open(templateFileName,\"r\")\n outfile = File.open(outFileName,\"w\") \n template.each_line do |line|\n line = line.gsub(/DATE/,date)\n line = line.gsub(/PREVRUN/,previousRunNum.to_s)\n line = line.gsub(/CURRRUN/,currentRunNum.to_s)\n line = line.gsub(/PREVTIMESTEP/,lastTimestep.to_s)\n line = line.gsub(/NEXTTIMESTEP/,nextTimestep.to_s)\n \n #print line\n outfile.print line\n end\n \n template.close\n outfile.close\n\n return outFileName\nend",
"def generate_project_file\n template_file = @template_dir + 'hhp_file.hhp.rhtml'\n\n @values = { :title => @options.title, :opname => @outputdir.basename }\n \n static_files = ['index.html', 'classindex.html', 'fileindex.html']\n @values[:html_files] = static_files + (@generated_files+@classes).map{|f| f.path}.uniq\n \n out_file = @outputdir + @project_name\n debug_msg \" rendering #{out_file}\"\n render_template template_file, out_file do |io| binding end\n end",
"def generator\n printf(\"%-10s %s\\n\",\"generator:\", \"generating.. (*hdls, *bmm, *scr, *prj)\")\n exitcode = 1\n FileUtils.rm_r Dir.glob(\"#{TMPDIR}/hdl/*.vhd\")\n FileUtils.rm_r Dir.glob(\"#{TMPDIR}/synthesis/*.vhd\")\n File.symlink(\"../pcores\", \"#{TMPDIR}/pcores\") unless File.symlink?(\"#{TMPDIR}/pcores\")\n pipe = IO.popen(\"platgen -od #{TMPDIR}/ -p xc4vfx100ff1152-10 -lang vhdl ../system.mhs\", \"r+\")\n # pipe = IO.popen(\"platgen -p xc4vfx12ff668-10 system.mhs\", \"r+\")\n pipe.each do |line|\n # puts line\n # do not synthesize\n if line =~ /Running XST synthesis/\n exitcode = 0\n Process.kill 'TERM', pipe.pid\n break\n end\n end\n unless exitcode == 0\n p \"# Error with platgen - check platgen.log\"\n exit\n end\n\n # he generated files under $PROJECT/TMPDIR/{hdl,synthesis}\n # copy them to $PROJECT/hdl/ under certain conditions (size differs & or abstence)\n FileUtils.mkdir('hdl') unless File.directory? 'hdl'\n FileUtils.mkdir('synthesis') unless File.directory? 'synthesis'\n FileUtils.mkdir_p(BMM_RESULTSDIR) unless File.directory? BMM_RESULTSDIR # output directory\n\n # move_files_if(\"#{TMPDIR}/hdl/*.vhd\")\n move_files_if(\"#{TMPDIR}/implementation/#{TOPLEVEL}.bmm\", BMM_RESULTSDIR)\n move_files_if(\"#{TMPDIR}/synthesis/*.scr\" )\n move_files_if(\"#{TMPDIR}/synthesis/*.prj\")\n Find.find(\"#{TMPDIR}/hdl\") do |path|\n move_files_if(path) if File.file? path\n end\n\n # move logfiles to scratch\n FileUtils.mkdir_p(GEN_SCRATCHDIR) unless File.directory? GEN_SCRATCHDIR\n [\"platgen.log\", \"platgen.opt\", \"#{TMPDIR}/clock_generator*.log\"].each { |t|\n FileUtils.mv(t, \"#{GEN_SCRATCHDIR}/\") if File.file? t\n }\n\n # change timestamps\n\nend",
"def create_output\n # create logstash configs\n indexname = @name\n File.open(File.join(@logstashdir, \"output.conf\"), \"w\") do |f|\n f.write <<OUTPUT\n# Generated by elasticsupport\noutput {\n elasticsearch {\n template => \"elasticsupport-template.json\"\n template_overwrite => true\n hosts => [\"#{@elastic}\"]\n index => #{indexname.inspect}\n }\n}\nOUTPUT\n end\n end",
"def write\n path = \"#{site.root}/_site/#{output_file}\"\n File.open(path, 'w') do |f|\n f.write(@output)\n end\n end",
"def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"# Created : \" + ccdd.getDateAndTime() + \"\\n# User : \" + ccdd.getUser() + \"\\n# Project : \" + ccdd.getProject() + \"\\n# Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n \n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n \n ccdd.writeToFileLn(file, \"\")\nend",
"def generated\n end",
"def regenerate_path!\n regenerate_path\n save\n end"
] | [
"0.68445474",
"0.6728632",
"0.6603393",
"0.6603393",
"0.65471137",
"0.6546071",
"0.6490662",
"0.6461581",
"0.6439944",
"0.6383751",
"0.63793933",
"0.6372324",
"0.6332653",
"0.63266903",
"0.63127595",
"0.63036895",
"0.63002634",
"0.63002634",
"0.62623596",
"0.62588036",
"0.62319154",
"0.6184472",
"0.6174102",
"0.61525923",
"0.61445886",
"0.61431855",
"0.6116893",
"0.608904",
"0.606858",
"0.6047558",
"0.6028612",
"0.60263634",
"0.60172284",
"0.6015955",
"0.5988777",
"0.5984396",
"0.59711874",
"0.5951407",
"0.59385043",
"0.59358126",
"0.5905577",
"0.5901564",
"0.5891257",
"0.58866215",
"0.5869741",
"0.58673865",
"0.58673865",
"0.58673865",
"0.58613837",
"0.5859279",
"0.58556247",
"0.58523834",
"0.5841759",
"0.58409935",
"0.5830107",
"0.581063",
"0.5806939",
"0.5797616",
"0.5790942",
"0.5784991",
"0.5776742",
"0.57642674",
"0.5760991",
"0.5760991",
"0.575828",
"0.57532245",
"0.57425535",
"0.57386297",
"0.57312554",
"0.57290566",
"0.5715181",
"0.5710401",
"0.57061136",
"0.57026684",
"0.5701009",
"0.5695821",
"0.56878114",
"0.5676264",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5675211",
"0.5672053",
"0.5667867",
"0.5667223",
"0.5665531",
"0.5661811",
"0.56605405",
"0.5660226",
"0.5654868"
] | 0.0 | -1 |
Convert using a2x tool | def ConvertA2X
# a2x options
if not @FullOpts.nil?
opts = @FullOpts + " "
else
opts = self.getOptionsA2X()
end
opts += @Opts + " " if not @Opts.nil?
opts += "-v " if $debug2
# Execute pre actions
self.ExecuteAction(:pre)
cmd = "a2x -D #{@outdir} #{opts} #{@doc.filename}"
puts "Generating (#{@Type}) #{@outfile}\n"
puts "Executing : #{cmd}" if $verbose
res = %x[#{cmd}]
puts res if res != ""
if $? == 0
# Execute post actions
self.ExecuteAction(:post)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert\n end",
"def convert\n end",
"def convert_one(*args)\n raise \"x2t file is not found in #{@bin_path} path\" unless x2t_exist?\n output_file_path = \"#{@convert_to}/#{File.basename(args.first[:input_file], '.*')}.\" + args.first[:format_to]\n convert_file(args.first[:input_file], output_file_path, false)\n output_file_path\n end",
"def convert!; end",
"def converter; end",
"def convert\n puts \"\\n--------------------------------\"\n puts \"Transforming #{File.extname(@file)} file to .#{@type} format...\"\n \n runHardklor if @hardklor && @file.downcase.include?(\".mzxml\")\n \n if @type == \"mgf\" || @type == \"ms2\"\n Ms::Msrun.open(@file) do |ms|\n file = @file.chomp(File.extname(@file)) + \"_#{@run}.#{@type}\"\n File.open(file, 'w') do |f|\n f.puts eval(\"ms.to_#{@type}\")\n end\n end\n else\n # If ms-msrun can't do it, then this might. Do something here to include run number. Doesn't work with Refiner, so\n # this is probably pointless to even have.\n #\n # And why do we run our own code to transform mzML instead of TPP?\n # 1) Prince said so\n # 2) I hate the TPP. The people who put that together don't deserve to be called programmers. I mean, come on! Methods\n # should never be longer than 100 lines of code, yet they've got methods that are over 1000 lines of code! Ack! It\n # just makes my skin crawl!\n system(\"/usr/local/src/tpp-4.3.1/build/linux/MzXML2Search -#{@type} #{@file}\")\n end\n end",
"def convert_file2(file_path)\n @ole.ConvertFile2(file_path)\n end",
"def a2f(args={})\n\t\t\t\tarray_to_file(args)\n\t\t\tend",
"def alb_convert data_type, target, model_script=nil\n case data_type \n when 'ltspice'\n cdraw2target target, 'cdraw', File.expand_path(target), model_script\n if target == 'qucs'\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'eeschema'\n Dir.chdir('eeschema'){\n eeschema2alb_back\n }\n elsif target == 'xschem'\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n end\n when 'eeschema'\n alb2eeschema 'cdraw', File.expand_path('eeschema')\n if target == 'qucs'\n eeschema2qucs 'eeschema', File.expand_path('qucs')\n Dir.chdir('qucs'){\n qucs2alb_back\n }\n elsif target == 'xschem'\n eeschema2xschem 'eeschema', File.expand_path('xschem')\n Dir.chdir('xschem'){\n xschem2alb_back\n }\n elsif target == 'ltspice'\n eeschema2cdraw 'eeschema', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'xschem'\n if target == 'qucs'\n xschem2qucs 'cdraw', File.expand_path('qucs')\n elsif target == 'xschem'\n alb2xschem 'cdraw', File.expand_path('xschem')\n elsif target == 'eeschema'\n xschem2eeschema 'cdraw', File.expand_path('eeschema')\n elsif target == 'ltspice'\n alb2xschem 'cdraw', File.expand_path('xschem')\n xschem2cdraw 'xschem', File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n when 'qucs'\n if target == 'qucs'\n alb2qucs 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'eeschema'\n qucs2eeschema 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'xschem'\n qucs2xschem 'cdraw', File.expand_path('qucs'), model_script\n elsif target == 'ltspice'\n qucs2cdraw nil, self.project.name, File.expand_path('alta')\n Dir.chdir('alta'){\n cdraw2alb_back\n }\n end\n end\n end",
"def converter\n end",
"def transformation\n end",
"def convert\n # Setup taxa information and orientation\n taxa_count = @csv.first.count\n character_count = @csv.count - 1\n taxa_labels = @csv.first.map { |name| name.to_s.strip.scrub.gsub(/[^A-Za-z0-9]/, \"_\") }\n\n # Generate labels and matrix\n character_labels = []\n character_matrix = taxa_labels.map { |t| [t] }\n (1..character_count).each do |r|\n row = @csv[r]\n token_hash = tokenize(row)\n character_label = (token_hash.map do |k, _|\n \"'#{sanitize_char(k)}'\"\n end).join(\" \")\n character_labels << %(#{r} /#{character_label})\n row.each_with_index do |charstate, i|\n token = token_hash[sanitize_char(charstate)]\n character_matrix[i] << (token.nil? ? \"-\" : token[0])\n end\n end\n character_matrix.map! do |arr|\n \"#{arr.shift} #{arr.join('')}\"\n end\n\n # Return NEXUS output\n <<~NEXUS_EOF\n #NEXUS\n\n BEGIN TAXA;\n TITLE Manuscripts;\n DIMENSIONS NTAX=#{taxa_count};\n TAXLABELS #{taxa_labels.join(' ')};\n END;\n\n BEGIN CHARACTERS;\n TITLE Variant_Matrix;\n DIMENSIONS NCHAR=#{character_count};\n FORMAT DATATYPE = STANDARD RESPECTCASE GAP = - MISSING = ? SYMBOLS = \"#{ALPHABET.join(' ')}\";\n CHARSTATELABELS #{character_labels.join(', ')};\n MATRIX\n #{character_matrix.join(\"\\n \")}\n ;\n\n END;\n\n BEGIN ASSUMPTIONS;\n OPTIONS DEFTYPE = UNORD;\n END;\n\n BEGIN PAUP;\n #{@paup}END;\n NEXUS_EOF\n end",
"def converter\n\n end",
"def internal_convert(\n input, convert_logger, backend, standalone, extra_attributes\n )\n attributes = { 'docdir' => File.dirname(__FILE__) }\n attributes.merge! extra_attributes\n args = internal_convert_args convert_logger, backend, standalone, attributes\n Asciidoctor.convert input, args\nend",
"def transform; end",
"def convert(object); end",
"def converters; end",
"def converters; end",
"def converters; end",
"def ATLtoASL _args\n \"ATLtoASL _args;\" \n end",
"def convert(output, args={})\n tokens = [\"convert\"]\n tokens << convert_to_arguments(args) if args\n tokens << \" '#{@file}#{\"[#{args[:layer].to_s}]\" if args[:layer]}'\"\n tokens << \" -annotate #{args[:annotate].to_s}\" if args[:annotate]\n tokens << \" #{output}\"\n tokens = convert_to_command(tokens)\n success = run(tokens)[1]\n success\n end",
"def transforms; end",
"def transform\n end",
"def convert\n \n # People might forget the trailing slash\n @options[:output_dir] = @options[:output_dir] + \"/\" unless @options[:output_dir].end_with?(\"/\")\n \n # Make sure that the output directory exits\n if !File.directory? @options[:output_dir] \n $LOG.info(\"Creating output directory #{@options[:output_dir]}...\")\n Dir.mkdir(@options[:output_dir])\n end\n \n # Array for storing ESE file pointers\n source_ese_files = []\n \n # If source ESE files are provided in batch mode (in a text file) ...\n unless @options[:batch_file] == nil\n # .. read the file line by line and extract the file location\n File.open(@options[:batch_file], \"r\") do |batch_file| \n # each line should point to a file path\n while path = batch_file.gets\n source_ese_files << path.chomp\n end\n end\n else\n # .. just take the source files provided on the command line\n source_ese_files = @files2convert\n end\n\n $LOG.info(\"Converting #{source_ese_files.size} ESE XML files to EDM RDF/XML...\")\n \n converted_files = []\n # Convert each ESE file individually\n source_ese_files.each do |source_file|\n \n unless File.exists?(source_file)\n $LOG.error(\"Cannot access source file #{source_file}. Exiting conversion process.\")\n return\n end\n \n # convert the file\n converted_file = transform(source_file, @options[:stylesheet], @options[:output_dir], @options[:base_uri], @options[:pretty_print])\n converted_files << converted_file\n \n end\n \n $LOG.info(\"*** Finished RDF/XML conversion *** Transformed #{source_ese_files.size} ESE XML files to EDM RDF/XML.\")\n \n # create an N-Triples dump if requested so\n if @options[:dump]\n \n $LOG.info(\"Merging created RDF/XML files into N-TRIPLES dump file: #{@options[:nt_dump_file]} ...\")\n \n create_NT_dump(converted_files, @options[:output_dir], @options[:nt_dump_file])\n \n $LOG.info(\"*** Finished N-TRIPLES dumping *** Dumped #{source_ese_files.size} RDF/XML files into #{@options[:nt_dump_file]}\")\n \n end\n \n end",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File conversion finished\")\n end",
"def converters=(_arg0); end",
"def transformations; end",
"def convert_binary\n end",
"def convert\n self.convert!\n success = system(convert_command)\n if success && $?.exitstatus == 0\n self.converted!\n else\n self.failure!\n end\n end",
"def convert\n self.convert!\n ss = system(convert_command)\n if ss && $?.exitstatus == 0\n self.converted!\n else\n self.failed!\n end\n end",
"def convert_alignment(args={})\n i, o = args[:in], args[:out]\n \n ff = Bio::FlatFile.auto(i).to_a\n aln = Bio::Alignment.new(ff)\n File.open(o, 'w') do |o|\n o.write aln.output :phylip\n end\n \nend",
"def convert\n raise NotImplementedError\n end",
"def convert(type)\n case type\n when 'tests' then @test_tool.convert\n when 'coverage' then @coverage_tool.convert\n when 'all'\n @test_tool.convert\n @coverage_tool.convert\n end\n end",
"def ASLtoATL _args\n \"ASLtoATL _args;\" \n end",
"def convert(data=nil)\n @input = data if data\n @output = @input\n @output\n end",
"def convert\n @input\n end",
"def render_as_format(from, to, format)\n puts \"Hola, bon dia!!\"\n puts from\n puts to\n thefile = `iconv -f ISO8859-1 #{from}`\n dotfile = Tempfile.new('dot')\n begin\n model = T2Flow::Parser.new.parse(thefile)\n T2Flow::Dot.new.write_dot(dotfile, model)\n dotfile.close\n `dot -T#{format} -o\"#{to}\" #{dotfile.path}`\n ensure\n dotfile.unlink\n end\nend",
"def convert(content); end",
"def convert(content); end",
"def convert_80!\n convert_rec!(*get_node_type_and_version)\n end",
"def convert_track2(i_track_to_convert)\n @ole.ConvertTrack2(i_track_to_convert)\n end",
"def transform\n self.output = converter.convert(self.content)\n end",
"def convert_file(file_path)\n @ole.ConvertFile(file_path)\n end",
"def convert!\n @output = convert\n self\n end",
"def converted_arrays; end",
"def transform (xmlIn,xmlOut)\r\n begin\r\n now = Time.now\r\n self.basic_transform xmlIn,xmlOut\r\n puts \"#{self.class} - [#{xmlIn}] -> [#{xmlOut}] : #{Time.now - now} ms\"\r\n rescue\r\n puts \"#{self.class} - ERROR: Unable to transform [#{xmlIn}] into [#{xmlOut}] because: #{$!}\"\r\n end\r\n end",
"def array_converter(*args)\n \nend",
"def convert(input, file_path = nil)\n render process parse(input, file_path)\n end",
"def converter( array)\n #define hash to convert binary to pixel \n pixels = { \"1\" => \"*\", \"0\" => \" \" }\n output = Array.new\n #iterate to input array \n for i in array\n #populate output array with converted hex to binary values\n #use string hex function to convert input array of hex characters to binary\n output.push(array.to_s[i].hex.to_s(2)) \n end\n #iterate to output array\n for i in output\n # use puts to ouput each element of the output array on a new line\n #use gsub function to replaces binary representation of hex input to pixel hash representation \n puts output.to_s[i].gsub(/[01]/, '1' => '*', '0' => ' ')\n end\nend",
"def convert_81!\n node_type, version = get_node_type_and_version\n csa = ConvertSemanticAry[version][node_type]\n try_semantic(node_type){ return send(csa) } if csa\n ofs_end, count = get_u, get_u\n if count == 0\n tag!(\"ary\", :type=>node_type, :version=>version)\n else\n tag!(\"ary\", :type=>node_type, :version=>version) do\n count.times do\n convert_rec!(node_type, nil)\n end\n end\n end\n end",
"def convert(src_node, dst_node, dst_top)\n @logger&.info { \"Converting #{src_node.pathname} and store result under #{dst_node.parent.pathname}\" }\n\n # merge the common api opts with node specific\n api_opts = DEFAULT_ADOC_API_OPTS.dup\n api_opts.merge!(@config_opts.fetch(:adoc_api_opts, {}))\n api_opts.merge!(src_node.api_options(src_node, dst_node, dst_top)) if src_node.respond_to?(:api_options)\n\n # use a new logger instance for each conversion\n adoc_logger = Giblish::AsciidoctorLogger.new(@logger, @adoc_log_level)\n\n begin\n doc_src = src_node.adoc_source(src_node, dst_node, dst_top)\n\n node_attr = src_node.respond_to?(:document_attributes) ?\n src_node.document_attributes(src_node, dst_node, dst_top) : {}\n doc_attr = resolve_doc_attributes(doc_src, node_attr)\n # piggy-back our own info on the doc attributes hash so that\n # asciidoctor extensions can use this info later on\n doc_attr[\"giblish-info\"] = {\n src_node: src_node,\n dst_node: dst_node,\n dst_top: dst_top\n }\n\n # load the source to enable access to doc attributes and properties\n #\n # NOTE: 'parse' is set to false to prevent preprocessor extensions to be run as part\n # of loading the document. We want them to run during the 'convert' call later when\n # doc attribs have been amended.\n #\n # NOTE2: by trial-and-error, it seems that some document attributes must be set when\n # calling 'load' and not added after the call and before the 'convert' call to have\n # the expected effect (e.g. idprefix).\n doc = Asciidoctor.load(doc_src, api_opts.merge(\n {\n attributes: doc_attr,\n parse: false,\n logger: adoc_logger\n }\n ))\n\n # update the destination node with the correct file suffix. This is dependent\n # on the type of conversion performed\n dst_node.name = dst_node.name.sub_ext(doc.attributes[\"outfilesuffix\"])\n d = dst_node.pathname\n\n # make sure the dst dir exists\n d.dirname.mkpath\n\n # do the conversion and write the converted doc to file\n output = doc.convert(api_opts)\n doc.write(output, d.to_s)\n\n # give the user the opportunity to eg store the result of the conversion\n # as data in the destination node\n @conv_cb[:success]&.call(src_node, dst_node, dst_top, doc, adoc_logger.in_mem_storage.string)\n true\n rescue => ex\n @logger&.error { \"Conversion failed for #{src_node.pathname}\" }\n @logger&.error { ex.message }\n @logger&.error { ex.backtrace }\n @conv_cb[:failure]&.call(src_node, dst_node, dst_top, ex, adoc_logger.in_mem_storage.string)\n false\n end\n end",
"def convert(value) value end",
"def convert_file(filename)\n return convert(File.read(filename), filename)\n end",
"def convert_files2(file_paths)\n @ole.ConvertFiles2(file_paths)\n end",
"def convert()\n xml_to_html()\n html_to_pandoc()\n\n\n if @option[:file_output] == \"\"\n # Without -o option\n puts @result\n else\n # Using option: -o filename\n File.open(@option[:file_output],\"w\") do |f|\n f.write(@result)\n end\n end\n\n return @result\n end",
"def linearConversion _args\n \"linearConversion _args;\" \n end",
"def to_ounce_troy(**options) = convert_to('ounce-troy', **options)",
"def to_xyz\n\t\t\tlab = []\n\n\t\t\tlab[1] = (self.l * 100 + 16) / 116\n\t\t\tlab[0] = self.a / 500 + lab[1]\n\t\t\tlab[2] = lab[1] - self.b / 200\n\n\t\t\tputs \"lab\"\n\t\t\tputs lab\n\n\t\t\tlab = lab.collect do |c| \n\t\t\t\tc = c ** 3 > 0.008856 ? c ** 3 : ( c - 16 / 116 ) / 7.787\n\t\t\tend\n\n\t\t\tx = lab[0] * CIELab::Reference[:x]\n\t\t\ty = lab[1] * CIELab::Reference[:y]\n\t\t\tz = lab[2] * CIELab::Reference[:z]\n\n\t\t\tx = x.has_decimals? ? x.to_i : x.round(2)\n\t\t y = y.has_decimals? ? y.to_i : y.round(2)\n\t\t z = z.has_decimals? ? z.to_i : z.round(2)\n\t\t\t\n\t\t\tXYZ.new([x, y, z]).to_s\n\t\tend",
"def convert\n pins = convert_pins(data[\"pinIndex\"])\n uart = convert_uart(data[\"uarts\"])\n i2c = convert_i2c(data[\"i2c\"])\n\n PinMap.new(pins, uart, i2c)\n end",
"def convert\n if @catalog[:name] == 'harvard'\n @marcxml.gsub!(/\\n/, '')\n .tr!('\"', '\\'')\n .sub!(/<\\?xml.+?>/, '')\n end\n \n @marcxml.sub!(/<record.+?>/, '<record>') \n @marcxml = \"<?xml version='1.0' encoding='UTF-8'?><collection xmlns='http://www.loc.gov/MARC21/slim'>\" + @marcxml + \"</collection>\"\n # Pretty print the unformatted marcxml for display purposes\n @marcxml = `echo \"#{@marcxml}\" | xmllint --format -`\n \n # Send the marcxml to the LC Bibframe converter \n # MARCXML to Bibframe conversion tools\n saxon = File.join(Rails.root, 'lib', 'saxon', 'saxon9he.jar')\n xquery = File.join(Rails.root, 'lib', @marc2bibframe, 'xbin', 'saxon.xqy')\n\n # The Saxon processor requires retrieving the marcxml from a file rather\n # than a variable or url, so we must write the result out to a temporary \n # file. Zorba could be used instead to retrieve directly over http without\n # writing to a file. See https://github.com/lcnetdev/marc2bibframe.\n # However, when export is selected we need to write marxml to a file anyway.\n marcxml_file = Tempfile.new ['bibid2bibframe-convert-marcxml-', '.xml'] \n # @bibframe = marcxml_file.path\n File.write(marcxml_file, @marcxml) \n \n method = (@serialization == 'ntriples' || \n @serialization == 'json') ? \"'!method=text'\" : ''\n\n turtle = @serialization == 'turtle' ? true : false\n @serialization = 'rdfxml' if turtle\n \n command = \"java -cp #{saxon} net.sf.saxon.Query #{method} #{xquery} marcxmluri=#{marcxml_file.path} baseuri=#{@catalog[:baseuri]} serialization=#{@serialization}\"\n @bibframe = %x(#{command})\n marcxml_file.close!\n \n if @bibframe.empty?\n @bibframe = \"[CONVERTER ERROR: no BIBFRAME RDF returned]\"\n end\n\n # LC Bibframe converter doesn't support turtle, so write Bibframe rdfxml\n # to a temporary file, convert to turtle, and read back into @bibframe.\n # TODO Can we avoid writing out the rdfxml and ttl to files? Try using\n # Tempfile class instead (see ConvertersController#export). Tried Ruby\n # rdf gems but it's not straightforward to get all prefixes into the\n # turtle.\n if turtle \n @serialization = 'turtle'\n rdfxml_file = Tempfile.new ['bibid2bibframe-convert-rdfxml-', '.rdf']\n File.write(rdfxml_file, @bibframe)\n turtle_file = Tempfile.new ['bibid2bibframe-convert-ttl-', '.ttl'] \n jarfile = File.join(Rails.root, 'lib', 'rdf2rdf-1.0.1-2.3.1.jar') \n @bibframe = %x(java -jar #{jarfile} #{rdfxml_file.path} #{turtle_file.path})\n @bibframe = File.read turtle_file\n rdfxml_file.close!\n turtle_file.close!\n end\n\n end",
"def apply_custom_transformation\n end",
"def transformation_device(*eras); end",
"def convert\n generate_uid\n tmp_file = Pathname.new(Dir::tmpdir).join(\"#{@uid}_#{@source.basename}\")\n tmp_image = image_to_tiff\n `#{@command} '#{tmp_image}' '#{tmp_file.to_s}' #{lang} #{psm} #{config_file} #{clear_console_output}`\n @value = File.read(\"#{tmp_file.to_s}.txt\").to_s\n @uid = nil\n remove_file([tmp_image,\"#{tmp_file.to_s}.txt\"])\n rescue\n raise RTesseract::ConversionError\n end",
"def convert(pipeline, format)\n pipeline.convert!(format)\n end",
"def convert(*args)\n raise NoMethodError.new('convert')\n end",
"def make\n\n src = @file\n dst = Tempfile.new([@basename, @output_ext].compact.join(\".\"))\n\n # build gpsbabel option string\n opt = %{ -i #{@input_format} }\n opt << %{ -f \"#{ File.expand_path(src.path) }\" }\n opt << @filters\n opt << %{ -o #{@gpsbabel_format} -F \"#{ File.expand_path(dst.path) }\" }\n \n begin\n success = Paperclip.run(\"gpsbabel\", opt.gsub(/\\s+/, \" \"))\n rescue PaperclipCommandLineError\n raise PaperclipError, \"There was an error processing the GPS file #{@basename}\" if @whiny\n end\n\n dst\n end",
"def convert_to(format)\n prepare_for_conversion unless @prepare_for_conversion\n output_path = output_path(format)\n\n log_folder = create_log_folder\n stdout_log, stderr_log = stdout_log(format), stderr_log(format)\n\n Cmd::Conversion.new(temp_path, output_path, format).run! %W(#{stdout_log} a), %W(#{stderr_log} a)\n rescue StandardError => e\n FileUtils.rm_rf output_folder\n raise e\n end",
"def transform(file, format:); end",
"def convert\n self.class.convert(object)\n end",
"def convert_u2!(comment=nil)\n v = get_u2\n out_with_comment! \"<u2>#{v}</u2>\", comment\n end",
"def convert(format)\n manipulate! do |img|\n \t@format = format\n img.convert\n img = yield(img) if block_given?\n img\n end\n end",
"def convert(el, opts = { indent: 0, result: [] })\n send(\"convert_#{el.type}\", el, opts)\n end",
"def convert(format)\n send \"to_#{format}\"\n end",
"def vxay2b(x, y)\n\t\[email protected](xy2p(x, y), y)\n\tend",
"def hex2_oct()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Hex2Oct::Hex2OctRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def convert(obj)\n if c = @converter\n c.call(obj)\n else\n obj\n end\n end",
"def __convert(h); end",
"def to_2da\n ret = []\n\n # Contains the maximum string length by each column,\n # from which we can calulate the padding we need that\n # things align properly.\n id_cell_size = @rows.size.to_s.size + CELL_PAD_SPACES\n max_cell_size_by_column = @columns.map {|col|\n ([col] + by_col(col)).inject(0) {|max, cell|\n cell = '\"%s\"' % cell if cell =~ /\\s/\n cell.to_s.size > max ? cell.to_s.size : max\n } + CELL_PAD_SPACES\n }\n\n ret << \"2DA V2.0\"\n ret << \"\"\n\n rv = []\n rv << \" \" * id_cell_size\n @columns.each_with_index {|column, column_idx|\n rv << column + \" \" * (max_cell_size_by_column[column_idx] - column.size)\n }\n ret << rv.join(\"\").rstrip\n\n @rows.each_with_index {|row, row_idx|\n rv = []\n rv << row_idx.to_s + \" \" * (id_cell_size - row_idx.to_s.size)\n row.each_with_index {|cell, column_idx|\n cell = cell ? 1 : 0 if cell.is_a?(TrueClass) || cell.is_a?(FalseClass)\n cell = \"****\" if cell == \"\"\n cell = '\"%s\"' % cell if cell =~ /\\s/\n cell = cell.to_s\n rv << cell + \" \" * (max_cell_size_by_column[column_idx] - cell.size)\n }\n ret << rv.join(\"\").rstrip\n }\n\n # Append an empty newline.\n ret << \"\"\n\n ret.join(case NWN.setting(\"2da_newline\")\n when \"0\", false\n \"\\r\\n\"\n when \"1\"\n \"\\n\"\n when \"2\"\n \"\\r\"\n when nil\n @newline\n end)\n end",
"def build_convert_command(input_file, output_file)\n builder = CommandBuilder.new([Sox::File.new(input_file)], Sox::File.new(output_file))\n builder.effects = {:channels => @options[:channels], :rate => @options[:rate]}\n builder.build\n end",
"def convert(el, opts = { indent: 0 })\n send(\"convert_#{el.type}\", el, opts)\n end",
"def to_a\n docnumb = self.number\n docdate = self.date ? self.date.oris_format : Date.today.oris_format\n currency = self.currency ? self.currency : 'GEL'\n project = self.project ? self.project.to_geo : ' მთ.წიგნი'.to_geo\n sysdate = self.sysdate ? self.sysdate.oris_format : Date.today.oris_format\n unit = self.unit ? self.unit.to_geo : 'ერთეული'.to_geo\n quant = self.quantity || 0\n quant2 = self.quantity_normal || quant\n user = self.user ? self.user.to_geo : ''\n ['', '', '', docnumb, '0', docdate, ORIS.oris_acc_code(self.acc_debit), ORIS.oris_acc_code(self.acc_credit),\n '0', self.calc_amount, currency, self.description, '0', '1', unit, quant, quant2, project, user,\n '0', '9', '0', '', '0', sysdate, self.related_to, '0', '1', '3', '', '0', '', '']\n end",
"def convert(exp)\n if exp == nil\n {}\n elsif exp == false\n {\n :type => :name,\n :id => 'false',\n }\n elsif exp == true\n {\n :type => :name,\n :id => 'true',\n }\n else\n case exp[0]\n when :program\n {\n :type => :program,\n :body => convert(exp[1]),\n :filename => @filename\n }\n when :module\n {\n :type => :module,\n :name => convert(exp[1]),\n :body => convert(exp[2]),\n :filename => @filename\n }\n when :@ident, :@op\n {\n :type => :name,\n :id => exp[1],\n :location => exp[2],\n }\n when :@gvar\n {\n :type => :gvar,\n :id => exp[1],\n :location => exp[2]\n }\n when :dyna_symbol\n # ignore dynamic symbols for now\n {\n :type => :name,\n :id => '#dyna_symbol'\n }\n when :symbol\n sym = convert(exp[1])\n sym[:type] = :symbol\n sym\n when :@cvar\n {\n :type => :cvar,\n :id => exp[1][2..-1],\n :location => exp[2]\n }\n when :@ivar\n {\n :type => :ivar,\n :id => exp[1][1..-1],\n :location => exp[2]\n }\n when :@const, :@kw, :@backtick\n #:@const and :@kw are just names\n {\n :type => :name,\n :id => exp[1],\n :location => exp[2]\n }\n when :@label\n {\n :type => :name,\n :id => exp[1][0..-2],\n :location => exp[2]\n }\n when :def\n {\n :type => :def,\n :name => convert(exp[1]),\n :params => convert(exp[2]),\n :body => convert(exp[3])\n }\n when :defs\n name = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n {\n :type => :def,\n :name => name,\n :params => convert(exp[4]),\n :body => convert(exp[5])\n }\n when :do_block\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :lambda\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :brace_block\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :params\n ret = {:type => :params}\n if exp[1]\n ret[:positional] = convert_array(exp[1])\n end\n if exp[2]\n # keyword arguments (converted into positionals and defaults)\n unless ret[:positional]\n ret[:positional] = []\n end\n exp[2].each { |x| ret[:positional].push(convert(x[0])) }\n ret[:defaults] = exp[2].map { |x| convert(x[1]) }\n end\n if exp[3] and exp[3] != 0\n ret[:rest] = convert(exp[3])\n end\n if exp[4]\n ret[:after_rest] = convert_array(exp[4])\n end\n if exp[5]\n ret[:kw_keys] = convert_array(exp[5].map{ |x| x[0]})\n ret[:kw_values] = convert_array(exp[5].map{ |x| x[1] })\n end\n if exp[6]\n ret[:rest_kw] = convert(exp[6])\n end\n if exp[7]\n ret[:blockarg] = convert(exp[7])\n end\n ret\n when :block_var\n params = convert(exp[1])\n if exp[2]\n params[:block_var] = convert_array(exp[2])\n end\n params\n when :class\n ret = {\n :type => :class,\n :static => false,\n :name => convert(exp[1]),\n :body => convert(exp[3]),\n }\n if exp[2]\n ret[:super] = convert(exp[2])\n end\n ret\n when :sclass\n {\n :type => :class,\n :static => true,\n :name => convert(exp[1]),\n :body => convert(exp[2]),\n }\n when :method_add_block\n call = convert(exp[1])\n if call[:args]\n call[:args][:blockarg] = convert(exp[2])\n else\n call[:args] = {\n :blockarg => convert(exp[2])\n }\n end\n call\n when :method_add_arg\n call = convert(exp[1])\n call[:args] = convert(exp[2])\n call\n when :vcall\n {\n :type => :call,\n :func => convert(exp[1])\n }\n when :command\n {\n :type => :call,\n :func => convert(exp[1]),\n :args => convert(exp[2])\n }\n when :command_call\n if exp[2] == :'.' or exp[2] == :'::'\n func = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n else\n func = convert(exp[1])\n end\n {\n :type => :call,\n :func => func,\n :args => convert(exp[4])\n }\n when :super, :zsuper\n {\n :type => :call,\n :func => {:type => :name, :id => :super},\n :args => convert(exp[1])\n }\n when :call, :fcall\n if exp[3] != :call and (exp[2] == :'.' or exp[2] == :'::')\n func = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n else\n func = convert(exp[1])\n end\n {\n :type => :call,\n :func => func\n }\n when :args_new, :mlhs_new, :mrhs_new, :words_new, :word_new, :qwords_new, :qsymbols_new, :symbols_new\n {\n :type => :args,\n :positional => []\n }\n when :args_add, :mlhs_add, :mrhs_add, :word_add, :words_add, :qwords_add, :qsymbols_add, :symbols_add\n args = convert(exp[1])\n args[:positional].push(convert(exp[2]))\n args\n when :args_add_star, :mrhs_add_star, :mlhs_add_star\n args = convert(exp[1])\n if exp[2]\n args[:star] = convert(exp[2])\n end\n args\n when :args_add_block\n args = convert(exp[1])\n if exp[2]\n args[:blockarg] = convert(exp[2])\n end\n args\n when :assign, :massign\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :opassign\n # convert x+=1 into x=x+1\n operation = convert([:binary, exp[1], exp[2][1][0..-2], exp[3]])\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => operation\n }\n when :dot2, :dot3\n {\n :type => exp[0],\n :from => convert(exp[1]),\n :to => convert(exp[2])\n }\n when :alias, :var_alias\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :undef\n {\n :type => :undef,\n :names => convert_array(exp[1]),\n }\n when :if, :if_mod, :elsif, :ifop\n ret = {\n :type => :if,\n :test => convert(exp[1]),\n :body => convert(exp[2]),\n }\n if exp[3]\n ret[:else] = convert(exp[3])\n end\n if exp[0] == :if_mod\n ret[:mod] = true\n end\n ret\n when :case\n if exp[1]\n value = convert(exp[1])\n else\n value = nil\n end\n convert_when(exp[2], value)\n when :while, :while_mod\n if exp[0] == :while_mod\n mod = true\n else\n mod = false\n end\n {\n :type => :while,\n :test => convert(exp[1]),\n :body => convert(exp[2]),\n :mod => mod\n }\n when :until, :until_mod\n if exp[0] == :until_mod\n mod = true\n else\n mod = false\n end\n {\n :type => :while,\n :test => negate(convert(exp[1])),\n :body => convert(exp[2]),\n :mod => mod\n }\n when :unless, :unless_mod\n if exp[0] == :unless_mod\n mod = true\n else\n mod = false\n end\n ret = {\n :type => :if,\n :test => negate(convert(exp[1])),\n :body => convert(exp[2]),\n :mod => mod\n }\n if exp[3]\n ret[:else] = convert(exp[3])\n end\n ret\n when :for\n {\n :type => :for,\n :target => convert(exp[1]),\n :iter => convert(exp[2]),\n :body => convert(exp[3])\n }\n when :begin\n bodystmt = exp[1]\n {\n :type => :begin,\n :body => convert(bodystmt[1]),\n :rescue => convert(bodystmt[2]),\n :else => convert(bodystmt[3]),\n :ensure => convert(bodystmt[4])\n }\n when :rescue\n ret = {:type => :rescue}\n if exp[1]\n if exp[1][0].is_a? Array\n ret[:exceptions] = convert_array(exp[1])\n else\n ret[:expections] = convert(exp[1])[:positional]\n end\n end\n if exp[2]\n ret[:binder] = convert(exp[2])\n end\n if exp[3]\n ret[:handler] = convert(exp[3])\n end\n if exp[4]\n ret[:else] = convert(exp[4])\n end\n ret\n when :rescue_mod\n {\n :type => :begin,\n :body => convert(exp[1]),\n :rescue => convert(exp[2]),\n :mod => true\n }\n when :stmts_new\n {\n :type => :block,\n :stmts => []\n }\n when :stmts_add\n block = convert(exp[1])\n stmt = convert(exp[2])\n block[:stmts].push(stmt)\n block\n when :bodystmt\n block = convert(exp[1])\n if exp[2]\n res = convert(exp[2])\n block[:stmts].push(res)\n end\n block\n when :binary\n {\n :type => :binary,\n :left => convert(exp[1]),\n :op => op(exp[2]),\n :right => convert(exp[3])\n }\n when :array\n args = convert(exp[1])\n {\n :type => :array,\n :elts => args[:positional]\n }\n when :aref, :aref_field\n args = convert(exp[2])\n {\n :type => :subscript,\n :value => convert(exp[1]),\n :slice => args[:positional]\n }\n when :unary\n {\n :type => :unary,\n :op => op(exp[1]),\n :operand => convert(exp[2])\n }\n when :@int\n {\n :type => :int,\n :value => exp[1],\n :location => exp[2]\n }\n when :@float\n {\n :type => :float,\n :value => exp[1],\n :location => exp[2]\n }\n when :regexp_literal\n regexp = convert(exp[1])\n regexp[:regexp_end] = convert(exp[2])\n regexp\n when :regexp_new\n {\n :type => :regexp,\n }\n when :regexp_add\n {\n :type => :regexp,\n :pattern => convert(exp[2]),\n }\n when :@regexp_end\n make_string(exp[1], exp[2])\n when :@backref\n make_string(exp[1], exp[2])\n when :@tstring_content, :@CHAR\n make_string(exp[1], exp[2])\n when :string_content, :xstring_new\n make_string('')\n when :string_add, :xstring_add, :qwords_add\n if not exp[1] or exp[1] == [:string_content] or exp[1] == [:xstring_new]\n convert(exp[2])\n else\n {\n :type => :binary,\n :op => op(:+),\n :left => convert(exp[1]),\n :right => convert(exp[2])\n }\n end\n when :string_concat, :xstring_concat\n convert([:binary, exp[1], :+, exp[2]])\n when :hash\n if exp[1]\n convert(exp[1])\n else\n {\n :type => :hash,\n }\n end\n when :assoclist_from_args, :bare_assoc_hash\n {\n :type => :hash,\n :entries => convert_array(exp[1])\n }\n when :assoc_new\n {\n :type => :assoc,\n :key => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :const_path_ref, :const_path_field\n {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[2])\n }\n when :field\n {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n when :void_stmt\n {\n :type => :void\n }\n when :yield0\n {\n :type => :yield\n }\n when :return0\n {\n :type => :return\n }\n when :break\n {\n :type => :break\n }\n when :retry\n {\n :type => :retry\n }\n when :redo\n {\n :type => :redo\n }\n when :defined\n {\n :type => :unary,\n :op => op(:defined),\n :operand => convert(exp[1])\n }\n when :return, :yield\n {\n :type => exp[0],\n :value => args_to_array(convert(exp[1]))\n }\n when :string_embexpr\n {\n :type => :string_embexpr,\n :value => convert(exp[1])\n }\n when :var_ref,\n :var_field,\n :const_ref,\n :top_const_ref,\n :top_const_field,\n :paren,\n :else,\n :ensure,\n :arg_paren,\n :mlhs_paren,\n :rest_param,\n :blockarg,\n :symbol_literal,\n :regexp_literal,\n :param_error,\n :string_literal,\n :xstring_literal,\n :string_dvar,\n :mrhs_new_from_args,\n :assoc_splat,\n :next,\n :END,\n :BEGIN\n # superflous wrappers that contains one object, just remove it\n convert(exp[1])\n else\n banner('unknown')\n puts \"#{exp}\"\n exp\n end\n end\n end",
"def hex2_dec()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Hex2Dec::Hex2DecRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def convert\n @value = \"\"\n @areas.each do |area|\n image = RTesseract.new(@source.to_s,@options)\n image.crop!(area[:x].to_i, area[:y].to_i, area[:width].to_i, area[:height].to_i)\n @value << image.to_s\n end\n rescue\n raise RTesseract::ConversionError\n end",
"def convert(attachment_name, convert_steps=\"\", style=nil)\n system \"convert \\\"#{file_path(attachment_name, nil, true)}\\\" #{convert_steps} \\\"#{file_path(attachment_name, style, true)}\\\"\"\n end",
"def iconv() end",
"def to_mods\n fail \"mods can only be instantiated for Instances\" unless self.is_a? Instance\n document = Nokogiri::XML(self.to_rdf)\n template = Nokogiri::XSLT(File.read(Rails.root.join('app','export','transforms','bibframe2mods.xsl')))\n transformed_document = template.transform(document)\n transformed_document.to_xml\n end",
"def convert\n original = __getobj__.to_s\n\n unless irregular_number?( __getobj__ )\n # Split up the number into triplets\n trios_reverse = create_reversed_grouped_numbers( original )\n\n # Generate the number based on the triplets\n multi_triplet = trios_reverse.length > 1\n result = []\n trios_reverse.each_with_index do |e, factor|\n result << (convert_triplet( e, factor, multi_triplet ) + ' ' + MEGA[factor]).strip\n end\n\n # And finaly join the triplets in the correct order\n result.reverse.join ' '\n else\n convert_irregular_number( original )\n end\n end",
"def convert_to(exchange_currency)\n begin\n exchange_currency = Money::InputSanitizer.sanitize_currency(exchange_currency,Money::CrossRate.get_all_available_currencies)\n Money::LiveConverter.new(@amount.to_f*Money::CrossRate.get_cross_value_for_currency(@currency,exchange_currency),exchange_currency)\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end",
"def convert_tracks2(i_tracks_to_convert)\n @ole.ConvertTracks2(i_tracks_to_convert)\n end",
"def convert!\n resource\n end",
"def test_0810_to_a\n @@log.debug \"test_0810_to_a starts\" if @@log.debug?\n assert_respond_to(@list, :to_a, \"test_0810_to_a_respond\")\n # Straight conversion\n result = @list.to_a\n assert_equal(result,\n [@aen, @bsb, @cab, @dad],\n \"test_0810_to_a_all\")\n #\n # This is another case where the 1.9 Pickaxe implies that to_a may \n # be passed argument(s). This does not appear to be the case, as \n # described previously.\n #\n @@log.debug \"test_0810_to_a ends\" if @@log.debug?\n end",
"def convert_file filename, content, in_dir, out_dir, language\n # Convert the file\n converter = AutoHeathen::Converter.new( { logger: logger } )\n action = converter.get_action content.content_type\n logger.debug \" convert: #{File.basename(filename)}, content_type: #{content.content_type}, action: #{action}\"\n start_time = Time.now\n outfile, data = converter.convert action, language, filename, content\n logger.debug \" conversion took %0.2f s\"%[Time.now-start_time]\n\n # Save the file\n outfile = to_outfile in_dir, filename, out_dir, outfile\n logger.info \" writing file: #{outfile}\"\n File.open outfile, \"wb\" do |f|\n f.write data\n end\nend",
"def convert(input)\n row = input[1].to_i\n column = convert_column(input[0])\n [row, column]\n end",
"def to_BMP\n CPL::Tools::Alchemy::BMP::Base.new(file.read,:string)\n end",
"def to_m4a(options={})\n options[:quality] ||= 320\n options[:output] ||= self.basename_with_path + '.m4a'\n cmd = \"afconvert -v \\\"#{self.path}\\\" -o \\\"#{options[:output]}\\\" -f m4af -d aac -b #{options[:quality]}000 -s 0\"\n system(cmd)\n end",
"def convert(from_file, to_file = {})\n @from_file = from_file\n FFMpegCommand << \"-i #{from_file}\"\n begin\n yield if block_given?\n rescue Exception => exception\n disable_method_checking!\n raise exception\n end\n \n build_output_file_name(from_file, to_file[:to]) do |file_name|\n FFMpegCommand << file_name\n end\n end",
"def compass_convert\n file = File.open('data_imu.txt', 'r')\n file.readlines.each do |line|\n next unless line =~ /compass:/\n array = line.split(', ')\n capture_raw(array)\n end # end of loop\n file.close\nend",
"def convert(obj)\n ret = convert_proc.call(obj)\n filters.execute(ret)\n end",
"def convert_one_line_constructions(source)\n for_outstrings_of(source) do |str|\n ShortcutsConverter.convert str\n end\n end"
] | [
"0.6633204",
"0.6633204",
"0.6587361",
"0.62261814",
"0.61679804",
"0.6020692",
"0.59798896",
"0.59233826",
"0.5895836",
"0.5842984",
"0.57885265",
"0.57435685",
"0.56970567",
"0.56860423",
"0.5643551",
"0.56189805",
"0.5618606",
"0.5618606",
"0.5618606",
"0.55961764",
"0.5593838",
"0.55927134",
"0.5592363",
"0.5583624",
"0.55751663",
"0.5568638",
"0.55497134",
"0.5471351",
"0.5454976",
"0.5451706",
"0.54489905",
"0.54459107",
"0.54311186",
"0.5421696",
"0.54070467",
"0.53867906",
"0.5383202",
"0.5368271",
"0.5368271",
"0.53461844",
"0.5345346",
"0.5286155",
"0.52752155",
"0.5269912",
"0.5210421",
"0.5204637",
"0.51988435",
"0.5168122",
"0.51473504",
"0.51427716",
"0.5137605",
"0.5129353",
"0.5113859",
"0.5112173",
"0.5110103",
"0.51038146",
"0.5073657",
"0.50728637",
"0.5069131",
"0.50585157",
"0.50543165",
"0.5053732",
"0.5047107",
"0.5047097",
"0.5046599",
"0.50444853",
"0.50410986",
"0.50362474",
"0.5032014",
"0.5021778",
"0.5020982",
"0.5011244",
"0.5003523",
"0.49970597",
"0.49758023",
"0.49703282",
"0.49696115",
"0.49678022",
"0.49655497",
"0.49470282",
"0.49450147",
"0.49416474",
"0.49378726",
"0.49202076",
"0.49197465",
"0.49158052",
"0.49114168",
"0.4903731",
"0.48979264",
"0.4894728",
"0.48684642",
"0.48654395",
"0.48630577",
"0.48615667",
"0.48605874",
"0.4859296",
"0.48489305",
"0.4848385",
"0.48450464",
"0.4838217"
] | 0.8192635 | 0 |
Convert using asciidoc tool | def ConvertASCIIDOC
# asciidoc options
if not @FullOpts.nil?
opts = @FullOpts + " "
else
opts = self.getOptionsAsciidoc()
end
opts += @Opts + " " if not @Opts.nil?
opts += "-v " if $debug2
# Execute pre actions
self.ExecuteAction(:pre)
cmd = "asciidoc -o #{@outfile} #{opts} #{@doc.filename}"
puts "Generating (#{@Type}) #{@outfile}\n"
puts "Executing : #{cmd}" if $verbose
res = %x[#{cmd}]
puts res if res != ""
if $? == 0
# Execute post actions
self.ExecuteAction(:post)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_markup_asciidoc(text); end",
"def asciidoc(src, target, *args)\n attributes =\n if args.last.is_a?(Hash)\n args.pop\n else\n {}\n end\n attributes = { :linkcss => '' }.merge(attributes)\n doing :adoc, target\n args = %W[asciidoc --unsafe -o #{target}] + args +\n attributes.map { |k,v| [\"-a\", \"#{k}=#{v}\"] }.flatten +\n [ (verbose ? '--verbose' : nil), src].compact\n sh(*args)\nend",
"def convert()\n xml_to_html()\n html_to_pandoc()\n\n\n if @option[:file_output] == \"\"\n # Without -o option\n puts @result\n else\n # Using option: -o filename\n File.open(@option[:file_output],\"w\") do |f|\n f.write(@result)\n end\n end\n\n return @result\n end",
"def md2html\n\t\tbook.toc.each do |source|\n\t\t\ttarget = 'build/raw_html/' + source.ext('html')\n\t\t\tcreate \"source/#{source}\" => target do\n\t\t\t\tinfo \"converting #{source} => #{target}\"\n\t\t\t\tm = Maruku.new IO.read(\"source/#{source}\")\n\t\t\t\tFile.open(target, 'w') do |f|\n\t\t\t\t\tif block_given?\n\t\t\t\t\t\thtml = m.to_filtered_html do |doc|\n\t\t\t\t\t\t\tyield doc\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\thtml = m.to_html\n\t\t\t\t\tend\n\t\t\t\t\tf.write html\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def to_docbook( *rules )\n @stack = Array.new\n @ids = Array.new\n @references = Array.new\n @automatic_content_ids = Array.new\n\n rules = DEFAULT_RULES if rules.empty?\n # make our working copy\n text = self.dup\n \n @urlrefs = {}\n @shelf = []\n @rules = rules.collect do |rule|\n case rule\n when :docbook\n DOCBOOK_RULES\n else\n rule\n end\n end.flatten\n \n # standard clean up\n incoming_entities text \n clean_white_space text \n\n # start processor\n @pre_list = []\n pre_process_docbook text\n\n no_docbook text\n docbook_rip_offtags text\n docbook_hard_break text\n\n refs text\n docbook_blocks text\n inline text\n \n smooth_offtags text\n retrieve text\n \n post_process_docbook text\n clean_html text if filter_html\n text.strip!\n \n text << \"\\n\"\n @stack.each_with_index {|sect,index| text << \"</sect#{@stack.size-index}>\\n\"}\n text << \"</chapter>\" if @chapter\n \n if (@references - @ids).size > 0\n text << %{<chapter label=\"86\" id=\"chapter-86\"><title>To Come</title>}\n (@references - @ids).each {|name| text << %!<sect1 id=\"#{name}\"><title>#{name.split('-').map {|t| t.capitalize}.join(' ')}</title><remark>TK</remark></sect1>\\n!}\n text << \"</chapter>\"\n end\n \n text\n\n end",
"def html_markup_rdoc(text); end",
"def convert(src_node, dst_node, dst_top)\n @logger&.info { \"Converting #{src_node.pathname} and store result under #{dst_node.parent.pathname}\" }\n\n # merge the common api opts with node specific\n api_opts = DEFAULT_ADOC_API_OPTS.dup\n api_opts.merge!(@config_opts.fetch(:adoc_api_opts, {}))\n api_opts.merge!(src_node.api_options(src_node, dst_node, dst_top)) if src_node.respond_to?(:api_options)\n\n # use a new logger instance for each conversion\n adoc_logger = Giblish::AsciidoctorLogger.new(@logger, @adoc_log_level)\n\n begin\n doc_src = src_node.adoc_source(src_node, dst_node, dst_top)\n\n node_attr = src_node.respond_to?(:document_attributes) ?\n src_node.document_attributes(src_node, dst_node, dst_top) : {}\n doc_attr = resolve_doc_attributes(doc_src, node_attr)\n # piggy-back our own info on the doc attributes hash so that\n # asciidoctor extensions can use this info later on\n doc_attr[\"giblish-info\"] = {\n src_node: src_node,\n dst_node: dst_node,\n dst_top: dst_top\n }\n\n # load the source to enable access to doc attributes and properties\n #\n # NOTE: 'parse' is set to false to prevent preprocessor extensions to be run as part\n # of loading the document. We want them to run during the 'convert' call later when\n # doc attribs have been amended.\n #\n # NOTE2: by trial-and-error, it seems that some document attributes must be set when\n # calling 'load' and not added after the call and before the 'convert' call to have\n # the expected effect (e.g. idprefix).\n doc = Asciidoctor.load(doc_src, api_opts.merge(\n {\n attributes: doc_attr,\n parse: false,\n logger: adoc_logger\n }\n ))\n\n # update the destination node with the correct file suffix. This is dependent\n # on the type of conversion performed\n dst_node.name = dst_node.name.sub_ext(doc.attributes[\"outfilesuffix\"])\n d = dst_node.pathname\n\n # make sure the dst dir exists\n d.dirname.mkpath\n\n # do the conversion and write the converted doc to file\n output = doc.convert(api_opts)\n doc.write(output, d.to_s)\n\n # give the user the opportunity to eg store the result of the conversion\n # as data in the destination node\n @conv_cb[:success]&.call(src_node, dst_node, dst_top, doc, adoc_logger.in_mem_storage.string)\n true\n rescue => ex\n @logger&.error { \"Conversion failed for #{src_node.pathname}\" }\n @logger&.error { ex.message }\n @logger&.error { ex.backtrace }\n @conv_cb[:failure]&.call(src_node, dst_node, dst_top, ex, adoc_logger.in_mem_storage.string)\n false\n end\n end",
"def convert_str(src_str, dst_dir, basename, logger: nil)\n index_opts = @converter_options.dup\n\n # use the same options as when converting all docs\n # in the tree but make sure we don't write to file\n # by trial and error, the following dirs seem to be\n # necessary to change\n index_opts[:to_dir] = dst_dir.to_s\n index_opts[:base_dir] = dst_dir.to_s\n index_opts.delete_if { |k, _v| %i[to_file].include? k }\n\n # give derived classes the opportunity to set doc specific attributes\n index_filepath = dst_dir + \"#{basename}.#{index_opts[:fileext]}\"\n add_doc_specific_attributes(index_filepath, false, index_opts[:attributes])\n\n # load and convert the document using the converter options\n begin\n conv_error = false\n # set a specific logger instance to-be-used by asciidoctor\n index_opts[:logger] = logger unless logger.nil?\n doc = Asciidoctor.load src_str, index_opts\n output = doc.convert index_opts\n\n if logger&.max_severity && logger.max_severity > Logger::Severity::WARN\n raise \"Failed to convert string to asciidoc!! \"\\\n \"Will _not_ generate #{index_filepath}\"\n end\n\n # write the converted document to an index file located at the\n # destination root\n doc.write output, index_filepath.to_s\n rescue StandardError => e\n puts e.backtrace\n Giblog.logger.error(e)\n conv_error = true\n end\n\n conv_error\n end",
"def yardoc_file; end",
"def convert(*args)\n @options += args if args\n outputfile = @options.map{ |x| x[:output] }.compact\n tmp_file = Tempfile.new('pandoc-conversion')\n @options += [{ output: tmp_file.path }] if outputfile.empty?\n @option_string = prepare_options(@options)\n begin\n run_pandoc\n IO.binread(tmp_file)\n ensure\n tmp_file.close\n tmp_file.unlink\n end\n end",
"def generate_yardoc(includes, yardoc_db)\n system(\"yardoc --db #{yardoc_db} --no-output --no-api --no-private #{includes.join(' ')}\")\nend",
"def what_it_does() \"Generate javadoc to '#{@name}' folder\" end",
"def tomdoc\n lines = raw.split(\"\\n\")\n\n # remove remark symbol\n if lines.all?{ |line| /^\\s*#/ =~ line }\n lines = lines.map do |line|\n line =~ /^(\\s*#)/ ? line.sub($1, '') : nil\n end\n end\n\n # for some reason the first line is coming in without indention\n # regardless, so we temporary remove it\n first = lines.shift\n\n lines = deindent(lines)\n\n # put first line back\n unless first.nil?\n lines.unshift(first.sub(/^\\s*/,''))\n end\n\n lines.compact.join(\"\\n\")\n end",
"def doc_transformed(root)\n\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 to_md\n # Usually ruby is extremely readable, but I think \"-1\" means \"give me all the \n # trailing blank lines\" is surprisingly opaque. That's what the -1 does...\n lines = @text.split(\"\\n\", -1)\n lines.collect do |line|\n result = line\n \n # Leave lines that start with 4 spaces alone. These are code blocks and\n # should pass through unchanged.\n unless result =~ /^\\s{4,}/\n \n # Convert headers\n result.sub!(/^(=){1,6}/) { |s| \"#\" * s.length} unless result =~ /^={7,}/\n \n # Convert strong to have two stars\n # The matching pair of stars should start with a single star that is either at\n # the beginning of the line or not following a backslash, have at least one\n # non-star and non-backslash in between, then end in one star\n result.gsub!(/(\\A|[^\\\\\\*])\\*([^\\*]*[^\\*\\\\])\\*/, '\\1**\\2**')\n\n # Convert inline code spans to use backticks\n result.gsub!(/(\\A|[^\\\\])\\+([^\\+]+)\\+/, '\\1`\\2`')\n\n # Convert bare http:, mailto: and ftp: links\n result.gsub!(/(\\A|\\s)(http:|https:|mailto:|ftp:)(\\S*)/, '\\1[\\2\\3](\\2\\3)')\n\n # Convert bare www to an http: link\n result.gsub!(/(\\A|\\s)www\\.(\\S*)/, '\\1[www.\\2](http://www.\\2)')\n\n # Convert link: links to refer to local files\n result.gsub!(/(\\A|\\s)link:(\\S*)/, '\\1[\\2](\\2)')\n\n # Convert multi word labels surrounded by {} with a url\n result.gsub!(/\\{([^\\}]*)\\}\\[(\\S*)\\]/, '[\\1](\\2)')\n\n # Convert one word labels with a url\n result.gsub!(/(\\A|\\s)([^\\{\\s]\\S*)\\[(\\S*)\\]/, '\\1[\\2](\\3)')\n\n end\n \n result\n end.join(\"\\n\")\n end",
"def rdoc(input)\n markup = RDoc::Markup::ToHtml.new\n markup.convert(input)\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 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 rst_to_md(rst)\n return PandocRuby.convert(rst, :from => :rst, :to => :markdown)\nend",
"def convertHtmlToMarkdown\n root = pathExports\n n = 1\n Pathname.glob(pathExports() + \"**/*.html\").each do |p|\n puts \"File \" + n.to_s + \": \" + p.to_s\n n = n + 1\n infile = p.to_s\n outfile = p.sub_ext(\".md\").to_s\n command = \"pandoc -f html -t markdown -o #{outfile} #{infile}\"\n puts command\n sh(command)\n end\nend",
"def to_s\n\t\t\t\t\t\tstr = @content\n\t\t\t\t\t\tstr.gsub!(/\\t/,' ')\n\t\t\t\t\t\t# rdoc syntax\n\t\t\t\t\t\tstr.gsub!(/^=head(\\d+)/) do\n \t\t\t\t\"=\" * $1.to_i\n \t\t\t\tend\n \t\t\t\tstr.gsub!(/=item\\s+/, '')\n \t\t\t\tstr.gsub!(/C<(.*?)>/, '<tt>\\1</tt>')\n \t\t\t\tstr.gsub!(/I<(.*?)>/, '<i>\\1</i>')\n \t\t\t\tstr.gsub!(/B<(.*?)>/, '<b>\\1</b>')\n\t\t\t\t\t\tstr.gsub!(/^=(over|back)[^\\n]*\\n/m, '')\n\n\t\t\t\t\t\t# yard syntax\n\t\t\t\t\t\t# convert first code block to example\n\t\t\t\t\t\tstr.gsub!(/\\A(\\s+)^(\\t| \\s*\\S)/, \"\\\\1@example\\n\\\\2\")\n\t\t\t\t\t\t# convert links\n \t\t\t\tstr.gsub!(/L<(.*?)>/) do |link|\n\t\t\t\t\t\t\tlink_and_ref = $1.split(/\\|/)\n\t\t\t\t\t\t\tthing = link_and_ref[0]\n\t\t\t\t\t\t\ttext = link_and_ref[1]\n\t\t\t\t\t\t\ttext ? \"{#{thing}|#{text}}\" : \"{#{thing}}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tstr\n\t\t\t\t\tend",
"def create_md tool\n \n original = tool[1].split(\"\\n\")\n new = []\n note = false\n\n # Cambia las rutas y < y > por código HTML\n def diple l\n return l.gsub('de +++YAML+++ en <http://pecas.cliteratu.re>', 'de [+++YAML+++](yaml.html)')\n .gsub('de JavaScript en <http://pecas.cliteratu.re>', 'de [JavaScript](js.html)')\n .gsub('Lista de acrónimos: <https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages>', '[Lista de acrónimos](https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages)')\n .gsub('<','<').gsub('>','>')\n end\n\n # Agrega versalitas\n def smallcaps l\n return l.gsub(/([A-Z]{3,})/, '+++\\1+++')\n end\n\n # Cambia comillas por sintaxis para línea de código\n def to_code l\n return l.gsub(/«(.+?)»/, '`\\1`')\n end\n\n # Añade líneas de código en las opciones\n def to_code_option l\n return l.gsub(/^(\\S+)/, '`\\1`')\n end\n\n new.push('# ' + $l_g_pc_docs_creation + '`' + tool[0] + '`')\n\n original.each_with_index do |l, i|\n\n l = to_code(diple(smallcaps(l)))\n\n if l =~ /^\\S/\n # Encabezados 2\n if l !~ /^Nota/ && i != 1\n new.push('## ' + l + \"\\n\\n\")\n # Párrafos\n else\n # Notas\n if l =~ /^Nota/\n if !note\n new.push(\"--- {.espacio-arriba3}\\n\\n\")\n note = true\n new.push(l + ' {.espacio-arriba3}')\n else\n new.push(l + ' {.espacio-arriba1 .sin-sangria}')\n end \n # Descripción\n else\n # Esto servirá para crear «herramientas.md»\n $tools_md[\"#{tool[0]}\"] = [tool[0], l.gsub(/^\\S+\\s+/, '')]\n new.push(l)\n end\n end\n else\n if l.strip != ''\n l = l.strip\n\n # Opciones de Pecas\n if l =~ /^-/\n new.push('* ' + to_code_option(l))\n # Comandos de Pecas\n elsif l =~ /^pc-/\n new.push('```')\n new.push(l)\n new.push('```')\n # Explicaciones\n elsif l =~ /^[A-Z]/\n new.push(\"\\n\" + l)\n # Dependencias / Tipos\n else\n # Evita que se quede como línea de código el tipo y su descripción\n l_final = []\n l.split(/\\s+/).each_with_index do |ll, i|\n # Solo la primera palabra se va como código\n if i == 0\n l_final.push('* `' + ll + '`')\n # El resto de las palabras se quedan como texto\n else\n l_final.push(ll)\n end\n end\n new.push(l_final.join(' '))\n end\n # Líneas en blanco\n else\n new.push(l)\n end\n end\n end\n\n\tarchivo = File.new(Dir.pwd + '/md/' + tool[0] + '.md', 'w:UTF-8')\n\tarchivo.puts new\n\tarchivo.close\nend",
"def convert(filepath, logger: nil)\n raise ArgumentError, \"Trying to invoke convert with non-pathname!\" unless filepath.is_a?(Pathname)\n\n Giblog.logger.info { \"Processing: #{filepath}\" }\n\n # update the relevant options for each specific document\n set_common_doc_specific_options(filepath, logger)\n\n # give derived classes the opportunity to set doc specific attributes\n add_doc_specific_attributes(filepath, true, @converter_options[:attributes])\n\n Giblog.logger.debug { \"converter_options: #{@converter_options}\" }\n\n # do the actual conversion\n doc = Asciidoctor.convert_file filepath, @converter_options\n\n # bail out if asciidoctor failed to convert the doc\n if logger&.max_severity && logger.max_severity > Logger::Severity::WARN\n raise \"Failed to convert the file #{filepath}\"\n end\n\n doc\n end",
"def load_yardoc(file = T.unsafe(nil)); end",
"def convert(content); end",
"def convert(content); end",
"def generatedDoc() \n asciidocCode = self.generateColumnDef\n #asciidocCode = asciidocCode + self.generateStoredProcDef\n return asciidocCode\n end",
"def collect_document(input, output)\r\n inputs=input.map{|xx| xx.esc.to_osPath }.join(\" \") # qoute cond combine the inputs\r\n\r\n #now combine the input files\r\n @log.info(\"combining the input files\")\r\n cmd=\"pandoc -s -S -o #{output} --ascii #{inputs}\" # note that inputs is already quoted\r\n system(cmd)\r\n if $?.success? then\r\n PandocBeautifier.new().beautify(output)\r\n end\r\n end",
"def pandoc_ruby_to_s5( content )\n content = PandocRuby.new( content, {:from => :markdown, :to => :s5}, :smart ).convert\n content = content.gsub(/class=\"incremental\"/,'class=\"step\"')\n # content = content.to_a[13..-1].join # remove the layout div\n end",
"def trans_html\n @doc.to_html\n end",
"def internal_convert(\n input, convert_logger, backend, standalone, extra_attributes\n )\n attributes = { 'docdir' => File.dirname(__FILE__) }\n attributes.merge! extra_attributes\n args = internal_convert_args convert_logger, backend, standalone, attributes\n Asciidoctor.convert input, args\nend",
"def define_asciidoc_tasks\n if defined?(AsciiDocTasks) && File.exist?(\"#{doc_dir}/asciidoc.conf\") && asciidoc_available?\n man_pages = FileList[\"#{doc_dir}/*.[0-9].txt\"]\n articles = FileList[\"#{doc_dir}/*.txt\"] - man_pages\n desc \"Build AsciiDoc under #{doc_dir}\"\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = articles\n t.doc_type = :article\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n AsciiDocTasks.new('doc:asciidoc') do |t|\n t.source_dir = doc_dir\n t.source_files = man_pages\n t.doc_type = :manpage\n t.config_file = \"#{doc_dir}/asciidoc.conf\"\n t.attributes = asciidoc_attributes\n end\n else\n desc \"Build AsciiDoc (disabled)\"\n task 'asciidoc'\n task 'asciidoc:build'\n task 'asciidoc:clean'\n task 'asciidoc:rebuild'\n end\n task 'doc:build' => 'doc:asciidoc:build'\n task 'doc:clean' => 'doc:asciidoc:clean'\n task 'doc:rebuild' => 'doc:asciidoc:rebuild'\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 convert(source, output_path)\n doc = Nokogiri::XML::Document.new\n parsing_node = Nokogiri::XML::Node.new \"posterous_to_jekyll\", doc\n namespaces.each_pair do |k, v| parsing_node.add_namespace(k, v) end\n\n item = parsing_node.parse(source)\n\n generate_file item, output_path do |output_file|\n write_headers item, output_file\n write_content item, output_file\n end\n end",
"def formatter(io)\n RDoc::Markup::ToRdoc.new\n end",
"def convert_file(content,user,filename,format)\n name = name_cleaner(filename)\n Dir.glob(\"public/docs/#{user.id.to_s}_*\") do |my_file|\n File.delete(my_file)\n end\n new_file_name = \"#{user.id.to_s}_#{name}.#{format}\"\n Tempfile.open(['pandoc','.html'], Rails.root.join('public/docs') ) do |f|\n f.print(content)\n f.flush\n system(\"pandoc -s -S #{f.path} -o public/docs/#{new_file_name}\")\n f.unlink\n end\n return {filename: new_file_name, filepath: \"public/docs/#{new_file_name}\" } \n end",
"def main\n blog = File.read(FILE_PATH).gsub(/-----[\\r\\n|\\n|\\r]EXTENDED BODY:/, '<!-- more -->')\n articles = split_to_articles(blog)\n headers_and_bodies = split_to_headers_and_bodies(articles)\n\n headers_and_bodies.each do |header_and_body|\n header_and_body[:header] = convert_header(header_and_body[:header])\n header_and_body[:body] = ReverseMarkdown.convert header_and_body[:body]\n end\n\n create_md_file(headers_and_bodies)\nend",
"def to_wiki_code\n \tself.gsub!(/<b>(.*)?(<\\/b>)/,'**\\1**')\n \tself.gsub!(/<i>(.*)?(<\\/i>)/,'\\\\\\\\\\\\\\\\\\1\\\\\\\\\\\\\\\\')\n \tself.gsub!(/<a href=\"\\/(.*)?\">(.*)?(<\\/a>)/,'((\\1 \\2))')\n end",
"def help\n print <<END\n Usage:\n convert.rb [options] <html-directory>\n\n -c, --per-chapter\n file-per-chapter mode -- generates one HTML file chapxxx.htm for each\n chapter sections are level 2 headings and anchors chapxxx.htm#SECTxxx.\n This is intended for local browsing, especially under MS-DOS\n \n -s, --silent silent running. Conversational messages are suppressed.\n\n <html-directory> defaults to the current directory\nEND\nend",
"def convert input, formatter\n document = case input\n when RDoc::Markup::Document then\n input\n else\n RDoc::Markup::Parser.parse input\n end\n\n document.accept formatter\n end",
"def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end",
"def convert_file(markdown_file, to_format: :html, output_file: nil, full_document: false)\n opts = []\n opts.push('-t', String(to_format).downcase) if to_format\n opts.push('-o', File.expand_path(output_file)) if output_file\n opts.push('-f') if full_document == true\n @sh.run_command(@bin.to_path, *opts, File.expand_path(markdown_file))\n end",
"def convert_document_to_html path\n system(\"unoconv\",\"-f\",\"html\", path)\n exit_status = $?.to_i\n if exit_status == 0\n conv_path = replace_extension(path, 'html')\n content = File.read(conv_path)\n File.delete(conv_path)\n content\n else\n logger.info \"Unoconv failed, filetype: #{get_mime_type(path)}\"\n []\n end\n end",
"def handle_pipe\n @html = RDoc::Markup::ToHtml.new @options\n\n parser = RDoc::Text::MARKUP_FORMAT[@options.markup]\n\n document = parser.parse $stdin.read\n\n out = @html.convert document\n\n $stdout.write out\n end",
"def inspect\n \"#<yardoc #{type} #{path}>\"\n end",
"def generate_panacea_document\n template \"templates/PANACEA.tt\", \"PANACEA.md\"\n end",
"def to_text\n unless pandoc? or docx2text?\n raise \"Cannot find either docx2txt or pandoc -- at least one must be installed\"\n end\n #################################################################################\n # Document must end in .docx (case sensitive) in order for the old jiggery-pokery\n # to work\n # This is what docx2txt does:\n # filename.docx --> filename.txt\n # filename.DOCX --> filename.DOCX.txt\n #################################################################################\n\n # Usage: /usr/bin/docx2txt [infile.docx|-|-h] [outfile.txt|-]\n # /usr/bin/docx2txt < infile.docx\n # /usr/bin/docx2txt < infile.docx > outfile.txt\n #\n # In second usage, output is dumped on STDOUT.\n #\n # Use '-h' as the first argument to get this usage information.\n #\n # Use '-' as the infile name to read the docx file from STDIN.\n #\n # Use '-' as the outfile name to dump the text on STDOUT.\n # Output is saved in infile.txt if second argument is omitted.\n #\n # Note: infile.docx can also be a directory name holding the unzipped content\n # of concerned .docx file.\n if pandoc?\n #binding.pry\n extension = File.extname(current_path)\n\n file_type = extension.downcase.delete_prefix('.').to_sym\n\n raise \"unknown file type (#{file_type})\" unless PANDOC_FILETYPES.include? file_type\n\n #txt_path = File.join( File.dirname(current_path), File.basename(current_path, extension) + '.md' )\n\n output = PandocRuby.new([current_path], from: file_type).to_commonmark\n\n File.write(current_path, output)\n else\n txt_path = current_path.sub(/docx$/i, 'txt')\n # Explicitly define destination because otherwise docx2txt is inconsistent\n # At this point the .docx is ONLY in public/uploads/tmp/\n `docx2txt < \"#{current_path}\" > \"#{txt_path}\"`\n # Still only in tmp\n File.rename txt_path, current_path\n # At some point after this, the two files get moved over to public/uploads/document/file/xxx\n end\n end",
"def format_search_adoc index, uri_top\n str = \"\"\n # debug print referer...\n # str << \"uri_top: #{uri_top}\\n\"\n index.each do |file_info|\n filename = Pathname.new(file_info[\"filepath\"]).basename\n str << \"== #{file_info[\"title\"]}\\n\\n\"\n file_info[\"matches\"].each do |section_id, info|\n str << \"#{uri_top}/#{info[\"location\"]}[#{info[\"section_title\"]}]::\\n\\n\"\n # str << \"<<#{info[\"location\"]},#{info[\"section_title\"]}>>::\\n\\n\"\n str << \"[subs=\\\"quotes\\\"]\\n\"\n str << \"----\\n\"\n info[\"lines\"].each do |line|\n str << \"-- #{wash_line(line)}\\n\"\n end.join(\"\\n\\n\")\n str << \"----\\n\"\n end\n str << \"\\n\"\n end\n\n <<~ADOC\n = Search Result\n\n #{str}\n ADOC\n end",
"def preprocessMarkdownForHTML(markdown)\n output = \"\"\n inInstructions = false\n \n markdown.split(\"\\n\").each do |line|\n # parse an instructions list\n # use a dummy HTML tag so our final regex doesn't get stuck in an infinite loop replacing itself\n instructionsMatch = line.match(/^>>\\s*(.*?)$/)\n if instructionsMatch\n if not inInstructions\n output += \"<instructions>\\n\"\n end\n output += instructionsMatch[1] + \"\\n\"\n inInstructions = true\n next # don't try to parse anything else\n elsif inInstructions\n output += \"</instructions>\\n\"\n inInstructions = false\n end\n\n # parse headers and page IDs\n headerMatch = line.match(/^(#+)\\s+(.*?)\\s+@@(.*?)$/)\n if headerMatch\n headerLevel = headerMatch[1].length.to_s\n headerTitle = headerMatch[2]\n headerID = headerMatch[3]\n node = nodeWithID(headerID, $doc.toc.rootNode)\n if not node\n puts \"ERROR: Couldn't find node with ID #{headerID}\"\n exit 1\n end\n output += \"<h#{headerLevel}><a name=\\\"#{headerID}\\\">#{node.levelPrefix} #{headerTitle}</a></h#{headerLevel}>\\n\"\n next\n end\n \n # parse links to page IDs and replace with links to the real .htm file\n while 1\n linkMatch = line.match(/\\[.*?\\]\\((@@(.*?))\\)/)\n if linkMatch\n linkID = linkMatch[2]\n linkValue = linkToPageIDFrom(linkID, \"_PAGE_\") # use dummy value\n if not linkValue\n puts \"ERROR: Invalid link ID \\\"#{linkID}\\\"\"\n exit 1\n end\n line[linkMatch[1]] = linkValue\n else\n break\n end\n end\n \n # parse image and label combo\n imgLabelMatch = line.match(/!!\\[(.*?)\\]\\((.*?)\\)/)\n if imgLabelMatch\n label = imgLabelMatch[1]\n imgPath = imgLabelMatch[2]\n \n # read the image and width height to force the size on images for better loading\n # when viewing the files in the boot DVD. there are some issues where anchor jump\n # links don't always jump to the right place on the boot DVD and apparently forcing\n # the image sizes allows the pages to jump properly.\n \t\timgWidth = 0\n \t\timgHeight = 1\n \t\tbegin\n \t\t data = nil\n \t\t if (imgPath =~ /.png$/)\n \t\t data = IO.read($pagesDir + \"/\" + imgPath, 8, 16).unpack('NN')\n\t\t else\n\t\t puts \"ERROR: Unsupported image type: #{imgPath}\"\n\t\t exit 1\n\t end\n \t\t if (data)\n \t\t imgWidth = data[0]\n \t\t imgHeight = data[1]\n\t\t end\n\t\t rescue\n\t end\n imgWidthHeightAttrs = \"\"\n if imgWidth != 0 and imgHeight != 0\n imgWidthHeightAttrs = \" width=\\\"#{imgWidth}\\\" height=\\\"#{imgHeight}\\\"\"\n end\n\n output += \"<p class=\\\"imageAndLabel\\\"><img src=\\\"#{imgPath}\\\" alt=\\\"\" + CGI::escapeHTML(label) + \"\\\"#{imgWidthHeightAttrs}/><br/><em>\" + CGI::escapeHTML(label) + \"</em></p>\\n\"\n next\n end\n \n # parse warning paragraphs\n warningMatch = line.match(/^!!\\s+(.*?)$/)\n if warningMatch\n output += \"<warning>\\n\" + warningMatch[1] + \"\\n<\\/warning>\\n\"\n next\n end\n \n output += line + \"\\n\"\n end\n \n # close off an open instructions div\n if inInstructions\n output += \"</instructions>\\n\"\n end\n \n # Markdown doesn't allow processing of markup within block-level tags such as <div>, so we have to manually process the markup.\n # We call preprocessMarkdownForHTML() to properly process our custom markup within these custom block elements.\n # An extra newline is added to force a paragraph\n while 1\n instructionsMatch = output.match(/(<instructions>)(.*?)(<\\/instructions>)/m)\n if instructionsMatch\n output[instructionsMatch[1]] = \"<div class=\\\"instructions\\\">\"\n output[instructionsMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+instructionsMatch[2]))\n output[instructionsMatch[3]] = \"</div>\"\n else\n break\n end\n end\n \n while 1\n warningMatch = output.match(/(<warning>)\\s*(.*?)(<\\/warning>)/m)\n if warningMatch\n output[warningMatch[1]] = \"<div class=\\\"warning\\\"><div class=\\\"warningBody\\\"><div class=\\\"warningImg\\\"></div><div class=\\\"warningContent\\\">\"\n output[warningMatch[2]] = markdownToHTML(preprocessMarkdownForHTML(\"\\n\"+warningMatch[2]))\n output[warningMatch[3]] = \"</div></div></div>\"\n else\n break\n end\n end\n \n return output\nend",
"def rearrange_docs!; end",
"def rerdoc_task_description\n \"Rebuild RDoc HTML files\"\n end",
"def compile\n table = TOC.new(self).table\n if table == []\n return content || ''\n else\n text = content + \"\\n\\n\" || ''\n table.each do |item |\n section = DocumentRepository.find(item.id)\n if section != nil\n text << section.compile << \"\\n\\n\"\n end\n end\n return text\n end\n end",
"def convert(str, op)\n document = RDoc::Markup::Parser.parse str\n\n document.accept op\n end",
"def document(file_name)\n origin = File.open(\"#{file_name}\",'r')\n docs = File.open(\"docs/doc-#{file_name.split('/')[-1]}.html\",'w')\n comment = true\n script = Script.new(file_name)\n \n # Need to refactor this into some form of a rules engine. It's getting a bit hairy\n str = origin.each_line.inject(\"\") do |str, line|\n # Skip if it's a shebang\n if line =~ /^ *#!/\n str << \"\"\n \n # Blank Comment line, insert newline\n elsif line =~ /^ *# *$/\n comment = true\n str << \"\\n\"\n \n # Evaluate as text if it's a comment with spaces prior\n elsif line =~ /^ *#/\n str << \"\\n\" unless comment \n comment = true\n \n # Find the meta-information in the comments and harvest it\n if line.include? '**Author**'\n script.author = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Description**'\n script.description = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Usage**'\n script.usage = line.gsub(/^.*: /,'').chomp\n elsif line.include? '**Type**'\n script.type = line.gsub(/^.*: /,'').chomp\n end\n \n str << \"#{line.gsub(/^ *# /,'')}\"\n \n # Find the Gems used\n elsif line =~ /^ *require /\n gemname = line.gsub(/^ *require /,'').delete(\"'\").delete('\"').gsub('/','-').chomp\n # Don't add it unless it's not there or it's an absolute path\n unless ($gems.include? gemname) or (gemname =~ /^[A-Za-z]\\:/)\n $gems << gemname\n end\n \n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n # Evaluate as a code block if it's code\n else\n str << \"\\n\" if comment \n comment = false\n str << \" #{line}\"\n end\n end\n \n # Add the current script to the collection for indexing\n $scripts << script\n \n # The following outputs a complete documentation for each and every single script that's in the directory. Very useful if you remember to type them out properly, otherwise you get to spend a few hours fixing it. Do it right the first time, trust me.\n \n # Headers and style information\n docs.puts \"<html>\"\n docs.puts \"<link rel='stylesheet' type='text/css' href='style.css' />\"\n docs.puts \"<body>\"\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n \n # Insert the string into the docs\n docs.puts GitHub::Markdown.render(str)\n \n docs.puts \"<a href='index.html'>( << Back to Index )</a>\"\n docs.puts \"</body></html>\"\nend",
"def fix_docbook_xhtml(xhtml)\r\n sf=File.new(xhtml, 'r')\r\n\t nf=File.new(xhtml+'~', 'w')\r\n\t sf.each_line do |l|\r\n r=l.gsub(/ =\"\"/, ' class=\"\"')\r\n\t\t nf << r\r\n\t end\r\n\t sf.close\r\n\t nf.close\r\n\t cp nf.path, sf.path\r\n\t rm nf.path\r\n end",
"def convert_markdown\n # self.content_html = Kramdown::Document.new(content).to_html\n self.content_html = markdown(content)\n end",
"def html_to_pandoc()\n @exporter.export()\n @result = @exporter.result\n return @result\n end",
"def readme\n txt = File.open(Rails.root.join('README.rdoc'), 'r').read\n @readme = RDoc::Markup::ToHtml.new(RDoc::Options.new).convert(txt)\n end",
"def to_html text\n html = (''.encode text.encoding).dup\n\n encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]\n\n s = StringScanner.new text\n insquotes = false\n indquotes = false\n after_word = nil\n\n until s.eos? do\n case\n when s.scan(/<(tt|code)>.*?<\\/\\1>/) then # skip contents of tt\n html << s.matched.gsub('\\\\\\\\', '\\\\')\n when s.scan(/<(tt|code)>.*?/) then\n warn \"mismatched <#{s[1]}> tag\" # TODO signal file/line\n html << s.matched\n when s.scan(/<[^>]+\\/?s*>/) then # skip HTML tags\n html << s.matched\n when s.scan(/\\\\(\\S)/) then # unhandled suppressed crossref\n html << s[1]\n after_word = nil\n when s.scan(/\\.\\.\\.(\\.?)/) then\n html << s[1] << encoded[:ellipsis]\n after_word = nil\n when s.scan(/\\(c\\)/i) then\n html << encoded[:copyright]\n after_word = nil\n when s.scan(/\\(r\\)/i) then\n html << encoded[:trademark]\n after_word = nil\n when s.scan(/---/) then\n html << encoded[:em_dash]\n after_word = nil\n when s.scan(/--/) then\n html << encoded[:en_dash]\n after_word = nil\n when s.scan(/"|\"/) then\n html << encoded[indquotes ? :close_dquote : :open_dquote]\n indquotes = !indquotes\n after_word = nil\n when s.scan(/``/) then # backtick double quote\n html << encoded[:open_dquote]\n after_word = nil\n when s.scan(/(?:'|'){2}/) then # tick double quote\n html << encoded[:close_dquote]\n after_word = nil\n when s.scan(/`/) then # backtick\n if insquotes or after_word\n html << '`'\n after_word = false\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n when s.scan(/'|'/) then # single quote\n if insquotes\n html << encoded[:close_squote]\n insquotes = false\n elsif after_word\n # Mary's dog, my parents' house: do not start paired quotes\n html << encoded[:close_squote]\n else\n html << encoded[:open_squote]\n insquotes = true\n end\n\n after_word = nil\n else # advance to the next potentially significant character\n match = s.scan(/.+?(?=[<\\\\.(\"'`&-])/) #\"\n\n if match then\n html << match\n after_word = match =~ /\\w$/\n else\n html << s.rest\n break\n end\n end\n end\n\n html\n end",
"def classScalaDoc(docs)\n return <<CLASS_SCALADOC\n/**\n#{ScalaLexer.scalaDocs(docs)}\n */\nCLASS_SCALADOC\n end",
"def convert(content)\n button_parts = content.match('div class=\"content-edit-page\"')\n source_parts = content.match(/<a href=\"([^\"]+)\">\\(source\\)<\\/a>/)\n if button_parts == nil and source_parts != nil\n url = source_parts[1]\n button_start = '<div class=\"content-edit-page\"><a href=\"'\n button_end = '\"><i class=\"fab fa-github\"></i> <span>Edit Page</span></a></div>'\n button_start.concat(url.gsub('blob', 'edit'), button_end, content)\n else\n content\n end\n end",
"def beautify(file)\r\n\r\n @log.debug(\" Cleaning: \\\"#{file}\\\"\")\r\n\r\n docfile = File.new(file)\r\n olddoc = docfile.readlines.join\r\n docfile.close\r\n \r\n # process the file in pandoc\r\n cmd=\"pandoc -s #{file.esc} -f markdown -t markdown --atx-headers --reference-links \"\r\n newdoc = `#{cmd}`\r\n @log.debug(\" finished: \\\"#{file}\\\"\")\r\n \r\n # tweak the quoting\r\n if $?.success? then \r\n # do this twice since the replacement\r\n # does not work on e.g. 2\\_3\\_4\\_5.\r\n #\r\n newdoc.gsub!(/(\\w)\\\\_(\\w)/, '\\1_\\2')\r\n newdoc.gsub!(/(\\w)\\\\_(\\w)/, '\\1_\\2')\r\n \r\n # fix more quoting\r\n newdoc.gsub!('-\\\\>[', '->[')\r\n\r\n # (RS_Mdc)\r\n # TODO: fix Table width toggles sometimes\r\n if (not olddoc == newdoc) then ##only touch the file if it is really changed\r\n File.open(file, \"w\"){|f| f.puts(newdoc)}\r\n File.open(file+\".bak\", \"w\"){|f| f.puts(olddoc)} # (RS_Mdc_) # remove this if needed\r\n @log.debug(\" cleaned: \\\"#{file}\\\"\")\r\n else\r\n @log.debug(\"was clean: \\\"#{file}\\\"\")\r\n end\r\n #TODO: error handling here\r\n else\r\n @log.error(\"error calling pandoc - please watch the screen output\")\r\n end\r\n end",
"def fulldoc_template; end",
"def markup_code\n return '' unless @token_stream\n\n src = RDoc::TokenStream.to_html @token_stream\n\n # dedent the source\n indent = src.length\n lines = src.lines.to_a\n lines.shift if src =~ /\\A.*#\\ *File/i # remove '# File' comment\n lines.each do |line|\n if line =~ /^ *(?=\\S)/\n n = $&.length\n indent = n if n < indent\n break if n == 0\n end\n end\n src.gsub!(/^#{' ' * indent}/, '') if indent > 0\n\n add_line_numbers(src) if options.line_numbers\n\n src\n end",
"def to_roff source=nil\n require 'md2man/roff/engine'\n Md2Man::Roff::ENGINE.render(read(source))\n rescue LoadError\n raise 'Run `gem install md2man` to use BinMan::roff().'\n end",
"def to_doxy_header\n r = @remark.dup\n # Change the remark init for Doxygen\n r[0] = \"/*!\"\n r.insert(1,\"@defgroup #{@filename} #{@style} #{@filename}\")\n if @style == :emboss\n r = removeDoubleAt(r)\n end\n\n buf = r.join(\"\\n\")+\"\\n\"\n buf\n end",
"def convert_markdown\n self.html_content = Raptor::Markdown.render(self.content)\n end",
"def attributes_to_docx; 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 chapter_template(title, content)\n %(<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <!DOCTYPE html>\n\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <title>#{title}</title>\n <link rel=\"stylesheet\" href=\"styles/pygments.css\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"styles/softcover.css\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"styles/epub.css\" type=\"text/css\" />\n <link rel=\"stylesheet\" href=\"styles/custom.css\" type=\"text/css\"/>\n <link rel=\"stylesheet\" href=\"styles/custom_epub.css\" type=\"text/css\"/>\n <link rel=\"stylesheet\" type=\"application/vnd.adobe-page-template+xml\" href=\"styles/page-template.xpgt\" />\n </head>\n\n <body>\n #{content}\n </body>\n </html>)\n end",
"def convert_single_before_context\n include_context 'tmp dirs'\n before(:context) do\n from = yield(Source.new @src)\n @asciidoctor_out = convert_single from, @dest,\n asciidoctor: true\n # Convert a second time with the legacy `AsciiDoc` tool and stick the\n # result into the `asciidoc` directory. We will compare the results of\n # this conversion with the results of the `Asciidoctor` conversion.\n @asciidoc_out = convert_single from, \"#{@dest}/asciidoc\",\n asciidoctor: false\n end\n include_examples 'convert single'\n end",
"def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end",
"def convert_html(html)\n # Sanitize the html and surround in a <span> tag to make it work with htmltolatex better\n html = \"<span>\" + sanitize(html, :tags => %w(em i sup sub)) + \"</span>\"\n\n # Create the temp files and output the html source to the first one\n raw = Tempfile.new('htmltolatex_html')\n output = Tempfile.new('htmltolatex_tex')\n raw << html; raw.flush\n \n # Run htmltolatex on the source\n path = File.join(RAILS_ROOT, \"lib\", \"htmltolatex\")\n `cd #{path} && #{File.join(path, \"htmltolatex\")} -input #{raw.path} -output #{output.path}`\n\n # Read in the results\n converted = File.open(output.path, \"rb\") { |f| f.read }\n \n # Close and unlink the files\n raw.close!\n output.close!\n \n # Return the results\n converted\n end",
"def markup_file_contents(contents); end",
"def docImportHTML\n sourceDir = Pathname.new pathExports\n destDir = Pathname.new pathDocuments\n \n # Process and copy pages to dest dir.\n n = 0\n docPages().each do |page|\n n = n + 1\n \n sourceFile = sourceDir + pageOriginalFile(page) + \"index.html\"\n destPath = destDir + pageTargetFile(page)\n destFile = destPath + \"index.html\"\n \n puts \"Importing File #{n.to_s}: #{sourceFile} #{destFile}\"\n puts \" \"\n \n destPath.mkpath()\n html = File.open(sourceFile, \"rb\") { |f| f.read }\n html = htmlUpdateLinks(html)\n html = htmlStripTOC(html)\n html = htmlReplaceSyntaxHighlighterTags(html)\n html = htmlReplaceTabsWithSpaces(html)\n html = htmlPrettify(html)\n fileSaveContent(destFile, html)\n end\nend",
"def html\n haml_opts = '-f xhtml'\n # process partials\n puts 'Compiling Partials...'\n inc_files = Dir['./haml/_partials/*.haml']\n inc_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.inc')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'Partials compile complete...'\n # process pages\n puts 'Compiling HTML files...'\n haml_files = Dir['./haml/*.haml']\n haml_files.each do |name|\n file_input = name\n file_output = name.sub('.haml','.html').sub('./haml/','../www/')\n haml_call = 'haml '+haml_opts+' '+file_input+' '+file_output\n `#{haml_call}`\n puts ' :: Converting '+name+' => '+file_output\n end\n puts 'HTML compile complete...'\n # regex/cleanup script\n puts 'Calling HAML cleanup script...'\n `./_scripts/hamlcleanup.pl haml/_partials/*.inc`\n `./_scripts/hamlcleanup.pl ../www/*.html`\n # move files as needed\nend",
"def index\n @thuocs = Thuoc.all\n end",
"def children_to_docx; end",
"def yaml(object) \n title = split(object)\n category = split(object, 1)\n ret = ''\n \n ret += '---' + \"\\n\"\n ret += \"layout: styleguide\" + \"\\n\"\n ret += \"title: #{title.capitalize}\" + \"\\n\"\n ret += \"category: #{category}\" + \"\\n\"\n ret += \"scss: _#{title}.scss\" + \"\\n\"\n ret += '---' + \"\\n\"\n \n ret\n end",
"def generate\n po = extract_messages\n pot_path = 'rdoc.pot'\n File.open(pot_path, \"w\") do |pot|\n pot.print(po.to_s)\n end\n end",
"def ConvertA2X\n # a2x options\n if not @FullOpts.nil?\n opts = @FullOpts + \" \"\n else\n opts = self.getOptionsA2X()\n end\n\n opts += @Opts + \" \" if not @Opts.nil?\n\n opts += \"-v \" if $debug2\n \n # Execute pre actions\n self.ExecuteAction(:pre)\n \n cmd = \"a2x -D #{@outdir} #{opts} #{@doc.filename}\"\n puts \"Generating (#{@Type}) #{@outfile}\\n\"\n puts \"Executing : #{cmd}\" if $verbose\n res = %x[#{cmd}]\n puts res if res != \"\"\n \n if $? == 0\n # Execute post actions\n self.ExecuteAction(:post)\n end\n\n end",
"def generate_doc\n\n end",
"def my_aide(_args)\n system(\"less #{__dir__}/../docs/aide\")\n end",
"def base_docstring; end",
"def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end",
"def rdoc_task_description\n 'Build RDoc HTML files'\n end",
"def latex_cabecalho(yaml)\n puts yaml\n string = header(yaml[\"template\"])\n string << packages_basic()\n string << changes(yaml[\"versao\"], Time.now)\n string << titulo(yaml[\"titulo\"])\n string << autor(yaml[\"autor\"])\n string << instituicao(yaml[\"instituicao\"])\n string << tipotrabalho(yaml[\"tipotrabalho\"])\n string << orientador(yaml[\"orientador\"])\n string << coorientador(yaml[\"coorientador\"])\n string << data_atual()\n string << metadatas(yaml[\"palavraschave\"]) \nend",
"def docs_to_write; end",
"def to_docx(tag); end",
"def generate_technique_docs!(atomic_yaml, output_doc_path)\n technique = ATTACK_API.technique_info(atomic_yaml.fetch('attack_technique'))\n technique['identifier'] = atomic_yaml.fetch('attack_technique').upcase\n\n template = ERB.new File.read(\"#{File.dirname(File.dirname(__FILE__))}/atomic-red-team/atomic_doc_template.md.erb\"), nil, \"-\"\n generated_doc = template.result(binding)\n\n print \" => #{output_doc_path} => \"\n File.write output_doc_path, generated_doc\n end",
"def contstruct_readme\n config = template.config\n\n s = []\n s << \"# %s - %s\" % [config[:name], config[:summary]]\n s << \"## SYNOPSIS\"\n s << Array(usage).join(\"\\n\")\n s << \"## DESCRIPTION\"\n s << config[:description]\n s << \"## COPYRIGHT\"\n s << config[:copyright]\n s.join(\"\\n\\n\")\n end",
"def to_s; \"Doc-#{target}\\n#{text}\" end",
"def convert!\n # Fonts and headings\n semanticize_font_styles!\n semanticize_headings!\n\n # Tables\n remove_paragraphs_from_tables!\n semanticize_table_headers!\n\n # list items\n remove_paragraphs_from_list_items!\n remove_unicode_bullets_from_list_items!\n remove_whitespace_from_list_items!\n remove_numbering_from_list_items!\n end",
"def output(input,fromfile=nil)\n @filename=@tmpl_cfg[:filename_tmpl]\n input=CqlsDoc.input_from_file(@filename=input) if fromfile\n ## fetch the contents of all saved variables! This fasten the compilation!\n Utils.saved_content_fetch_variables_from_file(@filename,self)\n\n#p @filename\n init_path(input)\n init_tags(input)\n init_keys\n init_model(input)\n#p input\n ## add the tag document in order to replace the user tag preamble and etc. Introduction of styles because of the odt format and the new convention in general to use styles even in latex. \n #txt=\"{#document][#content]\"+input+\"[#}\"\n txt=input\n#p txt\n prepare_user_input\n ## parse the content txt\n out=prepare_output(txt)\n prepare_last_output(out)\n clean_as_is(out)\n return out\n end",
"def generate_doc(resource_docs)\n generate_index_templates(resource_docs)\n copy_assets!\n end",
"def tralics_commands\n base_commands = <<-'EOS'\n% Commands specific to Tralics\n\\def\\hyperref[#1]#2{\\xmlelt{a}{\\XMLaddatt{target}{#1}#2}}\n\\newcommand{\\heading}[1]{\\xmlelt{heading}{#1}}\n\\newcommand{\\codecaption}[1]{\\xmlelt{heading}{#1}}\n\\newcommand{\\sout}[1]{\\xmlelt{sout}{#1}}\n\\newcommand{\\kode}[1]{\\xmlelt{kode}{#1}}\n\\newcommand{\\coloredtext}[2]{\\xmlelt{coloredtext}{\\AddAttToCurrent{color}{#1}#2}}\n\\newcommand{\\coloredtexthtml}[2]{\\xmlelt{coloredtexthtml}{\\AddAttToCurrent{color}{#1}#2}}\n\\newcommand{\\filepath}[1]{\\xmlelt{filepath}{#1}}\n\\newcommand{\\image}[1]{\\xmlelt{image}{#1}}\n\\newcommand{\\imagebox}[1]{\\xmlelt{imagebox}{#1}}\n% Ignore pbox argument, just replacing with content.\n\\newcommand{\\pbox}[2]{#2}\n% Ignore some other commands.\n\\newcommand{\\includepdf}[1]{}\n\\newcommand{\\newunicodechar}[2]{}\n\\newcommand{\\extrafloats}[1]{}\n EOS\n custom_commands = <<-EOS\n\\\\usepackage{amsthm}\n\\\\theoremstyle{definition}\n\\\\newtheorem{codelisting}{#{language_labels[\"listing\"]}}[chapter]\n\\\\newtheorem{aside}{#{language_labels[\"aside\"]}}[chapter]\n EOS\n [base_commands, custom_commands].join(\"\\n\")\n end",
"def generate_javadoc\n classpath = \"tools/jambidoc\"\n system \"javadoc -classpath #{classpath} -doclet jambidoc.JambiDoclet \" + \n \"-header \\\"#{@header}\\\" -J-Xmx500m -sourcepath #{@BASE_PATH} com.trolltech.qt com.trolltech.qt.core \" + \n \"com.trolltech.qt.gui com.trolltech.qt.opengl com.trolltech.qt.sql com.trolltech.qt.opengl \"+\n \"com.trolltech.qt.svg com.trolltech.qt.network com.trolltech.qt.xml \" +\n \"com.trolltech.qt.designer com.trolltech.qt.webkit com.trolltech.qt.phonon\"\n if $?.exitstatus != 0\n puts \"Failed to run javadoc\"\n exit 1\n end\n\n system 'find . -name \"qt jambi.dcf\" -exec rm {} \\;'\n system 'find . -name \"qt jambi.index\" -exec rm {} \\;'\n system 'find . -name \"*.jdoc\" -exec rm {} \\;'\n\n system \"jar -cf #{@OUTPUT_DIRECTORY}/qtjambi-javadoc-#{@qtjambi_version}.jar doc/html/*\"\n if $?.exitstatus != 0\n puts \"Failed to run jar -cf doc/*\"\n exit 1\n end\n\n #FileUtils.cp \"doc/html/qtjambi-javadoc-$QTJAMBI_VERSION.jar\", @OUTPUT_DIRECTORY\n end",
"def convert_to_latex(node)\n latex_code = nil\n Open3.popen3(\"pandoc -f json -t latex --wrap=none\") {|stdin, stdout, stderr, wait_thr|\n stdin.write(node.to_json)\n stdin.close # stdin, stdout and stderr should be closed explicitly in this form.\n latex_code = stdout.read\n\n pid = wait_thr.pid # pid of the started process.\n exit_status = wait_thr.value # Process::Status object returned.\n }\n latex_code\n end",
"def doclocation\n File.expand_path(\"../../uploaddoc/\", __FILE__)\nend"
] | [
"0.75268734",
"0.65174544",
"0.6423313",
"0.64173126",
"0.6245098",
"0.62437594",
"0.61786664",
"0.6177511",
"0.6145682",
"0.6139285",
"0.61370325",
"0.61037457",
"0.6053269",
"0.60519683",
"0.6040036",
"0.6006332",
"0.60004133",
"0.59812474",
"0.597234",
"0.5968544",
"0.5938466",
"0.5913285",
"0.5911756",
"0.5899664",
"0.5877626",
"0.5871213",
"0.5871213",
"0.5854311",
"0.5843516",
"0.5835158",
"0.5819244",
"0.5812341",
"0.57939565",
"0.57839024",
"0.5770421",
"0.57542694",
"0.57332623",
"0.5720152",
"0.5715607",
"0.5666317",
"0.56633496",
"0.5662887",
"0.56628335",
"0.56392753",
"0.56381845",
"0.562452",
"0.5618405",
"0.56127864",
"0.55701184",
"0.55672634",
"0.55599767",
"0.5545624",
"0.55377305",
"0.5532404",
"0.5526291",
"0.5525324",
"0.5511142",
"0.5511088",
"0.55088025",
"0.54996264",
"0.5497538",
"0.5497376",
"0.54739136",
"0.5473777",
"0.5467604",
"0.5466837",
"0.54559356",
"0.54462844",
"0.5445434",
"0.544532",
"0.5443531",
"0.5438799",
"0.54280424",
"0.5424931",
"0.54248905",
"0.5419223",
"0.54175466",
"0.541694",
"0.54153687",
"0.53978497",
"0.53939337",
"0.53927064",
"0.53835696",
"0.5381105",
"0.5379989",
"0.53795016",
"0.5372426",
"0.53687435",
"0.53670925",
"0.5365181",
"0.5359777",
"0.5349859",
"0.5343725",
"0.5343523",
"0.5342803",
"0.5331707",
"0.5329642",
"0.53287345",
"0.532045",
"0.5316335"
] | 0.81373525 | 0 |
Read optional file parameters | def ReadConfig()
# Deep copy
puts "Reading global config file #{$conf[:globalConfFile]}" if $verbose
conf = Marshal.load( Marshal.dump($conf) )
if @ConfFile.nil?
return conf
end
optfile = @ConfFile
optfile = optfile.gsub(/%f/, @doc.filename)
optfile = optfile.gsub(/%F/, @doc.file)
optfile = optfile.gsub(/%D/, @doc.dir)
optfile = optfile.gsub(/%E/, @doc.extname)
optfile = optfile.gsub(/%R/, @doc.dir + "/" + @doc.file.gsub(@doc.extname, ""))
optfile = optfile.gsub(/%r/, @doc.file.gsub(@doc.extname, ""))
optfile = optfile.gsub(/%t/, @Type)
optfile = optfile.gsub(/%B/, $basedir)
optfile = optfile.gsub(/%b/, $confdir)
conf["conffile"] = optfile
conf["filename"] = @doc.filename
conf["dir"] = @doc.dir
if File.exists?(optfile)
begin
puts "Reading specific config file #{optfile}" if $verbose
c = YAML.load_file(optfile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if c[s].class == Array
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
else
conf[s] = c[s]
end
}
rescue
puts "Error loading #{optfile}"
end
else
puts "Skip loading unknown specific config file #{optfile}" if $verbose
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
conf[k][i].gsub!(/%D/, @doc.dir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
conf[k].gsub!(/%D/, @doc.dir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def merged_file_read_opts(site, opts); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:name].nil? ||\n config[:vios].nil? ||\n config[:virtual_server].nil? ||\n config[:disk_name].nil?\n show_usage\n exit 1\n end\n\n if config[:profile].nil?\n config[:profile] = config[:name]\n end\n end",
"def readParams(fname)\n begin\n f = File.open(fname)\n rescue Exception => e\n puts e\n $stdout.flush\n exit(1)\n end\n\n section = nil\n f.each_line{|line|\n\n line.chomp!\n line.strip!\n if line == \"\" || line =~ /^%/\n # skip blank lines & lines beginning with %\n\n elsif line == $headerPorts || line == $headerShips ||\n line == $headerTraveler || line == $headerOutput\n section = line\n\n elsif section == $headerPorts\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starport.push(Starport.new(name,size))\n \n elsif section == $headerShips\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starship.push(Starship.new(name,size))\n\n elsif section == $headerTraveler\n parts = line.split(' ')\n name = parts.shift\n itinerary = []\n parts.each { |p| itinerary.push(find_name($starport,p)) }\n person = Traveler.new(name,itinerary)\n $traveler.push(person)\n find_name($starport,parts.first).arrive(person)\n\n elsif section == $headerOutput\n $simOut.push(line)\n\n else\n puts \"ERROR: simFile format error at #{line}\"\n $stdout.flush\n exit(1)\n end\n }\nend",
"def read_parameter\n @parameters = []\n ARGV.each { |option| parameters.push(option) }\n raise Exceptions::InvalidParameters if parameters.length > 1\n raise Exceptions::EmptyParameters if parameters.length.zero?\n end",
"def parse_file_argument(key)\n if @opts[key].nil? and [email protected]\n @opts[key] = do_file_read(f)\n end\n end",
"def read_options_from_file\n Shellwords.shellwords File.read(\".rspec_n\").to_s.gsub(/\\n|\\r\\n/, \" \")\n end",
"def read_defaults(fname, o)\n if File.exist?(fname)\n IO.foreach(fname) do |line|\n next if line.match(/^\\s*#/) || line.match(/^\\s*$/)\n if /(?<key>\\S+)\\s*=\\s*(?<val>\\S+)/ =~ line\n o[key.to_sym] = val\n end\n end\n else\n STDERR.puts \"Warning: System defaults file '#{fname}' does not exist\"\n end\nend",
"def read_params(params)\n cg_reader.read_params(params)\n end",
"def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"def file_options; end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def readConfigFile(filename)\n f = File.open(filename, \"r\")\n f.each_line do |line|\n line = line.strip().split(\"=\")\n option = line[0].upcase\n value = Integer(line[1])\n if option == \"UPDATEINTERVAL\"\n $update_interval = value\n elsif option == \"MAXPAYLOAD\"\n $mtu = value\n elsif option == \"PINGTIMEOUT\"\n $ping_timeout = value\n end\n end\n f.close()\nend",
"def readFlags\n @opt_parser.parse!\n\n Aerospike.logger.level = Logger::ERROR\n if @options[:debug_mode]\n Aerospike.logger.level = Logger::INFO\n end\n\n @binDataType, binDataSz = parseValuedParam(@options[:bin_def])\n if binDataSz\n @binDataSize = @options[:binDataSz]\n else\n case @binDataType\n when 'B'\n @binDataSize = 200\n when 'S'\n @binDataSize = 50\n end\n end\n\n @workloadType, workloadPct = parseValuedParam(@options[:workload_def])\n if workloadPct\n @workloadPercent = workloadPct.to_i\n else\n case @workloadType\n when 'I'\n @workloadPercent = 100\n when 'RU'\n @workloadPercent = 50\n end\n end\nend",
"def file_params\n [:path, :tag_list, :attachment, :downloadable].inject({}) do |hash, key|\n hash[key] = params[key] unless params[key].nil?\n hash\n end\n end",
"def read_config_file(file); end",
"def load_file_params\n @filename, @params = URIUtils.parse_asset_uri(uri)\n end",
"def read_config_file; end",
"def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend",
"def add_std_file_opt(inkey)\n @oparse.on(\"-f\", \"--file FILENAME\", \"Input from FILENAME\") do |f|\n @opts[inkey] = do_file_read(f)\n end\n return @oparse\n end",
"def read_configurations(file_name = T.unsafe(nil)); end",
"def import_params\n params.require(:file)\n end",
"def parameters_source\n @parameters_source ||= @options[:parameters_content] || read_file(parameter_file)\n end",
"def read_input_params options_cli={}\n #utility sub\n def find_first_yaml_file(dir_to_process)\n Dir.chdir(dir_to_process)\n yaml_file = nil\n Dir.glob(\"*.{yaml,yml}\") do |file|\n yaml_file = file\n break\n end \n return yaml_file\n end\n\n # read input args\n dir_to_process = Dir.pwd\n fail(\"#{dir_to_process} does not exist\") unless File.exist?(dir_to_process) \n fail(\"#{dir_to_process} is not a Directory\") unless File.directory?(dir_to_process)\n $log.info \"Dir to be processed: #{dir_to_process}\"\n \n yaml_name = options_cli['--event']||find_first_yaml_file(dir_to_process)\n fail(\"- no YAML File found;\") if yaml_name.nil? \n fail(\"- no YAML File found;\") unless File.file?(yaml_name)\n $log.info \"YAML Profile to be processed: #{yaml_name}\"\n return [dir_to_process, yaml_name]\nend",
"def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend",
"def read_options\n if ( request.format.csv? )\n @is_task_type = params[ :user_report ].nil?\n type = @is_task_type ? 'task' : 'user'\n @exclude_title = ! ( params[ \"include_title_#{ type }\" ] == '1' )\n end\n end",
"def read_parameters\n params = read_stdin\n return_error(\"Parameter 'target' contains illegal characters\") unless safe_string?(params['target'])\n params\nend",
"def read(*args, **kwd); end",
"def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend",
"def yardopts(file = T.unsafe(nil)); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end",
"def read_as_params\n reader ? {full_name => read} : {}\n end",
"def read_file_params\n params.require(:read_file).permit(:fecha, :referencia, :descripcion, :monto, :saldo)\n end",
"def read_options(files)\n ret = {}\n files.each do |file|\n data = read_file(file)\n next if data.nil? || data.empty?\n ret = merge_hashes(ret, data)\n end\n ret\n end",
"def load_params(args)\n return args['playbook_name'],\n args['role_name'],\n args['vars'] || {},\n args['tags'],\n args['user_id']\n end",
"def optional_file(val)\n path = val\n io = val if String === val\n if Hash === val\n raise 'argument to optional_file should be length 1' if val.size != 1\n path = val.first[0]\n io = val.first[1]\n end\n @book.add_optional_file(path, io)\n end",
"def initialize file\n @file = file\n @properties = {}\n# IO.foreach(file) do |line|\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# end\nFile.open(file, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n @properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n @properties[line] = ''\n end\n end\n end\n end\nend",
"def optional_config_file\n if ::File.exists?(@options.to_s)\n @options = @global.load_ruby_config(::File.expand_path(@options))\n end\n end",
"def github_params\n if File.exist?(GITHUB_INFO_PATH)\n read_github_info\n else\n retrieve_options_from_user\n end\n end",
"def read_opts(file_path=nil)\n begin\n default_opts.merge!(\n deep_symbolize(YAML.load_file(file_path || config_file_path))[environment.to_sym])\n rescue Errno::ENOENT => e\n p \"[warning] config file not read, using default options\"\n default_opts\n end\n end",
"def read(*args)\n file.try(:read, *args)\n end",
"def read(opts = T.unsafe(nil)); end",
"def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end",
"def load_input_params(in_file)\n params = YAML::load(File.open(in_file))\n load_helper(params[\"SS_script_support_path\"])\n @params = strip_private_flag(params)\n #BJB 11-10-14 Intercept to load framework\n initialize_framework\n @params\n end",
"def get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend",
"def read_config_files(files); end",
"def parameter_file\n filename_path(:parameter_dir, filename)\n end",
"def loadKnownParams(filename)\n\t\t\t@knownParams = {}\n\t\t\tif (!File.exist? filename )\n\t\t\t\tlogger(-1, \"Error, Known Params File does not exist: #{filename}\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlogger(1, \"Parsing Known Params File: #{filename}\")\n\t\t\tkpf = File.open( filename )\n\t\t\tkpf.each_line do |line|\n\t\t\t\tentry = line.chomp.split(',')\n\t\t\t\tobject = entry.shift\n\t\t\t\tif @knownParams.has_key?(object)\n\t\t\t\t\t@knownParams[object][entry.shift] = entry\n\t\t\t\telse\n\t\t\t\t\t@knownParams[object] = { entry.shift => entry } \n\t\t\t\tend\n\t\t\tend\t\t\n\t\t\tkpf.close\n\t\tend",
"def dir_get_args(dir)\n get_args(dir) { |filename| read_nil(filename) }\nend",
"def read_settings\n if test( ?s, RC_FILE )\n lines = File.read( RC_FILE ).split( /\\r\\n?|\\n/ )\n lines.each do |l|\n l = l.sub( /#.*$/, '' ) # remove trailing comments\n if l =~ /^\\s*(\\S+)\\s*=\\s*(\\S(.*\\S)?)\\s*$/\n key, val = $1, $2\n $rc_settings[ key ] = val \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n elsif l =~ /^\\s*(\\S+)\\s*=\\s*$/\n key, val = $1, ''\n $rc_settings[ key ] = '' \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n end # if l =~\n end # do |l|\n end # if ?s\n end",
"def read_prop_file(prop_file)\n props = {}\n File.open(prop_file, 'r') do |f|\n f.each_line do |line|\n props[$1] = $2 if line =~ /^export (.*)=(.*)$/\n end\n end if File.exists?(prop_file)\n props\nend",
"def load_ini\n last_file = nil\n last_speed = nil\n last_position = nil\n last_speeds = nil\n if File.exists? @ini_file\n File.open(@ini_file, \"r\") do |f|\n f.each do |line|\n last_file = line.sub(\"last_file=\", \"\").strip if line =~ /^last_file=/\n last_speed = line.sub(\"last_speed=\", \"\").strip.to_f if line =~ /^last_speed=/\n last_position = line.sub(\"last_position=\", \"\").strip.to_i if line =~ /^last_position=/\n if line =~ /^speeds=/\n last_speeds = line.sub(\"speeds=\", \"\").strip.split(\",\")\n last_speeds.map!{|s| s.to_f}\n end\n if line =~ /^partial_repeat=/\n @partial_repeat = line.sub(\"partial_repeat=\", \"\").strip\n if @partial_repeat == 'true'\n @partial_repeat = true\n else\n @partial_repeat = false\n end\n end\n @partial_duration = line.sub(\"partial_duration=\", \"\").strip.to_i if line =~ /^partial_duration=/\n end\n end\n end\n return last_file, last_speed, last_position, last_speeds\nend",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_quantity = info[0].chop\n @last_category = info[1].chop.to_i\n @exercises = info[2].chop.split(\",\")\n @last_repq = info[3].chop\n @rep_ex = info[4].chop\n end",
"def read(*rest) end",
"def read(*rest) end",
"def yardopts(file = options_file)\n return [] unless use_yardopts_file\n File.read_binary(file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def try_file(opt=\"\")\n File.read(File.expand_path(opt)) rescue opt\n end",
"def initialize(filename, read_properties=true)\n end",
"def initialize(filename, read_properties=true)\n end",
"def get_required_params(key)\n get_option(key, :required_params)\n end",
"def parse(filenames)\r\n properties = {}\r\n filenames.each do |filename|\r\n if (File.exists?(filename))\r\n file = File.open(filename, \"r\")\r\n file.read.each_line do |line|\r\n line.strip!\r\n if (line[0] != ?# and line[0] != ?=)\r\n i = line.index(\"=\")\r\n if (i)\r\n key = line[0..i - 1].strip\r\n value = line[i + 1..-1].strip\r\n properties[key] = value.strip\r\n else\r\n key = line\r\n value = \"\"\r\n properties[key] = value\r\n end\r\n end\r\n end\r\n file.close\r\n file = nil\r\n end\r\n end\r\n properties\r\nend",
"def base_validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n validate_parameters\n nil\n end",
"def read_config(config_path = T.unsafe(nil)); end",
"def PARAMETER_LIST()\r\n\"\r\n_VT01.txt:5du-4du+-3du+,1p,2m 8 6 12 0 64 2 24\r\n_VT02.txt:5m-2p,4d-3me,1p\r\n_VT03.txt:2me,3m,4m 8 6 12 0 64 2 24\r\n_VT04.txt:2m,7d-2me,3pw 8 6 12 0 64 2 24\r\n_VT05.txt:2me,3m-7m-6p+,4m-5m+ 8 6 12 0 64 2 24\r\n_VT06.txt:2me[2f]-6p[3]+,3m[1e]-7m[6d]-6p[3]+-2mew+,4m[3c]-5m[2b]+-2me+ 8 6 12 0 64 2 24\r\n_VT07.txt:1d-2me-3p,4m[uf]-5m[2]+,5m[6]-6me[2]+-3p[3]+-2mew+ 8 6 12 0 64 2 6\r\n_VT08.txt:9d-10d-11d-12d, 4p-5m-7m, 6m-8m | 1me, 2me, 3p\r\n\"\r\nend",
"def read_file(filename); end",
"def sysread(*rest) end",
"def sysread(*rest) end",
"def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end",
"def opts\n load_defaults unless @opts\n @opts\n end",
"def file_format_params\n params.require(:file_format).permit(:title, :notes)\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def load_params args\n\tparams = {}\n\targs.each_slice(2) do | key_value |\n\t\t# puts \"o #{key_value}\"\n\t\tparams[key_value[0][1..-1]] = key_value[1]\n\tend\n\tparams\nend",
"def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end",
"def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end",
"def read(*args)\n IO.read(@path, *args)\n end",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_learnq = info[0].to_i\n @last_repq = info[1].to_i\n @last_exerq = info[2].to_i\n @last_category = info[3].to_i\n @exercises = info[4].split(\",\").collect! {|v| v.to_i}\n @rep_ex = info[4].to_i\n end",
"def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end",
"def process_stack_parameters_file(filename)\n content = File.read(filename)\n return CloudFormation.parse_json_params(JSON.parse(content))\n end",
"def read_param(key)\n return nil unless value = params[key] || params[SHORT_NAMES[key]]\n value.strip!\n\n value.empty? ? nil : value\n end",
"def require_data(*file); end",
"def require_data(*file); end",
"def read_file(subpath = nil)\n result = {}\n path = full_path(@file_name_prefix, subpath)\n contents = File.file?(path) ? File.read(path) : ''\n contents.each_line do |line|\n match = line.chomp.match(/^(.+)=(.*)$/)\n result[match[1]] = match[2]\n end\n result\n end",
"def file_record_params\n params.fetch(:file_record, {})\n end",
"def get_flags(*files)\n matches = []\n begin\n files.each do |f|\n file = File.new(f, 'r')\n while (line = file.gets)\n m = line.match(/(^.*=)?/)\n matches << m[0] if m\n end\n file.close\n end\n rescue => err\n puts 'Exception: #{err}'\n err\n end\n matches.uniq.sort!\nend",
"def method_missing(m, *a, &b)\n read_settings(m.to_s)\n end",
"def read_file(file, context); end",
"def initialize(defaults,cmd_opts)\n @fields = defaults\n if !cmd_opts[:config_file].nil?\n path = cmd_opts[:config_file]\n else\n path = defaults[:config_file]\n end\n data = YAML.load_file(path)\n # Now combine data:\n # defaults, config file, command line (low->high priority)\n data.each do |k,v|\n if EXPECTED.include? k.to_sym\n @fields[k.to_sym] = v\n else\n STDERR.puts \"Warning: unknown section '#{k}' in config file\"\n end\n end\n cmd_opts.each do |k,v|\n @fields[k] = v\n end\n end",
"def parse_init_file(path)\n return [] unless ::File.exist?(path)\n\n in_info = false\n ::File.readlines(path).each_with_object([]) do |line, acc|\n if /^### BEGIN INIT INFO/.match?(line)\n in_info = true\n elsif /^### END INIT INFO/.match?(line)\n break acc\n elsif in_info\n if line =~ /Default-(Start|Stop):\\s+(\\d.*)/\n acc << $2.split(\" \")\n end\n end\n end.flatten\n end",
"def load_specification(file_name); end",
"def validate_opts\n validate_opts_file if options[:file]\n end",
"def build_args\n if File.exist? build_info_file\n build_info = File.readlines build_info_file\n build_info = build_info.map {|x| x.strip }\n build_info.delete \"\"\n build_info\n else\n []\n end\n end",
"def getParameters\n params = Hash.new\n\n # Define the supported options\n opts = GetoptLong.new(\n [ '-?', GetoptLong::NO_ARGUMENT ],\n [ '-d', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-h', GetoptLong::NO_ARGUMENT ],\n [ '-m', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-s', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-w', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-p', GetoptLong::REQUIRED_ARGUMENT ]\n )\n \n opts.each do |opt, arg|\n case opt\n when '-?'\n when '-h'\n raise\n when '-d'\n params['imageDirectory'] = arg\n when '-m'\n params['mapID'] = arg\n when '-s'\n params['metadataServerURL'] = arg\n when '-w'\n params['sleepDelay'] = arg\n when '-p'\n params['publishServerURL'] = arg\n end\n end\n \n params\n end",
"def read_file_level_settings\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_settings\n end"
] | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.5897326",
"0.58809644",
"0.58373344",
"0.58351016",
"0.5823861",
"0.57497233",
"0.57461405",
"0.5732525",
"0.57317245",
"0.57132757",
"0.5711",
"0.57086474",
"0.56513244",
"0.56203175",
"0.5594072",
"0.5592697",
"0.55752224",
"0.5517684",
"0.55149746",
"0.5496722",
"0.5495175",
"0.5486224",
"0.545998",
"0.54579645",
"0.5452573",
"0.54284143",
"0.5420056",
"0.5407102",
"0.5398042",
"0.5393706",
"0.5389009",
"0.5348413",
"0.53469765",
"0.5344859",
"0.5308994",
"0.53008205",
"0.52814114",
"0.5275601",
"0.5264888",
"0.52572304",
"0.5239648",
"0.5239648",
"0.5239558",
"0.52368546",
"0.5235852",
"0.52244216",
"0.52244216",
"0.5215373",
"0.5214081",
"0.5204531",
"0.52014554",
"0.51995486",
"0.5191211",
"0.51858777",
"0.51858777",
"0.51738644",
"0.5171061",
"0.5148052",
"0.5142491",
"0.5131674",
"0.5131047",
"0.513013",
"0.5128088",
"0.51253176",
"0.5125058",
"0.5122155",
"0.511778",
"0.5117451",
"0.5117451",
"0.5107368",
"0.5104604",
"0.5104577",
"0.50999326",
"0.5098876",
"0.50908405",
"0.50881994",
"0.50791806",
"0.50775564",
"0.50739384",
"0.5063782",
"0.5058908"
] | 0.0 | -1 |
Read optional file parameters | def ReadGlobalConfig()
# Load config file
begin
conf = YAML.load_file("#{$confdir}/#{$globalConfFile}")
rescue
puts "Unable to locate #{$confdir}/#{$globalConfFile}"
conf = {}
end
Dir.glob("#{$confdir}/#{$globalConfDir}/*.yaml") {|f|
begin
conf.merge!(YAML.load_file(f))
rescue
puts "Unable to locate #{f}"
conf = {}
end
}
$sections.each {|o|
conf[o] = [] if conf[o].nil?
}
conf[:globalConfFile] = "#{$confdir}/#{$globalConfFile}"
conf[:globalConfDir] = "#{$confdir}/#{$globalConfDir}"
altConfFile = "#{$curdir}/.rake/#{$globalConfFile}"
if File.exists?(altConfFile)
begin
puts "Reading local config file #{altConfFile}" if $verbose
c = YAML.load_file(altConfFile)
raise "Invalid yaml file" if not c
# surcharge d'options
$sections.each {|s|
next if c[s].nil?
if $sections_uniq.include?(s)
# remove then add option
c[s].each {|o|
o2 = o.gsub(/=.*/, "=")
conf[s].delete_if {|o3| o3.start_with?(o2)}
conf[s].push o
}
else
c[s].each {|o|
if o[0] == "!"
# delete option
conf[s].delete o[1..-1]
else
# just add option
conf[s].push o
end
}
end
}
rescue
puts "Error loading #{altConfFile}"
end
end
conf.each {|k,v|
if v.class == Array
conf[k].each_index {|i|
conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String
conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String
}
else
conf[k].gsub!(/%B/, $basedir) if conf[k].class == String
conf[k].gsub!(/%b/, $confdir) if conf[k].class == String
end
}
return conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_read_opts=(_arg0); end",
"def file_read_opts(context); end",
"def file_read_opts; end",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def get_launch_params(launch_params_file)\n IO.readlines launch_params_file\nend",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def file_read_opts(context)\n context.registers[:site].file_read_opts\n end",
"def merged_file_read_opts(site, opts); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:name].nil? ||\n config[:vios].nil? ||\n config[:virtual_server].nil? ||\n config[:disk_name].nil?\n show_usage\n exit 1\n end\n\n if config[:profile].nil?\n config[:profile] = config[:name]\n end\n end",
"def readParams(fname)\n begin\n f = File.open(fname)\n rescue Exception => e\n puts e\n $stdout.flush\n exit(1)\n end\n\n section = nil\n f.each_line{|line|\n\n line.chomp!\n line.strip!\n if line == \"\" || line =~ /^%/\n # skip blank lines & lines beginning with %\n\n elsif line == $headerPorts || line == $headerShips ||\n line == $headerTraveler || line == $headerOutput\n section = line\n\n elsif section == $headerPorts\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starport.push(Starport.new(name,size))\n \n elsif section == $headerShips\n parts = line.split(' ')\n name = parts[0]\n size = parts[1].to_i\n $starship.push(Starship.new(name,size))\n\n elsif section == $headerTraveler\n parts = line.split(' ')\n name = parts.shift\n itinerary = []\n parts.each { |p| itinerary.push(find_name($starport,p)) }\n person = Traveler.new(name,itinerary)\n $traveler.push(person)\n find_name($starport,parts.first).arrive(person)\n\n elsif section == $headerOutput\n $simOut.push(line)\n\n else\n puts \"ERROR: simFile format error at #{line}\"\n $stdout.flush\n exit(1)\n end\n }\nend",
"def read_parameter\n @parameters = []\n ARGV.each { |option| parameters.push(option) }\n raise Exceptions::InvalidParameters if parameters.length > 1\n raise Exceptions::EmptyParameters if parameters.length.zero?\n end",
"def parse_file_argument(key)\n if @opts[key].nil? and [email protected]\n @opts[key] = do_file_read(f)\n end\n end",
"def read_options_from_file\n Shellwords.shellwords File.read(\".rspec_n\").to_s.gsub(/\\n|\\r\\n/, \" \")\n end",
"def read_defaults(fname, o)\n if File.exist?(fname)\n IO.foreach(fname) do |line|\n next if line.match(/^\\s*#/) || line.match(/^\\s*$/)\n if /(?<key>\\S+)\\s*=\\s*(?<val>\\S+)/ =~ line\n o[key.to_sym] = val\n end\n end\n else\n STDERR.puts \"Warning: System defaults file '#{fname}' does not exist\"\n end\nend",
"def read_params(params)\n cg_reader.read_params(params)\n end",
"def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"def file_options; end",
"def yardopts\n IO.read(options_file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def readConfigFile(filename)\n f = File.open(filename, \"r\")\n f.each_line do |line|\n line = line.strip().split(\"=\")\n option = line[0].upcase\n value = Integer(line[1])\n if option == \"UPDATEINTERVAL\"\n $update_interval = value\n elsif option == \"MAXPAYLOAD\"\n $mtu = value\n elsif option == \"PINGTIMEOUT\"\n $ping_timeout = value\n end\n end\n f.close()\nend",
"def readFlags\n @opt_parser.parse!\n\n Aerospike.logger.level = Logger::ERROR\n if @options[:debug_mode]\n Aerospike.logger.level = Logger::INFO\n end\n\n @binDataType, binDataSz = parseValuedParam(@options[:bin_def])\n if binDataSz\n @binDataSize = @options[:binDataSz]\n else\n case @binDataType\n when 'B'\n @binDataSize = 200\n when 'S'\n @binDataSize = 50\n end\n end\n\n @workloadType, workloadPct = parseValuedParam(@options[:workload_def])\n if workloadPct\n @workloadPercent = workloadPct.to_i\n else\n case @workloadType\n when 'I'\n @workloadPercent = 100\n when 'RU'\n @workloadPercent = 50\n end\n end\nend",
"def file_params\n [:path, :tag_list, :attachment, :downloadable].inject({}) do |hash, key|\n hash[key] = params[key] unless params[key].nil?\n hash\n end\n end",
"def read_config_file(file); end",
"def load_file_params\n @filename, @params = URIUtils.parse_asset_uri(uri)\n end",
"def read_config_file; end",
"def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend",
"def add_std_file_opt(inkey)\n @oparse.on(\"-f\", \"--file FILENAME\", \"Input from FILENAME\") do |f|\n @opts[inkey] = do_file_read(f)\n end\n return @oparse\n end",
"def read_configurations(file_name = T.unsafe(nil)); end",
"def import_params\n params.require(:file)\n end",
"def parameters_source\n @parameters_source ||= @options[:parameters_content] || read_file(parameter_file)\n end",
"def read_input_params options_cli={}\n #utility sub\n def find_first_yaml_file(dir_to_process)\n Dir.chdir(dir_to_process)\n yaml_file = nil\n Dir.glob(\"*.{yaml,yml}\") do |file|\n yaml_file = file\n break\n end \n return yaml_file\n end\n\n # read input args\n dir_to_process = Dir.pwd\n fail(\"#{dir_to_process} does not exist\") unless File.exist?(dir_to_process) \n fail(\"#{dir_to_process} is not a Directory\") unless File.directory?(dir_to_process)\n $log.info \"Dir to be processed: #{dir_to_process}\"\n \n yaml_name = options_cli['--event']||find_first_yaml_file(dir_to_process)\n fail(\"- no YAML File found;\") if yaml_name.nil? \n fail(\"- no YAML File found;\") unless File.file?(yaml_name)\n $log.info \"YAML Profile to be processed: #{yaml_name}\"\n return [dir_to_process, yaml_name]\nend",
"def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend",
"def read_options\n if ( request.format.csv? )\n @is_task_type = params[ :user_report ].nil?\n type = @is_task_type ? 'task' : 'user'\n @exclude_title = ! ( params[ \"include_title_#{ type }\" ] == '1' )\n end\n end",
"def read_parameters\n params = read_stdin\n return_error(\"Parameter 'target' contains illegal characters\") unless safe_string?(params['target'])\n params\nend",
"def read(*args, **kwd); end",
"def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend",
"def yardopts(file = T.unsafe(nil)); end",
"def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end",
"def read_as_params\n reader ? {full_name => read} : {}\n end",
"def read_file_params\n params.require(:read_file).permit(:fecha, :referencia, :descripcion, :monto, :saldo)\n end",
"def read_options(files)\n ret = {}\n files.each do |file|\n data = read_file(file)\n next if data.nil? || data.empty?\n ret = merge_hashes(ret, data)\n end\n ret\n end",
"def load_params(args)\n return args['playbook_name'],\n args['role_name'],\n args['vars'] || {},\n args['tags'],\n args['user_id']\n end",
"def optional_file(val)\n path = val\n io = val if String === val\n if Hash === val\n raise 'argument to optional_file should be length 1' if val.size != 1\n path = val.first[0]\n io = val.first[1]\n end\n @book.add_optional_file(path, io)\n end",
"def initialize file\n @file = file\n @properties = {}\n# IO.foreach(file) do |line|\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n# end\nFile.open(file, 'r') do |properties_file|\n properties_file.read.each_line do |line|\n line.strip!\n if (line[0] != ?# and line[0] != ?=)\n i = line.index('=')\n if (i)\n @properties[line[0..i - 1].strip] = line[i + 1..-1].strip\n else\n @properties[line] = ''\n end\n end\n end\n end\nend",
"def optional_config_file\n if ::File.exists?(@options.to_s)\n @options = @global.load_ruby_config(::File.expand_path(@options))\n end\n end",
"def github_params\n if File.exist?(GITHUB_INFO_PATH)\n read_github_info\n else\n retrieve_options_from_user\n end\n end",
"def read_opts(file_path=nil)\n begin\n default_opts.merge!(\n deep_symbolize(YAML.load_file(file_path || config_file_path))[environment.to_sym])\n rescue Errno::ENOENT => e\n p \"[warning] config file not read, using default options\"\n default_opts\n end\n end",
"def read(*args)\n file.try(:read, *args)\n end",
"def read(opts = T.unsafe(nil)); end",
"def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end",
"def load_input_params(in_file)\n params = YAML::load(File.open(in_file))\n load_helper(params[\"SS_script_support_path\"])\n @params = strip_private_flag(params)\n #BJB 11-10-14 Intercept to load framework\n initialize_framework\n @params\n end",
"def get_file_data(options={})\n options={ file_type: :testflow \n }.merge(options)\n fp = FileParser.new\n fp.open(filename: @filename)\n if options[:file_type] == :testflow\n @testflow_lines = fp.readlines\n elsif options[:file_type] == :limits\n @limits_lines = fp.readlines\n else\n fail \"Invalid type '#{options[:type]}' passed to 'get_file_data'!\"\n end\n fp.close()\nend",
"def read_config_files(files); end",
"def parameter_file\n filename_path(:parameter_dir, filename)\n end",
"def loadKnownParams(filename)\n\t\t\t@knownParams = {}\n\t\t\tif (!File.exist? filename )\n\t\t\t\tlogger(-1, \"Error, Known Params File does not exist: #{filename}\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlogger(1, \"Parsing Known Params File: #{filename}\")\n\t\t\tkpf = File.open( filename )\n\t\t\tkpf.each_line do |line|\n\t\t\t\tentry = line.chomp.split(',')\n\t\t\t\tobject = entry.shift\n\t\t\t\tif @knownParams.has_key?(object)\n\t\t\t\t\t@knownParams[object][entry.shift] = entry\n\t\t\t\telse\n\t\t\t\t\t@knownParams[object] = { entry.shift => entry } \n\t\t\t\tend\n\t\t\tend\t\t\n\t\t\tkpf.close\n\t\tend",
"def dir_get_args(dir)\n get_args(dir) { |filename| read_nil(filename) }\nend",
"def read_settings\n if test( ?s, RC_FILE )\n lines = File.read( RC_FILE ).split( /\\r\\n?|\\n/ )\n lines.each do |l|\n l = l.sub( /#.*$/, '' ) # remove trailing comments\n if l =~ /^\\s*(\\S+)\\s*=\\s*(\\S(.*\\S)?)\\s*$/\n key, val = $1, $2\n $rc_settings[ key ] = val \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n elsif l =~ /^\\s*(\\S+)\\s*=\\s*$/\n key, val = $1, ''\n $rc_settings[ key ] = '' \\\n if $settings[ key ] and $settings[ key ].type == 'config'\n end # if l =~\n end # do |l|\n end # if ?s\n end",
"def read_prop_file(prop_file)\n props = {}\n File.open(prop_file, 'r') do |f|\n f.each_line do |line|\n props[$1] = $2 if line =~ /^export (.*)=(.*)$/\n end\n end if File.exists?(prop_file)\n props\nend",
"def load_ini\n last_file = nil\n last_speed = nil\n last_position = nil\n last_speeds = nil\n if File.exists? @ini_file\n File.open(@ini_file, \"r\") do |f|\n f.each do |line|\n last_file = line.sub(\"last_file=\", \"\").strip if line =~ /^last_file=/\n last_speed = line.sub(\"last_speed=\", \"\").strip.to_f if line =~ /^last_speed=/\n last_position = line.sub(\"last_position=\", \"\").strip.to_i if line =~ /^last_position=/\n if line =~ /^speeds=/\n last_speeds = line.sub(\"speeds=\", \"\").strip.split(\",\")\n last_speeds.map!{|s| s.to_f}\n end\n if line =~ /^partial_repeat=/\n @partial_repeat = line.sub(\"partial_repeat=\", \"\").strip\n if @partial_repeat == 'true'\n @partial_repeat = true\n else\n @partial_repeat = false\n end\n end\n @partial_duration = line.sub(\"partial_duration=\", \"\").strip.to_i if line =~ /^partial_duration=/\n end\n end\n end\n return last_file, last_speed, last_position, last_speeds\nend",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_quantity = info[0].chop\n @last_category = info[1].chop.to_i\n @exercises = info[2].chop.split(\",\")\n @last_repq = info[3].chop\n @rep_ex = info[4].chop\n end",
"def read(*rest) end",
"def read(*rest) end",
"def yardopts(file = options_file)\n return [] unless use_yardopts_file\n File.read_binary(file).shell_split\n rescue Errno::ENOENT\n []\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def try_file(opt=\"\")\n File.read(File.expand_path(opt)) rescue opt\n end",
"def initialize(filename, read_properties=true)\n end",
"def initialize(filename, read_properties=true)\n end",
"def get_required_params(key)\n get_option(key, :required_params)\n end",
"def parse(filenames)\r\n properties = {}\r\n filenames.each do |filename|\r\n if (File.exists?(filename))\r\n file = File.open(filename, \"r\")\r\n file.read.each_line do |line|\r\n line.strip!\r\n if (line[0] != ?# and line[0] != ?=)\r\n i = line.index(\"=\")\r\n if (i)\r\n key = line[0..i - 1].strip\r\n value = line[i + 1..-1].strip\r\n properties[key] = value.strip\r\n else\r\n key = line\r\n value = \"\"\r\n properties[key] = value\r\n end\r\n end\r\n end\r\n file.close\r\n file = nil\r\n end\r\n end\r\n properties\r\nend",
"def base_validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n validate_parameters\n nil\n end",
"def read_config(config_path = T.unsafe(nil)); end",
"def PARAMETER_LIST()\r\n\"\r\n_VT01.txt:5du-4du+-3du+,1p,2m 8 6 12 0 64 2 24\r\n_VT02.txt:5m-2p,4d-3me,1p\r\n_VT03.txt:2me,3m,4m 8 6 12 0 64 2 24\r\n_VT04.txt:2m,7d-2me,3pw 8 6 12 0 64 2 24\r\n_VT05.txt:2me,3m-7m-6p+,4m-5m+ 8 6 12 0 64 2 24\r\n_VT06.txt:2me[2f]-6p[3]+,3m[1e]-7m[6d]-6p[3]+-2mew+,4m[3c]-5m[2b]+-2me+ 8 6 12 0 64 2 24\r\n_VT07.txt:1d-2me-3p,4m[uf]-5m[2]+,5m[6]-6me[2]+-3p[3]+-2mew+ 8 6 12 0 64 2 6\r\n_VT08.txt:9d-10d-11d-12d, 4p-5m-7m, 6m-8m | 1me, 2me, 3p\r\n\"\r\nend",
"def read_file(filename); end",
"def sysread(*rest) end",
"def sysread(*rest) end",
"def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end",
"def opts\n load_defaults unless @opts\n @opts\n end",
"def file_format_params\n params.require(:file_format).permit(:title, :notes)\n end",
"def validate_opts\n if @options[:file].nil?\n puts \"Pass me some filename (-f FILE)\"\n return false\n elsif !File.exists?(@options[:file])\n puts \"File: #{@options[:file]} does not exist\"\n return false\n elsif !File.readable?(@options[:file])\n puts \"File: #{@options[:file]} is not readable\"\n return false\n elsif File.directory?(@options[:file])\n puts \"#{@options[:file]} is a directory!\"\n return false\n elsif File.zero?(@options[:file])\n puts \"File: #{@options[:file]} is empty\"\n return false\n end\n\n if @options[:mode].nil?\n puts \"Pass me indexing mode (-m index|noindex )\"\n return false\n end\n return true\n end",
"def load_params args\n\tparams = {}\n\targs.each_slice(2) do | key_value |\n\t\t# puts \"o #{key_value}\"\n\t\tparams[key_value[0][1..-1]] = key_value[1]\n\tend\n\tparams\nend",
"def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end",
"def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end",
"def read(*args)\n IO.read(@path, *args)\n end",
"def load_info\n info = File.readlines @dir+\"info\"\n @last_learnq = info[0].to_i\n @last_repq = info[1].to_i\n @last_exerq = info[2].to_i\n @last_category = info[3].to_i\n @exercises = info[4].split(\",\").collect! {|v| v.to_i}\n @rep_ex = info[4].to_i\n end",
"def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end",
"def process_stack_parameters_file(filename)\n content = File.read(filename)\n return CloudFormation.parse_json_params(JSON.parse(content))\n end",
"def read_param(key)\n return nil unless value = params[key] || params[SHORT_NAMES[key]]\n value.strip!\n\n value.empty? ? nil : value\n end",
"def require_data(*file); end",
"def require_data(*file); end",
"def read_file(subpath = nil)\n result = {}\n path = full_path(@file_name_prefix, subpath)\n contents = File.file?(path) ? File.read(path) : ''\n contents.each_line do |line|\n match = line.chomp.match(/^(.+)=(.*)$/)\n result[match[1]] = match[2]\n end\n result\n end",
"def file_record_params\n params.fetch(:file_record, {})\n end",
"def get_flags(*files)\n matches = []\n begin\n files.each do |f|\n file = File.new(f, 'r')\n while (line = file.gets)\n m = line.match(/(^.*=)?/)\n matches << m[0] if m\n end\n file.close\n end\n rescue => err\n puts 'Exception: #{err}'\n err\n end\n matches.uniq.sort!\nend",
"def method_missing(m, *a, &b)\n read_settings(m.to_s)\n end",
"def read_file(file, context); end",
"def initialize(defaults,cmd_opts)\n @fields = defaults\n if !cmd_opts[:config_file].nil?\n path = cmd_opts[:config_file]\n else\n path = defaults[:config_file]\n end\n data = YAML.load_file(path)\n # Now combine data:\n # defaults, config file, command line (low->high priority)\n data.each do |k,v|\n if EXPECTED.include? k.to_sym\n @fields[k.to_sym] = v\n else\n STDERR.puts \"Warning: unknown section '#{k}' in config file\"\n end\n end\n cmd_opts.each do |k,v|\n @fields[k] = v\n end\n end",
"def parse_init_file(path)\n return [] unless ::File.exist?(path)\n\n in_info = false\n ::File.readlines(path).each_with_object([]) do |line, acc|\n if /^### BEGIN INIT INFO/.match?(line)\n in_info = true\n elsif /^### END INIT INFO/.match?(line)\n break acc\n elsif in_info\n if line =~ /Default-(Start|Stop):\\s+(\\d.*)/\n acc << $2.split(\" \")\n end\n end\n end.flatten\n end",
"def load_specification(file_name); end",
"def validate_opts\n validate_opts_file if options[:file]\n end",
"def build_args\n if File.exist? build_info_file\n build_info = File.readlines build_info_file\n build_info = build_info.map {|x| x.strip }\n build_info.delete \"\"\n build_info\n else\n []\n end\n end",
"def getParameters\n params = Hash.new\n\n # Define the supported options\n opts = GetoptLong.new(\n [ '-?', GetoptLong::NO_ARGUMENT ],\n [ '-d', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-h', GetoptLong::NO_ARGUMENT ],\n [ '-m', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-s', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-w', GetoptLong::REQUIRED_ARGUMENT ],\n [ '-p', GetoptLong::REQUIRED_ARGUMENT ]\n )\n \n opts.each do |opt, arg|\n case opt\n when '-?'\n when '-h'\n raise\n when '-d'\n params['imageDirectory'] = arg\n when '-m'\n params['mapID'] = arg\n when '-s'\n params['metadataServerURL'] = arg\n when '-w'\n params['sleepDelay'] = arg\n when '-p'\n params['publishServerURL'] = arg\n end\n end\n \n params\n end",
"def read_file_level_settings\n cdjf = corresponding_data_json_file\n return {} if cdjf.nil?\n cdjf.read_settings\n end"
] | [
"0.7366005",
"0.7128029",
"0.70349675",
"0.68255615",
"0.68255615",
"0.68255615",
"0.6507255",
"0.6485177",
"0.6241533",
"0.6130209",
"0.6129557",
"0.6106181",
"0.60776764",
"0.6007821",
"0.59721625",
"0.59683573",
"0.5957129",
"0.5916238",
"0.5912605",
"0.59120184",
"0.5897326",
"0.58809644",
"0.58373344",
"0.58351016",
"0.5823861",
"0.57497233",
"0.57461405",
"0.5732525",
"0.57317245",
"0.57132757",
"0.5711",
"0.57086474",
"0.56513244",
"0.56203175",
"0.5594072",
"0.5592697",
"0.55752224",
"0.5517684",
"0.55149746",
"0.5496722",
"0.5495175",
"0.5486224",
"0.545998",
"0.54579645",
"0.5452573",
"0.54284143",
"0.5420056",
"0.5407102",
"0.5398042",
"0.5393706",
"0.5389009",
"0.5348413",
"0.53469765",
"0.5344859",
"0.5308994",
"0.53008205",
"0.52814114",
"0.5275601",
"0.5264888",
"0.52572304",
"0.5239648",
"0.5239648",
"0.5239558",
"0.52368546",
"0.5235852",
"0.52244216",
"0.52244216",
"0.5215373",
"0.5214081",
"0.5204531",
"0.52014554",
"0.51995486",
"0.5191211",
"0.51858777",
"0.51858777",
"0.51738644",
"0.5171061",
"0.5148052",
"0.5142491",
"0.5131674",
"0.5131047",
"0.513013",
"0.5128088",
"0.51253176",
"0.5125058",
"0.5122155",
"0.511778",
"0.5117451",
"0.5117451",
"0.5107368",
"0.5104604",
"0.5104577",
"0.50999326",
"0.5098876",
"0.50908405",
"0.50881994",
"0.50791806",
"0.50775564",
"0.50739384",
"0.5063782",
"0.5058908"
] | 0.0 | -1 |
def missing_number(section) if possibilites(section) == 1 numbers.each do |number| if row.include?(number) == false fill_cell(number) end end end end def fill_cell(number, index) end | def row(dash_index)
row = []
@board_array.each_with_index do |number, index|
if index % 9 == dash_index
row << number
end
end
row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_number_into_each_blank\n SudokuUtils.LoopPuzzle do |row, col|\n if self[row, col].is_a? Element\n if self[row, col].possibleNumbers.count == 1\n insert_number_into_blank(row, col, self[row, col].possibleNumbers[0])\n elsif self[row, col].relativeNumbers.count == 1\n insert_number_into_blank(row, col, self[row, col].relativeNumbers[0])\n end\n end\n end\n end",
"def missing\n num = 0\n each do |cell|\n num += 1 if cell.value.to_i == 0\n end\n num\n end",
"def filled\n num = 0\n each do |cell|\n num += 1 if cell.value.to_i != 0\n end\n num\n end",
"def missingNumber(array)\n (1..100).each do |i|\n return i if !array.index(i)\n end\nend",
"def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end",
"def test_missing_numbers_some_missing\n result = @sudoku_1.missing_numbers(@sudoku_1.squares[3])\n assert_equal([1, 3, 5, 6], result)\n end",
"def valid_sudoku(table)\n sudoku_box_hash = { [0, 0] => {}, [0, 1] => {}, [0, 2] => {},\n [1, 0] => {}, [1, 1] => {}, [1, 2] => {},\n [2, 0] => {}, [2, 1] => {}, [2, 2] => {}}\n\n sudoku_row_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n \n sudoku_col_hash = { 1 => {}, 2 => {}, 3 => {},\n 4 => {}, 5 => {}, 6 => {},\n 7 => {}, 8 => {}, 9 => {}}\n\n sudoku_diagonal_hash = {1 => {}, 9 => {}}\n\n table.each_with_index do |arr, i|\n arr.each_with_index do |ele, j|\n next if ele == \".\"\n # check and add diagonals\n if i == j \n return false if sudoku_diagonal_hash[1].include?(ele)\n sudoku_diagonal_hash[1][ele] = 1\n elsif i + j + 1 == 9 || i == 4 && j == 4\n return false if sudoku_diagonal_hash[9].include?(ele)\n sudoku_diagonal_hash[9][ele] = 1\n end\n\n # check these hashes for all elements\n return false if sudoku_row_hash[i + 1].include?(ele)\n return false if sudoku_col_hash[j + 1].include?(ele)\n return false if sudoku_box_hash[[i / 3, j / 3]].include?(ele)\n\n # can add if no return \n sudoku_row_hash[i + 1][ele] = 1\n sudoku_col_hash[j + 1][ele] = 1\n sudoku_box_hash[[i / 3, j / 3]][ele] = 1 # based off calculating indices of ecah sudoku box\n end\n end\n\n return true\nend",
"def valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n col = row[i]\n if col != '.'\n if column_map[col] \n return false\n else\n column_map[col] = 1\n end\n end\n\n end\n k += 1\n end\n \n i = 0\n k = 0\n 9.times do\n box_map = {}\n while i < i + 3\n while k < k + 3\n \n end\n end \n end\n \n return true\nend",
"def add_missing_cells_optimized\n a_cells = self.answer_cells.ratings\n count = 0\n # find missing\n cells = a_cells.map {|a| [a.row, a.col] }\n cell_arr = cells.first\n return if !(cell_arr && cell_arr.size == 2) \n\n q_cells = self.question.question_cells.ratings.map {|a| [a.row, a.col] }\n q_cells_size = q_cells.size\n missing_cells = q_cells - cells\n\n new_cells = []\n missing_cells.each do |m_cell|\n row, col = m_cell\n find_row = row - 1 # try one before this\n cells_away = 1 # how far the found cell is from the one to fill in\n while((prev_item = a_cells.detect { |c| c.row == find_row}).nil? && find_row > 0) do\n find_row -= 1\n cells_away += 1\n end\n if prev_item && (item = prev_item.item) && find_row > 0 && find_row < q_cells_size\n cells_away.times { item.succ! }\n unless exists = self.answer_cells(true).find_by_row_and_col(row, col)\n new_cells << self.answer_cells.build(:item => item, :row => row, :col => col, :answertype => 'Rating', :value => '')\n count += 1\n # puts \"AC created: #{ac.inspect}, item: #{item}, row: #{row}, m_cell: #{m_cell.inspect}\"\n end\n end\n row = col = find_row = cells_away = prev_item = exists = nil\n end if self.survey_answer.done\n new_cells\n end",
"def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend",
"def internal_check(row, col)\n \n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n values\n \n end",
"def missing_num(nums, num)\n high=nums.sort.last\n (0..num).each do |num|\n return num unless nums.include?(num)\n end\n\nend",
"def insert_number(number, cords)\n puts \"#{number} is present in row!\" if is_present_in_row?(number, cords)\n puts \"#{number} is present in column!\" if is_present_in_column?(number, cords)\n puts \"#{number} is present in subgrid!\" if is_present_in_subgrid?(number, cords)\n @grid[cords[0]][cords[1]] = number\n end",
"def solve_sudoku(board, empty_positions)\n i = 0\n\n while i < empty_positions.length\n rrow = empty_positions[i][0]\n ccolumn = empty_positions[i][1]\n number = board[rrow][ccolumn] + 1\n found = false\n\n while !found && number <= 9\n if check_value(board, rrow, ccolumn, number)\n found = true\n board[rrow][ccolumn] = number\n i += 1\n else\n number += 1\n end\n end\n\n if !found\n board[rrow][ccolumn] = 0\n i -= 1\n end\n end\n \n board\nend",
"def create_starting_numbers\n @board.each_index do |row|\n @board.each_index do |col|\n if @board[row][col].number != \"-\"\n @board[row][col].starting_number = true\n end\n end\n end\n end",
"def missing_number_hsh(nums)\n hsh = {}\n nums.each do |n|\n hsh[n] = 1\n end\n for i in (0..nums.length)\n return i if !hsh.include?(i)\n end\n -1\nend",
"def valid_sudoku(table)\n # edge cases\n return false if table.nil? || table.size != 9 || table[0].size != 9\n # 3 new storages will count number of occurances of each element for columns, rows and sub-boxes\n rows = Array.new(9)\n i = 0\n while i < rows.size\n rows[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n columns = Array.new(9)\n i = 0\n while i < columns.size\n columns[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n sub_boxes = Array.new(9)\n i = 0\n while i < sub_boxes.size\n sub_boxes[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n # loop through the input table to populate the above created storages with occurance numbers\n i = 0 # i is a row counter\n while i < table.size\n j = 0 # j is a column counter\n while j < table.size\n if table[i][j] != \".\"\n rows[i][table[i][j]] += 1\n columns[j][table[i][j]] += 1\n # find a number of a box/hash by calculating (i/3)*3 + (j/3)\n # e.g. for the element at indexes 1,2 the box will be: (1/3)*3 + (2/3) = 0, first box\n sub_boxes[(i/3)*3 + (j/3)][table[i][j]] += 1\n end\n j += 1\n end\n i += 1\n end\n # check if any of table elements occured more than 1 time within a row, a column or a sub-box\n rows.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n columns.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n sub_boxes.each_with_index do |hash, i|\n return false if hash.any? { |key, value| value > 1}\n end\n\n return true\nend",
"def external_check?(row,col)\n \n #Get values available in this block\n #------------------------------------------------------------------\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n \n section = []\n \n #Check row\n #Get values available in the other blocks in the current row\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n values_row = values.tr(section,\"\")\n \n if values_row.length == 1\n @rows[row][col] = values_row.to_s\n adjust_values\n return true\n else\n return false\n end \n #Check column\n #Get values available in the other blocks in the current column\n #---------------------------------------------------------------------------------------------------\n 9.times do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(i,col) unless row==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_col = values.tr(section,\"\")\n if values_col.length == 1\n @rows[row][col] = values_col.to_s\n adjust_values\n return true\n else\n return false\n end \n \n #Check block\n #Get values available in the other blocks in the current block\n #---------------------------------------------------------------------------------------------------\n blk = find_block(row,col)\n case blk\n when 0\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c-1) unless r=row and c=col\n\tend\n end\n when 1\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+2) unless r=row and c=col\n\tend\n end\n when 2\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r-1,c+5) unless r=row and c=col\n\tend\n end\n when 3\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c-1) unless r=row and c=col\n\tend\n end\n when 4\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+2) unless r=row and c=col\n\tend\n end\n when 5\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+2,c+5) unless r=row and c=col\n\tend\n end\n when 6\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c-1) unless r=row and c=col\n\tend\n end\n when 7\n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+2) unless r=row and c=col\n\tend\n end\n else \n 3.times do |r|\n\t3.times do |c|\n\t section << internal_check(r+5,c+5) unless r=row and c=col\n\tend\n end\n end \n \n @blks[blk].each do |i|\n if @rows[row][i] == \"0\"\n\tsection << internal_check(row,i) unless col==i\n end\n end\n \n section = section.join.split(\"\").sort.uniq.join.gsub(\"0\",\"\")\n \n values_block = values.tr(section,\"\") \n if values_block.length == 1\n @rows[row][col] = values_block.to_s\n adjust_values\n return true\n else\n return false\n end \n end",
"def check_number(element, row, col, grid)\n grid_row = (row / 3) * 3\n grid_column = (col / 3) *3\n for i in 0..8 do\n if ((grid[row][i] == element) || (grid[i][col] == element) ||(grid[grid_row + ( i % 3 )][grid_column + (i / 3)] == element))\n return 0\n end\n end\n grid[row][col] = element\n return 1\nend",
"def valid_sudoku(table)\n row_list = {}\n col_list = {}\n\n i = 0\n while i < table.length \n j = 0\n\n while j < table[i].length\n \n row_num = table[i][j]\n col_num = table[j][i]\n\n row_list = update_sub_grid(row_list, row_num)\n return false if !row_list\n\n col_list = update_sub_grid(col_list, col_num)\n return false if !col_list\n\n j += 1\n end\n\n\n row_list = {}\n col_list = {}\n \n i += 1\n end\n\n\n starting_points = [\n [0, 0],\n [0, 3],\n [0, 6],\n [3, 0],\n [3, 3],\n [3, 6],\n [6, 0],\n [6, 3],\n [6, 6]\n ]\n\n starting_points.each do |row_start, col_start|\n return false if !valid_sub_grid(table, row_start, col_start)\n end \n\n return true\nend",
"def each_missing(num, &block)\n if (num.is_a? Range) then\n num.each { |n| each_missing(n, &block) }\n return\n end\n\n if (num.is_a? Array) then\n num.each { |n| each_missing(n, &block) }\n return\n end\n\n if (!num.is_a?Integer) then\n raise \"each_missing: num argument must be an Integer, Array of Integers, or Range. num=#{num.inspect} which is a #{num.class}\"\n end\n\n if (num==0) then\n yield self\n return\n end\n\n if (num > self.size) then\n return\n end\n\n each_index do |index|\n before_first_missing = self[0,index]\n #after_first_missing = self[index+1,size]\n self[index+1,size].each_missing(num-1) do |subset|\n yield before_first_missing+subset\n end\n end\n end",
"def valid_sudoku(table)\n subgrids = {}\n\n # return false if any element is repeated in a row\n table.each do |row|\n row_count = {}\n row.each do |element|\n if row_count[element]\n return false unless element == \".\"\n else\n row_count[element] = 1\n end\n end\n end\n\n # return false if any element is repeated in a column\n columns = {\n 0 => {},\n 1 => {},\n 2 => {},\n 3 => {},\n 4 => {},\n 5 => {},\n 6 => {},\n 7 => {},\n 8 => {},\n }\n table.each do |row|\n row.each_with_index do |element, index|\n if columns[index][element]\n return false unless element == \".\"\n else\n columns[index][element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[0..2].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[3..5].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n first_subgrid = {}\n second_subgrid = {}\n third_subgrid = {}\n\n table[6..8].each do |row|\n row[0..2].each do |element|\n if first_subgrid[element]\n return false unless element == \".\"\n else\n first_subgrid[element] = 1\n end\n end\n\n row[3..5].each do |element|\n if second_subgrid[element]\n return false unless element == \".\"\n else\n second_subgrid[element] = 1\n end\n end\n\n row[6..8].each do |element|\n if third_subgrid[element]\n return false unless element == \".\"\n else\n third_subgrid[element] = 1\n end\n end\n end\n\n return true\nend",
"def valid_sudoku(table)\n numbers = {}\n\n # iterate through each row and confirm valid\n row = 0\n while row < table.length\n table[row].each do |value|\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n row += 1\n end\n\n # iterate through each column and confirm valid\n numbers = {}\n col = 0\n while col < table[0].length\n (0..8).each do |x|\n value = table[x][col]\n\n return false if !check_value(numbers, value)\n end\n\n numbers = {}\n col += 1\n end\n\n # create list of each sub-box's upper left corner\n corners = []\n (0..2).each do |row|\n (0..2).each do |col|\n corners << [row * 3, col * 3]\n end\n end\n\n # iterate through the list of corners to see if each value is unique within the sub-box\n numbers = {}\n index = 0\n while index < corners.length\n (0..2).each do |x|\n (0..2).each do |y|\n x_point = corners[index][0] + x\n y_point = corners[index][1] + y\n value = table[x_point][y_point]\n\n return false if !check_value(numbers, value)\n end\n end\n\n numbers = {}\n index += 1\n end\n\n return true\nend",
"def fill_spec\n zeros = count_zeros # how many to fill\n begin\n last_zeros = zeros\n (0..8).each{|i|\n (0..8).each{|j|\n next if @board[i][j] != 0 # skip filled spaces\n choices = find_choices(i, j)\n raise \"Illegal Board #{i+1} #{j+1}\" if choices.length == 0\n @board[i][j] = choices[0] if choices.length == 1\n }\n }\n zeros = count_zeros\n # if filled some, possibly others are now fully specified\n end while ((zeros > 0) && (last_zeros > zeros))\n end",
"def missing(numbers)\n (numbers.first..numbers.last).to_a.select do |current_number|\n !numbers.include?(current_number)\n end\nend",
"def valid_sudoku(table)\n store = {\n rows: {},\n cols: {},\n square: {},\n }\n # First loop it represents the first row we are checking\n # Second loop it represents the column.\n\n (0...9).each do |i|\n (0...9).each do |j|\n box = table[i][j]\n if !store[:rows][i] && box != \".\"\n store[:rows][i] = []\n store[:rows][i].push(box)\n elsif box != \".\" && !store[:rows][i].include?(box)\n store[:rows][i].push(box)\n elsif store[:rows][i] && store[:rows][i].include?(box)\n return false\n end\n\n if !store[:cols][j] && box != \".\"\n store[:cols][j] = []\n store[:cols][j].push(box)\n elsif box != \".\" && !store[:cols][j].include?(box)\n store[:cols][j].push(box)\n elsif store[:cols][j] && store[:cols][j].include?(box)\n return false\n end\n\n # Converting to float and the ceil to round up always.\n squareRowId = ((i + 1).to_f / 3).ceil\n squareColId = ((j + 1).to_f / 3).ceil\n # The squeare id is gonna be like\n # 1-1 , 1-2, 1-3\n # 2-1 , 2-2, 2-3\n # 3-1 , 3-2, 3-3\n\n squareId = \"#{squareRowId}-#{squareColId}\"\n\n # Here insted of checking rows and colums I will be checking the numbers inside of this\n # Squeare ids.\n if !store[:square][squareId] && box != \".\"\n store[:square][squareId] = []\n store[:square][squareId].push(box)\n elsif box != \".\" && !store[:square][squareId].include?(box)\n store[:square][squareId].push(box)\n elsif store[:square][squareId] && store[:square][squareId].include?(box)\n return false\n end\n end\n end\n return true\nend",
"def missing_number(nums)\n missing = nums.size\n nums.each_with_index do |num, index|\n missing ^= index ^ num\n end\n missing\nend",
"def fill_check_digit\n return unless @position\n\n odd = (@digits.size - @position).odd?\n @digits[@position] = calculate_check_digit(sum, odd)\n end",
"def findMissingNumbers( arrayOfNumbers )\n # walk through all known numbers\n # for each known number + 1 print until reaching next number\n $last = arrayOfNumbers[0].to_i\n arrayOfNumbers.each { |known|\n $last = $last.to_i + 1\n while $last < known.to_i\n puts $last\n $last = $last + 1 \n end\n $last = known\n next\n }\nend",
"def update_cell(number, symbol)\n if cell_free?(number)\n self.cells[number - 1] = symbol.to_s\n show_board\n else\n puts \"la case est occupée choisis une autre case\"\n return false\n end\n end",
"def loadFromFile(fileName)\n inFile = File.new(fileName, \"r\")\n index = 0\n\n # Iterate over the lines from the file.\n inFile.each_line do |line|\n # line is a string containing one line from the file.\n\n ### The code to process the line goes here. ###\n\t\tvals = line.split\n\t\t# The collect block will iterate over each item in vals (strings)\n\t\t# and perform the function (convert to int) returning the set as a new array.\n\t\t@sudokuBoard[index] = vals.collect { |x| x.to_i }\n index = index + 1\n end\n\t\n\t\n\t# Returns whether a number can be placed in this column\n\t#\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the column, false otherwise\n\tdef checkCol(col, num)\n\t\t0.upto(BOARD_SIZE-1){\n\t\t|row| \n\t\tif num == @sudokuBoard[row][col] then\n\t\t\treturn false\n\t\tend\n\t\t}\n\t\treturn true\n\n\tend\n\t# Returns whether a number can be placed in this row\n\t#\n\t# @param row A number representing the board row\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the row, false otherwise\n\tdef checkRow(row, num)\n\t\tdisjointSet = @sudokuBoard[row] - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add sum to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add sum to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\tend\n\t\n\t# Returns whether a number can be placed in this subgrid\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in the subgrid, false otherwise\n\tdef checkSubgrid(row, col, num)\n\t\tx = (row / 3) * 3\n\t\ty = (col / 3) * 3\n\n\t\tbox = @sudokuBoard[x][y..(y+2)] + @sudokuBoard[x+1][y..(y+2)] + @sudokuBoard[x+2][y..(y+2)]\n\t\tdisjointSet = box - [num]\n\t\tif disjointSet.length == 9 then\n\t\t\t# Safe to add num to the row.\n\t\t\treturn true\n\t\telse\n\t\t\t# Unsafe to add num to the row, since it already existed there.\n\t\t\treturn false\n\t\tend\n\t\t\n\t\n\t\n\t\n\tend\n\t\n\t# Returns whether a number can be placed per sudoku rules\n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @param num A number we're checking\n\t# @return Returns true if the number is valid in this postion, false otherwise\n\tdef check(row, col, num)\n\t\treturn checkCol(col,num) && checkRow(row,num) && checkSubgrid(row,col,num)\n\t\n\tend\n\t\n\t# A recursive backtracking function to solve sudoku boards \n\t#\n\t# @param row A number representing the board row\n\t# @param col A number representing the board column\n\t# @return Returns true if the board is solved, false otherwise\n\tdef solve(row, col)\n\tif row == 9 then\n\t\treturn true\n\tend\n\t\n\tif col == 9 then\n\t\treturn solve(row +1, 0)\n\tend\n\t\n\tif @sudokuBoard[row][col] != 0 then\n\t\treturn solve(row, col +1)\n\tend\n\t\n\t1.upto(9) {\n\t|num|\n\t\n\tif check(row,col,num) then\n\t\t@sudokuBoard[row][col] = num\n\t\tif solve(row, col+1) then\n\t\t\treturn true\n\t\tend\n\tend\n\t}\n\t\n\t@sudokuBoard[row][col] = 0\n\treturn false\n\t\n\t\n\tend\n\t\t\n\n inFile.close\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def valid_sudoku(table)\n raise NotImplementedError, \"Method hasn't been implemented yet!\"\nend",
"def missing(numbers)\n missed = []\n numbers.first.upto(numbers.last) do |num|\n missed << num unless numbers.include?(num)\n end\n missed\nend",
"def sudoku(rows)\n # constrain the non-zero elements to keep their current values, and\n # constrain the zero elements (i.e. the blanks) to be between 1 and 9\n constrain_each_row(rows)\nend",
"def numeral(section, digit)\n section.include? digit \nend",
"def row_checker(flat_board_array)\n first_row_indexes = [0,1,2,3,4,5,6,7,8]\n current_row = 0\n until current_row >= 9\n indexes = first_row_indexes.map { |index| index + current_row * 9}\n hash_of_vals = {}\n indexes.each do |index|\n if hash_of_vals[flat_board_array[index]] && flat_board_array[index] != 0\n return false\n else \n hash_of_vals[flat_board_array[index]] = 1\n end\n end\n current_row += 1\n end\n \n return true\nend",
"def test_fill_in\n assert_equal(0, @sudoku_1.rows[2][4])\n assert_equal(0, @sudoku_1.columns[4][2])\n assert_equal(0, @sudoku_1.squares[1][7])\n @sudoku_1.fill_in(2, 4, 1)\n assert_equal(1, @sudoku_1.rows[2][4])\n assert_equal(1, @sudoku_1.columns[4][2])\n assert_equal(1, @sudoku_1.squares[1][7])\n end",
"def find_the_missing_numbers(arr)\n example = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n\n send_back = []\n\n index = 0\n example.each do |num|\n if arr.include? num\n \n else\n send_back.insert(index, num)\n\n index += 1\n end\n \n end\n\n return send_back\nend",
"def update_cell(number, mark)\n if cell_free?(number)\n self.cells[number - 1] = mark.to_s\n show_board\n else\n puts \"Cell not empty! Choose other cell.\"\n return false\n end\n end",
"def check_row_availability_for_square(row, col)\n possible_for_row = []\n (0..8).each do |i|\n if (self[row, i].is_a? Element) && i != col\n possible_for_row |= calculate_possible_numbers_for_square(row, i)\n end\n end\n self[row, col].possibleNumbers - possible_for_row\n end",
"def valid_sudoku(table)\n \nend",
"def sudoku_not_filled?\n flg = false\n @sudoku.each do |row|\n flg = true if row.include? \" \"\n end\n flg\n end",
"def missing_numbers(nums)\n missing_numbers = []\n for number in nums.first...nums.last\n if nums.index(number).nil?\n missing_numbers << number\n end\n end\n return missing_numbers\nend",
"def find_missing_number(array)\n count = array.length\n return 1 if count == 1\n temp = array.dup\n until triangular_number(temp) == count_triangular_number(count)\n count -= 1\n temp.pop\n end\n count + 1\nend",
"def num_in_row(cell_row, num)\n\t$value_grid[cell_row].each do |cell|\n\t\tif cell.to_i == num\n\t\t\treturn false\n\t\tend\n\tend\n\treturn true\nend",
"def count_valid_cell(row, col)\n if row == -1 || row == grid.row_count\n 0\n elsif col == -1 || col == grid.column_count\n 0\n elsif !grid[row, col]\n 0\n else\n 1\n end\n end",
"def exist_in_row(grid, row, number)\n column = 0\n while column < N\n return true if grid[row][column] == number\n column += 1\n end\n return false\nend",
"def missing_num(arr)\n hashy = {1=>0, 2=>0, 3=>0,4=>0, 5=>0, 6=>0,7=>0, 8=>0, 9=>0, 10=>0}\n arr.each do |num|\n hashy[num] += 1\n end\n hashy.each do |k, v|\n if v == 0\n return k\n end\n end\nend",
"def append_non_zero_number\n append table.pick_non_zero\n end",
"def empty?(cell)\n\t\tcell == 0 || cell == @@FRONTIER\n\tend",
"def get_working_list(sudoku_cells)\n # look through the grid and put into the array\n # all the cells that still need attention\n working_list = []\n sudoku_cells.each do |row|\n row.each do |cell|\n if cell.value.zero? \n working_list << cell\n # print cell.value.to_s + ' '\n end\n end\n end\n return working_list\n # this method could possible implemented at the start\n # to reduce unnecessary check and improve performance\nend",
"def ensure_cell_exists(row_index, column_index = 0)\n validate_nonnegative(row_index)\n validate_nonnegative(column_index)\n\n row = sheet_data.rows[row_index] || add_row(row_index)\n end",
"def missing_number(nums)\n total = ((nums.length + 1) * nums.length) / 2\n total - nums.inject(0, :+)\nend",
"def is_a_starting_number?(row, col)\n return true if starting_numbers.include?([row.to_s, col.to_s])\n false\n end",
"def validateBoard()\n #cycle through all lines in the file\n row = 0\n for row in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[row * @DIMENSION + index]\n if temp.include? @gameboard[row * @DIMENSION + index]\n return false\n else\n temp[i] = @gameboard[row * @DIMENSION + index]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all columns in the file\n column = 0\n for column in 0..8\n # @gameboard index\n index = 0\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n while index<@DIMENSION\n if (1..9).member? @gameboard[column + index * @DIMENSION]\n if temp.include? @gameboard[column+ index * @DIMENSION]\n return false\n else\n temp[i] = @gameboard[column+ index * @DIMENSION]\n i += 1\n end\n end\n index += 1\n end\n end\n #cycle through all @DEIMENSION squares in the file\n startIndex = 0\n rowBase = 0\n columnBase = 0\n for rowBase in 0..2\n startIndex = rowBase * 3 * @DIMENSION\n for columnBase in 0..2\n # array temp is used to store number appearing in the same row\n temp = Array.new\n # temp array index\n i = 0\n #find the real index in @gameboard\n l = 0\n for l in 0..2\n m = 0\n for m in 0..2\n index = startIndex + m * @DIMENSION + l\n if (1..9).member? @gameboard[index]\n if temp.include? @gameboard[index]\n return false\n else\n temp[i] = @gameboard[index]\n i += 1\n end\n end\n end\n end\n startIndex += 3\n end\n end\n return true\nend",
"def puzzle(sudoku,removed_cells=20)\n # this method is yours to implement\n random = (0..81).to_a.sample(removed_cells)\n @puzzled = []\n sudoku.each_with_index do |element,index|\n if random.include?(index) then @puzzled.push(0)\n else @puzzled.push(element) end\n end\n @puzzled\n # random.each { |index| sudoku[index] = 0 }\n # sudoku\nend",
"def game_over \n # all the grid's cells are full and different numbers \n end",
"def ensure_cell_exists(row_index, column_index = 0)\n validate_nonnegative(row_index)\n validate_nonnegative(column_index)\n\n sheet_data.rows[row_index] || add_row(row_index)\n end",
"def fill n, value\n pz = @pz.dup\n pz[n] = value\n Sudoku.new pz\n end",
"def search1(num)\n @numbers.each_with_index do |number, i|\n if @hash[number]\n puts \"Indexes: #{@hash[number]}, #{i}\"\n break\n else\n @hash[num - number] = i\n end\n puts 'loop'\n end\n end",
"def sudoku_valid? grid\n \n # grid has first index for row, 2nd index for column\n \n # Check every row\n grid.each do |row|\n seen = Set.new\n (0..9).each do |row_value|\n if !seen.add?(row_value)\n return false\n end\n end\n end\n \n # Check every column\n grid.each do |row|\n seen = Set.new\n row.each do |col_value|\n if !seen.add?(col_value)\n return false\n end\n end\n end\n \n # Check every 3x3\n [0,3,6].each do |offset|\n [0,3,6].each do |offset2|\n to_check = get3by3 grid, offset, offset2\n seen = Set.new\n to_check.each do |value|\n if !seen.add?(value)\n return false\n end\n end\n end\n end\n \n \n return true\nend",
"def available_numbers_in_row_or_col\n all_actual_numbers = []\n (0..9).each do |i|\n yield(i, all_actual_numbers)\n end\n @@all_possible_numbers - all_actual_numbers\n end",
"def matrix_helper(matrix, row, column)\n if matrix[row].nil? # QUESTION: Recurses one extra time? Better to stop early?\n return matrix\n elsif matrix[row][column] == 0\n go_to_next_cell(matrix, row, column)\n set_zeros_in_columns(matrix, row)\n set_zeros_in_rows(matrix, column)\n return matrix\n else # value in current cell is 1\n go_to_next_cell(matrix, row, column)\n end\nend",
"def cell_population(row, column, num)\n @number_grid[row][column] = num\n end",
"def number_cells\n n = 1\n for row in 0...height\n for col in 0...width\n cell = self[row, col]\n west, north, east, south = DIRS.map{|dx, dy| self[row + dx, col + dy] and self[row + dx, col + dy].empty }\n if cell.empty and ((!west and east) or (!north and south))\n cell.number = n\n n += 1\n end\n end\n end\n end",
"def validate(section)\n \n #Rows, Columns or Blocks\n #--------------------------------------------------\n section.each do |i|\n check = i.sort.join.squeeze(\"0\")\n if check.length > check.split(\"\").uniq.length\n\tputs \"***************************************************\"\n\tputs \"Failed Validation, Values did not meet sudoku rules\"\n\tputs \"***************************************************\"\n\treturn false\n end\n end \n \n #Return true if all validations passed\n #--------------------------------------------------\n return true\n end",
"def valid_row?(row)\n if @row_counter[row - 1] == nil\n puts \"Row invalid\"\n return 9\n elsif @row_counter[row - 1] > 5\n puts \"Row full\"\n return 9\n else\n return row\n end\n end",
"def check\n @bingo_board.each_with_index do |sub_array, index|\n#The index is given to the check_column method. The index tells us which sub-array we're currently in. Checks if the current column is equal to the letter of the call AND checks if the number is in the sub-array. IF it is, then it will goto the replace method.\n if check_column(index) == @call_letter && @bingo_board[index].include?(@call_number)\n replace(index)\n end\n end\n show_board\n end",
"def create_board_indicator\n @row_of_first_empty_square = 0\n @col_of_first_empty_square = 0\n first_empty_square_found = false\n board_indicator = initialize_empty_board\n (MIN_ROW_POSITION..MAX_ROW_POSITION).each do |j| \n (MIN_COL_POSITION..MAX_COL_POSITION).each do |i|\n #board_indicator[j][i] = 1 if (@board[j][i] != 0 && @board[j][i] != '')\n if (@board[j][i] == 0 || @board[j][i] == '')\n if !first_empty_square_found\n puts 'first empty'\n first_empty_square_found = true\n @row_of_first_empty_square = j\n @col_of_first_empty_square = i\n end\n else\n board_indicator[j][i] = 1\n end\n end\n end\n board_indicator\n end",
"def num_in_region(cell_r, cell_c, num)\n\t(0..2).each do |row|\n\t\t(0..2).each do |col|\n\t\t\tif $value_grid[row+cell_r][col+cell_c].to_i == num\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\treturn true\nend",
"def fill(row, column, colour, memo = [])\n start_colour = self[row, column]\n self[row, column] = colour\n\n memo.push([row, column]) # adds coordinates to memo\n p memo\n (row - 1..row + 1).each do |i|\n (column - 1..column + 1).each do |j|\n next unless valid_coordinates?(i, j)\n next if memo.include? [i, j]\n next unless self[i, j] == start_colour\n\n fill(i, j, colour, memo)\n end\n end\n end",
"def include(num)\n return true if !filled? && @possible.insert(num - 1, num)\n\n false\n end",
"def missing(array)\n result = []\n num = array.first + 1\n loop do\n result << num if !array.include?(num)\n num += 1\n break if num == array.last\n end\n result\nend",
"def check_row(row)\n @possible_solutions_row = []\n (1..9).each do |i|\n if @board_grid[row].include?(i.to_s) == false\n @possible_solutions_row << i.to_s\n end\n end\n @possible_solutions_row\n end",
"def missing_numbers(nums)\n result = []\n\n (nums.first..nums.last).each do |x|\n\n if nums.include?(x) == false\n result << x\n end\n end\n\n result\n end",
"def show_free_seats(array_of_seats)\n array_of_seats.each_with_index do |row, row_index|\n row.each_with_index do |seat, seat_index|\n if seat == nil\n puts \"Row #{ row_index + 1 } seat #{ seat_index + 1 } is free.\"\n end\n end\n end\nend",
"def drop_checker(color, column)\n\n if column < 0 || column > 6\n puts \"Insert a column number 0-6!\"\n return false\n end\n \n \n if color != :red && color != :black\n puts \"Color must be red or black!\"\n return false\n end\n \n 5.downto 0 do |row| #Counts down to zero\n if rows[row][column].empty?\n if color == :black \n rows[row][column] = \"O\"\n else\n rows[row][column] = \"X\"\n end\n print_grid\n return true\n end\n end\n \n puts \"You can't put a checker in a full column!\" \n return false \n end",
"def check_valid_num(index)\n (0..8).any?(index)\nend",
"def missing(arr)\n starting_num = arr[0]\n ending_num = arr[-1]\n complete_arr = []\n\n (ending_num - starting_num + 1).times do\n complete_arr << starting_num\n starting_num += 1\n end\n\n complete_arr - arr\nend"
] | [
"0.6944222",
"0.64589316",
"0.6368105",
"0.6282497",
"0.6252968",
"0.6201066",
"0.6073232",
"0.6051671",
"0.6030695",
"0.6020522",
"0.60204893",
"0.6014079",
"0.60006046",
"0.5987056",
"0.5949613",
"0.590761",
"0.5903598",
"0.589869",
"0.58715475",
"0.58403075",
"0.5808087",
"0.58004415",
"0.57785094",
"0.5765223",
"0.57314235",
"0.5729834",
"0.57231635",
"0.5719704",
"0.5719354",
"0.5693987",
"0.56813735",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.56709",
"0.5652244",
"0.56506073",
"0.5631059",
"0.5623037",
"0.56194353",
"0.5609914",
"0.5604797",
"0.55946505",
"0.5586554",
"0.55761695",
"0.5563635",
"0.5553309",
"0.5544126",
"0.5540889",
"0.553831",
"0.55374676",
"0.5528993",
"0.55254084",
"0.55186856",
"0.55178905",
"0.5516365",
"0.55144346",
"0.55125886",
"0.5492991",
"0.5483908",
"0.54834676",
"0.5479",
"0.5472806",
"0.5470323",
"0.54629284",
"0.5453931",
"0.5447286",
"0.54423267",
"0.5433847",
"0.54264265",
"0.5392709",
"0.53810984",
"0.5379372",
"0.53769445",
"0.5374855",
"0.53709084",
"0.53630096",
"0.53590655",
"0.5331766",
"0.53299993",
"0.53243905",
"0.5323347"
] | 0.0 | -1 |
def video_title video.title end Todo: Fixme: It should use the average value Virtual attribute for activerecord model | def rating
# review = Review.where(user_id: user.id, video_id: video.id).first
#review = Review.find_by(user_id: user.id, video_id: video.id)
review.rating if review
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_title\n if video\n video.title\n end\n end",
"def title\n \tobject.movie_name\n end",
"def episode_title; end",
"def movie_name\n self.movie.name\n \n end",
"def to_s\n movie_title\n end",
"def title\n if @title == nil\n \"Movie not found!\"\n else\n @title\n end\n end",
"def title_attribute\n @title\n end",
"def ars_title\n self.ars_titles.order('percent_appears desc').limit(1).first.title\n end",
"def percent\n (self.time_watched/self.video.duration)*100\n end",
"def height; @video.height; end",
"def normalized_title\n normalized(full_title)\n end",
"def get_title\n @title\n end",
"def title \n @title \n # define title method which is a getter becuase it gets a property for us \n end",
"def get_title()\n @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def get_score(movie_title_id)\n Movie.find(movie_title_id).fractal_score\nend",
"def title\n @title ||= doc.search('.moviename-big').xpath('text()').text.strip\n end",
"def get_title()\n return @title\n end",
"def title\n adventure.title\n end",
"def film_title(film)\n film[\"title\"]\nend",
"def video_names \n\t\tvideo_trainings.map{|v| v.name}\n\tend",
"def textual_title\n @record.title\n end",
"def avg_rating\n visits.avg_rating\n end",
"def title\n @title\n end",
"def title\n @title\n end",
"def title\n @title\n end",
"def title\n @title\n end",
"def title\n @title\n end",
"def title \n @attributes[:title]\n end",
"def get_title\n @title\n end",
"def\n get_title()\n @title\n end",
"def video\n \"#{self.video_file_name}\"\n end",
"def title\n @title\nend",
"def augmented_title\n return self.title\n end",
"def show\n @title = 'Movie details + | ' + @movie.title\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 video_names \n\t\tvideos.map{|v| v.name}\n\tend",
"def title\n return @title\n end",
"def title\n @title\n end",
"def set_title \n write_attribute(:title, File.basename(file_name, '.mp4')) if title.blank?\n end",
"def normalized_title\n t = self.title.presence || default_title\n t.gsub('.', '').strip\n end",
"def title\n article.title\n end",
"def title\r\n @attributes['title']\r\n end",
"def title\n\n @title\n\nend",
"def title\n @attributes['title']\n end",
"def book_title\n self.title\n end",
"def index\n @videos = Video.all.sort {|a, b| b.average_rating <=> a.average_rating}\n end",
"def title\n attributes.fetch(:title)\n end",
"def title\n attributes.fetch(:title)\n end",
"def title_name; end",
"def movie; end",
"def show\n @page_title = @recommendation.movie.title\n end",
"def f_title\n self.title[0]\n end",
"def title\n object.title\n end",
"def title\n @attributes[:title]\n end",
"def title\n \"#{@artist} - #{@name} (#{@length})\"\n end",
"def normalized_tz_title\n return self[:normalized_tz_title] if attribute_present?(:normalized_tz_title) or !attribute_present?(:tz_title)\n \n title_words = self.tz_title\n \n require 'cgi'\n title_words = CGI::unescapeHTML(title_words) # convert " etc to regular characters\n title_words = ActionController::Base.helpers.strip_tags(title_words) # remove <b> tages etc\n\n # Lowercase, strip punctuation\n title_words = Movie::normalize_words(title_words)\n \n # Remove junk words. Do this after stripping html tags\n title_words = title_words.split(/\\s+/)\n title_words.delete_if { |word| Movie::JUNK_WORDS.include?(word) } \n title_words = title_words.join(' ')\n \n return self[:normalized_tz_title] = title_words\n end",
"def vida\n @vida_actual\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def title\n model.name.titleize\n end",
"def title\n self.attributes[\"title\"] || DEFAULT_TITLE\n end",
"def movie\n @movie\n end",
"def book_title\n @book_title\n end",
"def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end",
"def popular_shows\nend",
"def upcased_title\n title.upcase\n end",
"def upcased_title\n title.upcase\n end",
"def title\n\t\t@title\n\tend",
"def title\n @attributes[:title]\n end",
"def title\n @attributes[:title]\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n return @title\n end",
"def title\n\t\t@title \n\tend",
"def title\n if @data.attribute_names.include?(:title)\n @title ||= @data[:title].last\n else\n if @data.attribute_names.include?(:cmutitle)\n @title ||= @data[:cmutitle].last\n else\n @title ||= nil\n end\n end\n end",
"def get_genre_name\n self.genre.name\n end",
"def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end",
"def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def title\n return @gallery.gsub(/[_]+/, ' ').capitalize\n end",
"def rating\n reviews.average(:rating)\n end",
"def movie_title=(title)\n mt = Movie.arel_table\n m = Movie.where(mt[:name].matches(title)).first\n if movie = m\n self[:movie_id] = movie.id\n else \n m = Movie.create(name: title)\n self[:movie_id] = m.id\n end\n end",
"def to_s\n \"#{@title}\"\n end",
"def title\n \"Vat MTD\"\n end",
"def show\n @video = Video.find(params[:id])\n @original_video = @video.panda_video\n @h264_encoding = @original_video.encodings[\"h264\"]\n @rating = Rating.where(video_id: @video.id, user_id: current_user.id).first\n unless @rating\n @rating = Rating.create(video_id: @video.id, user_id: current_user.id, score: 0)\n end\n end",
"def video_regex\n @attributes[:video_regex]\n end",
"def title\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: title_ordered, values: values )\n return values\n end",
"def average_rating\n reviews.average(:rating)\n end",
"def title\nbase_title = \"MatterMouth\"\nif @title.nil?\nbase_title\nelse\n\"#{base_title} | #{@title}\"\nend\nend",
"def title\n name\n end",
"def title\n name\n end",
"def to_s\n @title\n end",
"def genre; end",
"def genre; end"
] | [
"0.7161962",
"0.6542916",
"0.6377608",
"0.6122962",
"0.6107751",
"0.60009605",
"0.5999953",
"0.59255517",
"0.59152013",
"0.58809936",
"0.5854644",
"0.58347714",
"0.5828151",
"0.5817354",
"0.5801279",
"0.5801279",
"0.5789752",
"0.5788244",
"0.5781102",
"0.57787293",
"0.5769678",
"0.57583034",
"0.57122344",
"0.570906",
"0.5703105",
"0.5703105",
"0.5703105",
"0.5703105",
"0.5703105",
"0.56979185",
"0.56888527",
"0.56737757",
"0.5671017",
"0.5658869",
"0.5658785",
"0.56430846",
"0.5615273",
"0.560016",
"0.55946803",
"0.5592834",
"0.55918574",
"0.5591838",
"0.55889565",
"0.5577728",
"0.5567708",
"0.5566482",
"0.5562416",
"0.5556435",
"0.554975",
"0.554975",
"0.5527999",
"0.5524574",
"0.55113953",
"0.5493666",
"0.5492336",
"0.5486651",
"0.5484015",
"0.54833645",
"0.5472913",
"0.54629105",
"0.5459513",
"0.54570484",
"0.54564244",
"0.5455516",
"0.54517096",
"0.54402065",
"0.54286003",
"0.54286003",
"0.54216075",
"0.5420015",
"0.5420015",
"0.5420006",
"0.5420006",
"0.5420006",
"0.5420006",
"0.5420006",
"0.5420006",
"0.5420006",
"0.54162496",
"0.54022926",
"0.5397521",
"0.5390681",
"0.5390681",
"0.5387187",
"0.5387187",
"0.5387187",
"0.53859186",
"0.53732574",
"0.5364396",
"0.5356252",
"0.5351572",
"0.5348659",
"0.53451145",
"0.5342184",
"0.53394985",
"0.5317921",
"0.5313739",
"0.5313739",
"0.5305612",
"0.5296703",
"0.5296703"
] | 0.0 | -1 |
Virtual attribute for activerecord model | def rating=(new_rating)
#review = Review.find_by(user_id: user.id, video_id: video.id)
if review
# In Rails4 update_columns is preffered than update_column
# update_columns will bypass the validation
review.update_columns(rating: new_rating)
#review.update(rating: new_rating)
else
review = Review.new(user: user, video: video, rating: new_rating)
review.save(validate: false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_for_attribute(name)\n if self.class._has_virtual_column?(name)\n return VirtualColumnWrapper.new(singleton_class._virtual_column(name))\n else\n super\n end\n end",
"def virtual; end",
"def has_attribute?(name)\n return true if self.class._has_virtual_column?(name)\n return super\n end",
"def virtual_attribute? c\n raise NotImplementedError\n end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def my_attribute\n @my_attribute\n end",
"def set_default_virtual(c)\n if c[:virtual].nil? # sometimes at maybe handy to mark a column as non-virtual forcefully\n assoc, assoc_method = assoc_and_assoc_method_for_attr(c)\n if assoc\n c[:virtual] = true if !assoc.klass.column_names.map(&:to_sym).include?(assoc_method.to_sym)\n else\n c[:virtual] = true if !data_class.column_names.map(&:to_sym).include?(c[:name].to_sym)\n end\n end\n end",
"def to_model_attr(attr)\n\t\t\t\treturn model_attributes[attr]\n\t\t\tend",
"def column_virtual? c\n raise NotImplementedError\n end",
"def custom_data\n super.attributes\n end",
"def arel_attribute(column_name, table = arel_table)\n super\n end",
"def model_attributes\n raise NotImplementedError\n end",
"def arel_column(field, &block)\n if virtual_attribute?(field) && (arel = table[field])\n arel\n else\n super\n end\n end",
"def relation\n super.extending!(TranslatedAttributesQuery)\n end",
"def override\n attributes.override\n end",
"def attr; end",
"def model\n self.public_send(self.class._attributes.first)\n end",
"def set_default_virtual(c)\n if c[:virtual].nil? # sometimes at maybe handy to mark a column as non-virtual forcefully\n assoc, assoc_method = assoc_and_assoc_method_for_column(c)\n if assoc\n c[:virtual] = true if !assoc.klass.column_names.map(&:to_sym).include?(assoc_method.to_sym)\n else\n c[:virtual] = true if !data_class.column_names.map(&:to_sym).include?(c[:name].to_sym)\n end\n end\n end",
"def record_value_for_attribute(r, a, through_association = false)\n end",
"def owner_class_attribute_default; end",
"def []=(attribute_name, value)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n \n return_value = super(attribute_name, self.class.cast(attribute_name, value))\n\n if self.__owner_object \n # This makes the tableless model compatible with partial_updates:\n # whenever a property in the tableless model is changed, we force the parent/owner object to a changed state\n # by updating it with a new, updated instance of the tableless model\n self.__owner_object.send \"#{self.__serialized_attribute.to_s}=\".to_sym, self\n end\n\n return_value\n end",
"def is_attribute?; end",
"def read_attribute\n record.public_send(attribute)\n end",
"def virtual?\n attributes[\"virtual\"] == \"1\"\n end",
"def attr_name\n \"#{self.proxy.column_family_name}:#{key}\"\n end",
"def real_column; end",
"def base_class\n S::Model\n end",
"def base_model\n BaseModel\n end",
"def ext_attr\n attribute_prop(10)\n end",
"def instance_attributes; end",
"def attributes(_record)\n raise 'Abstract method attributes should be overriden'\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def [](attribute_name)\n raise NoMethodError, \"The attribute #{attribute_name} is undefined\" unless self.class.attributes.has_key? attribute_name\n default = super(attribute_name)\n self.class.cast(attribute_name, default.is_a?(Proc) ? default.call : default)\n end",
"def purely_virtual?\n attributes[\"pure_virtual\"] == \"1\"\n end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def virtual?\n @virtual\n end",
"def attribute(name); end",
"def virtual?\n true\n end",
"def attribute_in_database(attr_name)\n mutations_from_database.original_value(attr_name.to_s)\n end",
"def original\n active_record._reflections[original_name]\n end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def editable_attribute_names; super + additional_fields end",
"def child_relation; end",
"def attribute_values\n # call Array#map on SQLObject::columns, call send on the instance to \n # get the value\n self.class.columns.map { |attribute| self.send(attribute) }\n end",
"def model_class; end",
"def dynamo_attribute(obj)\n dynamo_attribute_from_value dynamo_attribute_value(obj.send name)\n end",
"def attribute_values\n super.merge('product_id' => @source.concept_product.product.product_id)\n end",
"def attribute_to_set; end",
"def override_setter_on(model)\n model.class_eval %(\n def #{attribute}=(raw_value)\n definition = self.class.bitmask_definitions[:#{attribute}]\n if raw_value_index = definition.values.find_index(raw_value)\n @#{attribute} = raw_value\n self[:#{attribute}] = raw_value_index\n end\n @#{attribute}\n end\n )\n\n if default_raw.present? then\n model.class_eval %(\n before_save do |m|\n self[:#{attribute}] ||= #{default_raw}\n end\n )\n end\n\n end",
"def model_inst\n attrs.value_parent\n end",
"def define_accessor\n klass.class_eval <<-ACCESSOR\n def #{@relation}\n #self.dataset.left_outer_join(#{@relation}, :id => :#{klass.primary_key_string}).limit(1)\n puts #{relation_class}\n end\n \n def #{@relation}=(value)\n end\n ACCESSOR\n end",
"def method_missing(name, *args, &block)\n fn = name.to_s\n fnne = fn.gsub('=','')\n if (!self.attributes.keys.include?(fnne)) && self.connection.columns(self.class.table_name).map{|c| c.name}.include?(fnne)\n # for next time\n self.class.reset_column_information\n\n # for this time\n if self.new_record?\n self.attributes[fnne] = nil\n else\n self.attributes[fnne] = self.connection.select_all(\"select #{fnne} from #{self.class.table_name} where id = #{self.id}\")[0][fnne] rescue nil\n end\n\n return self.attributes[fnne]\n else\n super\n end\n end",
"def create_virtual_attributes!\n project_attributes = @object.project_type.fields_attributes_list\n @object.class_eval do\n attr_accessor *project_attributes\n end\n end",
"def to_query(_model)\n raise 'subclasses should implement this method.'\n end",
"def supports_virtual_columns?\n false\n end",
"def supports_virtual_columns?\n false\n end",
"def time_based_attribute\n return @time_based_attribute\n end",
"def across_virtual_state\n super\n end",
"def method_missing(method_name, *args, &block)\n return super unless define_attribute_methods\n self.send(method_name, *args, &block)\n end",
"def member\n super\n end",
"def member\n super\n end",
"def additional_fields; self.class.additional_fields end",
"def additional_fields; self.class.additional_fields end",
"def additional_fields; self.class.additional_fields end",
"def model\n self::Model\n end",
"def [](attr)\n public_send(attr)\n end",
"def virtual?\n false\n end",
"def virtual?\n false\n end",
"def x\n @virtual_x ||= @x\n end",
"def method_missing( attribute, *args )\n\t\treturn self.base.send( attribute, *args )\n\tend",
"def virtual?\n column.nil? && association.nil?\n end",
"def serialize_column(data)\n activerecord_json_column? ? data : super\n end",
"def user_column\n end",
"def properties\n super\n end",
"def model_attributes\n super.merge(\n viewmodel: ->(v) {\n self.schema_version = 2\n\n migrates from: 1, to: 2 do\n down do |view, refs|\n case view['name']\n when 'old-tail'\n view['next'] = { ViewModel::REFERENCE_ATTRIBUTE => 'ref:s:new_tail' }\n refs['ref:s:new_tail'] = {\n ViewModel::TYPE_ATTRIBUTE => v.view_name,\n ViewModel::VERSION_ATTRIBUTE => v.schema_version,\n 'id' => 100, # entirely fake\n 'name' => 'new-tail',\n 'next' => nil,\n }\n\n when 'new-tail'\n view['name'] = 'newer-tail'\n end\n end\n end\n },\n )\n end",
"def attr(name); end",
"def value\n self.send :\"#{_mapped_value_column}\"\n end",
"def column_for_attribute(method)\n if method.to_s == \"value\" && [VTYPE_BOOLEAN,\n VTYPE_NUMBER,\n VTYPE_DATETIME].include?(self.vtype)\n dressed_like_column = OpenStruct.new(\n name: \"value\", type: nil, sql_type: nil, klass: nil,\n coder: nil, default: false, null: true, primary: false,\n limit: nil, precision: nil, scale: nil\n )\n case self.vtype\n when VTYPE_BOOLEAN\n dressed_like_column.type = :boolean\n dressed_like_column.sql_type = \"boolean\"\n dressed_like_column.klass = Object\n when VTYPE_NUMBER\n dressed_like_column.type = :decimal\n dressed_like_column.sql_type = \"numeric\"\n dressed_like_column.klass = BigDecimal\n when VTYPE_DATETIME\n dressed_like_column.type = :datetime\n dressed_like_column.sql_type = \"timestamp without time zone\"\n dressed_like_column.klass = Time\n end\n dressed_like_column\n else\n super(method)\n end\n end",
"def write(object, attribute, value)\n result = super\n column = self.attribute.to_sym\n object.changed_columns << column if attribute == :state && owner_class.columns.include?(column) && !object.changed_columns.include?(column)\n result\n end",
"def password\n \t\t return password_virtual_attr\n end",
"def attribute attr\n @ref.attribute(TRANSLATOR.cocoaify(attr)).to_ruby\n end",
"def derived_attributes\n @derive_attribute ||= {}\n end",
"def inheritance_column\n @inheritance_column ||= @klass.inheritance_column.to_s\n end",
"def attribute_for live_property\n live_property = live_property.to_sym\n attribute =\n case live_property\n when :id\n :live_id # avoid conflicts with Ruby's Object#id()\n else\n live_property\n end\n return attribute, \"@#{attribute}\"\n end",
"def class_attributes; end",
"def model_metadatum(value, event)\n if value.respond_to?(:call)\n value.call(@record)\n elsif value.is_a?(Symbol) && @record.respond_to?(value, true)\n # If it is an attribute that is changing in an existing object,\n # be sure to grab the current version.\n if event != \"create\" &&\n @record.has_attribute?(value) &&\n attribute_changed_in_latest_version?(value)\n attribute_in_previous_version(value)\n else\n @record.send(value)\n end\n else\n value\n end\n end",
"def post_code_attribute_get(instance, name)\n self.default_attribute_get(instance, name)\n end"
] | [
"0.68646145",
"0.66638243",
"0.65532595",
"0.64089715",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.63227123",
"0.6206445",
"0.6155087",
"0.60419816",
"0.6022984",
"0.6018529",
"0.5959158",
"0.59561074",
"0.5950973",
"0.5938468",
"0.59329313",
"0.59229666",
"0.59229344",
"0.590836",
"0.5873676",
"0.5856384",
"0.5829015",
"0.5820048",
"0.5817442",
"0.58054316",
"0.5801271",
"0.5785917",
"0.57463986",
"0.57334864",
"0.5681201",
"0.56719977",
"0.56496686",
"0.5642097",
"0.5642097",
"0.56215465",
"0.56132466",
"0.56096154",
"0.56096154",
"0.56096154",
"0.56096154",
"0.56096154",
"0.56096154",
"0.56096154",
"0.55744517",
"0.5556948",
"0.55471814",
"0.55466413",
"0.55317223",
"0.5516461",
"0.5516461",
"0.5516461",
"0.5501495",
"0.54921573",
"0.5474704",
"0.5469684",
"0.5459916",
"0.5459792",
"0.54512453",
"0.54472226",
"0.54327863",
"0.54275155",
"0.53994644",
"0.53779906",
"0.537242",
"0.537242",
"0.53633404",
"0.53596383",
"0.5357428",
"0.5357277",
"0.5357277",
"0.53555804",
"0.53555804",
"0.53555804",
"0.5349538",
"0.5346502",
"0.53459644",
"0.53459644",
"0.5345762",
"0.5337806",
"0.533574",
"0.5328176",
"0.5315195",
"0.5314436",
"0.5305496",
"0.5303302",
"0.5299795",
"0.52925986",
"0.5290777",
"0.5289772",
"0.5281003",
"0.5275214",
"0.52679825",
"0.5261436",
"0.52609676",
"0.5258598",
"0.5254306"
] | 0.0 | -1 |
existing auth with this provider found by Authorization.find_from_oauth; so we just update. | def update_tokens(oauth_params)
# binding.pry
self.oauth_token = oauth_params.credentials.token
# facebook, google provide this; twitter, linkedin don't
self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.expires_at
# twitter
self.oauth_secret = oauth_params.credentials.secret if oauth_params.credentials.secret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @auth_provider = args[:auth_provider] if args.key?(:auth_provider)\n end",
"def update_from_auth_hash(auth_hash)\n update_account_info auth_hash['info']\n update_oauth_credentials auth_hash['credentials']\n self\n end",
"def update_from_provider!(auth)\n last_updated = auth[\"extra\"][\"raw_info\"][\"updated_at\"] rescue nil\n return nil if last_updated && Time.parse(last_updated) < person.resource_cache_updated_at\n avatar_image_url = auth[\"info\"][\"image\"] || auth[\"extra\"][\"raw_info\"][\"profile_image_url_https\"] rescue nil\n person.update_attributes({\n :display_name => auth[\"info\"][\"name\"],\n :firstname => auth[\"info\"][\"first_name\"],\n :lastname => auth[\"info\"][\"last_name\"],\n :email => auth[\"info\"][\"email\"],\n :avatar_image_url => avatar_image_url,\n :resource_cache_updated_at => Time.now\n })\n end",
"def update_using_auth o\n\t\tself.user_id = o.info.user_id\n\t\tself.login_name = o.info.profile.login_name\n\t\tself.email = o.info.email\n\t\tself.join_tsz = o.info.profile.join_tsz\n\t\tself.transaction_buy_count = o.info.profile.transaction_buy_count\n\t\tself.transaction_sold_count = o.info.profile.transaction_sold_count\n\t\tself.is_seller = o.info.profile.is_seller\n\t\tself.location = o.info.profile.lon ? [o.info.profile.lon, o.info.profile.lat] : nil\n\t\tself.image_url = o.info.profile.image_url_75x75\n\t\tself.country_id = o.info.profile.country_id\n\t\tself.gender = o.info.profile.gender\n\t\tself.oauth_token = o.extra.access_token.token\n\t\tself.oauth_token_secret = o.extra.access_token.secret\n\t\tsave\n\t\tself\n\tend",
"def recreate_authentication_with_hash auth\n recreate_authentication auth[:provider], uid: auth[:uid] unless identity?(auth)\n self\n end",
"def update!(**args)\n @authorization = args[:authorization] if args.key?(:authorization)\n end",
"def update!(**args)\n @authorization = args[:authorization] if args.key?(:authorization)\n end",
"def add_omniauth(auth)\n self.authentications.find_or_create_by(\n provider: auth['provider'],\n uid: auth['uid'].to_s\n )\n end",
"def on_new_oauth!(oauth_response)\n authentications.new(\n \"uid\" => oauth_response[\"uid\"],\n \"provider\" => oauth_response[\"provider\"]\n )\n self\n end",
"def flush\n if exists?\n update_foreman_auth_sources('put',get_attribute_from_auth_source('id'))\n else\n update_foreman_auth_sources('post')\n end\n end",
"def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end",
"def update_by_twitter(auth)\n self.access_token = auth['credentials']['token']\n self.secret = auth['credentials']['secret']\n self.name = auth['info']['nickname']\n self.nickname = auth['info']['nickname']\n self.image_path = auth['info']['image']\n end",
"def update\n current_account.update(provider_params, without_protection: true)\n respond_with current_account\n end",
"def authenticate_with_oauth2(oauth2_id, oauth2_token)\n \n # find user and update access token \n returning(self.find_for_oauth2(oauth2_id)) do |user|\n user.update_attributes(:oauth2_token => oauth2_token) unless user.nil?\n end\n\n end",
"def update_omniauth(auth_hash)\n token = auth_hash['credentials']['token']\n secret = auth_hash['credentials']['secret']\n self.access_token = '%s:%s' % [token, secret]\n\n self.save(validate: false)\n end",
"def authentication= new_auth\n if new_auth.nil?\n @grpc.oidc_token = nil\n else\n raise ArgumentError unless new_auth.is_a? OidcToken\n\n @grpc.oidc_token = new_auth.to_grpc\n end\n end",
"def update!(**args)\n @provider_id = args[:provider_id] if args.key?(:provider_id)\n @realm = args[:realm] if args.key?(:realm)\n @use_birdsong_tacl = args[:use_birdsong_tacl] if args.key?(:use_birdsong_tacl)\n end",
"def save\n response = if @id.nil?\n Cloud.instance.post ['cloud-service-auth', 'accounts', @account.id, 'authorities'], self\n else\n raise 'editing authorities not supported'\n # @cloud.put [\"cloud-service-auth\", \"principals\", @id], self\n end\n apply_data(response.body)\n self\n end",
"def set_oauth_account\n @oauth_account = OauthAccount.find(params[:id])\n end",
"def update_credentials(auth)\n\t\texp = auth['credentials']['expires_at']\n\t\texp = DateTime.strptime(\"#{exp}\",'%s') if exp\n\t\tself.update_attributes(\n\t\t\taccess_token: auth['credentials']['token'],\n\t\t\taccess_token_secret: auth['credentials']['secret'],\n\t\t\trefresh_token: auth['credentials']['refresh_token'],\n\t\t\ttoken_expires_at: exp\n\t\t)\n\t\t\n\t\t# retry pending submissions\n\t\tretried = []\n\t\tself.backlogs.each do |backlog|\n\t\t\tnext unless backlog.resource\n\t\t\t\n\t\t\t# only resubmit each resource once\n\t\t\tnext if retried.include? backlog.resource\n\t\t\tretried << backlog.resource\n\t\t\t\n\t\t\tshare(backlog.resource) if backlog.resource.is_a? Share\n\t\t\tupdate_listen(backlog.resource) if backlog.resource.is_a? Listen\n\t\t\tupdate_playlist(backlog.resource) if backlog.resource.is_a? Playlist\n\t\t\tdonate(backlog.resource) if backlog.resource.is_a? Donation\n\t\tend\n\t\t\n\t\t# clear pending submissions\n\t\tself.backlogs.destroy_all\n\tend",
"def set_auth\n @auth = session[:omniauth] if session[:omniauth]\n end",
"def update_and_save_from_auth_hash(auth_hash)\n update_from_auth_hash(auth_hash)\n unless save\n messages = errors.full_messages.join(', ')\n logger.error \"Unable to update account (#{provider}##{uid}): #{messages}\"\n end\n self\n end",
"def update(*args)\n require_authentication\n arguments(args, required: [:authorization_id]) do\n sift(VALID_AUTH_PARAM_NAMES)\n end\n\n patch_request(\"/authorizations/#{authorization_id}\", arguments.params)\n end",
"def apply_omniauth(auth)\n # In previous omniauth, 'user_info' was used in place of 'raw_info'\n self.email = auth['extra']['raw_info']['email']\n # Again, saving token is optional. If you haven't created the column in authentications table, this will fail\n authentications.build(:provider => auth['provider'], :uid => auth['uid'], :token => auth['credentials']['token'])\n end",
"def auth_change\n @auth_change ||=\n AuthChange.transaction do \n AuthChange.find(:first, :order => 'id') || \n AuthChange.create!(:changed_at => Time.now)\n end\n end",
"def update_token\n client.authorization.update_token!(oauth_data)\n if client.authorization.refresh_token && client.authorization.expired?\n client.authorization.fetch_access_token!\n end\n end",
"def update_devise_user\n inject_into_file 'app/models/user.rb', after: \":validatable\" do <<-'RUBY'\n, :omniauthable\n validates_presence_of :email\n has_many :authorizations\n\n def self.new_with_session(params,session)\n if session[\"devise.user_attributes\"]\n new(session[\"devise.user_attributes\"],without_protection: true) do |user|\n user.attributes = params\n user.valid?\n end\n else\n super\n end\n end\n\n def self.from_omniauth(auth, current_user)\n authorization = Authorization.where(:provider => auth.provider, :uid => auth.uid.to_s, :token => auth.credentials.token, :secret => auth.credentials.secret).first_or_initialize\n if authorization.user.blank?\n user = current_user.nil? ? User.where('email = ?', auth[\"info\"][\"email\"]).first : current_user\n if user.blank?\n user = User.new\n user.password = Devise.friendly_token[0,10]\n user.name = auth.info.name\n user.email = auth.info.email\n auth.provider == \"twitter\" ? user.save(:validate => false) : user.save\n end\n authorization.username = auth.info.nickname\n authorization.user_id = user.id\n authorization.save\n end\n authorization.user\n end\n RUBY\n end\n end",
"def touch_auth_session\n if logged_in?\n auth_session.touch!\n end\n end",
"def refresh_single_use_oauth2_token!\n assign_single_use_oauth2_token\n save!\n end",
"def update_avatar_from_provider!(auth)\n avatar_image_url = auth[\"info\"][\"image\"] || auth[\"extra\"][\"raw_info\"][\"profile_image_url_https\"] rescue nil\n person.update_attribute(:avatar_image_url, avatar_image_url) if avatar_image_url && person\n end",
"def bind_with_oauth\n if u = User.find_by_email(params[:user][:email])\n flash[:alert] = I18n.t 'devise.oauth_services.user.email_has_been_token'\n redirect_to new_oauth_user_registration_path and return\n end \n u = build_resource permitted_params.merge(name: session[:oauth].info.name, password: SecureRandom.hex )\n\n u.bypass_humanizer = true\n if u.save\n u.apply_oauth session[:oauth]\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: (I18n.t \"devise.oauth_services.providers.#{session[:oauth].provider}\") if session[:oauth].present?\n sign_in_and_redirect @user, :event => :authentication\n else\n flash[:alert] = I18n.t 'devise.oauth_services.user.failure'\n redirect_to new_oauth_user_registration_path\n end\n end",
"def apply_omniauth(auth)\n self.email = auth['extra']['raw_info']['email'] if auth['extra']['raw_info']['email']\n self.password = Devise.friendly_token[0,20]\n authentications.build(:provider=>auth['provider'], :uid=>auth['uid'], :token=>auth['credentials']['token'], :secret=>auth['credentials']['secret'])\n end",
"def update_oauth_user_credentials(oauth_data)\r\n oauth_access_token = oauth_data.credentials.token\r\n raise Totem::Authentication::Session::MissingSessionUserAccessToken, \"Blank oauth access token in oauth data. #{oauth_data.inspect}\" if oauth_access_token.blank?\r\n self.oauth_access_token = oauth_data.credentials.token\r\n if self.respond_to?(:populate_user_oauth_extra_info)\r\n extra_values = oauth_data.extra.user_info || {}\r\n self.populate_user_oauth_extra_info(extra_values)\r\n end\r\n end",
"def auth_hash=(auth)\n # By default, omniauth-saml's auth hash is not serializable--it will raise\n # a StackLevelTooDeep error which is probably a bug. So we will discard the\n # parts that are causing problems (which are fortunately irrelevant).\n if auth[:provider] == \"saml\" && auth.dig(:extra, :raw_info)\n auth = auth.deep_symbolize_keys\n auth[:extra][:raw_info] = auth[:extra][:raw_info].attributes\n auth[:extra][:response_object] = nil\n end\n\n case auth[:provider]\n when \"shibboleth\", \"developer\"\n self.provider = Provider::SHIBBOLETH\n when \"saml\"\n self.provider = Provider::SAML\n when \"identity\"\n self.provider = Provider::LOCAL\n end\n\n super(auth)\n end",
"def regenerate_auth_token\n new_token = oauth.exchange_access_token_info(authentication.auth_token)\n\n # Save the new token and its expiry over the old one\n authentication.update_attributes!(\n auth_token: new_token['access_token'],\n last_expires_at: authentication.expires_at,\n expires_at: Time.now + new_token['expires_in'].to_i,\n )\n\n authentication.auth_token\n end",
"def update!(**args)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def update\n\n # Only allow update by SEA or LEA admin.\n unless is_app_authorizer?\n logger.warn 'User is not SEA or LEA admin and cannot update application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n\n # Top level edOrg to expand\n edorg = session[:edOrgId]\n # EdOrgs selected using Tree Control\n added = params[:application_authorization][:edorgsAdded] || ''\n added.strip!\n addedEdOrgs = added.split(/,/)\n\n removed = params[:application_authorization][:edorgsRemoved] || ''\n removed.strip!\n removedEdOrgs = removed.split(/,/)\n\n # ID of app\n appId = params[:application_authorization][:appId]\n\n updates = {\"appId\" => appId, \"authorized\" => true, :edorgs => addedEdOrgs}\n @application_authorization = ApplicationAuthorization.find(params[:id])\n success = @application_authorization.update_attributes(updates)\n\n updates = {\"appId\" => appId, \"authorized\" => false, :edorgs => removedEdOrgs}\n @application_authorization = ApplicationAuthorization.find(params[:id])\n success = @application_authorization.update_attributes(updates)\n\n # Redirect to response page\n ApplicationAuthorization.cur_edorg = edorg\n respond_to do |format|\n if success\n format.html { redirect_to application_authorizations_path, notice: 'Application was succesfully updated.'}\n #format.html {redirect_to :action => 'index', notice: 'Application authorization was succesfully updated.'}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application_authorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def amend_muni_admin\n # we should have a current muni_admin. And we are going to the new authentication if\n # it is not there already.\n muni_admin = current_muni_admin\n if (muni_admin)\n auth = request.env[\"omniauth.auth\"]\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :muni_admin_id.ne => nil,\n :master_id => @master.id).order(\"created_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.muni_admin == muni_admin\n if oauth.nil?\n oauth = oa\n else\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :alert => \"This authentication belongs to different administrator.\"\n return\n end\n end\n if oauth\n # Already added\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n muni_admin.authentications << oauth\n muni_admin.save\n redirect_to edit_master_muni_admin_registration_path(muni_admin.master, muni_admin),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_muni_admin_sign_in_path(:master_id => params[:master_id]),\n :alert => \"Need to sign in first.\"\n end\n end",
"def update!(**args)\n @provider_info = args[:provider_info] if args.key?(:provider_info)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def omniauthclone omniauthable, auth=nil\n PROVIDERS.reject{|p| p == auth}.each do |provider|\n unless self.send(\"#{provider}?\")\n if omniauthable.send(\"#{provider}?\")\n self[\"#{auth.provider}_uid\"] = omniauthable[\"#{auth.provider}_uid\"]\n self[\"#{auth.provider}_auth\"] = omniauthable[\"#{auth.provider}_auth\"]\n self.save\n end\n end\n end\n end",
"def oauth_authentication; end",
"def update_user_from_auth(auth)\n user = self\n user.username = auth.info.nickname\n user.avatar_url = auth.info.image\n user.location = auth.extra.raw_info.city\n user.country = auth.extra.raw_info.country\n user.name = auth.info.name\n user\n end",
"def update\n @auth = Auth.find(params[:id])\n\n respond_to do |format|\n if @auth.update_attributes(params[:auth])\n format.html { redirect_to @auth, notice: 'Auth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auth.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @providers = args[:providers] if args.key?(:providers)\n end",
"def amend_user\n # we should have a current user.\n user = current_user\n if (user)\n auth = request.env[\"omniauth.auth\"]\n # We should have at most one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :user_id.ne => nil,\n :master_id => @master.id).order(\"create_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.user == user\n if oauth.nil?\n oauth = oa\n else # masters should all be the same\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple administrator authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_master_user_registration_path(user.master, user),\n :alert => \"This authentication belongs to different user.\"\n return\n end\n end\n if oauth\n if @master != oauth.user.master\n # This is really bad. Attempt a fix.\n logger.error \"sessions#amend_user: Authentication has mismatched master for user. Removing.\"\n oauth.destroy()\n end\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"This authentication has already been added.\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n oauth.master = @master\n user.authentications << oauth\n user.save\n redirect_to edit_master_user_registration_path(user.master, user),\n :notice => \"Authentication added.\"\n end\n else\n redirect_to master_user_sign_in_path(@master),\n :alert => \"Need to sign in first.\"\n end\n end",
"def auth_oauth\n @attributes[:auth_oauth]\n end",
"def update_fb_auth(account_selected_name)\n auth = Auth.find_by(key: 'facebook', name: account_selected_name)\n if auth.nil?\n Auth.create(\n key: 'facebook',\n name: account_selected_name,\n value: params[model_name][:fb_page_access_key]\n )\n else\n #only support 1 fb account\n auth.update_attribute(:value, params[model_name][:fb_page_access_key])\n end\n end",
"def account_from_oauth(auth)\n extractor = Extractor::Base.load(auth)\n\n accounts.where(extractor.signature).first_or_initialize do |account|\n account.username = extractor.username\n account.oauth_token = extractor.oauth_token\n account.oauth_secret = extractor.oauth_secret\n account.oauth_expires = extractor.oauth_expires\n end\n end",
"def refresh_oauth2_token!\n ensure_oauth2_token(true)\n save!\n end",
"def update\n authenticate_customer!\n # We put this in the session in case the user adds an authentication.\n tpauth = Authentication.find session[:customer_oauth_id]\n if tpauth\n @customer = current_customer\n @customer.update_attributes(params[:customer])\n @customer.authentications << tpauth\n @customer.save\n redirect_to edit_customer_registration_path(@customer), :notice => \"Account Updated!\"\n else\n redirect_to customer_sign_in_path, \"You need to authenticate first.\"\n end\n end",
"def find_or_create_authentication_for_current_user\n current_user.add_authentication(omniauth)\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.added', :kind => provider_name\n redirect_to edit_user_registration_path\n end",
"def ==(other_auth)\n (provider == other_auth.provider) && (uid == other_auth.uid)\n end",
"def update!(**args)\n @provider = args[:provider] if args.key?(:provider)\n @provider_uri = args[:provider_uri] if args.key?(:provider_uri)\n end",
"def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\[email protected] = @auth_file.authorization\n\t\tend\n\tend",
"def exchange_oauth_tokens\n end",
"def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @provider_id = args[:provider_id] if args.key?(:provider_id)\n @redirect_uri = args[:redirect_uri] if args.key?(:redirect_uri)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n @token = args[:token] if args.key?(:token)\n @token_type = args[:token_type] if args.key?(:token_type)\n end",
"def update_from_linkedin(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.first_name if auth.info.first_name\n cv['image'] = auth.info.picture_url if auth.info.picture_url\n cv['language_spoken'] = auth.extra.raw_info.lastName.preferredLocale.country if auth.extra.raw_info.lastName.preferredLocale.country\n cv['linkedin_auth'] = true\n end",
"def refresh_auth_token\n generate_token(:auth_token)\n save!\n end",
"def reverse_merge_attributes_from_auth(auth)\n auth.oauth_data.each do |k, v|\n self[k] = v if self.respond_to?(\"#{k}=\") && self[k].blank?\n end\n end",
"def reverse_merge_attributes_from_auth(auth)\n auth.oauth_data.each do |k, v|\n self[k] = v if self.respond_to?(\"#{k}=\") && self[k].blank?\n end\n end",
"def oauth\n if (!@oauth || !@oauth[:token] || !@oauth[:consumer_key]) &&\n @headers['Authorization'].to_s =~ /^OAuth\\s/\n\n @oauth =\n SimpleOAuth::Header.parse(@headers['Authorization']).\n merge(@oauth || {})\n end\n\n @oauth\n end",
"def set_current_user_for_auth\n Authorization.current_user = current_user\n end",
"def apply_omniauth(omniauth)\n authorizations.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def save_omniauth(provider, uid, access_token, refresh_token=nil)\n\t credentials = self.provider_credentials.find_or_create_by(company: company, provider: Provider.named(provider), uid: uid)\n\t Rails.logger.info credentials.inspect\n\t credentials.access_token = access_token\n\t credentials.refresh_token = refresh_token\n\t credentials.save!\n\t Rails.logger.info credentials.inspect\n\t Rails.logger.info credentials.errors.inspect\n\tend",
"def update_auth_header\n # cannot save object if model has invalid params\n # @resource should == current_user\n return unless @resource && @resource.valid? && @client_id\n\n # Generate new client_id with existing authentication\n @client_id = nil unless @used_auth_by_token\n\n if @used_auth_by_token &&\n @resource.try(:tokens).present? &&\n ENV['ACCESS_TOKEN_LIFETIME'].to_i > 0\n\n # Get the token we are working with before reload (a simultaneous request could alter the valid token)\n original_token = @resource.tokens[@client_id].try(:fetch, 'token')\n\n @resource.reload\n\n # should not append auth header if @resource related token was\n # cleared by sign out in the meantime.\n return if @resource.tokens[@client_id].nil?\n\n token_created_at = Time.zone.at(@resource.tokens[@client_id]['created_at'])\n\n # If the token has not expired or changed and this is not a batch request, return it as a valid token.\n if @request_started_at < token_created_at + Integer(ENV['ACCESS_TOKEN_LIFETIME']) &&\n original_token == @resource.tokens[@client_id]['token'] &&\n !is_batch_request?(@resource, @client_id)\n\n return response.headers.merge!(@resource.build_auth_header(@token, @client_id))\n end\n end\n\n super\n end",
"def set_userauth\n @userauth = Userauth.find(params[:id])\n end",
"def set_auth_token\n return if auth_token.present?\n self.auth_token = generate_auth_token\n end",
"def add_service_from_auth_hash(auth_hash)\n self.email = auth_hash.info.email if self.email.blank?\n self.send(\"#{auth_hash.provider}_user_id=\", auth_hash.uid)\n self.send(\"#{auth_hash.provider}_token=\", auth_hash.credentials.token)\n self.send(\"#{auth_hash.provider}_secret=\", auth_hash.credentials.secret)\n self.save\n self.send(\"process_#{auth_hash.provider}_queue\")\n end",
"def update(hash)\n authlete_model_update?(hash)\n end",
"def update!(**args)\n @auth_mechanism_for_remote_requests = args[:auth_mechanism_for_remote_requests] if args.key?(:auth_mechanism_for_remote_requests)\n end",
"def set_authorization\n Authorization.current_user = current_user\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def refresh\n begin\n oauth_attrs = source.create(params: refresh_token_params)\n oauth_attrs.each do |attr, value|\n send(\"#{attr}=\", value)\n end\n rescue My::Oauth::Unauthorized => e\n errors << 'Error refreshing token'\n end\n self\n end",
"def auth_store; end",
"def update!(**args)\n @has_valid_creds = args[:has_valid_creds] if args.key?(:has_valid_creds)\n end",
"def twitter_auth_cache\n self.auth_profiles.where(provider: 'twitter').first\n end",
"def oauth_login oauth\n method = ::AuthMethod.by_provider_data oauth.provider_data\n\n if !method\n user = find_by_email(oauth.email) || create_from_oauth(oauth)\n\n if user.respond_to? :add_auth_method\n method = user.add_auth_method oauth.provider_data\n else\n method = user.auth_methods.create! oauth.provider_data\n end\n end\n\n method.create_token access_token: oauth.access_token\n end",
"def auth_changed! object = nil\n $stderr.puts \" auth_changed! #{object.inspect}\"\n flush!\n @last_check = auth_change.changed_at = Time.now\n auth_change.save! rescue nil\n # auth_change.class.destroy(:all, :conditions => [ 'id <> ?', auth_change.id ])\n self\n end",
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def oauth\n Auth.new(params[:uid], params[:oauth_token], action_name)\n end",
"def authenticate_organization_using_digest!\n authenticate_or_request_with_http_digest do |sid|\n (@organization = Organization.find_by( sid: sid )).try( :auth_token )\n end\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end",
"def save_omniauth_details\n authentication = @user.authentications.find_or_create_by(\n provider: auth_info.provider,\n uid: auth_info.uid\n )\n\n authentication.update_attributes!(\n email: auth_email,\n nickname: auth_nickname,\n image: auth_info.image,\n raw_info: @auth.to_json\n )\n end",
"def save\n response = if @id.nil?\n @cloud.auth_for_accounts [@parent]\n @cloud.post ['cloud-service-auth', 'accounts'], self\n else\n @cloud.post path, self\n end\n apply_data(response.body)\n self\n end",
"def set_auth_user\n @auth_user = AuthUser.find(params[:id])\n end",
"def apply_omniauth(omniauth)\n self.email = omniauth['user_info']['email'] if email.blank?\n apply_trusted_services(omniauth) if self.new_record?\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def authorize(auth = {})\n auth[:login] = auth[:login] || auth[:username]\n raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank?\n provider.login = auth[:login]\n provider.user_token = auth[:password] || auth[:oauth_token]\n provider.api = new_github_client auth\n end",
"def auth\n @auth ||= access_token.params.to_h.merge({'token' => access_token.token})\n end",
"def auth() @auth ||= Flickr::Auth.new(self) end",
"def update!(**args)\n @first_party_principal = args[:first_party_principal] if args.key?(:first_party_principal)\n @third_party_principal = args[:third_party_principal] if args.key?(:third_party_principal)\n end",
"def auth\n if (!@auth || !@auth[:username]) && @headers['Authorization'] &&\n @headers['Authorization'] !~ /^OAuth\\s/\n\n str = Base64.decode64 @headers['Authorization'].split[1]\n username, password = str.split(\":\", 2)\n @auth = {\n :username => username,\n :password => password\n }.merge(@auth || {})\n end\n\n @auth\n end",
"def update_with_omniauth(authentication, omniauth)\n authentication.token = omniauth['credentials']['token']\n authentication.secret = omniauth['credentials']['secret']\n\n self.update_timezone(omniauth['extra']['raw_info']['time_zone'])\n authentication.save\n\n self.nickname = omniauth['info']['nickname']\n self.name = omniauth['info']['name']\n self.save\n end",
"def update_access_token!\n if self.role_type === \"admin\"\n self.access_token = \"#{self.id}:#{self.email}\"\n else\n self.access_token = \"#{self.id}:#{Devise.friendly_token}\"\n end\n save\n end",
"def apply_omniauth(omniauth)\n authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'])\n end",
"def amend_customer\n # we should have a current customer.\n cust = current_customer\n if (cust)\n auth = request.env[\"omniauth.auth\"]\n # We should only have one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :customer_id.ne => nil,\n :master => nil).order(\"created_at desc\").all\n oauth = nil\n oauths.each do |oa|\n if oa.customer == cust\n if oauth.nil?\n oauth = oa\n else\n # Be proactive resilience here and get rid of this one. We should not have multiples\n logger.error(\"sessions#ammend_customer: getting rid of multiple customer authentications.\")\n oa.destroy()\n end\n else\n redirect_to edit_customer_registration_path(cust), :alert => \"This authentication belongs to different customer.\"\n return\n end\n end\n if oauth\n # Already added\n redirect_to edit_customer_registration_path(cust), :notice => \"This authentication already exists\"\n else\n oauth = Authentication.create_with_omniauth(auth)\n cust.authentications << oauth\n cust.save\n # We do not change the current_customer_authentication.\n redirect_to edit_customer_registration_path(cust), :notice => \"Authentication Added.\"\n end\n else\n redirect_to customer_sign_in_path, :notice => \"Need to sign in first.\"\n end\n end",
"def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @scope = args[:scope] if args.key?(:scope)\n @token_type = args[:token_type] if args.key?(:token_type)\n end",
"def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend"
] | [
"0.7412766",
"0.6756025",
"0.6505242",
"0.6399501",
"0.6388465",
"0.6273595",
"0.6273595",
"0.6235391",
"0.6221958",
"0.6156656",
"0.60747486",
"0.60666245",
"0.59963024",
"0.5971927",
"0.5961947",
"0.59553516",
"0.5939227",
"0.59244466",
"0.589061",
"0.5885361",
"0.58574307",
"0.5813789",
"0.5801175",
"0.57891685",
"0.57832414",
"0.57622623",
"0.57554764",
"0.57529336",
"0.57506037",
"0.57482",
"0.57454646",
"0.5736695",
"0.572463",
"0.5682473",
"0.56744444",
"0.5666459",
"0.5656962",
"0.56504124",
"0.56261593",
"0.56215185",
"0.5611011",
"0.5603666",
"0.55884147",
"0.5577023",
"0.55707234",
"0.5567302",
"0.55624086",
"0.5562152",
"0.55583227",
"0.55562013",
"0.55498546",
"0.55434656",
"0.55362064",
"0.5535494",
"0.5532435",
"0.5532202",
"0.5527946",
"0.55239606",
"0.55074126",
"0.55074126",
"0.5497756",
"0.54953355",
"0.5486497",
"0.5482855",
"0.5474688",
"0.54629236",
"0.5455537",
"0.54426533",
"0.5418979",
"0.54186046",
"0.54139525",
"0.5411582",
"0.5411582",
"0.5400004",
"0.5386678",
"0.5384478",
"0.5383441",
"0.5378775",
"0.5371935",
"0.5369306",
"0.5365846",
"0.53636754",
"0.5349668",
"0.5349668",
"0.5349472",
"0.5334627",
"0.5333218",
"0.53289396",
"0.5326124",
"0.5322689",
"0.5314792",
"0.5310793",
"0.52844",
"0.5268605",
"0.5265385",
"0.52597374",
"0.525628",
"0.5251092",
"0.52492774",
"0.5245068"
] | 0.5777884 | 25 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.